Wallet
constructor
Constructor to create a Wallet
Parameters
phrase
string mnemonic phrasenetwork
Network mnemonic phrasechainConfigs
ChainConfigs Config by chain. If it isn not set, each client uses its default params (optional, default{}
)
Returns any Wallet
getAddress
Get chain address
Parameters
chain
Chain
Returns any the chain address
validateAddress
Check if address is valid
Parameters
chain
Chain in which the address has to be validaddress
string to validate
Returns any true if it is a valid address, otherwise, false
transfer
Make a transaction
Parameters
txParams
TxParams to make the transfertxParams.asset
txParams.amount
txParams.recipient
txParams.memo
txParams.walletIndex
Returns any the transaction hash
deposit
Make a deposit
Parameters
depositParams
DepositParamdepositParams.asset
depositParams.amount
depositParams.memo
- Throws Error if can not make deposit with the asset
Returns any the hash of the deposit
isApproved
Check if an spenderAddress is allowed to spend in name of another address certain asset amount
Parameters
asset
Asset to checkamount
BaseAmount to checkfromAddress
string owner of the amount asset-
spenderAddress
string spender to check if it is allowed to spend - Throws Error if asset is a non ERC20 asset
Returns any true if the spenderAddress is allowed to spend the amount, otherwise, false
getExplorerTxUrl
Get transaction url
Parameters
chain
Chain of the transactionhash
string of the transaction
Returns any the transaction url
getGasFeeRates
Get feeRates
Parameters
-
chain
Chain of which return the feeRates -
Throws Error if gas fee rates can not be returned from the chain
Returns any the gas fee rates
getChainWallet
Get chain wallet
Parameters
-
chain
Chain of which return the wallet -
Throws Error wallet can not be retrieve from chain
Returns any the chain wallet
getChainClient
Get chain client
Parameters
-
chain
Chain of which return the client -
Throws Error if client does not exist
Returns any the chain client
isERC20Asset
Check if asset is ERC20
Parameters
asset
Asset to check
Returns any true if asset is ERC20, otherwise, false
isEVMChain
Check if asset chain is EVM
Parameters
chain
Chain to check
Returns any true if chain is EVM, otherwise, false