@xchainjs/xchain-thorchain
Version:
Custom Thorchain client and utilities used by XChainJS clients
104 lines (103 loc) • 4.58 kB
TypeScript
import { Account } from '@cosmjs/stargate';
import { BigNumber } from 'bignumber.js';
import { Client } from './client';
import { DepositParam, TxOfflineParams, TxParams } from './types';
/**
* Thorchain Keystore client
*/
export declare class ClientKeystore extends Client {
/**
* Asynchronous version of getAddress method.
* @param {number} index Derivation path index of the address to be generated.
* @returns {string} A promise that resolves to the generated address.
*/
getAddressAsync(index?: number): Promise<string>;
/**
* Get the address derived from the provided phrase.
* @param {number | undefined} walletIndex The index of the address derivation path. Default is 0.
* @returns {string} The user address at the specified walletIndex.
*/
getAddress(walletIndex?: number): string;
/**
* Get the Account frmom Address.
* @param {number | undefined} walletIndex The index of the address derivation path. Default is 0.
* @returns {Account} The Account holder details or error if account does not exist
*/
getAccountDetails(walletIndex?: number): Promise<Account>;
/**
* Returns the private key associated with an index
*
* @param {number} index Optional - The index to use to generate the private key. If it is not set, address associated with
* index 0 will be used
* @returns {Uint8Array} The private key
*/
getPrivateKey(index?: number): Promise<Uint8Array>;
/**
* Returns the compressed public key associated with an index
*
* @param {number} index Optional - The index to use to generate the private key. If it is not set, address associated with
* index 0 will be used
* @returns {Uint8Array} The public key
*/
getPubKey(index?: number): Promise<Uint8Array>;
transfer(params: TxParams): Promise<string>;
/**
* Make a deposit
*
* @param {number} param.walletIndex Optional - The index to use to generate the address from the transaction will be done.
* If it is not set, address associated with index 0 will be used
* @param {CompatibleAsset} param.asset Optional - The asset that will be deposit. If it is not set, Thorchain native asset will be
* used
* @param {BaseAmount} param.amount The amount that will be deposit
* @param {string} param.memo Optional - The memo associated with the deposit
* @param {BigNumber} param.gasLimit Optional - The limit amount of gas allowed to spend in the deposit. If not set, default
* value of 600000000 will be used
* @returns {string} The deposit hash
*/
deposit({ walletIndex, asset, amount, memo, gasLimit, }: DepositParam): Promise<string>;
/**
* Create and sign transaction without broadcasting it
*
* @deprecated Use prepare Tx instead
*/
transferOffline({ walletIndex, recipient, asset, amount, memo, gasLimit, }: TxOfflineParams & {
gasLimit?: BigNumber;
}): Promise<string>;
/**
* Hashes a buffer using SHA256 followed by RIPEMD160 or RMD160.
* @param {Uint8Array} buffer The buffer to hash
* @returns {Uint8Array} The hashed buffer
*/
private hash160;
/**
* Sign a transaction making a round robin over the clients urls provided to the client
*
* @param {string} sender Sender address
* @param {DecodedTxRaw} unsignedTx Unsigned transaction
* @param {DirectSecp256k1HdWallet} signer Signer
* @param {BigNumber} gasLimit Transaction gas limit
* @returns {TxRaw} The raw signed transaction
*/
private roundRobinSign;
/**
* Sign and broadcast a transaction making a round robin over the clients urls provided to the client
*
* @param {string} sender Sender address
* @param {DecodedTxRaw} unsignedTx Unsigned transaction
* @param {DirectSecp256k1HdWallet} signer Signer
* @returns {DeliverTxResponse} The transaction broadcasted
*/
private roundRobinSignAndBroadcastTx;
/**
* Sign and broadcast a transaction making a round robin over the clients urls provided to the client
*
* @param {string} sender Sender address
* @param {DirectSecp256k1HdWallet} signer Signer
* @param {BigNumber} gasLimit Gas limit for the transaction
* @param {BaseAmount} amount Amount to deposit
* @param {string} memo Deposit memo
* @param {CompatibleAsset} asset Asset to deposit
* @returns {DeliverTxResponse} The transaction broadcasted
*/
private roundRobinSignAndBroadcastDeposit;
}