get https://example.com
Xlayer API - Creates a filter object, based on filter options, to notify when the state changes (logs). Unlike eth_newBlockFilterwhich notifies you of all new blocks, you can pass in filter options t
Parameters
- Object - The filter options:
- fromBlock: QUANTITY|TAG - (optional, default: "latest") Integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions.
- toBlock: QUANTITY|TAG - (optional, default: "latest") Integer block number, or "latest" for the last mined block or "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.
params: [
{
fromBlock: "0x1",
toBlock: "0x2",
address: "0x8888f1f195afa192cfee860698584c030f4c9db1",
topics: [
"0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
[
"0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"0x0000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebccc"
]
]
}
];
Returns
QUANTITY - A filter id.
Example
Request
curl https://xlayer-mainnet.unifra.io/v1/your-api-key \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_newFilter","params":[{"fromBlock": "0x224777e","toBlock": "0x2247796","address": "0x2ef3723bb09c311d035334b11614efadbd0d7a24","topics": ["0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1"]}],"id":0}'
URL: https://xlayer-mainnet.unifra.io/v1/your-api-key
RequestType: POST
Body:
{
"jsonrpc":"2.0",
"method":"eth_newFilter",
"params":[{"fromBlock": "0x224777e","toBlock": "0x2247796","address": "0x2ef3723bb09c311d035334b11614efadbd0d7a24","topics": ["0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1"]}],
"id":0
}
Result
{
"jsonrpc": "2.0",
"id": 0,
"result": "0x0700000000000000bf0b1f4b27e765fb"
}