UNPKG

@xchainjs/xchain-dash

Version:

Custom Dash client and utilities used by XChainJS clients

66 lines (65 loc) 3.14 kB
import { FeeRate, TxHash } from '@xchainjs/xchain-client'; import { Address } from '@xchainjs/xchain-util'; import { TxParams, UTXO, UtxoSelectionPreferences } from '@xchainjs/xchain-utxo'; import { ECPairInterface } from 'ecpair'; import { Client } from './client'; export declare class ClientKeystore extends Client { /** * Get the DASH address corresponding to the given index. * @deprecated This function will be removed eventually. Use getAddressAsync instead. * @param {number} index The index of the address. * @returns {Address} The DASH address. * @throws {"index must be greater than zero"} Thrown if index is less than zero. * @throws {"Phrase must be provided"} Thrown if phrase is not provided. * @throws {"Address not defined"} Thrown if address is not defined. */ getAddress(index?: number): Address; /** * Asynchronously get the DASH address corresponding to the given index. * @param {number} index The index of the address. * @returns {Promise<string>} A promise resolving to the DASH address. */ getAddressAsync(index?: number): Promise<string>; /** * Get the private and public keys for DASH. * @param {string} phrase The phrase used to derive keys. * @param {number} index The index for key derivation. * @returns {Dash.ECPairInterface} The DASH ECPairInterface object. * @throws {"Could not get private key from phrase"} Thrown if private key cannot be obtained from the phrase. */ getDashKeys(phrase: string, index?: number): ECPairInterface; /** * Asynchronously transfers assets between addresses. * @param {TxParams & { feeRate?: FeeRate; utxoSelectionPreferences?: UtxoSelectionPreferences }} params - Parameters for the transfer. * @returns {Promise<TxHash>} A promise resolving to the transaction hash. */ transfer(params: TxParams & { feeRate?: FeeRate; utxoSelectionPreferences?: UtxoSelectionPreferences; selectedUtxos?: UTXO[]; }): Promise<TxHash>; /** * Transfer the maximum amount of DASH (sweep). * * Calculates the maximum sendable amount after fees, signs, and broadcasts the transaction. * @param {Object} params The transfer parameters. * @param {string} params.recipient The recipient address. * @param {string} [params.memo] Optional memo for the transaction. * @param {FeeRate} [params.feeRate] Optional fee rate. Defaults to 'average' rate. * @param {number} [params.walletIndex] Optional wallet index. Defaults to 0. * @param {UtxoSelectionPreferences} [params.utxoSelectionPreferences] Optional UTXO selection preferences. * @returns {Promise<{ hash: TxHash; maxAmount: number; fee: number }>} The transaction hash, amount sent, and fee. */ transferMax(params: { recipient: Address; memo?: string; feeRate?: FeeRate; walletIndex?: number; utxoSelectionPreferences?: UtxoSelectionPreferences; selectedUtxos?: UTXO[]; }): Promise<{ hash: TxHash; maxAmount: number; fee: number; }>; }