6. Interact with the contract - Call
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
Execute the following command in your terminal to run the script using the Swisstronik network
npx hardhat run scripts/getMessage.js --network swisstronik
Upon successful execution, your terminal should display
Decoded response: Hello Swisstronik!!or the latest message you've defined in the contract 🎉
Last updated