send-crypto
Version:
A minimal JavaScript library / wallet for sending crypto assets
46 lines (45 loc) • 2.33 kB
TypeScript
import BigNumber from "bignumber.js";
import { PromiEvent } from "../../lib/promiEvent";
import { UTXO } from "../../lib/utxo";
import { Asset, Handler } from "../../types/types";
interface AddressOptions {
}
interface BalanceOptions extends AddressOptions {
address?: string;
confirmations?: number;
}
interface TxOptions extends BalanceOptions {
fee?: number;
subtractFee?: boolean;
}
export declare const _apiFallbacks: {
fetchUTXO: (testnet: boolean, txHash: string, vOut: number) => (() => Promise<UTXO>)[];
fetchUTXOs: (testnet: boolean, address: string, confirmations: number, scriptHash?: string | undefined) => (() => Promise<readonly UTXO[]>)[];
fetchTXs: (testnet: boolean, address: string, confirmations?: number, scriptHash?: string | undefined) => ((() => Promise<readonly UTXO[]>) | (() => Promise<readonly UTXO[]>) | (() => Promise<UTXO[]>) | (() => Promise<readonly UTXO[]>))[];
broadcastTransaction: (testnet: boolean, hex: string) => ((() => Promise<string>) | undefined)[];
};
export declare class BTCHandler implements Handler {
private readonly privateKey;
private readonly testnet;
private readonly decimals;
static getUTXOs: (testnet: boolean, options: {
address: string;
confirmations?: number;
scriptHash?: string;
}) => Promise<readonly UTXO[]>;
static getUTXO: (testnet: boolean, txHash: string, vOut: number) => Promise<UTXO>;
static getTransactions: (testnet: boolean, options: {
address: string;
confirmations?: number;
scriptHash?: string;
}) => Promise<readonly UTXO[]>;
constructor(privateKey: string, network: string);
readonly handlesAsset: (asset: Asset) => boolean;
readonly address: (asset: Asset, options?: AddressOptions | undefined) => Promise<string>;
readonly getBalance: (asset: Asset, options?: BalanceOptions | undefined) => Promise<BigNumber>;
readonly getBalanceInSats: (asset: Asset, options?: BalanceOptions | undefined) => Promise<BigNumber>;
readonly send: (to: string, value: BigNumber, asset: Asset, options?: TxOptions | undefined) => PromiEvent<string>;
readonly sendSats: (to: string, valueIn: BigNumber, asset: Asset, options?: TxOptions | undefined) => PromiEvent<string>;
private readonly _getConfirmations;
}
export {};