Testing your Smart Trigger

Overview

After you finished writing custom ParsiQL code for your Smart Trigger, you might be tempt to test it before deploying. The TEST feature located in the Smart Trigger code editor can help you understand if the ParsiQL code is right and will run without error.

Setting up the sample transaction

Note that this TEST function will not send you any notifications or data through your Delivery Channels nor it will use your plan’s actions.
When pressed, you will be greeted with a Trigger Testing pop-up with Sample Transaction.
This Sample Transaction contains all the information of a transaction you want to test your Smart Trigger with.
Default Sample Transaction for Ethereum (left) and BSC Smart Trigger
Before pressing TEST you need to change the fields so the sample transaction would match with the conditions you wrote in your Smart Trigger code. For example, check the following BSC Smart Trigger code:
1
stream TestingCode
2
from BscBEP20Transfers
3
where @to == BSC.address("0x0000000000000000000000000000000123456789")
4
​
5
process
6
7
let txInfo = { txHash: @transaction.hash }
8
if @to == BSC.address("0x0000000000000000000000000000000123456789") && @value >= 8000000000000000000 && @token.symbol == "TestToken" then
9
let transfer_type = "deposit"
10
emit { @from, @to, @value, txInfo, symbol: @token.symbol, decimals: @token.decimals, transfer_type }
11
end
12
13
end
Copied!
Based on that code, we need to make sure that the sample transaction must have following fields changed:
    The "to" address must be "0x0000000000000000000000000000000123456789"
    The "value" must be more than or equal to 8000000000000000000
    The "token" "symbol" must be "TestToken"
When finished editing the fields you need, press TEST then switch to CONSOLE tab. It should automatically go to testing part of the console. If everything was correct, There you’ll see JSON string that your Smart Trigger produced, containing everything that you chose to emit.
JSON string of a correctly tested Smart Trigger
Last modified 14d ago