▶️Interact with the contract-Call
Make sure you have installed SwisstronikJS by running npm i @swisstronik/swisstronik.js
Within the scripts folder, create a file called
getMessage.js

Let's write our
getMessage.jsscript
Import hardhat and swisstronikJS functions
Let's use
sendShieldedQueryto send a call/query to the blockchain
Write the
mainscript to usesendShieldedQueryfunction
Add this by hardhat default
The final getMessage.js script should look like this:
Execute the following command in your terminal to run the script using the Swisstronik network
Upon successful execution, your terminal should display
Decoded response: Hello Swisstronik!!or the latest message you've defined in the contract 🎉
Last updated
Was this helpful?