Constructor¶
constructor(extension)
Parameter
extension
-ExtensionWrapper
Property¶
extension¶
Type: ExtensionWrapper
Description: ExtensionWrapper instance passed by constructor.
Methods¶
loadContract¶
async loacContract(abi, address)
Description
Load smart contract to a ContractWrapper instance.
Parameters :
abi
-Any
:Contract ABI Array, Object or any other types required by the blockchain.
address
-String
:Contract Address passed by the constructor.
Returns :
Promise<Result<ContractWrapper, Status>>
:ContractWrapper instance will be set into the data field of Result if success.
transfer¶
async transfer(to, amount, memo, extra)
Description
Transfer original token of the block. Original token is the base assets of a blockchain, like ETH on Ethereum.
Parameters :
to
-String
:Assets transfer target address.
amount
-Number
:How many tokens will be transferred.
memo
-String
:Transaction's memo.
extra
-Any
:Additional data to accommodate the transaction requirements of different blockchains.
Returns :
Promise<Result<ContractWrapper, Status>>
:Transaction hash will be set into the data field of Result if success.
transferToken¶
async transferToken(wrapper, to, amount, extra)
Description
Transfer contract based token. These tokens are issued by smart contract, like ERC 20 token etc.
Parameters :
wrapper
-ContractWrapper
:A ContractWrapper instance returned by loadContract method.
to
-String
:Token transfer target address.
How many tokens will be transferred. Some of the blockchain accept number with token symbol in the amount string, like "1.000 EOS".
extra
-Any
:Additional data to accommodate the transaction requirements of different blockchains.
Returns :
Promise<Result<ContractWrapper, Status>>
:Transaction hash will be set into the data field of Result if success.
getAccount¶
async getAccount()
Description
Get the account loaded in extension.
Returns :
Promise<Result<String, Status>>
:Account string will be set into the data field of Result if success.