Token & price queries
Endpoint: https://subgraph.barkswap.fi/subgraphs/name/barkswap/core
List tokens
query AllTokens {
tokens {
id
symbol
name
decimals
derivedMatic
}
}
derivedMatic is the token's price denominated in the native token (multiply by the native USD
price from the bundle below to get USD).
A single token
query SingleToken($tokenId: ID!) {
token(id: $tokenId) {
id
symbol
name
decimals
derivedMatic
}
}
{ "tokenId": "0xf6bdb158a5ddf77f1b83bc9074f6a472c58d78ae" }
Native (USD) price
The Bundle singleton (id: "1") holds the native-token USD price used to derive all USD values.
query NativePrice {
bundles {
id
maticPriceUSD
}
}
Prices for several tokens at once
query GetTokenPrices($tokenAddresses: [String!]!) {
tokens(where: { id_in: $tokenAddresses }) {
id
symbol
decimals
derivedMatic
}
bundle(id: "1") {
maticPriceUSD
}
}
{ "tokenAddresses": ["0xaaa…", "0xbbb…"] }
USD price of a token = derivedMatic × bundle.maticPriceUSD.
See the schema reference for the full Token shape.