Contract API
Initializing
Instantiating the Contract API.
You can instantiate it using a cache system too:
Get to know more about the cache system by clicking on the link below:
API Reference
view
: Make a read-only call to retrieve information from the network. It has the following parameters:method
: Contract's method name.props?
: an optional parameter withargs
for the contract's method.config?
: currently, this has only theuseCache
prop. When useCache is true, this is going to use non-expired cached data instead of calling the contract's method.
call
: Call a method that changes the contract's state. This is payable. It has the following parameters:method
: Contract's method nameprops?
: an optional parameter withargs
for the contract's method,gas
,deposit
to be attached andcallbackUrl
if you want to take the user to a specific page after a transaction succeeds.
callMultiple
: Call multiple methods that change the contract's state. This is payable and has the following parameters:transactionsList
: A list of Transaction props. You can usebuildTransaction(...)
to help you outcallbackUrl?
: A page to take the user to after all the transactions succeed.
Contract View
Using a view
method is free.
Contract Call
You need to pay for every request you make for acall
method. This is going to change data and store it within the blockchain.
Contract Multiple Calls at Once
As well as the call
, you will need to pay for every request you make. This is going to change data and store it within the blockchain.
Last updated