/** * Bitcoin-specific type definitions * Following Phase 2g incremental implementation */ import type { IBlockchainManager } from '../types'; export interface BitcoinNetwork { name: 'mainnet' | 'testnet' | 'regtest'; bech32: string; pubKeyHash: number; scriptHash: number; wif: number; } export interface BitcoinConfig { enabled: boolean; network: 'mainnet' | 'testnet' | 'regtest'; rpcUrl?: string; rpcAuth?: { username: string; password: string; }; electrumServers?: string[]; lightning?: LightningConfig; } export interface LightningConfig { enabled: boolean; implementation: 'lnd' | 'c-lightning' | 'eclair'; host: string; macaroon?: string; cert?: string; } export interface UTXO { txid: string; vout: number; value: number; scriptPubKey: string; address?: string; confirmations: number; } export interface TransactionInput { txid: string; vout: number; sequence?: number; scriptSig?: string; witness?: string[]; } export interface TransactionOutput { address?: string; script?: string; value: number; } export interface BitcoinTransaction { inputs: TransactionInput[]; outputs: TransactionOutput[]; version: number; locktime: number; fee?: number; size: number; vsize: number; weight: number; } export type AddressType = 'p2pkh' | 'p2sh' | 'p2wpkh' | 'p2wsh' | 'p2tr'; export interface MultisigAddress { address: string; redeemScript: Buffer; m: number; n: number; pubkeys: string[]; } export interface PSBTOptions { inputs: Array<{ txid: string; vout: number; value: number; scriptPubKey?: string; redeemScript?: Buffer; witnessScript?: Buffer; }>; outputs: Array<{ address?: string; script?: string; value: number; }>; locktime?: number; version?: number; } export interface PSBT { data: { inputs: any[]; outputs: any[]; }; toBase64(): string; toHex(): string; sign(keyPair: any): void; finalizeAllInputs(): void; extractTransaction(): any; } export interface LightningInvoice { paymentRequest: string; paymentHash: string; amount: number; description: string; expiry: number; timestamp: number; } export interface LightningChannel { channelId: string; nodeId: string; capacity: number; localBalance: number; remoteBalance: number; active: boolean; } export interface SendTransactionParams { to: string; amount: number; feeRate?: number; utxos?: UTXO[]; rbf?: boolean; data?: Buffer; } export interface FeeEstimate { fastestFee: number; halfHourFee: number; hourFee: number; economyFee: number; } export interface BitcoinBlock { hash: string; height: number; time: number; nTx: number; size: number; weight: number; merkleRoot: string; previousBlockHash: string; } export interface IBitcoinManager extends IBlockchainManager { generateAddress(type: AddressType): Promise; validateAddress(address: string): Promise; getUTXOs(address: string): Promise; selectUTXOs(utxos: UTXO[], amount: number): Promise; sendTransaction(params: SendTransactionParams): Promise; createPSBT(options: PSBTOptions): Promise; signPSBT(psbt: PSBT, privateKey: string): Promise; broadcastTransaction(hex: string): Promise; estimateFee(params: SendTransactionParams): Promise; getFeeRates(): Promise; getBalance(address: string): Promise; batchGetBalances(addresses: string[]): Promise; createMultisig(params: { pubkeys: string[]; m: number; network?: string; }): Promise; createMultisigPSBT(params: { multisig: MultisigAddress; inputs: TransactionInput[]; outputs: TransactionOutput[]; }): Promise; getNetwork(): string; getBlockHeight(): Promise; getBlock(hashOrHeight: string | number): Promise; lightning?: { createInvoice(params: { amount: number; description: string; expiry?: number; }): Promise; decodeInvoice(paymentRequest: string): Promise; payInvoice(paymentRequest: string): Promise<{ paymentHash: string; }>; listChannels(): Promise; }; } export type BitcoinEventType = 'transaction:sent' | 'transaction:confirmed' | 'block:new' | 'utxo:spent' | 'utxo:received' | 'lightning:invoice:created' | 'lightning:invoice:paid' | 'lightning:channel:opened' | 'lightning:channel:closed'; export interface BitcoinEvent { type: BitcoinEventType; data: unknown; timestamp: Date; txid?: string; blockHeight?: number; } //# sourceMappingURL=types.d.ts.map