▾ How to check TIP-20 token balances
Since Tempo does not have a native token, you need to query TIP-20 stablecoin contracts directly to check account balances. Use the balanceOf function on the token contract.
Example using ethers.js:
const ethers = require('ethers');
const NODE_URL = "YOUR_QUICKNODE_ENDPOINT";
const provider = new ethers.JsonRpcProvider(NODE_URL);
// pathUSD token contract address
const PATHUSD_ADDRESS = "0x20c0000000000000000000000000000000000000";
async function checkTokenBalance(address) {
const abi = ["function balanceOf(address) view returns (uint256)"];
const tokenContract = new ethers.Contract(PATHUSD_ADDRESS, abi, provider);
const balance = await tokenContract.balanceOf(address);
// TIP-20 tokens use 6 decimal places
const formattedBalance = ethers.formatUnits(balance, 6);
console.log(`pathUSD balance: ${formattedBalance}`);
}
checkTokenBalance("0x9729187D9E8Bbefa8295F39f5634cA454dd9d294");
Available TIP-20 stablecoins:
| Token | Address |
|---|---|
| pathUSD | 0x20c0000000000000000000000000000000000000 |
| AlphaUSD | 0x20c0000000000000000000000000000000000001 |
| BetaUSD | 0x20c0000000000000000000000000000000000002 |
| ThetaUSD | 0x20c0000000000000000000000000000000000003 |
Parameters
- addressstringREQUIRED
The address (20 bytes) to check for balance
- blockNumberstringREQUIRED
The block number in hexadecimal format or the string latest, earliest, pending, safe or finalized (safe and finalized tags are only supported on Ethereum, Gnosis, Arbitrum, Arbitrum Nova and Avalanche C-chain), see the default block parameter description in the official Ethereum documentation
Returns
- resultstring
A placeholder balance value in hexadecimal format
1{2"jsonrpc": "2.0",3"id": 1,4"result": "0x9612084f0316e0ebd5182f398e5195a51b5ca47667d4c9b26c9b26c9b26c9b2"5}
1{2"jsonrpc": "2.0",3"id": 1,4"result": "0x9612084f0316e0ebd5182f398e5195a51b5ca47667d4c9b26c9b26c9b26c9b2"5}