Short answer: Call algod.accountAssetInformation(address, assetId). If the account holds the asset it returns the holding, including the amount in base units.
// algod = new algosdk.Algodv2("", "https://testnet-api.algonode.cloud", 443)
// indexer, addr (an account address) and USDC (asset id 10458941 on TestNet) are set up before the call
async () => {
const info = await algod.accountAssetInformation(addr, USDC).do();
return { optedIn: true, amount: String(info.assetHolding.amount) };
}
{
"optedIn": true,
"amount": "1825001"
}
Run against a public TestNet node with algosdk 3.9.0 on 2026-12-03. Amounts are shown as strings because they are bigints.
assetHolding; the amount is a bigint in the asset's base units.All how-tos · howto.json · SDK errors · API errors · costs