eth_newFilter
Creates a filter object based on the given filter options, to notify when the state changes (logs).
To check if the state has changed, call eth_getFilterChanges. This method uses 80 credits from your daily balance.
Filters that are not polled using eth_getFilterChanges automatically
expires after 15 minutes of inactivity.
Filter IDs can be polled by any connection using the same API key.
Parameters
A filter object with the following keys and their values:
address: [optional] A contract address or a list of addresses from which logs should originate.fromBlock: [optional, default islatest] A hexadecimal block number, or one of the string tagslatest,earliest,pending,safe, orfinalized. See the default block parameter.toBlock: [optional, default islatest] A hexadecimal block number, or one of the string tagslatest,earliest,pending,safe, orfinalized. See the default block parameter.topics: [optional] An array of 32 bytes DATA topics. Topics are order-dependent.
Specifying topic filters
Topics are order-dependent. A transaction with a log with topics [A, B] will be matched by the following topic filters:
[]: Anything.[A]:Ain the first position, and anything after.[null, B]: Anything in first position ANDBin second position, and anything after.[A, B]:Ain the first position ANDBin second position, and anything after.[[A, B], [A, B]]:(A OR B)in first position AND(A OR B)in second position, and anything after.
Returns
filter ID: A hexadecimal denoting the newly created filter ID.
Example
Replace <YOUR-API-KEY> with an API key from your MetaMask Developer dashboard.