5. Interact with the contract - Transaction
Make sure you have installed SwisstronikJS by running npm i @swisstronik/utils
Within the scripts folder, create a file called
setMessage.js

Let's write our
setMessage.jsscript
Import hardhat and swisstronikJS functions
Let's use
sendShieldedTransactionto send a call/query to the blockchain
Write the
mainscript to usesendShieldedTransactionfunction
Add this by hardhat default
The final setMessage.js script should look like this:
Execute the following command in your terminal to run the script using the Swisstronik network
npx hardhat run scripts/setMessage.js --network swisstronikUpon successful execution, your terminal should display
Transaction Receipt: TransactionResponse {...}, now it's time to retrieve this message🎉
Last updated