Skip to main content

/streams/rest/v1/streams/test_filter REST Method

Test a filter.

Updated on
May 9, 2024

/streams/rest/v1/streams/test_filter REST Method

Body Parameters

network
string
REQUIRED
The network for this stream. ENUM: "arbitrum-mainnet", "arbitrum-sepolia", "avalanche-fuji", "avalanche-mainnet", "base-mainnet", "base-sepolia", "bera-artio", "blast-mainnet", "blast-sepolia", "bnbchain-mainnet", "bnbchain-testnet", "celo-mainnet", "ethereum-holesky", "ethereum-mainnet", "ethereum-sepolia", "fantom-mainnet", "gnosis-mainnet", "imx-mainnet", "imx-testnet", "nova-mainnet", "optimism-mainnet", "optimism-sepolia", "polygon-mainnet", "polygon-amoy", "scroll-mainnet", "scroll-testnet", "zkevm-mainnet", "zksync-mainnet", "zksync-sepolia"
dataset
string
REQUIRED
The dataset for this stream. ENUM: "block", "block_with_receipts", "receipts", "logs", "transactions", "trace_blocks", "debug_traces", "block_with_receipts_debug_trace", "block_with_receipts_trace_block"
filter_function
string<base64>
REQUIRED
JS/ECMAScript compliant filter encoded in base64.
block
string
REQUIRED
The block number to test against.

Returns

result
string
The result of the filter test.
Request
1
curl -X POST \
2
"https://api.quicknode.com/streams/rest/v1/streams/test_filter" \
3
-H "accept: application/json" \
4
-H "Content-Type: application/json" \
5
-H "x-api-key: YOUR_API_KEY" \
6
-d $'{
7
"network": "ethereum-mainnet",
8
"dataset": "block",
9
"filter_function": "ZnVuY3Rpb24gbWFpbihkYXRhKSB7CiAgICB2YXIgbnVtYmVyRGVjaW1hbCA9IHBhcnNlSW50KGRhdGEuc3RyZWFtRGF0YS5udW1iZXIsIDE2KTsKICAgIHZhciBmaWx0ZXJlZERhdGEgPSB7CiAgICAgICAgaGFzaDogZGF0YS5zdHJlYW1EYXRhLmhhc2gsCiAgICAgICAgbnVtYmVyOiBudW1iZXJEZWNpbWFsCiAgICB9OwogICAgcmV0dXJuIGZpbHRlcmVkRGF0YTsKfQ==",
10
"block": "17811625"
11
}'
12
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free