import { bitcoin as bT, CreateMultisigResponse, finalizePSBTResponse, Input, Output, Transaction } from '@atomicfinance/types'; import { BIP32Interface } from 'bip32'; import { BitcoinNetwork } from 'bitcoin-network'; import * as bitcoin from 'bitcoinjs-lib'; import { ECPairInterface } from 'ecpair'; interface BitcoinJsWalletProviderOptions { network: BitcoinNetwork; mnemonic: string; baseDerivationPath: string; addressType?: bT.AddressType; addressIndex?: number; changeAddressIndex?: number; } declare const BaseProvider: any; export default class BitcoinJsWalletProvider extends BaseProvider { _mnemonic: string; _seedNode: BIP32Interface; _baseDerivationNode: BIP32Interface; constructor(options: BitcoinJsWalletProviderOptions); seedNode(): Promise; baseDerivationNode(): Promise; keyPair(derivationPath: string): Promise; private _toWIF; exportPrivateKey(): Promise; signMessage(message: string, from: string): Promise; _createMultisigPayment(m: number, pubkeys: string[]): bitcoin.Payment; /** * Creates a native-segwit multi-signature address (P2MS in P2WSH) with n signatures of m required keys * https://developer.bitcoin.org/reference/rpc/createmultisig.html * @param m the number of required signatures * @param pubkeys n possible pubkeys in total * @returns a json object containing the `address` and `redeemScript` */ createMultisig(m: number, pubkeys: string[]): CreateMultisigResponse; /** * Creates a PSBT of a native-segwit multi-signature address (P2MS in P2WSH) with n signatures of m required keys * https://developer.bitcoin.org/reference/rpc/createmultisig.html * https://developer.bitcoin.org/reference/rpc/createpsbt.html * @param m the number of required signatures * @param pubkeys n possible pubkeys in total * @param inputs the Inputs to the PSBT * @param ouputs the Outputs to the PSBT * @returns a base64 encoded psbt string */ buildMultisigPSBT(m: number, pubkeys: string[], inputs: Input[], outputs: Output[]): string; /** * Update a PSBT with input information from our wallet and then sign inputs that we can sign for * https://developer.bitcoin.org/reference/rpc/walletprocesspsbt.html * @param psbt a base64 encoded psbt string (P2WSH only) * @returns a base64 encoded signed psbt string */ walletProcessPSBT(psbtString: string): Promise; /** * Finalize the inputs of a PSBT. If the transaction is fully signed, it will * produce a network serialized transaction which can be broadcast with sendrawtransaction * https://developer.bitcoin.org/reference/rpc/finalizepsbt.html * @param psbt a base64 encoded psbt string * @returns a json object containing `psbt` in base64, `hex` for transaction and `complete` for if * the transaction has a complete set of signatures */ finalizePSBT(psbtString: string): finalizePSBTResponse; sendSweepTransactionWithSetOutputs(externalChangeAddress: string, feePerByte: number, _outputs: Output[], fixedInputs: Input[]): Promise>; buildSweepTransactionWithSetOutputs(externalChangeAddress: string, feePerByte: number, _outputs: Output[], fixedInputs: Input[]): Promise<{ hex: string; fee: number; }>; _buildSweepTransactionWithSetOutputs(externalChangeAddress: string, feePerByte: number, _outputs: Output[], fixedInputs: Input[]): Promise<{ hex: string; fee: number; }>; _getInputForAmountWithoutUtxoCheck(_outputs: Output[], _feePerByte: number, fixedInputs: Input[], sweepAddress?: string): { inputs: bT.UTXO[]; outputs: { value: number; id?: string; }[]; fee: number; change?: { value: number; id?: string; }; }; _buildTransactionWithoutUtxoCheck(outputs: Output[], feePerByte: number, fixedInputs: Input[]): Promise<{ hex: string; fee: number; }>; _buildTransaction(targets: bT.OutputTarget[], feePerByte?: number, fixedInputs?: bT.Input[]): Promise<{ hex: string; fee: any; }>; _buildSweepTransaction(externalChangeAddress: string, feePerByte: number): Promise<{ hex: string; fee: number; }>; _getSweepInputVbytes(): 68 | 91 | 148; _getOutputVbytes(address?: string): number; _getTxOverheadVbytes(inputCount: number, outputCount: number): number; _buildTransactionWithInputs(targets: bT.OutputTarget[], inputs: bT.UTXO[]): Promise; signPSBT(data: string, inputs: bT.PsbtInputTarget[]): Promise; signBatchP2SHTransaction(inputs: [ { inputTxHex: string; index: number; vout: any; outputScript: Buffer; txInputIndex?: number; } ], addresses: string, tx: any, _lockTime?: number, segwit?: boolean): Promise; getScriptType(): "p2pkh" | "p2sh-p2wpkh" | "p2wpkh"; getConnectedNetwork(): Promise; isWalletAvailable(): Promise; } export {};