Extends¶
Constructor¶
constructor(extension)
Parameter
extension
-MetamaskExtension
Property¶
extension¶
Type: MetamaskExtension
Description: Metamask 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
-Any
:Data for the contract method's parameter.
amount
-Number
:How much ETH will send to the contract in this call.
extra
-TransactionExtraInfo
:Transaction extra data, such as gas, gas limit etc.
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
-Any
:Data for the contract method's parameter.
Returns :
Value returned by the contract will be set into the data field of Result if contract called successfully.