UNPKG

@xchainjs/xchain-bitcoincash

Version:

Custom bitcoincash client and utilities used by XChainJS clients

46 lines (45 loc) 2.03 kB
import { FeeRate, TxHash } from '@xchainjs/xchain-client'; import { Address } from '@xchainjs/xchain-util'; import { TxParams } from '@xchainjs/xchain-utxo'; import { Client } from './client'; /** * Custom Bitcoin client extended to support keystore functionality */ declare class ClientKeystore extends Client { /** * @deprecated This function eventually will be removed. Use getAddressAsync instead. * Get the address associated with the given index. * @param {number} index The index of the address. * @returns {Address} The Bitcoin address. * @throws {"index must be greater than zero"} Thrown if the index is less than zero. * @throws {"Phrase must be provided"} Thrown if the phrase has not been set before. * @throws {"Address not defined"} Thrown if failed to create the address from the phrase. */ getAddress(index?: number): Address; /** * Get the current address asynchronously. * @param {number} index The index of the address. * @returns {Promise<Address>} A promise that resolves to the BitcoinCash address. * @throws {"Phrase must be provided"} Thrown if the phrase has not been set before. */ getAddressAsync(index?: number): Promise<string>; /** * Private function to get BCH keys. * Generates a key pair from the provided phrase and derivation path. * @param {string} phrase - The phrase used for generating the private key. * @param {string} derivationPath - The BIP44 derivation path. * @returns {PrivateKey} The key pair generated from the phrase and derivation path. * * @throws {"Invalid phrase"} Thrown if an invalid phrase is provided. * */ private getBCHKeys; /** * Transfer BCH. * @param {TxParams & { feeRate?: FeeRate }} params - The transfer options. * @returns {Promise<TxHash>} A promise that resolves with the transaction hash. */ transfer(params: TxParams & { feeRate?: FeeRate; }): Promise<TxHash>; } export { ClientKeystore };