Skip to content

Commit 060b60e

Browse files
Add filter methods for supported methods (#1994)
* Add initial filter methods. Signed-off-by: bgravenorst <[email protected]> * Add filter topics. Signed-off-by: bgravenorst <[email protected]> * Add what's new. Signed-off-by: bgravenorst <[email protected]> * Apply suggestions from code review Co-authored-by: Alexandra Carrillo <[email protected]> --------- Signed-off-by: bgravenorst <[email protected]> Co-authored-by: Alexandra Carrillo <[email protected]>
1 parent 229430c commit 060b60e

File tree

90 files changed

+2389
-20
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+2389
-20
lines changed

docs/whats-new.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ of the [MetaMask developer page](https://metamask.io/developer/).
1111

1212
## May 2025
1313

14+
- Documented Infura's filter API method support for [Arbitrum](/services/reference/arbitrum/json-rpc-methods/filter-methods/),
15+
[Avalanche](/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/), [Base](/services/reference/base/json-rpc-methods/filter-methods/),
16+
[Celo](/services/reference/celo/json-rpc-methods/filter-methods/), [Linea](/services/reference/linea/json-rpc-methods/filter-methods/),
17+
[Optimism](/services/reference/optimism/json-rpc-methods/filter-methods/), and
18+
[Polygon POS](/services/reference/polygon-pos/json-rpc-methods/filter-methods/) networks. ([#1994](https://github.com/MetaMask/metamask-docs/pull/1994))
1419
- Discontinue Infura support for the Ethereum Holesky testnet. ([#1996](https://github.com/MetaMask/metamask-docs/pull/1996))
1520

1621
## April 2025
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Polling method for a filter, which returns an array of logs which occurred since the last poll.
2-
Filter must be created by calling either [`eth_newFilter`](../../ethereum/json-rpc-methods/filter-methods/eth_newfilter.mdx) or [`eth_newBlockFilter`](../../ethereum/json-rpc-methods/filter-methods/eth_newblockfilter.mdx).
2+
Filter must be created by calling either [`eth_newFilter`](../eth_newfilter) or [`eth_newBlockFilter`](../eth_newblockfilter).
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
- `log object array`: (array) An array of log objects, or an empty array if nothing has changed since the last poll.
2-
- For filters created with [`eth_newBlockFilter`](../../ethereum/json-rpc-methods/filter-methods/eth_newblockfilter.mdx) the return values are block hashes (32 bytes), for example, `["0x3454645634534..."]`.
3-
- For filters created with [`eth_newFilter`](../../ethereum/json-rpc-methods/filter-methods/eth_newfilter.mdx) the logs are objects with the following params:
2+
- For filters created with [`eth_newBlockFilter`](../eth_newblockfilter) the return values are block hashes (32 bytes), for example, `["0x3454645634534..."]`.
3+
- For filters created with [`eth_newFilter`](../eth_newfilter) the logs are objects with the following params:
44
- `address`: 20 bytes. Address from which this log originated.
5-
- `blockHash`: 32 bytes. The hash of the block where this log was in. `Null` when it is a pending log.
6-
- `blockNumber`: The block number where this log was in. `Null` when it is a pending log.
5+
- `blockHash`: 32 bytes. The hash of the block where this log was in. `null` when it is a pending log.
6+
- `blockNumber`: The block number where this log was in. `null` when it is a pending log.
77
- `data`: DATA. Contains the non-indexed arguments of the log.
8-
- `logIndex`: A hexadecimal of the log index position in the block. `Null` when it is a pending log.
8+
- `logIndex`: A hexadecimal of the log index position in the block. `null` when it is a pending log.
99
- `removed`: `true` when the log was removed, due to a chain reorganization. `false` if it is a valid log.
1010
- `topics`: Array of DATA. An 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 (for example, `Deposit(address,bytes32,uint256)`), except when you declared the event with the anonymous specifier.
11-
- `transactionHash`: 32 bytes. A hash of the transactions from which this log was created. `Null` when it is a pending log.
12-
- `transactionIndex`: A hexadecimal of the transactions index position from which this log was created. `Null` when it is a pending log.
11+
- `transactionHash`: 32 bytes. A hash of the transactions from which this log was created. `null` when it is a pending log.
12+
- `transactionIndex`: A hexadecimal of the transactions index position from which this log was created. `null` when it is a pending log.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
- `log object array`: (array) An array of log objects that match the filter. For an array of logs that occurred since the last poll, use [eth_getFilterChanges](../../ethereum/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx). Log objects contain the following keys and their values:
22
- `address`: 20 bytes. Address from which this log originated.
3-
- `blockHash`: 32 bytes. The hash of the block where this log was in. `Null` when it is a pending log.
4-
- `blockNumber`: The block number where this log was in. `Null` when it is a pending log.
3+
- `blockHash`: 32 bytes. The hash of the block where this log was in. `null` when it's a pending log.
4+
- `blockNumber`: The block number where this log was in. `null` when it's a pending log.
55
- `data`: DATA. Contains the non-indexed arguments of the log.
6-
- `logIndex`: A hexadecimal of the log index position in the block. `Null` when it is a pending log.
7-
- `removed`: `true` when the log was removed, due to a chain reorganization. `false` if it is a valid log.
6+
- `logIndex`: A hexadecimal of the log index position in the block. `null` when it is a pending log.
7+
- `removed`: `true` when the log was removed, due to a chain reorganization. `false` if it's a valid log.
88
- `topics`: Array of DATA. An 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 (for example, `Deposit(address,bytes32,uint256)`), except when you declared the event with the anonymous specifier.
9-
- `transactionHash`: 32 bytes. A hash of the transactions from which this log was created. `Null` when it is a pending log.
10-
- `transactionIndex`: A hexadecimal of the transactions index position from which this log was created. `Null` when it is a pending log.
9+
- `transactionHash`: 32 bytes. A hash of the transactions from which this log was created. `null` when it's a pending log.
10+
- `transactionIndex`: A hexadecimal of the transactions index position from which this log was created. `null` when it's a pending log.
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call [`eth_getFilterChanges`](../../ethereum/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx).
1+
Creates a filter in the node, to notify when a new block arrives. To check if the state has
2+
changed, call [`eth_getFilterChanges`](../eth_getfilterchanges).
23

3-
:::tip Valid for fifteen minutes
4-
Filter IDs will be valid for up to fifteen minutes, and can be polled by any connection using the same `<YOUR-API-KEY>`.
4+
:::warning Expires after 15 minutes of inactivity
5+
Filters that are not polled using [`eth_getFilterChanges`](../eth_getfilterchanges) automatically
6+
expires after 15 minutes of inactivity.
7+
Filter IDs can be polled by any connection using the same API key.
58
:::
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
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`](../../ethereum/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx).
1+
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`](../eth_getfilterchanges).
22

3-
:::tip Valid for fifteen minutes
4-
Filter IDs will be valid for up to fifteen minutes, and can be polled by any connection using the same `<YOUR-API-KEY>`.
3+
:::warning Expires after 15 minutes of inactivity
4+
Filters that are not polled using [`eth_getFilterChanges`](../eth_getfilterchanges) automatically
5+
expires after 15 minutes of inactivity.
6+
Filter IDs can be polled by any connection using the same API key.
57
:::
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import Tabs from "@theme/Tabs"
2+
import TabItem from "@theme/TabItem"
3+
4+
<Tabs>
5+
<TabItem value="curl">
6+
7+
```bash
8+
curl https://arbitrum-mainnet.infura.io/v3/<YOUR-API-KEY> \
9+
-X POST \
10+
-H "Content-Type: application/json" \
11+
-d '{"jsonrpc": "2.0", "method": "eth_getFilterChanges", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}'
12+
```
13+
14+
</TabItem>
15+
<TabItem value="WSS">
16+
17+
```bash
18+
wscat -c wss://arbitrum-mainnet.infura.io/ws/v3/<YOUR-API-KEY> -x '{"jsonrpc": "2.0", "method": "eth_getFilterChanges", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}'
19+
```
20+
21+
</TabItem>
22+
</Tabs>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import Tabs from "@theme/Tabs"
2+
import TabItem from "@theme/TabItem"
3+
4+
<Tabs>
5+
<TabItem value="curl">
6+
7+
```bash
8+
curl https://arbitrum-mainnet.infura.io/v3/<YOUR-API-KEY> \
9+
-X POST \
10+
-H "Content-Type: application/json" \
11+
-d '{"jsonrpc": "2.0", "method": "eth_getFilterLogs", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}'
12+
```
13+
14+
</TabItem>
15+
<TabItem value="WSS">
16+
17+
```bash
18+
wscat -c wss://arbitrum-mainnet.infura.io/ws/v3/<YOUR-API-KEY> -x '{"jsonrpc": "2.0", "method": "eth_getFilterLogs", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}'
19+
```
20+
21+
</TabItem>
22+
</Tabs>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import Tabs from "@theme/Tabs"
2+
import TabItem from "@theme/TabItem"
3+
4+
<Tabs>
5+
<TabItem value="curl">
6+
7+
```bash
8+
curl https://arbitrum-mainnet.infura.io/v3/<YOUR-API-KEY> \
9+
-X POST \
10+
-H "Content-Type: application/json" \
11+
-d '{"jsonrpc": "2.0", "method": "eth_newBlockFilter", "params": [], "id": 1}'
12+
```
13+
14+
</TabItem>
15+
<TabItem value="WSS">
16+
17+
```bash
18+
wscat -c wss://arbitrum-mainnet.infura.io/ws/v3/<YOUR-API-KEY> -x '{"jsonrpc": "2.0", "method": "eth_newBlockFilter", "params": [], "id": 1}'
19+
```
20+
21+
</TabItem>
22+
</Tabs>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import Tabs from "@theme/Tabs"
2+
import TabItem from "@theme/TabItem"
3+
4+
<Tabs>
5+
<TabItem value="curl">
6+
7+
```bash
8+
curl https://arbitrum-mainnet.infura.io/v3/<YOUR-API-KEY> \
9+
-X POST \
10+
-H "Content-Type: application/json" \
11+
-d '{"jsonrpc": "2.0", "method": "eth_newFilter", "params": [{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}'
12+
```
13+
14+
</TabItem>
15+
<TabItem value="WSS">
16+
17+
```bash
18+
wscat -c wss://arbitrum-mainnet.infura.io/ws/v3/<YOUR-API-KEY> -x '{"jsonrpc": "2.0", "method": "eth_newFilter", "params": [{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}'
19+
```
20+
21+
</TabItem>
22+
</Tabs>

0 commit comments

Comments
 (0)