Aller au contenu principal

GraphQL API Example Queries

This page contains some example queries that you can run directly into the embedded playground on the previous page.

Atom Queries

There are two primary queries available for retrieving Atom data:

  • GetAtoms: Retrieves a collection of atoms based on specified filters and parameters
  • GetAtom: Fetches a single atom by its unique identifier (id)

These Atom queries are foundational and are used in more complex queries to retrieve data from the Intuition protocol.

GetAtoms

query GetAtoms(
$limit: Int
$offset: Int
$orderBy: [atoms_order_by!]
$where: atoms_bool_exp
) {
atoms(limit: $limit, offset: $offset, order_by: $orderBy, where: $where) {
# AtomMetadata fields
data
id
image
label
emoji
type

# AtomTxn fields
blockNumber
blockTimestamp
transactionHash
creatorId

# AtomVaultDetails fields
vaultId
walletId
vault {
positionCount
totalShares
currentSharePrice
}

# Creator fields
creator {
id
address
username
created_at
updated_at
}
}
}

Interact with this query in Apollo Sandbox

GetAtom

query GetAtom(
$atomId: numeric!
) {
atom(id: $atomId) {
# AtomMetadata fields
id
image
label
emoji
type

# AtomTxn fields
blockNumber
blockTimestamp
transactionHash
creatorId

# AtomVaultDetails fields
vaultId
walletId
vault {
positionCount
totalShares
currentSharePrice
}

# Creator fields
creator {
id
label
image
}
}
}

# Variables
{
"atomId": "2"
}

Interact with this query in Apollo Sandbox

Account Queries

There are two primary queries available for retrieving Account data:

  • GetAccounts: Retrieves a collection of atoms based on specified filters and parameters
  • GetAccount: Fetches a single atom by its unique identifier (address)

GetAccounts

query GetAccounts {
accounts {
# AccountMetadata fields
label
image
id
atomId
type

# AccountClaims fields
claims(order_by: { shares: desc }) {
triple {
id
label
}
shares
counterShares
}

# AccountPositions fields
positions_aggregate(order_by: { shares: desc }) {
nodes {
id
shares
vault {
id
totalShares
currentSharePrice
atom {
id
label
}
triple {
id
label
}
}
}
}
}
}

Interact with this query in Apollo Sandbox

GetAccount

query GetAccount($address: String!) {
account(id: $address) {
# AccountMetadata fields
label
image
id
atomId
type

# AccountClaims fields
claims(order_by: { shares: desc }) {
triple {
id
label
}
shares
counterShares
}

# AccountPositions fields
positions_aggregate(order_by: { shares: desc }) {
nodes {
id
shares
vault {
id
totalShares
currentSharePrice
atom {
id
label
}
triple {
id
label
}
}
}
}
}
chainLinkPrices(limit: 1, order_by: { id: desc }) {
usd
}
}

# Variables
{
"address": "0x01ba1635602706ce2794f2cd5d7eba0bdcf4972b"
}

Interact with this query in Apollo Sandbox

Triple Queries

There are two primary queries available for retrieving Triple data:

  • GetTriples: Retrieves a collection of triples based on specified filters and parameters
  • GetTriple: Fetches a single triple by its unique identifier (id)

GetTriples

query GetTriples(
$limit: Int
$offset: Int
$orderBy: [triples_order_by!]
$where: triples_bool_exp
) {
triples(limit: $limit, offset: $offset, order_by: $orderBy, where: $where) {
# TripleMetadata fields
id
label
subject {
data
id
image
label
emoji
type
creator {
label
image
id
atomId
type
}
}
predicate {
data
id
image
label
emoji
type
creator {
label
image
id
atomId
type
}
}
object {
data
id
image
label
emoji
type
creator {
label
image
id
atomId
type
}
}

# TripleTxn fields
blockNumber
blockTimestamp
transactionHash
creatorId

# TripleVaultDetails fields
vaultId
counterVaultId
vault {
id
totalShares
currentSharePrice
positionCount
atom {
id
label
}
}
counterVault {
id
totalShares
currentSharePrice
positionCount
atom {
id
label
}
}

# Creator fields
creator {
label
image
id
atomId
type
}
}
}

Interact with this query in the Apollo Sandbox

GetTriple

query GetTriple($tripleId: numeric!) {
triple(id: $tripleId) {
# TripleMetadata fields
id
label
subject {
data
id
image
label
emoji
type
creator {
label
image
id
atomId
type
}
}
predicate {
data
id
image
label
emoji
type
creator {
label
image
id
atomId
type
}
}
object {
data
id
image
label
emoji
type
creator {
label
image
id
atomId
type
}
}

# TripleTxn fields
blockNumber
blockTimestamp
transactionHash
creatorId

# TripleVaultDetails fields
vaultId
counterVaultId
vault {
id
totalShares
currentSharePrice
positionCount
atom {
id
label
}
}
counterVault {
id
totalShares
currentSharePrice
positionCount
atom {
id
label
}
}

# Creator fields
creator {
label
image
id
atomId
type
}
}
}

# Variables
{
"tripleId": "15"
}

Interact with this query in Apollo Sandbox

Positions

GetPositions

query GetPositions(
$limit: Int
$offset: Int
$orderBy: [positions_order_by!]
$where: positions_bool_exp
) {
positions_aggregate(limit: $limit, offset: $offset, order_by: $orderBy, where: $where) {
nodes {
id
account {
id
label
}
vault {
id
atom {
id
label
}
triple {
id
subject {
id
label
}
predicate {
id
label
}
object {
id
label
}
}
}
shares
}
}
}

Interact with this query in Apollo Sandbox

GetPosition

query GetPosition($positionId: String!) {
position(id: $positionId) {
id
account {
id
label
}
vault {
id
atom {
id
label
}
triple {
id
subject {
id
label
}
predicate {
id
label
}
object {
id
label
}
}
}
shares
}
}


# Variables
{
"positionId": "13-0x000ddc0e1bbfd22d2f0909d4638fec62aafea106"
}

Interact with this query in Apollo Sandbox

Vaults

GetVaults

query GetVaults(
$limit: Int
$offset: Int
$orderBy: [vaults_order_by!]
$where: vaults_bool_exp
) {
vaults_aggregate(
limit: $limit
offset: $offset
order_by: $orderBy
where: $where
) {
nodes {
id
atom {
id
label
}
triple {
id
subject {
id
label
}
predicate {
id
label
}
object {
id
label
}
}
positions_aggregate {
nodes {
account {
id
label
}
shares
}
}
currentSharePrice
totalShares
}
}
}

Interact with this query in Apollo Sandbox

GetVault

query GetVault(
$vaultId: numeric!
) {
vault(id: $vaultId) {
id
atom {
id
label
}
triple {
id
subject {
id
label
}
predicate {
id
label
}
object {
id
label
}
}
positions_aggregate {
nodes {
account {
id
label
}
shares

}
}
currentSharePrice
totalShares
}
}
}

# Variables
{
"vaultId": "1"
}

Interact with this query in Apollo Sandbox

“Utility” Queries

These “utility” queries don’t necessarily fall into the other categories but are examples of how you can query for specific purpose data. For example, the GetStats query returns stats such as the total number of Atoms created.

GetEvents

query GetEvents(
$limit: Int
$offset: Int
$orderBy: [events_order_by!]
$where: events_bool_exp
) {
events_aggregate(
limit: $limit
offset: $offset
order_by: $orderBy
where: $where
) {
nodes {
blockNumber
blockTimestamp
type
transactionHash
atomId
tripleId
depositId
feeTransferId
redemptionId
}
}
}

Interact with this query in Apollo Sandbox