curl --request POST \
--url https://rpc.testnet.tempo.xyz/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [
{
"to": "0x20c0000000000000000000000000000000000000",
"data": "0x70a082310000000000000000000000009729187d9e8bbefa8295f39f5634ca454dd9d294"
},
"latest"
],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}curl --request POST \
--url https://rpc.testnet.tempo.xyz/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [
{
"to": "0x20c0000000000000000000000000000000000000",
"data": "0x70a082310000000000000000000000009729187d9e8bbefa8295f39f5634ca454dd9d294"
},
"latest"
],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}callObject — the call object:
from — (optional) address the call is sent fromto — the address the call is directed togas — (optional) gas provided for the callgasPrice — (optional) gas price for the callvalue — (optional) value sent with the calldata — (optional) hash of the method signature and encoded parametersblockParameter — the block number (hex) or tag (latest, earliest, pending)result — the return value of the executed contract calleth_call code examplesbalanceOf function on the pathUSD TIP-20 token contract:
const ethers = require('ethers');
const NODE_URL = "CHAINSTACK_NODE_URL";
const provider = new ethers.JsonRpcProvider(NODE_URL);
// pathUSD token address
const PATHUSD = "0x20c0000000000000000000000000000000000000";
const getBalance = async (address) => {
const abi = ["function balanceOf(address) view returns (uint256)"];
const token = new ethers.Contract(PATHUSD, abi, provider);
const balance = await token.balanceOf(address);
// TIP-20 tokens use 6 decimals
console.log(`pathUSD balance: ${ethers.formatUnits(balance, 6)}`);
};
getBalance("0x9729187D9E8Bbefa8295F39f5634cA454dd9d294");
Was this page helpful?