You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: consolidate on deploy-quicknode-filter.sh as single source of truth
The repo had two conflicting paths for QuickNode filter deployment:
1. bin/update-quicknode-filter.js → infra/quicknode.tf (legacy, never worked)
2. bin/deploy-quicknode-filter.sh → QuickNode template API (current, working)
The Terraform path was always dead: ignore_all_server_changes=true prevents
Terraform from pushing filter_function changes to existing webhooks.
Changes:
- Delete bin/update-quicknode-filter.js (zombie script)
- Remove dead dev:webhook:* npm scripts that invoked it
- Add prominent deprecation notice to infra/quicknode.tf explaining that
filter_function blobs are not deployed and all updates go via the script
- Rewrite README.md QuickNode section to document the actual deploy workflow
- Rewrite ADDING_EVENTS.md to replace Terraform migration steps with
deploy-quicknode-filter.sh instructions
- Document the contracts address filtering quirk (silently ignored by
QuickNode API — filtering must be done in the Cloud Function handler)
This watches for changes to your filter function file and automatically base64-encodes it into [`infra/quicknode.tf`](infra/quicknode.tf).
69
+
The deploy script reads the ABI and contract addresses from the `/* template: evmAbiFilter ... */` comment header at the top of each filter file and applies the update live via `PATCH /webhooks/{id}/template/evmAbiFilterGo` (no downtime required).
70
+
71
+
> **Note:** The old `npm run dev:webhook:*` scripts and `bin/update-quicknode-filter.js` are legacy — they updated `infra/quicknode.tf` which is never applied to live webhooks (`ignore_all_server_changes = true`). Use `deploy-quicknode-filter.sh` instead.
69
72
70
73
#### 3. Test the Filter Function with Real Blockchain Data
71
74
@@ -104,36 +107,29 @@ Once your filter function works correctly:
104
107
105
108
**Pro tip:** Using real data ensures your fixture accurately represents what QuickNode will send in production.
106
109
107
-
#### 5. Clean Up and Migrate to Terraform
110
+
#### 5. Clean Up and Make Permanent
108
111
109
-
1.**Delete the temporary webhook** from the [QuickNode Webhooks Dashboard](https://dashboard.quicknode.com/webhooks)
110
-
1.**Write Terraform code** in [`infra/quicknode.tf`](infra/quicknode.tf) to automate webhook creation:
112
+
1.**Delete the temporary test webhook** from the [QuickNode Webhooks Dashboard](https://dashboard.quicknode.com/webhooks) (the one you created manually for testing).
**Note:**If updating an existing webhook's filter function, you may need to pause it first or destroy and recreate it (see [README](README.md#workflow) for details).
132
+
> **Note:**Terraform (`infra/quicknode.tf`) manages webhook_creation_ but cannot update filter configuration on existing webhooks (`ignore_all_server_changes = true`). All filter updates go through `bin/deploy-quicknode-filter.sh`.
Copy file name to clipboardExpand all lines: README.md
+23-36Lines changed: 23 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -209,55 +209,40 @@ The centralized event system makes adding new events straightforward—just upda
209
209
210
210
## Developing QuickNode Webhook Filter Functions
211
211
212
-
QuickNode webhooks use [JavaScript filter functions](https://www.quicknode.com/docs/streams/filters?#example-filter-functions) that run on QuickNode's servers to determine which blockchain events should trigger notifications to our Cloud Function. These filters are base64-encoded and stored in[`infra/quicknode.tf`](./infra/quicknode.tf) under the `filter_function` properties.
212
+
QuickNode webhooks use the `evmAbiFilter` template to match blockchain events by ABI event signature. Filter configuration (ABI and contract addresses) lives in the comment header of each filter file under[`infra/quicknode-filter-functions/`](./infra/quicknode-filter-functions/).
213
213
214
-
### Workflow
214
+
> **Note:** The `filter_function` base64 blobs in `infra/quicknode.tf` and the old `bin/update-quicknode-filter.js` script are **legacy artefacts**. They are not deployed — `ignore_all_server_changes = true` in Terraform prevents Terraform from pushing any changes to existing webhooks. All deploys go through `bin/deploy-quicknode-filter.sh`.
215
215
216
-
1.[OPTIONAL] If you want to first double-check which code is actually deployed right now:
217
-
- Navigate to the [QuickNode Webhooks Dashboard](https://dashboard.quicknode.com/webhooks)
218
-
- Click the Webhook you're developing
219
-
- Copy the webhook ID from the URL into your clipboard
1.**Edit the filter file** at [`infra/quicknode-filter-functions/sorted-oracles.js`](./infra/quicknode-filter-functions/sorted-oracles.js) or [`governor.js`](./infra/quicknode-filter-functions/governor.js).
230
219
231
-
2. **Open the filter function**in plain JavaScript at [`infra/quicknode-filter-functions/sorted-oracles.js`](./infra/quicknode-filter-functions/sorted-oracles.js)
220
+
The comment header at the top of each file is the deployment source of truth:
221
+
```js
222
+
/*
223
+
template: evmAbiFilter
224
+
abi: [{...}]
225
+
contracts: 0xYourContractAddress
226
+
*/
227
+
```
232
228
233
-
3. **Enable hot-reload**to automatically update the Terraform file:
229
+
2.**Deploy to QuickNode**using the deploy script:
234
230
235
231
```sh
236
-
# Run the cmd for the webhook you're interested in
This will watch for changes to `sorted-oracles.js` (which we're using as the healthcheck) and automatically:
241
-
- Base64 encode the updated function
242
-
- Update the `filter_function` field in the `quicknode_webhook_healthcheck` resource in `quicknode.tf`
243
-
- Create a timestamped backup of `quicknode.tf` before making changes
244
-
245
-
4. **Make your changes** to `sorted-oracles.js` and save the file. The script will automatically update `quicknode.tf`.
237
+
This reads the ABI and contract addresses from the comment header, builds the `templateArgs` payload, and calls `PATCH /webhooks/{id}/template/evmAbiFilterGo` to apply the update live (no downtime).
246
238
247
-
5. **Review the changes** with `git diff infra/quicknode.tf` to ensure the filter function was updated correctly.
239
+
3.**Verify**by checking the [QuickNode Webhooks Dashboard](https://dashboard.quicknode.com/webhooks) or inspecting the raw webhook via:
248
240
249
-
6. **Deploy to QuickNode**:
250
-
251
-
```sh
252
-
cd infra
253
-
terraform plan # Review changes
254
-
terraform apply # Deploy
241
+
```bash
242
+
curl -X GET "https://api.quicknode.com/webhooks/rest/v1/webhooks/$webhook_id" \
243
+
-H "x-api-key: $quicknode_api_key"
255
244
```
256
245
257
-
**⚠️ Important:** QuickNode rejects updates to active webhooks. You must either:
258
-
- Pause the webhook first (set `status = "paused"` in the resource, run `terraform apply`, then update the filter function, then set `status = "active"` and `terraform apply` again)
259
-
- OR comment out the webhook resource, `terraform apply` to delete it, uncomment with your changes, and `terraform apply` to recreate it
260
-
261
246
### Filter Function Structure
262
247
263
248
The filter functions follow QuickNode's `evmAbiFilter` template:
- They can include custom filtering logic (e.g., filtering by specific token addresses)
268
253
- They return matching events or `null` if no matches found
269
254
255
+
> **Important quirk:** The `evmAbiFilter` template filters by topic hash only — the `contracts` address filter in `templateArgs` is currently **silently ignored** by QuickNode's API. All addresses that emit a matching event signature will trigger the webhook. Address filtering must be done in the Cloud Function handler.
256
+
270
257
See the [QuickNode Webhooks documentation](https://www.quicknode.com/docs/webhooks/getting-started) for more details on filter function syntax.
0 commit comments