Queries for Tokens
token
Returns a single token.
token(id, address, chain_id) {
/* Token fields */
}
Arguments
address
String
address
StringThe address of the token to return. Must be used in conjunction with chain_id
.
chain_id
Int
chain_id
IntThe identifier of the chain of the token to return. Must be used in conjunction with address
.
id
Int
id
IntThe ID of the Token to return.
Response
Token.*
Token
Token.*
TokenAny requested field from the Token object.
Example
Request
query {
token(id: 3) {
id
symbol
address
chain {
id
name
}
}
}
query {
token(address: "0x3845badade8e6dff049820680d1f14bd3903a5d0", chain_id: 1) {
id
symbol
address
chain {
id
name
}
}
}
Response
{
"data": {
"token": {
"id": 3,
"symbol": "SAND",
"address": "0x3845badade8e6dff049820680d1f14bd3903a5d0",
"chain": {
"id": 1,
"name": "Ethereum"
}
}
}
}
tokens
Returns all available tokens.
tokens(game_id, symbols) {
/* Token fields */
}
Arguments
game_id
Int
game_id
IntGame identifier for which to return compatible token objects.
symbols
[String!]
symbols
[String!]A list of symbols for which to return token objects.
Response
Token.*
[Token!]
Token.*
[Token!]A list of Token objects returning any requested fields from the Token object.
Example
Request
query {
tokens(game_id: 2) {
id
name
}
}
query {
tokens(symbols: ["USDC", "MATIC", "WETH"]) {
id
name
}
}
Response
{
"data": {
"tokens": [
{
"id": 4,
"symbol": "USDC"
},
{
"id": 11,
"symbol": "MATIC"
},
{
"id": 6,
"symbol": "WETH"
},
{
"id": 3,
"symbol": "SAND"
},
{
"id": 5,
"symbol": "DAI"
},
{
"id": 1,
"symbol": "ETH"
}
]
}
}
{
"data": {
"tokens": [
{
"id": 13,
"symbol": "WETH"
},
{
"id": 6,
"symbol": "WETH"
},
{
"id": 4,
"symbol": "USDC"
},
{
"id": 11,
"symbol": "MATIC"
}
]
}
}