UNPKG

@btc-vision/transaction

Version:

OPNet transaction library allows you to create and sign transactions for the OPNet network.

59 lines 2.62 kB
import { type Network } from '@btc-vision/bitcoin'; import { Wallet } from '../keypair/Wallet.js'; import type { BroadcastResponse } from './interfaces/BroadcastResponse.js'; import type { FetchUTXOParams, FetchUTXOParamsMultiAddress, RawUTXOResponse, UTXO } from './interfaces/IUTXO.js'; export interface WalletUTXOs { readonly confirmed: RawUTXOResponse[]; readonly pending: RawUTXOResponse[]; readonly spentTransactions: RawUTXOResponse[]; readonly raw: string[]; } /** * Allows to fetch UTXO data from any OPNET node */ export declare class OPNetLimitedProvider { private readonly opnetAPIUrl; private readonly utxoPath; private readonly rpc; constructor(opnetAPIUrl: string); /** * Fetches UTXO data from the OPNET node * @param {FetchUTXOParams} settings - The settings to fetch UTXO data * @returns {Promise<UTXO[]>} - The UTXOs fetched * @throws {Error} - If UTXOs could not be fetched */ fetchUTXO(settings: FetchUTXOParams): Promise<UTXO[]>; /** * Fetches UTXO data from the OPNET node for multiple addresses * @param {FetchUTXOParamsMultiAddress} settings - The settings to fetch UTXO data * @returns {Promise<UTXO[]>} - The UTXOs fetched * @throws {Error} - If UTXOs could not be fetched */ fetchUTXOMultiAddr(settings: FetchUTXOParamsMultiAddress): Promise<UTXO[]>; /** * Broadcasts a transaction to the OPNET node * @param {string} transaction - The transaction to broadcast * @param {boolean} psbt - Whether the transaction is a PSBT * @returns {Promise<BroadcastResponse>} - The response from the OPNET node */ broadcastTransaction(transaction: string, psbt: boolean): Promise<BroadcastResponse | undefined>; /** * Splits UTXOs into smaller UTXOs * @param {Wallet} wallet - The wallet to split UTXOs * @param {Network} network - The network to split UTXOs * @param {number} splitInputsInto - The number of UTXOs to split into * @param {bigint} amountPerUTXO - The amount per UTXO * @returns {Promise<BroadcastResponse | { error: string }>} - The response from the OPNET node or an error */ splitUTXOs(wallet: Wallet, network: Network, splitInputsInto: number, amountPerUTXO: bigint): Promise<BroadcastResponse | { error: string; }>; /** * Fetches to the OPNET node * @param {string} method * @param {unknown[]} paramsMethod * @returns {Promise<unknown>} */ rpcMethod(method: string, paramsMethod: unknown[]): Promise<unknown>; } //# sourceMappingURL=OPNetLimitedProvider.d.ts.map