Skip to content

Commit 0e3392b

Browse files
committed
docs: update webhook parameter filtering types and add example
1 parent da9ceef commit 0e3392b

File tree

1 file changed

+23
-2
lines changed
  • apps/portal/src/app/insight/webhooks/filtering

1 file changed

+23
-2
lines changed

apps/portal/src/app/insight/webhooks/filtering/page.mdx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Each webhook must have either an events filter or a transactions filter (or both
3535
signatures: { // Filter by event signatures
3636
sig_hash: string, // Event signature hash
3737
abi?: string, // Optional ABI for data decoding
38-
params?: Record<string, any> // Filter on decoded parameters
38+
params?: Record<string, string | number> // Filter on decoded parameters
3939
}[]
4040
}
4141
}
@@ -51,7 +51,7 @@ Each webhook must have either an events filter or a transactions filter (or both
5151
signatures: { // Filter by function signatures
5252
sig_hash: string, // Function signature hash
5353
abi?: string, // Optional ABI for data decoding
54-
params?: string[] // Filter on decoded parameters
54+
params?: Record<string, string | number> // Filter on decoded parameters
5555
}[]
5656
}
5757
}
@@ -106,6 +106,27 @@ And this example will filter for `Approve` function calls on Ethereum for the co
106106

107107
`params` on the `signatures` object will allow you to filter based on the decoded data. Only strict equality is supported at the moment.
108108

109+
For example, if you want to filter for `Transfer` events where the `from` address is `0x1f9840a85d5af5bf1d1762f925bdaddc4201f984`, you can use the following:
110+
```typescript
111+
{
112+
...
113+
"filters": {
114+
"v1.events": {
115+
"chain_ids": ["1"],
116+
"addresses": ["0x1f9840a85d5af5bf1d1762f925bdaddc4201f984"],
117+
"signatures": [{
118+
"sig_hash": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
119+
"abi": "{\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"}",
120+
"params": {
121+
"from": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984"
122+
}
123+
}]
124+
}
125+
}
126+
...
127+
}
128+
```
129+
109130
### Notes
110131
- You can specify ABIs to receive decoded event/transaction data
111132
- Parameter filtering supports equality matching only

0 commit comments

Comments
 (0)