Client
Extends xchain_client_1.BaseXChainClient
Custom Cosmos client
Parameters
params
XChainClientParamsparams.network
(optional, defaultxchain_client_1.Network.Mainnet
)params.phrase
params.clientUrls
(optional, defaultutils_1.getDefaultClientUrls()
)params.chainIds
(optional, defaultutils_1.getDefaultChainIds()
)params.rootDerivationPaths
(optional, defaultutils_1.getDefaultRootDerivationPaths()
)
setNetwork
Updates current network.
Parameters
network
Network
Returns void
getExplorerUrl
Get the explorer url.
Returns string The explorer url.
getExplorerAddressUrl
Get the explorer url for the given address.
Parameters
address
Address
Returns string The explorer url for the given address.
getExplorerTxUrl
Get the explorer url for the given transaction id.
Parameters
txID
string
Returns string The explorer url for the given transaction id.
getAddress
Parameters
index
(optional, default0
)
Meta
- deprecated: this function eventually will be removed use getAddressAsync instead
getAddressAsync
Get the current address.
Parameters
-
index
(optional, default0
) -
Throws Error Thrown if phrase has not been set before. A phrase is needed to create a wallet and to derive an address from it.
Returns Address The current address.
validateAddress
Validate the given address.
Parameters
address
Address
Returns boolean true
or false
getBalance
Get the balance of a given address.
Parameters
address
Address By default, it will return the balance of the current wallet. (optional)assets
asset
Asset If not set, it will return all assets available. (optional)
Returns Array<Balance> The balance of the address.
getAssetInfo
Returns any asset info
getTransactions
Get transaction history of a given address and asset with pagination options. If asset
is not set, history will include ATOM
txs only By default it will return the transaction history of the current wallet.
Parameters
params
TxHistoryParams The options to get transaction history. (optional)
Returns TxsPage The transaction history.
getTransactionData
Get the transaction details of a given transaction id. Supports ATOM
txs only.
Parameters
txId
string The transaction id.
Returns Tx The transaction details of the given transaction id.
transfer
Transfer balances.
Parameters
params
TxParams The transfer options.params.walletIndex
(optional, default0
)params.asset
(optional, defaultconst_1.AssetATOM
)params.amount
params.recipient
params.memo
params.gasLimit
(optional, defaultnew bignumber_js_1.default(const_1.DEFAULT_GAS_LIMIT)
)params.feeAmount
(optional, defaultconst_1.DEFAULT_FEE
)
Returns TxHash The transaction hash.
transferOffline
Transfer offline balances.
Parameters
params
TxOfflineParams The transfer offline options.params.walletIndex
params.asset
(optional, defaultconst_1.AssetATOM
)params.amount
params.recipient
params.memo
params.from_account_number
params.from_sequence
params.gasLimit
(optional, defaultnew bignumber_js_1.default(const_1.DEFAULT_GAS_LIMIT)
)params.feeAmount
(optional, defaultconst_1.DEFAULT_FEE
)
Returns string The signed transaction bytes.
getFees
Returns fees. It tries to get chain fees from THORChain inbound_addresses
first If it fails, it returns DEFAULT fees.
Returns Fees Current fees
prepareTx
Prepare transfer.
Parameters
params
TxParams&Address&BaseAmount&BigNumber The transfer options.params.sender
params.recipient
params.amount
params.memo
params.asset
(optional, defaultconst_1.AssetATOM
)params.feeAmount
(optional, defaultconst_1.DEFAULT_FEE
)params.gasLimit
(optional, defaultnew bignumber_js_1.default(const_1.DEFAULT_GAS_LIMIT)
)
Returns PreparedTx The raw unsigned transaction.