UNPKG

@xchainjs/xchain-dash

Version:

Custom Dash client and utilities used by XChainJS clients

85 lines (84 loc) 3.59 kB
import { AssetInfo, FeeRate, TxHistoryParams } from '@xchainjs/xchain-client'; import { Address } from '@xchainjs/xchain-util'; import { Balance, Client as UTXOClient, Tx, TxParams, TxsPage, UTXO, UtxoClientParams } from '@xchainjs/xchain-utxo'; import { DashPreparedTx, NodeAuth, NodeUrls } from './types'; /** * Default parameters for the DASH client. */ export declare const defaultDashParams: UtxoClientParams & { nodeUrls: NodeUrls; nodeAuth?: NodeAuth; }; /** * DASH client class extending UTXOClient. */ declare abstract class Client extends UTXOClient { protected readonly nodeUrls: NodeUrls; protected readonly nodeAuth?: NodeAuth; constructor(params?: import("@xchainjs/xchain-client").XChainClientParams & { explorerProviders: import("@xchainjs/xchain-client").ExplorerProviders; dataProviders: import("@xchainjs/xchain-utxo/lib/types/types").UtxoOnlineDataProviders[]; } & { nodeUrls: NodeUrls; nodeAuth?: NodeAuth; }); /** * Get the asset info for DASH. * @returns {AssetInfo} The asset info for DASH. */ getAssetInfo(): AssetInfo; /** * Validate a DASH address. * @param {string} address The DASH address to validate. * @returns {boolean} True if the address is valid, false otherwise. */ validateAddress(address: string): boolean; /** * Asynchronously get the balance for a DASH address. * @param {string} address The DASH address. * @returns {Promise<Balance[]>} A promise resolving to an array of balances. */ getBalance(address: string): Promise<Balance[]>; /** * Asynchronously retrieves transactions for a given address. * @param {TxHistoryParams} params - Parameters for transaction retrieval. * @returns {Promise<TxsPage>} A promise resolving to a page of transactions. */ getTransactions(params?: TxHistoryParams): Promise<TxsPage>; /** * Asynchronously retrieves transaction data for a given transaction ID. * @param {string} txid - The transaction ID. * @returns {Promise<Tx>} A promise resolving to the transaction data. */ getTransactionData(txid: string): Promise<Tx>; /** * Converts an Insight transaction response to XChain transaction. * @param {InsightTxResponse} tx - The Insight transaction response. * @returns {Tx} The XChain transaction. */ private insightTxToXChainTx; /** * Asynchronously prepares a transaction for sending assets. * @param {TxParams&Address&FeeRate} params - Parameters for the transaction preparation. * @returns {string} A promise resolving to the prepared transaction data. */ prepareTx({ sender, memo, amount, recipient, feeRate, }: TxParams & { sender: Address; feeRate: FeeRate; }): Promise<DashPreparedTx>; /** * Compiles a memo into a buffer. * @param {string} memo - The memo to be compiled. * @returns {Buffer} The compiled memo as a buffer. */ protected compileMemo(memo: string): Buffer; /** * Calculates the transaction fee based on the provided UTXOs, fee rate, and optional compiled memo. * @param {UTXO[]} inputs - The UTXOs used as inputs for the transaction. * @param {FeeRate} feeRate - The fee rate for the transaction. * @param {Buffer | null} data - The compiled memo as a buffer (optional). * @returns {number} The calculated transaction fee amount. */ protected getFeeFromUtxos(inputs: UTXO[], feeRate: FeeRate, data?: Buffer | null): number; } export { Client };