Private
web3This call returns the balance in native token for the specified address. So in Ethereum mainnet, this would be the ether balance. In Gnosis Chain this would be the XDAI token balance.
promise for the native token amount as a string in native units (usually wei
).
If no address is provided, then the balance of the first address in the wallet will be retrieved.
let assetsAPI = await getSDK('Assets', web3);
let etherBalance = await assetsAPI.getNativeTokenBalance(walletAddress);
Optional
userAddress: stringThis call returns the balance in for an ERC-20 token from the specified address.
a promise for the token amount as a string in native units of the token (usually) wei
).
If no token holder address is provided, then the balance of the first address in the wallet will be retrieved.
let assetsAPI = await getSDK('Assets', web3);
let cardBalance = await assetsAPI.getBalanceForToken(cardTokenAddress, walletAddress);
Optional
tokenHolderAddress: stringThis call returns ERC-20 token information: the token name, the token symbol, and the token decimals for an ERC-20 token.
let assetsAPI = await getSDK('Assets', web3);
let { name, symbol, decimals } = await assetsAPI.getTokenInfo(cardTokenAddress);
Generated using TypeDoc
Thie
Assets
API is used issue queries for native coin balances and ERC-20 token balances, as well as to get ERC-20 token info. TheAssets
API can be obtained fromgetSDK()
with aWeb3
instance that is configured to operate on either layer 1 or layer 2, depending on where the asset you wish to query lives.Example