post https://api.infstones.com/theta/mainnet/
Returns an array of all logs matching a given filter object.
Parameters
OBJECT
- The filter options:
Object Name | Required | Type | Detail |
---|---|---|---|
fromBlock | ❌ | String | A hex code of an integer that represents the block number, or "latest" that represents the last mined block. |
toBlock | ❌ | String | A hex code of an integer that represents the integer block number, or "latest" that represents the last mined block. |
address | ❌ | String/Array | Contract address or a list of addresses from which logs should originate. |
topics | ❌ | Array | Array of 32 Bytes DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with "or" options. |
blockHash | ❌ | String | Restricts the logs returned to the single block with the blockHash . If blockHash is present in the filter criteria, then neither fromBlock nor toBlock are allowed. |
"params": [
{
"address": "0xb65329892d41fca555f6bfd7fe4c7fe8b63ecaf4",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
],
"blockHash": "0x492e154d7948e130bcd182e82f2162b2d427b39157aebf6341abc4e128418a99"
}
]
Result
It is an 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.["0x123456789..."]
. - For filters created with
eth_newFilter
logs are objects with the following fields.
Result Fields
Key | Type | Detail |
---|---|---|
address | String | Address from which this log originated. |
blockHash | String | Hash of the block where this log was in. null if either the returned block is pending or the log is pending. |
blockNumber | String | A hex code of an integer that represents the block number where this log was in. null if either the returned block is pending or the log is pending. |
data | String | Contains one or more 32 Bytes non-indexed arguments of the log. |
logIndex | String | A hex code of an integer that represents the log index position in the block. null if the log is pending. |
removed | Boolean | true if the log was removed, due to a chain reorganization. false if the log is valid. |
topics | Array | Array of 0 to 4 32 Bytes DATA of indexed log arguments. |
transactionHash | String | Hash of the transactions this log was created from. null if the log is pending. |
transactionIndex | String | A hex code of an integer that represents the transactions index position log was created from. null if the log is pending. |
Example
Request
curl <your-endpoint> \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"address": "0xb65329892d41fca555f6bfd7fe4c7fe8b63ecaf4","topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],"blockHash": "0x492e154d7948e130bcd182e82f2162b2d427b39157aebf6341abc4e128418a99"}],"id":0}'
Return
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"logIndex": "0x0",
"transactionIndex": "0x3",
"transactionHash": "0xad48e32eb8abcc833320507faf69303cd44857cc4b64d4ffaaa543025c4126fc",
"blockHash": "0x492e154d7948e130bcd182e82f2162b2d427b39157aebf6341abc4e128418a99",
"blockNumber": "0x1288686",
"address": "0xb65329892d41fca555f6bfd7fe4c7fe8b63ecaf4",
"data": "0x",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x00000000000000000000000054ddadad2794d38e7bd2d19b9dd542a5409889ed",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x000000000000000000000000000000000000000000000000000000000000028e"
],
"type": "mined"
}
]
}