omnia_getAssetBalance

Returns a list of assets owned by the wallet, including token details and current balance. Receives up to 100 contract addresses used to check the balance of the wallet. If no contract addresses are provided, it will use OMNIA's list of most used contracts per chain.

Parameters

  1. DATA, 20 Bytes - wallet. The wallet address that is checked for it's holdings. REQUIRED

  2. Array of DATA, 20 Bytes - contracts. The contract addresses of the tokens for which the wallet is checked.

Beta version note: The feature of not providing a contracts and relying solely on OMNIA's token contracts collection is still in beta, so you might experience some Internal Server Error responses. To avoid that, until the stable version is released, we recommend explicitly specifying token contract addresses in the paramsfield of the request body.

Returns

Array - assets. Token holdings of the wallet address. Only tokens for which the balance is > 0 are returned.

Example

Request

curl --request POST \
     --url https://endpoints.omniatech.io/v1/RPC_ENDPOINT \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "omnia_getAssetBalance",
    "params": [
        {
            "wallet": "0xbBa591C7C9e8460B3EA2b6A9d8980b0237Fd42eC",
            "contracts": [
                "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
                "0x4d224452801ACEd8B2F0aebE155379bb5D594381"
            ]
        }
    ]
}
'

Response

{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "wallet": "0xbBa591C7C9e8460B3EA2b6A9d8980b0237Fd42eC",
        "assets": [
            {
                "token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
                "balance": "1184434877401855",
                "symbol": "WETH",
                "decimals": 18
            },
            {
                "token": "0x4d224452801ACEd8B2F0aebE155379bb5D594381",
                "balance": "8990163329569654507",
                "symbol": "APE",
                "decimals": 18
            }
        ]
    }
}

Last updated