@xchainjs/xchain-zcash
Version:
Custom Zcash client and utilities used by XChainJS clients
57 lines (56 loc) • 2.15 kB
TypeScript
import { AssetInfo, FeeEstimateOptions, FeeRate, FeeRates, Fees, FeesWithRates } from '@xchainjs/xchain-client';
import { Address } from '@xchainjs/xchain-util';
import { Client as UTXOClient, PreparedTx, TxParams, UTXO, UtxoClientParams } from '@xchainjs/xchain-utxo';
export declare const defaultZECParams: UtxoClientParams;
/**
* Custom Zcash client (only support t-addresses)
*/
declare abstract class Client extends UTXOClient {
/**
* Constructor
* Initializes the client with network type and other parameters.
* @param {UtxoClientParams} params
*/
constructor(params?: UtxoClientParams);
/**
* Get ZEC asset info.
* @returns {AssetInfo} ZEC asset information.
*/
getAssetInfo(): AssetInfo;
/**
* Validate the given Zcash address.
* @param {string} address Zcash address to validate (only t-addresses).
* @returns {boolean} `true` if the address is valid, `false` otherwise.
*/
validateAddress(address: string): boolean;
/**
* Compile memo into a buffer.
* @param {string} memo Memo to compile.
* @returns {Buffer} Compiled memo.
*/
protected compileMemo(memo: string): Buffer;
/**
* Get transaction fee from UTXOs.
* @param {UTXO[]} inputs UTXOs to calculate fee from.
* @param {FeeRate} feeRate Fee rate.
* @param {Buffer | null} data Compiled memo (Optional).
* @returns {number} Transaction fee.
*/
protected getFeeFromUtxos(inputs: UTXO[], feeRate: FeeRate, _data?: Buffer | null): number;
/**
* Prepare transfer.
*
* @param {TxParams&Address&FeeRate&boolean} params The transfer options.
* @returns {PreparedTx} The raw unsigned transaction.
*/
prepareTx({ sender, memo, amount, recipient, feeRate: _feeRate, // Ignored: Zcash uses flat fees
spendPendingUTXO, }: TxParams & {
sender: Address;
feeRate: FeeRate;
spendPendingUTXO?: boolean;
}): Promise<PreparedTx>;
getFeesWithRates(): Promise<FeesWithRates>;
getFeeRates(): Promise<FeeRates>;
getFees(options?: FeeEstimateOptions): Promise<Fees>;
}
export { Client };