Step 4. Add Variable Values
This section will contain a variable values details and how they work.
NoteEach call incurs a fixed CU charge, plus additional CUs for API operations. See the Compute Units Usage page for details.
Variable values contain the actual addresses and event types you are interested in. All variable values should be unique.
How does it work?
When a rule references a variable, it will trigger an event if its values match. This works as an OR condition, meaning that if a rule is set to match addresses A, B, and C, any transaction related to A, B, or C will trigger the rule.
Info:Please note that adding or removing a value to the variable automatically updates the corresponding rule. This ensures that changes dynamically affect event monitoring.
To receive block events:
- Add the value "
block
" to the designated variable. - Replace the
<VARIABLE_ID>
with the variable id you've created.
curl --location 'https://svc.blockdaemon.com/streaming/v2/variables/<VARIABLE_ID>/values' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"value": "block"
}'
A successful response will return a variable value details.
{
"created_at": "2024-03-06T15:15:07.373101Z",
"id": "4799906d-058a-4b99-874d-69874e8c0568",
"value": "block"
}
To receive confirmed_tx
and confirmed_balance
events for a specific address:
- Add the address value to the designated variable. You can add as many addresses as needed, but currently, it only supports adding one at a time.
- Replace the
<VARIABLE_ID>
with the variable id you've created.
curl --location 'https://svc.blockdaemon.com/streaming/v2/variables/<VARIABLE_ID>/values' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"value": "12xtAYsRUrmbniiWQqJtECiBQrMn8AypQcXhnQAc6RB6XkLW"
}'
A successful response will return a variable value details.
{
"created_at": "2024-03-07T09:00:15.142087Z",
"id": "2c197266-6dde-47dc-a432-b9016a67d595",
"value": "12xtAYsRUrmbniiWQqJtECiBQrMn8AypQcXhnQAc6RB6XkLW"
}
Delete a Variable Value
You can delete a variable value in two ways:
Option 1: Delete Variable Value by Value
Deletes a specific variable value by matching the variable's ID and the exact value you want to remove. This is useful when you know the value itself but not its ID.
Example Payload
curl --request DELETE \
--url https://svc.blockdaemon.com/streaming/v2/variables/{variable_id}/{VALUE_HERE} \
--header 'accept: application/json' \
--header 'authorization: Bearer 2go1YqUcuAr4WZ2-3WgSD3c7qpatZqQuNWhTVBldKZnTSUtw'
A 204 response status indicates the variable value was successfully deleted.
Option 2: Delete Variable Value by ID
Deletes a specific variable value using its value ID. Use this method when you have a value ID (e.g., from a GET call/when creating a new variable value).
Example Payload
curl --request DELETE \
--url https://svc.blockdaemon.com/streaming/v2/variables/{variable_id}/values/{VALUE_ID_HERE} \
--header 'accept: application/json' \
--header 'authorization: Bearer YOUR_API_KEY'
A 204 response status indicates the variable value was successfully deleted.
👋 Need Help?
Contact us through email or our support page for any issues, bugs, or assistance you may need.
Updated 26 days ago