Introduction - Stability - Core - CLI - Query API
Query a specific Cup by Id
Example: Retrieve Cup 3 lad
, ink
and art
attributes along with 5 most
recent actions. The top level attributes in this query represent the current
cup state whilst the attributes actions
represent the state at a particular
block height.
{
getCup(id: 3) {
lad
art
ink
actions(first: 5) {
nodes {
act
arg
block
time
ink
art
}
}
}
}
Query across all Cups
Example: Retrieve the first 10 active cups with the lowest collateralisation ratio along with 5 most recent actions, the total number of cups matching the query, and pagination info.
{
allCups(
first: 10,
condition: { deleted: false },
orderBy: RATIO_ASC
) {
totalCount
pageInfo {
hasNextPage
hasPreviousPage
endCursor
}
nodes {
id
lad
art
ink
ratio
actions(first: 5) {
nodes {
act
time
}
}
}
}
}
Query across all Cup Actions
Example: Retrieve the 10 most recent bite
acts.
{
allCupActs(
first: 10,
orderBy: BLOCK_DESC,
condition: { act: BITE }
) {
nodes {
id
lad
art
ink
}
}
}