UNPKG

chaingate

Version:

Multi-chain cryptocurrency SDK for TypeScript — unified API for Bitcoin, Ethereum, Litecoin, Dogecoin, Bitcoin Cash, Polygon, Arbitrum, and any EVM-compatible chain. Create wallets, query balances, send transactions, and manage tokens and NFTs across UTXO

47 lines (46 loc) 1.71 kB
import type { UtxoExplorer } from '../../Explorer/UtxoExplorer'; import type { UtxoNetworkParams } from '../../ChainGate/networks/types'; import { BaseUtxoTransaction } from './BaseUtxoTransaction'; import type { Txo, UtxoFee, UtxoFeeTier, UtxoRecommendedFee, UtxoRecommendedFees } from './BaseUtxoTransaction'; export type { UtxoFee, UtxoFeeTier, UtxoRecommendedFee, UtxoRecommendedFees }; /** * An unsigned UTXO transaction prepared by {@link UtxoConnector.transfer}. * * The transaction is created with "normal" recommended fees. Before sending, * you can inspect or change the fee: * * @example * ```ts * const amount = cg.networks.bitcoin.amount('0.001'); * const tx = await btc.transfer(amount, 'bc1q...'); * * // Inspect recommended fees * const fees = tx.recommendedFees(); * console.log(fees.normal.enoughFunds); * * // Override with a specific tier * tx.setFee(fees.high); * * // Or set a custom fee rate * tx.setFee({ feePerKbSat: 50_000n }); * * // Sign and broadcast * const broadcasted = await tx.signAndBroadcast(); * ``` */ export declare class UtxoTransaction extends BaseUtxoTransaction { /** @internal — used by UtxoConnector.transfer to build the transaction. */ static create(params: { explorer: UtxoExplorer; fromAddress: string; toAddress: string; valueSat: bigint; networkParams: UtxoNetworkParams; getPrivateKey: () => Promise<Uint8Array>; }): Promise<UtxoTransaction>; /** Signs the transaction and returns the serialized raw bytes. */ protected signTransaction(inputs: Txo[], outputs: Array<{ address: string; amount: bigint; }>, privateKey: Uint8Array): Uint8Array; }