curl --request POST \
--url https://rpc.testnet.tempo.xyz/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [
{
"fromBlock": "latest",
"toBlock": "latest",
"address": "0x20c0000000000000000000000000000000000000",
"topics": []
}
],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": [
{}
]
}curl --request POST \
--url https://rpc.testnet.tempo.xyz/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [
{
"fromBlock": "latest",
"toBlock": "latest",
"address": "0x20c0000000000000000000000000000000000000",
"topics": []
}
],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": [
{}
]
}filterObject — the filter object:
fromBlock — (optional) block number (hex) or tag to start fromtoBlock — (optional) block number (hex) or tag to end ataddress — (optional) contract address or array of addressestopics — (optional) array of topic filtersresult — array of log objects:
address — contract address that emitted the logtopics — array of indexed log parametersdata — non-indexed log parametersblockNumber — block number containing the logtransactionHash — hash of the transaction that emitted the loglogIndex — position of the log in the blocketh_getLogs code examplesconst ethers = require('ethers');
const NODE_URL = "CHAINSTACK_NODE_URL";
const provider = new ethers.JsonRpcProvider(NODE_URL);
// pathUSD token address
const PATHUSD = "0x20c0000000000000000000000000000000000000";
// Transfer event topic
const TRANSFER_TOPIC = ethers.id("Transfer(address,address,uint256)");
const getLogs = async () => {
const logs = await provider.getLogs({
address: PATHUSD,
topics: [TRANSFER_TOPIC],
fromBlock: "latest"
});
for (const log of logs) {
console.log(`Transfer in tx: ${log.transactionHash}`);
}
};
getLogs();
Was this page helpful?