▶️Interact with the contract-Transaction

Make sure you have installed SwisstronikJS by running npm i @swisstronik/swisstronik.js

  1. Within the scripts folder, create a file called setMessage.js

  1. Let's write our setMessage.js script

  • Import hardhat and swisstronikJS functions

  • Let's use sendShieldedTransaction to send a call/query to the blockchain

  • Write the main script to use sendShieldedTransaction function

  • Add this by hardhat default

  1. Execute the following command in your terminal to run the script using the Swisstronik network

    npx hardhat run scripts/setMessage.js --network swisstronik

  2. Upon successful execution, your terminal should display Transaction Receipt: TransactionResponse {...} , now it's time to retrieve this message🎉

Last updated

Was this helpful?