import { Connector } from '../Connector'; import type { AddressOptions } from '../Connector'; import { UtxoExplorer } from '../../Explorer/UtxoExplorer'; import type { Wallet } from '../../Wallet/Wallet'; import { Amount } from '../../utils/Amount'; import type { UtxoAddressType, UtxoNetworkDescriptor } from '../../ChainGate/networks'; import { UtxoTransaction } from './UtxoTransaction'; import { CustomUtxoTransaction } from './CustomUtxoTransaction'; import type { CustomUtxoTransactionParams } from './CustomUtxoTransaction'; /** Options for resolving a UTXO wallet address. */ export interface UtxoAddressOptions extends AddressOptions { /** Address type override. When omitted the network's default is used. */ addressType?: UtxoAddressType; } /** * Connector for UTXO-based networks (Bitcoin, Litecoin, Dogecoin, Bitcoin Testnet). * * Bridges a {@link Wallet} with a {@link UtxoExplorer} to provide * address derivation, balance queries, and transaction broadcasting. * * @example * ```ts * const cg = new ChainGate({ apiKey: 'your-key' }); * const btcConn = cg.connect(cg.networks.bitcoin, wallet); * * // Default address (segwit for Bitcoin) * const addr = await btcConn.address(); * * // Taproot address (auto-resolves derivation path) * const taprootAddr = await btcConn.address({ addressType: 'taproot' }); * * // Legacy address with custom derivation path * const legacyAddr = await btcConn.address({ addressType: 'legacy', derivationPath: "m/44'/0'/0'/0" }); * * const balance = await btcConn.addressBalance(); * * const amount = cg.networks.bitcoin.amount('0.001'); * const tx = await btcConn.transfer(amount, 'bc1q...'); * ``` */ export declare class UtxoConnector extends Connector { /** @internal */ constructor(wallet: Wallet, explorer: UtxoExplorer, network: UtxoNetworkDescriptor); /** * Resolves the effective address type and derivation path from the given options. * @internal */ private resolveAddressOptions; /** * Returns the address for this wallet on this UTXO network. * * - **HD wallets**: derives at `{derivationPath}/{index}` using the derivation * path for the selected address type (or the network default). * - **Single-key wallets**: only index `0` is valid. The address type determines * the encoding (segwit, legacy, taproot) of the same public key. * - **XpubWallet**: derives at `m/0/{index}`. */ address(options?: UtxoAddressOptions): Promise; /** * Returns the confirmed and unconfirmed balance for this wallet's address. */ addressBalance(options?: UtxoAddressOptions): Promise<{ address: string; confirmed: Amount; unconfirmed: Amount; }>; /** * Returns paginated transaction history for this wallet's address. * * @param page - Pagination cursor. */ addressHistory(page?: string, options?: UtxoAddressOptions): Promise<{ page: number; transactions: Array<{ height: number; txid: string; amount: Amount; addressBalance: Amount; }>; }>; /** * Returns paginated UTXOs for this wallet's address. * * @param page - Pagination cursor. */ addressUtxos(page?: string, options?: UtxoAddressOptions): Promise<{ address: string; page: number; utxos: Array<{ txid: string; n: number; amount: Amount; height: number; script: string; }>; }>; /** * Creates a UTXO transfer transaction with recommended fees. * * The returned {@link UtxoTransaction} can be inspected, have its fee adjusted, * and then signed + broadcast. * * @param amount - Amount to send. Create via * {@link NetworkDescriptor.amount | cg.networks.bitcoin.amount(0.001)} or * {@link NetworkDescriptor.amountFromCurrency | cg.networks.bitcoin.amountFromCurrency('usd', 50)}. * @param toAddress - Recipient address. * * @throws {@link UnsupportedOperationError} if the wallet is view-only. */ transfer(amount: Amount, toAddress: string, options?: UtxoAddressOptions): Promise; /** * Creates a custom UTXO transaction with caller-defined inputs and outputs. * * @param params - Inputs and outputs for the transaction. * @throws {@link UnsupportedOperationError} if the wallet is view-only. */ createTransaction(params: CustomUtxoTransactionParams, options?: UtxoAddressOptions): CustomUtxoTransaction; }