Fetch Token Balances

Methods

fetchTokenList

returns the list of tokens owned by the accountId

const tokenList = await sdk.fetchTokenList(accountId)
// Try root.near, ironman.near

accountId refers to the Near wallet address

Response Body

{
  balance: string // formatted token amount, available in the given account
  
  name: string // Name of the token
  
  price: object /* price of token in fiat, supports only usd for now
  if usd price is not found returns {} */
  
  symbol: string // The symbol of the token
  
  decimals: number // The number of decimals the token uses
  
  token_id: string // ID of this particular token i.e a near address
  
  icon: string // icon URL of the token, can be a base64 string as well
  
  isWhitelisted: boolean // if the token is a verifed token or not

}[] // array of this object
Sample Response

fetchTokenBalance

returns the balance of a token in an accountId

accountId is the near wallet address. tokenId is the nep-141 token address.

Response Body

Sample Response

Last updated