getAccountState
Retrieve account state (balances and staking positions) for blockchain networks, ensuring raw amounts are converted to human-readable formats using mandatory API calls to avoid display errors.
Instructions
Get the state of an account (balances and staking positions). CRITICAL: Balance amounts are returned in SMALLEST UNITS (wei for ETH, satoshis for BTC, µATOM for ATOM, etc.). NEVER show raw amounts to users! Always convert first! MANDATORY CONVERSION STEPS - ALWAYS CALL THESE ENDPOINTS: 1. For NATIVE currency: MUST call listFeatures(chainId) first to get the exact decimal places - NEVER assume! 2. For TOKENS: MUST call getTokenDetails(chainId, tokenId) for each token to get its exact decimals - NEVER assume! 3. Convert ALL amounts: human_readable = raw_amount ÷ 10^decimals (using the decimals from the API calls above) 4. Present in human-readable format to users COMMON ERRORS TO AVOID: • ATOM: Raw '4191769000' with 6 decimals = 4.191769 ATOM (NOT 4,191.769 ATOM!) • ETH: Raw '5354656887913579' with 18 decimals = 0.005354656887913579 ETH (NOT 5.35 ETH!) • Always divide by 10^decimals, check your decimal point placement!
Input Schema
Name | Required | Description | Default |
---|---|---|---|
accountId | Yes | ||
chainId | Yes |