Skip to content

Latest commit

 

History

History
105 lines (84 loc) · 3.85 KB

File metadata and controls

105 lines (84 loc) · 3.85 KB

Interaction with Concordium Smart Contracts

  • This is a simple node project with support for typescript.
  • Support for parsing input cli args is done via Commander. As can be seen in the cli.ts file

Setup

Deploy

Execute command

ts-node ./src/cli.ts deploy --wasm <WASM-FILE> --sender $ACCOUNT --sign-key $SIGN_KEY --wait

This will output the Explorer URL

Transaction sent to node : true
Transaction Hash : 42380f621e07becf80d880a1749150d8aeae707c98abb0b42f8228ed3e0801aa
url : https://dashboard.testnet.concordium.com/lookup/42380f621e07becf80d880a1749150d8aeae707c98abb0b42f8228ed3e0801aa

Check the transaction on the explorer and note the <Module Hash>

Interact

  • Initializing Contract

    ts-node ./src/cli.ts init --sender $ACCOUNT --sign-key $SIGN_KEY --contract <CONTRACT-NAME> --module <Module Hash> --wait
  • Mint Token : Update Contract

    ts-node ./src/cli.ts mint --sender $ACCOUNT --sign-key $SIGN_KEY --wait --contract <CONTRACT-NAME> --schema <SCHEMA-FILE> --params <MINT-PARAMS> --index <CONTRACT-INDEX>
  • Transfer Token : Update Contract

    ts-node ./src/cli.ts transfer --sender $ACCOUNT --sign-key $SIGN_KEY --wait --contract <CONTRACT-NAME> --schema <SCHEMA-FILE> --params <TRANSFER-PARAMS> --index <CONTRACT_INDEX>
  • View Balance : Invoke Contract

    ts-node ./src/cli.ts view --sender $ACCOUNT --contract <CONTRACT-NAME> --schema <SCHEMA-FILE> --index <CONTRACT-INDEX>

This will print contracts state to console.