UNPKG

@xchainjs/xchain-dash

Version:

Custom Dash client and utilities used by XChainJS clients

67 lines (66 loc) 2.5 kB
import { Transaction } from '@dashevo/dashcore-lib/typings/transaction/Transaction'; import { FeeRate, Network } from '@xchainjs/xchain-client'; import { Address } from '@xchainjs/xchain-util'; import { TxParams, UTXO } from '@xchainjs/xchain-utxo'; import * as Dash from 'bitcoinjs-lib'; /** * Object containing the sizes (in bytes) of various components in a Dash transaction. */ export declare const TransactionBytes: { Version: number; Type: number; InputCount: number; OutputCount: number; LockTime: number; InputPrevOutputHash: number; InputPrevOutputIndex: number; InputScriptLength: number; InputSequence: number; InputPubkeyHash: number; OutputPubkeyHash: number; OutputValue: number; OutputOpReturn: number; OutputScriptLength: number; }; /** * Minimum transaction fee in duff (smallest unit of Dash). */ export declare const TX_MIN_FEE = 1000; /** * Threshold value for dust amount in Dash transactions. */ export declare const TX_DUST_THRESHOLD: any; /** * Function to determine the Dash network based on the provided network type. * @param {Network} network The network type (Mainnet, Testnet, or Stagenet). * @returns {Dash.Network} The Dash network information. */ export declare const dashNetwork: (network: Network) => Dash.Network; /** * Function to validate a Dash address for a given network. * @param {Address} address The Dash address to validate. * @param {Network} network The network type (Mainnet, Testnet, or Stagenet). * @returns {boolean} True if the address is valid for the network, false otherwise. */ export declare const validateAddress: (address: Address, network: Network) => boolean; /** * Function to build a Dash transaction. * @param {TxParams} params Transaction parameters including amount, recipient, memo, fee rate, sender, and network. * @returns {Promise<{ tx: Transaction; utxos: UTXO[] }>} Promise that resolves with the built transaction and its UTXOs. */ export declare const buildTx: ({ amount, recipient, memo, feeRate, sender, network, }: TxParams & { feeRate: FeeRate; sender: Address; network: Network; withTxHex?: boolean; }) => Promise<{ tx: Transaction; utxos: UTXO[]; inputs: UTXO[]; }>; /** * Function to get the prefix for a given network. * @param {Network} network The network type (Mainnet, Testnet, or Stagenet). * @returns {string} The prefix for the network. */ export declare const getPrefix: (network: Network) => string;