Skip to Content
GraphQL APIPools APIgetProtocolPoolUserBalance

getProtocolPoolUserBalance

This method obtains the user balance in a pool from a protocol on a chain.

Inputs

NameTypeRequiredDescription
input[ProtocolPoolUserBalanceInput!]!YesList of queries with chain ID, protocol, pool and user address.

ProtocolPoolUserBalanceInput Fields

NameTypeRequiredDescription
chainChain!YesChain ID.
protocolProtocol!YesThe protocol name.
poolString!YesThe pool address or name on the protocol.
addressString!YesThe address to query.

chain

Type: Chain!

Allowed Values: A chain ID from the list of supported pools.

protocol

Type: Protocol!

Allowed Values: A protocol from the list of supported pools for the given chain.

pool

Type: String

Allowed Values: A pool from the list of supported pools for the given protocol and chain.

address

Type: String!

Allowed Values: The address of the account to query.

Response

FieldTypeDescription
chainStringThe chain ID.
protocolStringThe protocol.
poolStringThe pool.
balanceJSONThe user’s balance in the pool.
errorStringError message if query failed.

Query Example

Query

query GetProtocolPoolUserBalance($input: [ProtocolPoolUserBalanceInput!]!) { getProtocolPoolUserBalance(input: $input) { chain protocol pool balance error } }

Variables

{ "input": [ { "chain": "CHAIN_0X1", "pool": "USDC", "protocol": "AAVE", "address": "0xdB20A894d2CDEa7F6AA288188f826F18bB2082DD" }, { "chain": "CHAIN_0X2105", "pool": "USDC", "protocol": "AAVE", "address": "0xdB20A894d2CDEa7F6AA288188f826F18bB2082DD" }, { "chain": "CHAIN_0X1", "pool": "0xc3d688B66703497DAA19211EEdff47f25384cdc3", "protocol": "COMPOUNDV3", "address": "0xdB20A894d2CDEa7F6AA288188f826F18bB2082DD" }, { "chain": "CHAIN_0X1", "pool": "0xBe53A109B494E5c9f97b9Cd39Fe969BE68BF6204", "protocol": "YEARN", "address": "0xdB20A894d2CDEa7F6AA288188f826F18bB2082DD" }, { "chain": "CHAIN_HYPERLIQUID_MAINNET", "pool": "0xdfc24b077bc1425ad1dea75bcb6f8158e10df303", "protocol": "HYPERLIQUID", "address": "0xdB20A894d2CDEa7F6AA288188f826F18bB2082DD" } ] }

Curl

curl -X POST https://your-graphql-endpoint.com/graphql \ -H "Content-Type: application/json" \ -d '{ "query": "query GetProtocolPoolUserBalance($input: [ProtocolPoolUserBalanceInput!]!) { getProtocolPoolUserBalance(input: $input) { chain protocol pool balance error } }", "variables": { "input": [ { "chain": "CHAIN_0X1", "pool": "USDC", "protocol": "AAVE", "address": "0xdB20A894d2CDEa7F6AA288188f826F18bB2082DD" }, { "chain": "CHAIN_0X1", "pool": "0xc3d688B66703497DAA19211EEdff47f25384cdc3", "protocol": "COMPOUNDV3", "address": "0xdB20A894d2CDEa7F6AA288188f826F18bB2082DD" }, { "chain": "CHAIN_0X1", "pool": "0xBe53A109B494E5c9f97b9Cd39Fe969BE68BF6204", "protocol": "YEARN", "address": "0xdB20A894d2CDEa7F6AA288188f826F18bB2082DD" } ] } }'

Response Example

{ "data": { "getProtocolPoolUserBalance": [ { "chain": "CHAIN_0X1", "protocol": "AAVE", "pool": "USDC", "balance": { "USDC": 1.010508, "USD": 1.010316508734 }, "error": null }, { "chain": "CHAIN_0X2105", "protocol": "AAVE", "pool": "USDC", "balance": { "USDC": 2.025413, "USD": 2.02499695991567 }, "error": null }, { "chain": "CHAIN_0X1", "protocol": "COMPOUNDV3", "pool": "0xc3d688B66703497DAA19211EEdff47f25384cdc3", "balance": { "USDC": 1.008356, "USD": 1.00801116241512 }, "error": null }, { "chain": "CHAIN_0X1", "protocol": "YEARN", "pool": "0xBe53A109B494E5c9f97b9Cd39Fe969BE68BF6204", "balance": { "USDC": 2.022617, "USD": 2.021836269838 }, "error": null }, { "chain": "CHAIN_HYPERLIQUID_MAINNET", "protocol": "HYPERLIQUID", "pool": "0xdfc24b077bc1425ad1dea75bcb6f8158e10df303", "balance": { "USDC": 10.083708, "USD": 10.079815688712 }, "error": null } ] } }