=nil; CLI: calling smart contracts
This tutorial shows how to call the previously deployed manufacturer and retailer contracts.
Via internal transactions
To call the orderProduct()
function inside the retailer contract and trigger an async call:
nil smart-account send-tokens RETAILER_ADDRESS 5000000
nil smart-account send-transaction RETAILER_ADDRESS orderProduct MANUFACTURER_ADDRESS new-product --abi path/to/Retailer.abi --fee-credit FEECREDIT
Make a readonly call to access the value:
nil contract call-readonly MANUFACTURER_ADDRESS getProducts --abi path/to/Manufacturer.abi
The CLI should output the decoded values automatically.
Via external transactions
The CLI currently does not support sending external transactions that modify the internal state of smart contracts or spawn internal transactions. As a result, sending an external transaction to a function that performs an async call to another function will fail.
In the retailer contract, the orderProduct()
function cannot be called externally as it makes an async call to the manufacturer.