Extends

ExtensionContractCaller


Constructor

constructor(extension)

Parameter

extension - CyanoExtension


Property

extension

Type: CyanoExtension
Description: Cyano wrapper instance passed by constructor.


Methods

onChainCall

async onChainCall(wrapper, method, param, amount, extra)

Description

Invoke a smart contract's method. This method may change the mart contract state.

Parameters :

wrapper - ContractWrapper:

A ContractWrapper instance returned by loadContract method.

method - String:

Which method in the contract will be called.

param - Array:

Data for the contract method's parameter.

amount - Unused

extra - Unused

Returns :

Promise<Result<String, Status>>:

Transaction hash will be set into the data field of Result if contract called successfully.

offChainCall

async offChainCall(wrapper, method, param)

Description

Call smart contract and get the output or result whithout change the state of it.
Parameters : wrapper - ContractWrapper:

A ContractWrapper instance returned by loadContract method.

method - String:

Which method in the contract will be called.

param - Array:

Data for the contract method's parameter.

Returns :

Promise<Result<Any, Status>>:

Value returned by the contract will be set into the data field of Result if contract called successfully.