post https://base-mainnet.unifra.io/v1/
Returns an array of all logs matching a given filter object. For more information about eth_getLogs check out our Deep Dive into eth_getLogs page.
Parameters
Object - The filter options:
- fromBlock: QUANTITY|TAG - (optional, default: "latest") Value:
- Integer block number
- "latest" for the last mined block
- "pending", "earliest" for not yet mined transactions.
- toBlock: QUANTITY|TAG - (optional, default: "latest") Value:
- Integer block number
- "latest" for the last mined block
- "pending", "earliest" for not yet mined transactions.
- address: DATA|Array, 20 Bytes - (optional) Contract address or a list of addresses from which logs should originate.
- topics: Array of DATA, - (optional) Array of 32 Bytes DATA topics.
- Topics are order-dependent. Each topic can also be an array of DATA with "or" options.
- Check out more details on how to format topics in eth_newFilter.
- blockHash: DATA, 32 Bytes - (optional) With the addition of EIP-234 (Geth >= v1.8.13 or Parity >= v2.1.0), blockHash is a new filter option which restricts the logs returned to the single block with the 32-byte hash blockHash. Using blockHash is equivalent to fromBlock = toBlock = the block number with hash blockHash. If blockHash is present in the filter criteria, then neither fromBlock nor toBlock are allowed.
curl --location --request POST 'https://base-testnet.unifra.io/v1/{your-api-key}' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [
{
"address": "0x000070300830FFC8501Cf42402015bAD12699D71",
"blockHash": "0xdecf7d1109c108ec3c01cd71e9bff4bd5b8790b86654f95e495012eb66524e25"
}
],
"id": 0
}'
Returns
Array - Array of log objects, or an empty array if nothing has changed since last poll.
- For filters created with eth_newBlockFilter the return are block hashes (DATA, 32 Bytes), e.g. ["0x3454645634534..."].
- For filters created with eth_newPendingTransactionFilter the return are transaction hashes (DATA, 32 Bytes), e.g. ["0x6345343454645..."].
- For filters created with eth_newFilter logs are objects with following params:
- removed: TAG - True when the log was removed, due to a chain reorganization. False if its a valid log.
- logIndex: QUANTITY - Integer of the log index position in the block. Null when its pending log.
- transactionIndex: QUANTITY - Integer of the transactions index position log was created from. Null when its pending log.
- transactionHash: DATA, 32 Bytes - Hash of the transactions this log was created from. Null when its pending log.
- blockHash: DATA, 32 Bytes - Hash of the block where this log was in. Null when its pending. Null when its pending log.
- blockNumber: QUANTITY - The block number where this log was in. Null when its pending. Null when its pending log.
- address: DATA, 20 Bytes - Address from which this log originated.
- data: DATA - Contains one or more 32 Bytes non-indexed arguments of the log.
- topics: Array of DATA - Array of 0 to 4 32 Bytes DATA of indexed log arguments.
- In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except you declare the event with the anonymous specifier.
Example
Request
curl --request POST \
--url https://base-testnet.unifra.io/v1/{your-api-key} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [
{
"fromBlock": "0x5ca46e",
"toBlock": "0x5ca46f",
"address": "0x4200000000000000000000000000000000000006",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
]
}
],
"id": 0
}
'
Result
{
"jsonrpc": "2.0",
"id": 0,
"result": [
{
"address": "0x4200000000000000000000000000000000000006",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000004df34a29aabd0694a62cbf65a844e12a44617975",
"0x000000000000000000000000360e41201597a82007046329c021abc9d4ae0b6e"
],
"data": "0x000000000000000000000000000000000000000000000000000000e8d4a51000",
"blockNumber": "0x5ca46f",
"transactionHash": "0x650f7532fa7c3ccdf4bb8e6db9ca893cff358a92aabd70b320979dabc47ad684",
"transactionIndex": "0x2",
"blockHash": "0x5fc58e789ab7d1a5c76f410685c70a84c3e62653c8fd19c660bf265e793f72bf",
"logIndex": "0x1",
"removed": false
},
{
"address": "0x4200000000000000000000000000000000000006",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x000000000000000000000000abe856bcde2be8b4fbf481e9be8e07279fccdd34",
"0x000000000000000000000000fea6e5e6f7a831ae028c4d26dcb668613509d1a9"
],
"data": "0x000000000000000000000000000000000000000000000000000f8720e4eb7800",
"blockNumber": "0x5ca46f",
"transactionHash": "0xcce1f8becea5f597fffee43cae43d1507690a059ed0835adc1d55a4a4161cadb",
"transactionIndex": "0x4",
"blockHash": "0x5fc58e789ab7d1a5c76f410685c70a84c3e62653c8fd19c660bf265e793f72bf",
"logIndex": "0x6",
"removed": false
}
]
}