import { Bip21Options } from "bip21"; import * as bitcoin from "bitcoinjs-lib"; import * as ecpair0 from "ecpair"; import { HDKey, Versions } from "@scure/bip32"; import * as btc from "@scure/btc-signer"; import { deriveBip39SeedFromMnemonic, deriveRootBip32Keychain } from "@leather.io/crypto"; import { Network } from "bitcoin-address-validation"; import BigNumber from "bignumber.js"; import { z } from "zod"; import { RawPSBTV0, TransactionInput, TransactionOutput } from "@scure/btc-signer/psbt"; import * as _leather_io_models0 from "@leather.io/models"; import { AverageBitcoinFeeRates, BitcoinAddress, BitcoinNetworkModes, InscriptionAsset, Money, NetworkModes, TransactionErrorKey, ValueOf } from "@leather.io/models"; import * as _scure_btc_signer_payment0 from "@scure/btc-signer/payment"; import { P2Ret, P2TROut } from "@scure/btc-signer/payment"; import { SigHash } from "@scure/btc-signer/transaction"; import { BitcoinPaymentTypes, signatureHash } from "@leather.io/rpc"; //#region src/bip21/bip21.d.ts interface Bip21ResultValue { address: string; [key: string]: string | number | undefined; } type Bip21Result = { success: true; data: Bip21ResultValue; } | { success: false; error: string; }; declare const bip21: { decode: (uri: string, urnScheme?: string) => Bip21Result; encode: (address: string, options: Bip21Options, urnScheme?: string) => string | null; }; //#endregion //#region src/bip322/bip322-utils.d.ts declare function ecPairFromPrivateKey(key: Uint8Array): ecpair0.ECPairInterface; declare function hashBip322Message(message: Uint8Array | string): Uint8Array; declare const bip322TransactionToSignValues: { prevoutHash: Uint8Array; prevoutIndex: number; sequence: number; }; declare function isSupportedMessageSigningPaymentType(paymentType: string): boolean; /** * Encode witness data for a BIP322 message * TODO: Refactor to remove `Buffer` use */ declare function encodeMessageWitnessData(witnessArray: Buffer[]): Buffer; declare function tweakSigner(signer: bitcoin.Signer, opts?: any): bitcoin.Signer; //#endregion //#region src/bip322/sign-message-bip322-bitcoinjs.d.ts declare function createNativeSegwitBitcoinJsSigner(privateKey: Buffer): ecpair0.ECPairInterface; declare function createTaprootBitcoinJsSigner(privateKey: Buffer): bitcoin.Signer; declare function createToSpendTx(address: BitcoinAddress, message: string, network: BitcoinNetworkModes): { virtualToSpend: bitcoin.Transaction; script: Buffer; }; interface SignBip322MessageSimple { address: BitcoinAddress; message: string; network: BitcoinNetworkModes; signPsbt(psbt: bitcoin.Psbt): Promise; } declare function signBip322MessageSimple(args: SignBip322MessageSimple): Promise<{ virtualToSpend: bitcoin.Transaction; virtualToSign: bitcoin.Transaction; unencodedSig: Buffer; signature: string; }>; //#endregion //#region src/coin-selection/coin-selection.d.ts interface CoinSelectionOutput { value: bigint; address?: string; } interface CoinSelectionRecipient { address: string; amount: Money; } interface DetermineUtxosForSpendArgs { feeRate: number; recipients: CoinSelectionRecipient[]; utxos: T[]; } declare function determineUtxosForSpendAll({ feeRate, recipients, utxos }: DetermineUtxosForSpendArgs): { inputs: T[]; outputs: { value: bigint; address: string; }[]; size: number; fee: Money; }; declare function determineUtxosForSpend({ feeRate, recipients, utxos }: DetermineUtxosForSpendArgs): { txVBytes: number; txBytes: number; txWeight: number; filteredUtxos: T[]; inputs: T[]; outputs: CoinSelectionOutput[]; size: number; fee: Money; }; //#endregion //#region src/coin-selection/coin-selection.utils.d.ts interface InputData { value: number; txid: string; address: string; } declare function getUtxoTotal(utxos: T[]): BigNumber; interface CountInputsByScriptTypeResponse { p2wpkh: number; p2tr: number; } declare function countInputsByScriptType(utxos: T[]): CountInputsByScriptTypeResponse; declare function getSizeInfo(payload: { utxos: T[]; recipients: CoinSelectionRecipient[]; isSendMax?: boolean; }): { txVBytes: number; txBytes: number; txWeight: number; }; interface GetSpendableAmountArgs { utxos: T[]; feeRate: number; recipients: CoinSelectionRecipient[]; isSendMax?: boolean; } declare function getSpendableAmount({ utxos, feeRate, recipients, isSendMax }: GetSpendableAmountArgs): { spendableAmount: BigNumber; fee: number; }; declare function filterUneconomicalUtxos({ utxos, feeRate, recipients }: { utxos: T[]; feeRate: number; recipients: CoinSelectionRecipient[]; }): T[]; //#endregion //#region src/coin-selection/calculate-max-spend.d.ts interface CalculateMaxSpendParams { recipient: string; utxos: InputData[]; feeRate: number; } interface CalculateMaxSpendResponse { spendAllFee: number; amount: Money; spendableBitcoin: BigNumber; } declare function calculateMaxSpend({ recipient, utxos, feeRate }: CalculateMaxSpendParams): CalculateMaxSpendResponse; //#endregion //#region src/fees/bitcoin-fees.d.ts type GetBitcoinTransactionFeeArgs = DetermineUtxosForSpendArgs & { isSendingMax?: boolean; }; declare function getBitcoinTransactionFee({ isSendingMax, ...props }: GetBitcoinTransactionFeeArgs): Money | null; interface BitcoinFees { blockchain: 'bitcoin'; high: { fee: Money | null; feeRate: number; }; standard: { fee: Money | null; feeRate: number; }; low: { fee: Money | null; feeRate: number; }; } interface GetBitcoinFeesArgs { feeRates: AverageBitcoinFeeRates; isSendingMax?: boolean; recipients: CoinSelectionRecipient[]; utxos: InputData[]; } declare function getBitcoinFees({ feeRates, isSendingMax, recipients, utxos }: GetBitcoinFeesArgs): { high: { feeRate: number; fee: Money | null; }; standard: { feeRate: number; fee: Money | null; }; low: { feeRate: number; fee: Money | null; }; }; //#endregion //#region src/fees/btc-size-fee-estimator.d.ts type InputScriptType = 'p2pkh' | 'p2sh' | 'p2sh-p2wpkh' | 'p2sh-p2wsh' | 'p2wpkh' | 'p2wsh' | 'p2tr'; interface TxSizerParams { input_count: number; input_script: InputScriptType; input_m: number; input_n: number; p2pkh_output_count: number; p2sh_output_count: number; p2sh_p2wpkh_output_count: number; p2sh_p2wsh_output_count: number; p2wpkh_output_count: number; p2wsh_output_count: number; p2tr_output_count: number; } interface MixedInputTxSizerParams { p2wpkh_input_count: number; p2tr_input_count: number; p2pkh_input_count?: number; p2sh_input_count?: number; p2sh_p2wpkh_input_count?: number; p2sh_p2wsh_input_count?: number; p2wsh_input_count?: number; input_m?: number; input_n?: number; p2pkh_output_count?: number; p2sh_output_count?: number; p2sh_p2wpkh_output_count?: number; p2sh_p2wsh_output_count?: number; p2wpkh_output_count?: number; p2wsh_output_count?: number; p2tr_output_count?: number; _forceSegwit?: boolean; } declare class BtcSizeFeeEstimator { P2PKH_IN_SIZE: number; P2PKH_OUT_SIZE: number; P2SH_OUT_SIZE: number; P2SH_P2WPKH_OUT_SIZE: number; P2SH_P2WSH_OUT_SIZE: number; P2SH_P2WPKH_IN_SIZE: number; P2WPKH_IN_SIZE: number; P2WPKH_OUT_SIZE: number; P2WSH_OUT_SIZE: number; P2TR_OUT_SIZE: number; P2TR_IN_SIZE: number; PUBKEY_SIZE: number; SIGNATURE_SIZE: number; SUPPORTED_INPUT_SCRIPT_TYPES: InputScriptType[]; defaultParams: TxSizerParams; params: TxSizerParams; getSizeOfScriptLengthElement(length: number): 1 | 3 | 5 | 2; getSizeOfletInt(length: number): 1 | 3 | 5 | 9; getTxOverheadVBytes(input_script: InputScriptType, input_count: number, output_count: number): number; getTxOverheadExtraRawBytes(input_script: InputScriptType, input_count: number): number; prepareParams(opts: Partial): TxSizerParams; getOutputCount(): number; getSizeBasedOnInputType(): { inputSize: number; inputWitnessSize: number; }; calcTxSize(opts: Partial): { txVBytes: number; txBytes: number; txWeight: number; }; calcMixedInputTxSize(opts: MixedInputTxSizerParams): { txVBytes: number; txBytes: number; txWeight: number; }; estimateFee(vbyte: number, satVb: number): number; formatFeeRange(fee: number, multiplier: number): string; } //#endregion //#region src/mocks/mocks.d.ts declare const TEST_ACCOUNT_1_NATIVE_SEGWIT_ADDRESS: _leather_io_models0.BitcoinAddress; declare const TEST_ACCOUNT_1_TAPROOT_ADDRESS: _leather_io_models0.BitcoinAddress; declare const TEST_ACCOUNT_2_TAPROOT_ADDRESS: _leather_io_models0.BitcoinAddress; declare const TEST_TESNET_ACCOUNT_1_NATIVE_SEGWIT_ADDRESS: _leather_io_models0.BitcoinAddress; declare const TEST_TESTNET_ACCOUNT_2_BTC_ADDRESS: _leather_io_models0.BitcoinAddress; declare const TEST_TESTNET_ACCOUNT_2_TAPROOT_ADDRESS: _leather_io_models0.BitcoinAddress; declare const recipientAddress: _leather_io_models0.BitcoinAddress; declare const legacyAddress: _leather_io_models0.BitcoinAddress; declare const segwitAddress: _leather_io_models0.BitcoinAddress; declare const taprootAddress: _leather_io_models0.BitcoinAddress; declare const invalidAddress = "whoop-de-da-boop-da-de-not-a-bitcoin-address"; declare const inValidCharactersAddress: _leather_io_models0.BitcoinAddress; declare const inValidLengthAddress: _leather_io_models0.BitcoinAddress; //#endregion //#region src/schemas/address-schema.d.ts declare function nonEmptyStringValidator(message?: string): z.ZodString; declare function btcAddressValidator(): z.ZodString; declare function getNetworkTypeFromAddress(address: string): BitcoinNetworkModes; declare function btcAddressNetworkValidator(network: BitcoinNetworkModes): z.ZodString; //#endregion //#region src/signer/bitcoin-payer.d.ts type AllowedSighashTypes = ValueOf | SigHash; interface BitcoinAccountKeychain { descriptor: string; masterKeyFingerprint: string; keyOrigin: string; keychain: HDKey; xpub: string; } type WithDerivePayer = T & { derivePayer(args: BitcoinPayerInfo): P; }; interface BitcoinPayerBase { paymentType: SupportedPaymentType; network: BitcoinNetworkModes; address: BitcoinAddress; keyOrigin: string; masterKeyFingerprint: string; publicKey: Uint8Array; } interface BitcoinNativeSegwitPayer extends BitcoinPayerBase { paymentType: 'p2wpkh'; payment: P2Ret; } interface BitcoinTaprootPayer extends BitcoinPayerBase { paymentType: 'p2tr'; payment: P2TROut; } type BitcoinPayer = BitcoinNativeSegwitPayer | BitcoinTaprootPayer; declare function initializeBitcoinAccountKeychainFromDescriptor(descriptor: string): BitcoinAccountKeychain; interface BitcoinPayerInfo { change: number; addressIndex: number; } declare function deriveBitcoinPayerFromAccount(descriptor: string, network: BitcoinNetworkModes): ({ change, addressIndex }: BitcoinPayerInfo) => { keyOrigin: string; masterKeyFingerprint: string; paymentType: SupportedPaymentType; network: BitcoinNetworkModes; payment: P2Ret; readonly address: string; readonly publicKey: Uint8Array; }; interface BtcSignerDerivationPath { fingerprint: number; path: number[]; } type BtcSignerDefaultBip32Derivation = [Uint8Array, BtcSignerDerivationPath]; type BtcSignerTapBip32Derivation = [Uint8Array, { hashes: Uint8Array[]; der: BtcSignerDerivationPath; }]; type BtcSignerBip32Derivation = BtcSignerDefaultBip32Derivation | BtcSignerTapBip32Derivation; type PayerToBip32DerivationArgs = Pick; /** * @example * ```ts * tx.addInput({ * ...input, * bip32Derivation: [payerToBip32Derivation(payer)], * }) * ``` */ declare function payerToBip32Derivation(args: PayerToBip32DerivationArgs): BtcSignerDefaultBip32Derivation; /** * @example * ```ts * tx.addInput({ * ...input, * tapBip32Derivation: [payerToTapBip32Derivation(payer)], * }) * ``` */ declare function payerToTapBip32Derivation(args: PayerToBip32DerivationArgs): BtcSignerTapBip32Derivation; type PsbtInputBitcoinJsLib = bitcoin.Psbt['data']['inputs']['0']; type TapBip32DerivationBitcoinJsLib = NonNullable['0']; declare function payerToTapBip32DerivationBitcoinJsLib(args: PayerToBip32DerivationArgs): TapBip32DerivationBitcoinJsLib; type Bip32DerivationBitcoinJsLib = NonNullable['0']; declare function payerToBip32DerivationBitcoinJsLib(args: PayerToBip32DerivationArgs): Bip32DerivationBitcoinJsLib; declare function extractPayerInfoFromDerivationPath(path: string): { change: number; addressIndex: number; }; /** * @description * Turns key format from @scure/btc-signer lib back into key origin string * @example * ```ts * const [inputOne] = getPsbtTxInputs(tx); * const keyOrigin = serializeKeyOrigin(inputOne.bip32Derivation[0][1]); * ``` */ declare function serializeKeyOrigin({ fingerprint, path }: BtcSignerDerivationPath): string; /** * @description * Of a given set of a `tx.input`s bip32 derivation paths from * `@scure/btc-signer`, serialize the paths back to the string format used * internally */ declare function extractRequiredKeyOrigins(derivation: BtcSignerBip32Derivation[]): string[]; //#endregion //#region src/utils/bitcoin.network.d.ts interface BtcSignerNetwork { bech32: string; pubKeyHash: number; scriptHash: number; wif: number; } declare function getBtcSignerLibNetworkConfigByMode(network: BitcoinNetworkModes): BtcSignerNetwork; declare function getBitcoinJsLibNetworkConfigByMode(network: BitcoinNetworkModes): bitcoin.networks.Network; //#endregion //#region src/utils/bitcoin.utils.d.ts interface BitcoinAccount { type: BitcoinPaymentTypes; derivationPath: string; keychain: HDKey; accountIndex: number; network: BitcoinNetworkModes; } /** * Represents a map of `BitcoinNetworkModes` to `NetworkModes`. While Bitcoin * has a number of networks, its often only necessary to consider the higher * level concept of mainnet and testnet */ declare const bitcoinNetworkToCoreNetworkMap: Record; declare function bitcoinNetworkModeToCoreNetworkMode(mode: BitcoinNetworkModes): "mainnet" | "testnet"; type BitcoinNetworkMap = Record; declare function whenBitcoinNetwork(mode: BitcoinNetworkModes): >(networkMap: T) => T[BitcoinNetworkModes]; /** * Map representing the "Coin Type" section of a derivation path. * Consider example below, Coin type is one, thus testnet * @example * `m/86'/1'/0'/0/0` */ declare const coinTypeMap: Record; declare function getBitcoinCoinTypeIndexByNetwork(network: BitcoinNetworkModes): 0 | 1; declare function deriveAddressIndexKeychainFromAccount(keychain: HDKey): ({ changeIndex, addressIndex }: { changeIndex: number; addressIndex: number; }) => HDKey; declare function deriveAddressIndexZeroFromAccount(keychain: HDKey): HDKey; declare const ecdsaPublicKeyLength = 33; declare function ecdsaPublicKeyToSchnorr(pubKey: Uint8Array): Uint8Array; declare function toXOnly(pubKey: Buffer): Buffer; declare function decodeBitcoinTx(tx: string): ReturnType; declare function getAddressFromOutScript(script: Uint8Array, bitcoinNetwork: BtcSignerNetwork): BitcoinAddress | null; /** * Payment type identifiers, as described by `@scure/btc-signer` library */ type BtcSignerLibPaymentTypeIdentifers = 'wpkh' | 'wsh' | 'tr' | 'pkh' | 'sh'; declare const paymentTypeMap: Record; declare function btcSignerLibPaymentTypeToPaymentTypeMap(payment: BtcSignerLibPaymentTypeIdentifers): "p2pkh" | "p2sh" | "p2wpkh-p2sh" | "p2wpkh" | "p2tr"; declare function isBtcSignerLibPaymentType(payment: string): payment is BtcSignerLibPaymentTypeIdentifers; declare function parseKnownPaymentType(payment: BtcSignerLibPaymentTypeIdentifers | BitcoinPaymentTypes): "p2pkh" | "p2sh" | "p2wpkh-p2sh" | "p2wpkh" | "p2tr"; type PaymentTypeMap = Record; declare function whenPaymentType(mode: BitcoinPaymentTypes | BtcSignerLibPaymentTypeIdentifers): (paymentMap: PaymentTypeMap) => T; type SupportedPaymentType = 'p2wpkh' | 'p2tr'; type SupportedPaymentTypeMap = Record; declare function whenSupportedPaymentType(mode: SupportedPaymentType): (paymentMap: SupportedPaymentTypeMap) => T; /** * Infers the Bitcoin payment type from the derivation path. * Below we see path has 86 in it, per convention, this refers to taproot payments * @example * `m/86'/1'/0'/0/0` */ declare function inferPaymentTypeFromPath(path: string): BitcoinPaymentTypes; declare function inferNetworkFromPath(path: string): NetworkModes; declare function extractExtendedPublicKeyFromPolicy(policy: string): string; declare function createWalletIdDecoratedPath(policy: string, walletId: string): string; declare function getHdKeyVersionsFromNetwork(network: NetworkModes): Versions | undefined; declare function getBitcoinInputAddress(input: TransactionInput, bitcoinNetwork: BtcSignerNetwork): BitcoinAddress | null; declare function getInputPaymentType(input: TransactionInput, network: BitcoinNetworkModes): BitcoinPaymentTypes; interface GetAddressArgs { changeIndex: number; addressIndex: number; keychain?: HDKey; network: BitcoinNetworkModes; } declare function getTaprootAddress({ changeIndex, addressIndex, keychain, network }: GetAddressArgs): string; declare function getNativeSegwitAddress({ changeIndex, addressIndex, keychain, network }: GetAddressArgs): string; /** * @deprecated * Use `deriveRootBip32Keychain` in `@leather.io/crypto` instead */ declare function mnemonicToRootNode(secretKey: string): HDKey; declare function getPsbtTxInputs(psbtTx: btc.Transaction): TransactionInput[]; declare function getPsbtTxOutputs(psbtTx: btc.Transaction): TransactionOutput[]; declare function inferNetworkFromAddress(address: BitcoinAddress): BitcoinNetworkModes; declare function inferPaymentTypeFromAddress(address: BitcoinAddress): SupportedPaymentType; declare function getBitcoinInputValue(input: TransactionInput): number; declare function isNativeSegwitDerivationPath(path: string): boolean; declare function isTaprootDerivationPath(path: string): boolean; declare function isTaprootPayer(payer: BitcoinPayer | null): payer is BitcoinTaprootPayer; //#endregion //#region src/payments/p2tr-address-gen.d.ts declare function makeTaprootAccountDerivationPath(network: BitcoinNetworkModes, accountIndex: number): string; /** @deprecated Use makeTaprootAccountDerivationPath */ declare const getTaprootAccountDerivationPath: typeof makeTaprootAccountDerivationPath; declare function makeTaprootAddressIndexDerivationPath({ network, accountIndex, changeIndex, addressIndex }: { network: BitcoinNetworkModes; accountIndex: number; changeIndex: number; addressIndex: number; }): string; /** @deprecated Use makeTaprootAddressIndexDerivationPath */ declare const getTaprootAddressIndexDerivationPath: typeof makeTaprootAddressIndexDerivationPath; declare function deriveTaprootAccount(keychain: HDKey, network: BitcoinNetworkModes): (accountIndex: number) => BitcoinAccount; declare function getTaprootPayment(publicKey: Uint8Array, network: BitcoinNetworkModes): _scure_btc_signer_payment0.P2TROut; declare function getTaprootPaymentFromAddressIndex(keychain: HDKey, network: BitcoinNetworkModes): _scure_btc_signer_payment0.P2TROut; interface DeriveTaprootReceiveAddressIndexArgs { keychain: HDKey; network: BitcoinNetworkModes; } declare function deriveTaprootReceiveAddressIndexZero({ keychain, network }: DeriveTaprootReceiveAddressIndexArgs): { keychain: HDKey; payment: _scure_btc_signer_payment0.P2TROut; }; //#endregion //#region src/payments/p2wpkh-address-gen.d.ts declare function makeNativeSegwitAccountDerivationPath(network: BitcoinNetworkModes, accountIndex: number): string; /** @deprecated Use makeNativeSegwitAccountDerivationPath */ declare const getNativeSegwitAccountDerivationPath: typeof makeNativeSegwitAccountDerivationPath; declare function makeNativeSegwitAddressIndexDerivationPath({ network, accountIndex, changeIndex, addressIndex }: { network: BitcoinNetworkModes; accountIndex: number; changeIndex: number; addressIndex: number; }): string; /** @deprecated Use makeNativeSegwitAddressIndexDerivationPath */ declare const getNativeSegwitAddressIndexDerivationPath: typeof makeNativeSegwitAddressIndexDerivationPath; declare function deriveNativeSegwitAccountFromRootKeychain(keychain: HDKey, network: BitcoinNetworkModes): (accountIndex: number) => BitcoinAccount; declare function getNativeSegwitPaymentFromAddressIndex(keychain: HDKey, network: BitcoinNetworkModes): _scure_btc_signer_payment0.P2Ret; interface DeriveNativeSegwitReceiveAddressIndexArgs { keychain: HDKey; network: BitcoinNetworkModes; } declare function deriveNativeSegwitReceiveAddressIndexZero({ keychain, network }: DeriveNativeSegwitReceiveAddressIndexArgs): { keychain: HDKey; payment: _scure_btc_signer_payment0.P2Ret; }; //#endregion //#region src/payments/p2wsh-p2sh-address-gen.d.ts /** * @deprecated * Use `deriveBip39MnemonicFromSeed` from `@leather.io/crypto` */ declare const deriveBtcBip49SeedFromMnemonic: typeof deriveBip39SeedFromMnemonic; /** * @deprecated * Use `deriveRootBip32Keychain` from `@leather.io/crypto` */ declare const deriveRootBtcKeychain: typeof deriveRootBip32Keychain; declare function decodeCompressedWifPrivateKey(key: string): Uint8Array; declare const payToScriptHashTestnetPrefix = 196; declare function makePayToScriptHashKeyHash(publicKey: Uint8Array): Uint8Array; declare function makePayToScriptHashAddressBytes(keyHash: Uint8Array): Uint8Array; declare function makePayToScriptHashAddress(addressBytes: Uint8Array, network: NetworkModes): string; declare function publicKeyToPayToScriptHashAddress(publicKey: Uint8Array, network: NetworkModes): string; //#endregion //#region src/psbt/psbt-inputs.d.ts interface PsbtInput { address: BitcoinAddress; index?: number; inscription?: InscriptionAsset; isMutable: boolean; toSign: boolean; txid: string; value: number; bip32Derivation: TransactionInput['bip32Derivation']; tapBip32Derivation: TransactionInput['tapBip32Derivation']; } interface GetParsedInputsArgs { inputs: TransactionInput[]; indexesToSign?: number[]; networkMode: BitcoinNetworkModes; psbtAddresses: BitcoinAddress[]; } interface GetParsedInputsResponse { isPsbtMutable: boolean; parsedInputs: PsbtInput[]; } declare function getParsedInputs({ inputs, indexesToSign, networkMode, psbtAddresses }: GetParsedInputsArgs): GetParsedInputsResponse; //#endregion //#region src/psbt/psbt-outputs.d.ts interface PsbtOutput { address: BitcoinAddress | null; isMutable: boolean; toSign: boolean; value: number; } interface PsbtOutputWithAddress extends PsbtOutput { address: BitcoinAddress; } interface GetParsedOutputsArgs { isPsbtMutable: boolean; outputs: TransactionOutput[]; networkMode: BitcoinNetworkModes; psbtAddresses: BitcoinAddress[]; } declare function getParsedOutputs({ isPsbtMutable, outputs, networkMode, psbtAddresses }: GetParsedOutputsArgs): PsbtOutput[]; //#endregion //#region src/psbt/psbt-totals.d.ts interface GetPsbtTotalsProps { psbtAddresses: BitcoinAddress[]; parsedInputs: PsbtInput[]; parsedOutputs: PsbtOutput[]; } declare function getPsbtTotals({ psbtAddresses, parsedInputs, parsedOutputs }: GetPsbtTotalsProps): { inputsTotalNativeSegwit: _leather_io_models0.Money; inputsTotalTaproot: _leather_io_models0.Money; outputsTotalNativeSegwit: _leather_io_models0.Money; outputsTotalTaproot: _leather_io_models0.Money; psbtInputsTotal: _leather_io_models0.Money; psbtOutputsTotal: _leather_io_models0.Money; }; //#endregion //#region src/psbt/psbt-details.d.ts interface GetPsbtDetailsArgs { psbtHex: string; psbtAddresses: BitcoinAddress[]; networkMode: BitcoinNetworkModes; indexesToSign?: number[]; } declare function getPsbtDetails({ psbtHex, networkMode, indexesToSign, psbtAddresses }: GetPsbtDetailsArgs): { addressNativeSegwitTotal: _leather_io_models0.Money; addressTaprootTotal: _leather_io_models0.Money; fee: _leather_io_models0.Money; isPsbtMutable: boolean; psbtInputs: PsbtInput[]; psbtOutputs: PsbtOutput[]; }; //#endregion //#region src/psbt/utils.d.ts type RawPsbt = ReturnType; declare function getPsbtAsTransaction(psbt: string | Uint8Array): btc.Transaction; declare function getRawPsbt(psbt: string | Uint8Array): ReturnType; //#endregion //#region src/transactions/generate-unsigned-transaction.d.ts interface GenerateBitcoinUnsignedTransactionArgs { feeRate: number; isSendingMax?: boolean; network: BtcSignerNetwork; recipients: CoinSelectionRecipient[]; utxos: T[]; changeAddress: string; payerLookup(keyOrigin: string): BitcoinNativeSegwitPayer | BitcoinTaprootPayer | undefined; } declare function generateBitcoinUnsignedTransaction({ feeRate, isSendingMax, network, recipients, changeAddress, utxos, payerLookup }: GenerateBitcoinUnsignedTransactionArgs): { tx: btc.Transaction; hex: string; psbt: Uint8Array; inputs: T[]; fee: _leather_io_models0.Money; }; //#endregion //#region src/validation/address-validation.d.ts declare function getBitcoinAddressNetworkType(network: BitcoinNetworkModes): Network; declare function isValidBitcoinAddress(address: string): boolean; declare function isValidBitcoinNetworkAddress(address: string, network: BitcoinNetworkModes): boolean; //#endregion //#region src/validation/amount-validation.d.ts interface isBtcBalanceSufficientParams { desiredSpend: Money; maxSpend: Money; } declare function isBtcBalanceSufficient({ desiredSpend, maxSpend }: isBtcBalanceSufficientParams): boolean; declare function isBtcMinimumSpend(desiredSpend: Money): boolean; //#endregion //#region src/validation/bitcoin-address.d.ts declare function isBitcoinAddress(value: string): value is BitcoinAddress; declare function createBitcoinAddress(value: string): BitcoinAddress; //#endregion //#region src/validation/bitcoin-error.d.ts declare class BitcoinError extends Error { message: BitcoinErrorKey; constructor(message: BitcoinErrorKey); } type BitcoinErrorKey = TransactionErrorKey | 'InsufficientAmount' | 'NoInputsToSign' | 'NoOutputsToSign' | 'InscribedUtxos'; //#endregion //#region src/utils/bitcoin.descriptors.d.ts declare function getDescriptorFromKeychain(accountKeychain: T): string | undefined; declare function inferPaymentTypeFromDescriptor(descriptor: string): SupportedPaymentType; declare function extractXpubFromDescriptor(descriptor: string): string; interface DeriveAddressesFromDescriptorArgs { accountDescriptor: string; network: BitcoinNetworkModes; limit?: number; } interface DeriveAddressesFromDescriptorResult { address: string; path: string; } declare function deriveAddressesFromDescriptor({ accountDescriptor, network, limit }: DeriveAddressesFromDescriptorArgs): DeriveAddressesFromDescriptorResult[]; //#endregion //#region src/utils/lookup-derivation-by-address.d.ts interface LookUpDerivationByAddressArgs { taprootXpub: string; nativeSegwitXpub: string; iterationLimit: number; } declare function lookupDerivationByAddress(args: LookUpDerivationByAddressArgs): (address: BitcoinAddress) => { readonly status: "success"; readonly duration: number; readonly path: string; } | { readonly status: "failure"; readonly duration?: undefined; readonly path?: undefined; }; //#endregion //#region src/utils/deconstruct-btc-address.d.ts declare function deconstructBtcAddress(address: string): { type: string; hashbytes: Uint8Array; }; //#endregion export { AllowedSighashTypes, BitcoinAccount, BitcoinAccountKeychain, BitcoinError, BitcoinErrorKey, BitcoinFees, BitcoinNativeSegwitPayer, BitcoinPayer, BitcoinPayerBase, BitcoinPayerInfo, BitcoinTaprootPayer, BtcSignerDefaultBip32Derivation, BtcSignerLibPaymentTypeIdentifers, BtcSignerNetwork, BtcSignerTapBip32Derivation, BtcSizeFeeEstimator, CalculateMaxSpendResponse, CoinSelectionOutput, CoinSelectionRecipient, DeriveAddressesFromDescriptorArgs, DeriveAddressesFromDescriptorResult, DetermineUtxosForSpendArgs, GenerateBitcoinUnsignedTransactionArgs, GetBitcoinFeesArgs, InputData, InputScriptType, MixedInputTxSizerParams, PaymentTypeMap, PsbtInput, PsbtOutput, PsbtOutputWithAddress, RawPsbt, SupportedPaymentType, SupportedPaymentTypeMap, TEST_ACCOUNT_1_NATIVE_SEGWIT_ADDRESS, TEST_ACCOUNT_1_TAPROOT_ADDRESS, TEST_ACCOUNT_2_TAPROOT_ADDRESS, TEST_TESNET_ACCOUNT_1_NATIVE_SEGWIT_ADDRESS, TEST_TESTNET_ACCOUNT_2_BTC_ADDRESS, TEST_TESTNET_ACCOUNT_2_TAPROOT_ADDRESS, TxSizerParams, WithDerivePayer, bip21, bip322TransactionToSignValues, bitcoinNetworkModeToCoreNetworkMode, bitcoinNetworkToCoreNetworkMap, btcAddressNetworkValidator, btcAddressValidator, btcSignerLibPaymentTypeToPaymentTypeMap, calculateMaxSpend, coinTypeMap, countInputsByScriptType, createBitcoinAddress, createNativeSegwitBitcoinJsSigner, createTaprootBitcoinJsSigner, createToSpendTx, createWalletIdDecoratedPath, decodeBitcoinTx, decodeCompressedWifPrivateKey, deconstructBtcAddress, deriveAddressIndexKeychainFromAccount, deriveAddressIndexZeroFromAccount, deriveAddressesFromDescriptor, deriveBitcoinPayerFromAccount, deriveBtcBip49SeedFromMnemonic, deriveNativeSegwitAccountFromRootKeychain, deriveNativeSegwitReceiveAddressIndexZero, deriveRootBtcKeychain, deriveTaprootAccount, deriveTaprootReceiveAddressIndexZero, determineUtxosForSpend, determineUtxosForSpendAll, ecPairFromPrivateKey, ecdsaPublicKeyLength, ecdsaPublicKeyToSchnorr, encodeMessageWitnessData, extractExtendedPublicKeyFromPolicy, extractPayerInfoFromDerivationPath, extractRequiredKeyOrigins, extractXpubFromDescriptor, filterUneconomicalUtxos, generateBitcoinUnsignedTransaction, getAddressFromOutScript, getBitcoinAddressNetworkType, getBitcoinCoinTypeIndexByNetwork, getBitcoinFees, getBitcoinInputAddress, getBitcoinInputValue, getBitcoinJsLibNetworkConfigByMode, getBitcoinTransactionFee, getBtcSignerLibNetworkConfigByMode, getDescriptorFromKeychain, getHdKeyVersionsFromNetwork, getInputPaymentType, getNativeSegwitAccountDerivationPath, getNativeSegwitAddress, getNativeSegwitAddressIndexDerivationPath, getNativeSegwitPaymentFromAddressIndex, getNetworkTypeFromAddress, getParsedInputs, getParsedOutputs, getPsbtAsTransaction, getPsbtDetails, getPsbtTotals, getPsbtTxInputs, getPsbtTxOutputs, getRawPsbt, getSizeInfo, getSpendableAmount, getTaprootAccountDerivationPath, getTaprootAddress, getTaprootAddressIndexDerivationPath, getTaprootPayment, getTaprootPaymentFromAddressIndex, getUtxoTotal, hashBip322Message, inValidCharactersAddress, inValidLengthAddress, inferNetworkFromAddress, inferNetworkFromPath, inferPaymentTypeFromAddress, inferPaymentTypeFromDescriptor, inferPaymentTypeFromPath, initializeBitcoinAccountKeychainFromDescriptor, invalidAddress, isBitcoinAddress, isBtcBalanceSufficient, isBtcMinimumSpend, isBtcSignerLibPaymentType, isNativeSegwitDerivationPath, isSupportedMessageSigningPaymentType, isTaprootDerivationPath, isTaprootPayer, isValidBitcoinAddress, isValidBitcoinNetworkAddress, legacyAddress, lookupDerivationByAddress, makeNativeSegwitAccountDerivationPath, makeNativeSegwitAddressIndexDerivationPath, makePayToScriptHashAddress, makePayToScriptHashAddressBytes, makePayToScriptHashKeyHash, makeTaprootAccountDerivationPath, makeTaprootAddressIndexDerivationPath, mnemonicToRootNode, nonEmptyStringValidator, parseKnownPaymentType, payToScriptHashTestnetPrefix, payerToBip32Derivation, payerToBip32DerivationBitcoinJsLib, payerToTapBip32Derivation, payerToTapBip32DerivationBitcoinJsLib, paymentTypeMap, publicKeyToPayToScriptHashAddress, recipientAddress, segwitAddress, serializeKeyOrigin, signBip322MessageSimple, taprootAddress, toXOnly, tweakSigner, whenBitcoinNetwork, whenPaymentType, whenSupportedPaymentType }; //# sourceMappingURL=index.d.ts.map