Retrieve token balance

How to retrieve the token balances for a wallet (ERC20 standard)

Get all token balances by wallet id

GET https://api-wallet.venly.io/api/wallets/<walletId>/balance/tokens

Path Parameters

NameTypeDescription

walletId*

string

ID of the wallet

Query Parameters

NameTypeDescription

all

boolean

false (default) if you do not want to retrieve 0 or dust balances (example 0.00000000001). When true is provided, everything is returned including 0 balances. In case of HEDERA: tokens with 0 balance are associated tokens.

{
    "success": true,
    "result": [
        {
            "tokenAddress": "0x2d7882bedcbfddce29ba99965dd3cdf7fcb10a1e",
            "rawBalance": "1000000000000000000",
            "balance": 1.0,
            "decimals": 18,
            "symbol": "TST",
            "logo": "https://img.arkane.network/tokens/matic/testnet/logos/0x2d7882bedcbfddce29ba99965dd3cdf7fcb10a1e.png",
            "type": "ERC_20",
            "transferable": true
        }
    ]
}

Get a specific token balance by wallet id

GET https://api-wallet.venly.io/api/wallets/<walletId>/balance/tokens/<tokenAddress>

Path Parameters

NameTypeDescription

tokenAddress

string

Token address

walletId

string

ID of the wallet

{
    "success": true,
    "result": [
        {
            "tokenAddress": "0x2d7882bedcbfddce29ba99965dd3cdf7fcb10a1e",
            "rawBalance": "1000000000000000000",
            "balance": 1.0,
            "decimals": 18,
            "symbol": "TST",
            "logo": "https://img.arkane.network/tokens/matic/testnet/logos/0x2d7882bedcbfddce29ba99965dd3cdf7fcb10a1e.png",
            "type": "ERC_20",
            "transferable": true
        }
    ]
}

Get all token balances by secret type and wallet address

GET https://api-wallet.venly.io/:secretType/:walletAddress/balance/tokens

Path Parameters

NameTypeDescription

secretType*

SecretType

Parameter to indicate on which chain the token balances should be fetched

waletAddress*

String

The address of the wallet to fetch token balances for

{
    "success": true,
    "result": [
        {
            "tokenAddress": "0x01b98a3f1766ff8248bf33b05213f411d3272261",
            "rawBalance": "50000000000",
            "balance": 50000.0,
            "decimals": 6,
            "symbol": "USDC",
            "logo": "https://logos.covalenthq.com/tokens/80001/0x01b98a3f1766ff8248bf33b05213f411d3272261.png",
            "type": "ERC20",
            "transferable": true,
            "name": "USD Coin"
        },
        {
            "tokenAddress": "0x2d7882bedcbfddce29ba99965dd3cdf7fcb10a1e",
            "rawBalance": "60000000000000000",
            "balance": 0.06,
            "decimals": 18,
            "symbol": "TST",
            "logo": "https://logos.covalenthq.com/tokens/80001/0x2d7882bedcbfddce29ba99965dd3cdf7fcb10a1e.png",
            "type": "ERC20",
            "transferable": true,
            "name": "Test Token"
        },
        {
            "tokenAddress": "0x4354ede79651b3627332faad1a4ceb001d005ce9",
            "rawBalance": "990000000000000000000",
            "balance": 990.0,
            "decimals": 18,
            "symbol": "BNA",
            "logo": "https://logos.covalenthq.com/tokens/80001/0x4354ede79651b3627332faad1a4ceb001d005ce9.png",
            "type": "ERC20",
            "transferable": true,
            "name": "Banana"
        },
        {
            "tokenAddress": "0xfe4f5145f6e09952a5ba9e956ed0c25e3fa4c7f1",
            "rawBalance": "2000000000000000000",
            "balance": 2.0,
            "decimals": 18,
            "symbol": "DERC20",
            "logo": "https://logos.covalenthq.com/tokens/80001/0xfe4f5145f6e09952a5ba9e956ed0c25e3fa4c7f1.png",
            "type": "ERC20",
            "transferable": true,
            "name": "Dummy ERC20"
        }
    ]
}

Get a specific token balance by secret type and wallet address

GET https://api-wallet.venly.io/:secretType/:walletAddress/balance/tokens/:tokenAddress

Path Parameters

NameTypeDescription

secretType*

SecretType

Parameter to indicate on which chain the token balance should be fetched

walletAddress*

String

The address of the wallet to fetch token balance for

tokenAddress*

String

Address of the token (contract) to fetch the balance for

{
    "success": true,
    "result": {
        "tokenAddress": "0x01b98a3f1766ff8248bf33b05213f411d3272261",
        "rawBalance": "50000000000",
        "balance": 50000.0,
        "decimals": 6,
        "symbol": "USDC",
        "logo": null,
        "type": "ERC20",
        "transferable": true,
        "name": "Venly"
    }
}

Example

Response

{
    "success": true,
    "result": [
        {
            "tokenAddress": "0x2d7882bedcbfddce29ba99965dd3cdf7fcb10a1e",
            "rawBalance": "1000000000000000000",
            "balance": 1.0,
            "decimals": 18,
            "symbol": "TST",
            "logo": "https://img.arkane.network/tokens/matic/testnet/logos/0x2d7882bedcbfddce29ba99965dd3cdf7fcb10a1e.png",
            "type": "ERC_20",
            "transferable": true
        }
    ]
}

Last updated