eth_newFilter
Creates a filter object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call eth_getFilterChanges.
Params
- a string array containing (required):Object
- The filter options:fromBlock(hex string|string, optional)
.QUANTITY|TAG
- Integer block number, or"latest"
for the last mined block or"pending"
,"earliest"
for not yet mined transactions.toBlock(hex string|string, optional)
.QUANTITY|TAG
- Integer block number, or"latest"
for the last mined block or"pending"
,"earliest"
for not yet mined transactions.address(hex string|array, optional)
.DATA|Array, 20 Bytes
- Contract address or a list of addresses from which logs should originate.topics(array, optional)
.Array of DATA
- Array of 32 BytesDATA
topics. Topics are order-dependent. Each topic can also be an array of DATA with “or” options.
QUANTITY(hex string)
- A filter id.curl
TypeScript
curl https://blockvision.org/v1/<your api key> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_newFilter",
"params": [
{
"fromBlock": "0x1",
"toBlock": "0x2",
"address": "0x8888f1f195afa192cfee860698584c030f4c9db1",
"topics": [
"0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
null,
[
"0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"0x0000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebccc"
]
]
}
],
"id": 0
}'
import { BlockVisionProvider, BvNetwork } from 'blockvision.js'
// Optional parameters, but default to eth-mainnet and default api-key.
const bv = new BlockVisionProvider(BvNetwork.OPT_MAINNET)
// Access BlockVision Enhanced API requests
bv.getNewFilter([
{
fromBlock: '0x1',
toBlock: '0x2',
address: '0x8888f1f195afa192cfee860698584c030f4c9db1',
topics: [
'0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b',
null,
[
'0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b',
'0x0000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebccc'
]
]
}
]).then(console.log)
{
"jsonrpc": "2.0",
"id": 0,
"result": "0xdcc9a819f80efa9e1d215a9d41b2d22e"
}
Last modified 1mo ago