@leather.io/bitcoin 0.35.7 → 0.36.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
 
2
- > @leather.io/bitcoin@0.35.7 build /home/runner/work/mono/mono/packages/bitcoin
2
+ > @leather.io/bitcoin@0.36.2 build /home/runner/work/mono/mono/packages/bitcoin
3
3
  > tsdown
4
4
 
5
5
  ℹ tsdown v0.16.5 powered by rolldown v1.0.0-beta.50
@@ -7,9 +7,9 @@
7
7
  ℹ entry: src/index.ts
8
8
  ℹ tsconfig: tsconfig.json
9
9
  ℹ Build start
10
- ℹ dist/index.js  55.56 kB │ gzip: 13.15 kB
11
- ℹ dist/index.js.map 112.77 kB │ gzip: 26.65 kB
12
- ℹ dist/index.d.ts.map  10.24 kB │ gzip: 4.25 kB
13
- ℹ dist/index.d.ts  30.61 kB │ gzip: 6.34 kB
14
- ℹ 4 files, total: 209.18 kB
15
- ✔ Build complete in 3764ms
10
+ ℹ dist/index.js  57.09 kB │ gzip: 13.46 kB
11
+ ℹ dist/index.js.map 115.73 kB │ gzip: 27.30 kB
12
+ ℹ dist/index.d.ts.map  10.55 kB │ gzip: 4.37 kB
13
+ ℹ dist/index.d.ts  31.34 kB │ gzip: 6.44 kB
14
+ ℹ 4 files, total: 214.72 kB
15
+ ✔ Build complete in 4012ms
package/CHANGELOG.md CHANGED
@@ -939,6 +939,59 @@
939
939
  * @leather.io/prettier-config bumped to 0.9.0
940
940
  * @leather.io/rpc bumped to 2.20.17
941
941
 
942
+ ## [0.36.2](https://github.com/leather-io/mono/compare/@leather.io/bitcoin-v0.36.1...@leather.io/bitcoin-v0.36.2) (2026-01-06)
943
+
944
+
945
+ ### Bug Fixes
946
+
947
+ * change addresses support ([7469bcc](https://github.com/leather-io/mono/commit/7469bcc3bc4b44bda655c5d86b0a66397aea419b))
948
+
949
+ ## [0.36.1](https://github.com/leather-io/mono/compare/@leather.io/bitcoin-v0.36.0...@leather.io/bitcoin-v0.36.1) (2025-12-18)
950
+
951
+
952
+ ### Dependencies
953
+
954
+ * The following workspace dependencies were updated
955
+ * dependencies
956
+ * @leather.io/constants bumped to 0.29.0
957
+ * @leather.io/crypto bumped to 1.12.12
958
+ * @leather.io/utils bumped to 0.49.6
959
+ * devDependencies
960
+ * @leather.io/rpc bumped to 2.21.6
961
+
962
+ ## [0.36.0](https://github.com/leather-io/mono/compare/@leather.io/bitcoin-v0.35.8...@leather.io/bitcoin-v0.36.0) (2025-12-15)
963
+
964
+
965
+ ### Features
966
+
967
+ * add withdrawal and fee logic to sbtc swap provider service ([3d277dd](https://github.com/leather-io/mono/commit/3d277dd8e1f56eae7772b4a042f66288b87101ba))
968
+
969
+
970
+ ### Dependencies
971
+
972
+ * The following workspace dependencies were updated
973
+ * dependencies
974
+ * @leather.io/constants bumped to 0.28.5
975
+ * @leather.io/crypto bumped to 1.12.11
976
+ * @leather.io/models bumped to 0.52.0
977
+ * @leather.io/utils bumped to 0.49.5
978
+ * devDependencies
979
+ * @leather.io/rpc bumped to 2.21.5
980
+
981
+ ## [0.35.8](https://github.com/leather-io/mono/compare/@leather.io/bitcoin-v0.35.7...@leather.io/bitcoin-v0.35.8) (2025-12-09)
982
+
983
+
984
+ ### Dependencies
985
+
986
+ * The following workspace dependencies were updated
987
+ * dependencies
988
+ * @leather.io/constants bumped to 0.28.4
989
+ * @leather.io/crypto bumped to 1.12.10
990
+ * @leather.io/models bumped to 0.51.0
991
+ * @leather.io/utils bumped to 0.49.4
992
+ * devDependencies
993
+ * @leather.io/rpc bumped to 2.21.4
994
+
942
995
  ## [0.35.7](https://github.com/leather-io/mono/compare/@leather.io/bitcoin-v0.35.6...@leather.io/bitcoin-v0.35.7) (2025-12-08)
943
996
 
944
997
 
package/dist/index.d.ts CHANGED
@@ -292,7 +292,13 @@ declare function whenBitcoinNetwork(mode: BitcoinNetworkModes): <T extends Bitco
292
292
  */
293
293
  declare const coinTypeMap: Record<NetworkModes, 0 | 1>;
294
294
  declare function getBitcoinCoinTypeIndexByNetwork(network: BitcoinNetworkModes): 0 | 1;
295
- declare function deriveAddressIndexKeychainFromAccount(keychain: HDKey): (index: number) => HDKey;
295
+ declare function deriveAddressIndexKeychainFromAccount(keychain: HDKey): ({
296
+ changeIndex,
297
+ addressIndex
298
+ }: {
299
+ changeIndex: number;
300
+ addressIndex: number;
301
+ }) => HDKey;
296
302
  declare function deriveAddressIndexZeroFromAccount(keychain: HDKey): HDKey;
297
303
  declare const ecdsaPublicKeyLength = 33;
298
304
  declare function ecdsaPublicKeyToSchnorr(pubKey: Uint8Array): Uint8Array<ArrayBuffer>;
@@ -304,9 +310,9 @@ declare function getAddressFromOutScript(script: Uint8Array, bitcoinNetwork: Btc
304
310
  */
305
311
  type BtcSignerLibPaymentTypeIdentifers = 'wpkh' | 'wsh' | 'tr' | 'pkh' | 'sh';
306
312
  declare const paymentTypeMap: Record<BtcSignerLibPaymentTypeIdentifers, BitcoinPaymentTypes>;
307
- declare function btcSignerLibPaymentTypeToPaymentTypeMap(payment: BtcSignerLibPaymentTypeIdentifers): "p2wpkh" | "p2tr" | "p2pkh" | "p2sh" | "p2wpkh-p2sh";
313
+ declare function btcSignerLibPaymentTypeToPaymentTypeMap(payment: BtcSignerLibPaymentTypeIdentifers): "p2pkh" | "p2sh" | "p2wpkh-p2sh" | "p2wpkh" | "p2tr";
308
314
  declare function isBtcSignerLibPaymentType(payment: string): payment is BtcSignerLibPaymentTypeIdentifers;
309
- declare function parseKnownPaymentType(payment: BtcSignerLibPaymentTypeIdentifers | BitcoinPaymentTypes): "p2wpkh" | "p2tr" | "p2pkh" | "p2sh" | "p2wpkh-p2sh";
315
+ declare function parseKnownPaymentType(payment: BtcSignerLibPaymentTypeIdentifers | BitcoinPaymentTypes): "p2pkh" | "p2sh" | "p2wpkh-p2sh" | "p2wpkh" | "p2tr";
310
316
  type PaymentTypeMap<T> = Record<BitcoinPaymentTypes, T>;
311
317
  declare function whenPaymentType(mode: BitcoinPaymentTypes | BtcSignerLibPaymentTypeIdentifers): <T>(paymentMap: PaymentTypeMap<T>) => T;
312
318
  type SupportedPaymentType = 'p2wpkh' | 'p2tr';
@@ -329,17 +335,20 @@ declare function lookUpLedgerKeysByPath(getDerivationPath: (network: BitcoinNetw
329
335
  policy: string;
330
336
  } | undefined>, network: BitcoinNetworkModes) => (accountIndex: number) => BitcoinAccount | undefined;
331
337
  interface GetAddressArgs {
332
- index: number;
338
+ changeIndex: number;
339
+ addressIndex: number;
333
340
  keychain?: HDKey;
334
341
  network: BitcoinNetworkModes;
335
342
  }
336
343
  declare function getTaprootAddress({
337
- index,
344
+ changeIndex,
345
+ addressIndex,
338
346
  keychain,
339
347
  network
340
348
  }: GetAddressArgs): string;
341
349
  declare function getNativeSegwitAddress({
342
- index,
350
+ changeIndex,
351
+ addressIndex,
343
352
  keychain,
344
353
  network
345
354
  }: GetAddressArgs): string;
@@ -353,12 +362,24 @@ declare function getPsbtTxOutputs(psbtTx: btc.Transaction): TransactionOutput[];
353
362
  declare function inferNetworkFromAddress(address: BitcoinAddress): BitcoinNetworkModes;
354
363
  declare function inferPaymentTypeFromAddress(address: BitcoinAddress): SupportedPaymentType;
355
364
  declare function getBitcoinInputValue(input: TransactionInput): number;
365
+ declare function isTaprootDerivationPath(path: string): boolean;
366
+ declare function isNativeSegwitDerivationPath(path: string): boolean;
356
367
  //#endregion
357
368
  //#region src/payments/p2tr-address-gen.d.ts
358
369
  declare function makeTaprootAccountDerivationPath(network: BitcoinNetworkModes, accountIndex: number): string;
359
370
  /** @deprecated Use makeTaprootAccountDerivationPath */
360
371
  declare const getTaprootAccountDerivationPath: typeof makeTaprootAccountDerivationPath;
361
- declare function makeTaprootAddressIndexDerivationPath(network: BitcoinNetworkModes, accountIndex: number, addressIndex: number): string;
372
+ declare function makeTaprootAddressIndexDerivationPath({
373
+ network,
374
+ accountIndex,
375
+ changeIndex,
376
+ addressIndex
377
+ }: {
378
+ network: BitcoinNetworkModes;
379
+ accountIndex: number;
380
+ changeIndex: number;
381
+ addressIndex: number;
382
+ }): string;
362
383
  /** @deprecated Use makeTaprootAddressIndexDerivationPath */
363
384
  declare const getTaprootAddressIndexDerivationPath: typeof makeTaprootAddressIndexDerivationPath;
364
385
  declare function deriveTaprootAccount(keychain: HDKey, network: BitcoinNetworkModes): (accountIndex: number) => BitcoinAccount;
@@ -380,7 +401,17 @@ declare function deriveTaprootReceiveAddressIndexZero({
380
401
  declare function makeNativeSegwitAccountDerivationPath(network: BitcoinNetworkModes, accountIndex: number): string;
381
402
  /** @deprecated Use makeNativeSegwitAccountDerivationPath */
382
403
  declare const getNativeSegwitAccountDerivationPath: typeof makeNativeSegwitAccountDerivationPath;
383
- declare function makeNativeSegwitAddressIndexDerivationPath(network: BitcoinNetworkModes, accountIndex: number, addressIndex: number): string;
404
+ declare function makeNativeSegwitAddressIndexDerivationPath({
405
+ network,
406
+ accountIndex,
407
+ changeIndex,
408
+ addressIndex
409
+ }: {
410
+ network: BitcoinNetworkModes;
411
+ accountIndex: number;
412
+ changeIndex: number;
413
+ addressIndex: number;
414
+ }): string;
384
415
  /** @deprecated Use makeNativeSegwitAddressIndexDerivationPath */
385
416
  declare const getNativeSegwitAddressIndexDerivationPath: typeof makeNativeSegwitAddressIndexDerivationPath;
386
417
  declare function deriveNativeSegwitAccountFromRootKeychain(keychain: HDKey, network: BitcoinNetworkModes): (accountIndex: number) => BitcoinAccount;
@@ -743,5 +774,11 @@ declare function lookupDerivationByAddress(args: LookUpDerivationByAddressArgs):
743
774
  readonly path?: undefined;
744
775
  };
745
776
  //#endregion
746
- export { AllowedSighashTypes, BitcoinAccount, BitcoinAccountKeychain, BitcoinError, BitcoinErrorKey, BitcoinFees, BitcoinNativeSegwitPayer, BitcoinPayer, BitcoinPayerBase, BitcoinPayerInfo, BitcoinSigner, BitcoinTaprootPayer, BtcSignerDefaultBip32Derivation, BtcSignerLibPaymentTypeIdentifers, BtcSignerNetwork, BtcSignerTapBip32Derivation, CalculateMaxSpendResponse, CoinSelectionOutput, CoinSelectionRecipient, DeriveAddressesFromDescriptorArgs, DeriveAddressesFromDescriptorResult, DetermineUtxosForSpendArgs, GenerateBitcoinUnsignedTransactionArgs, GetBitcoinFeesArgs, 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, WithDerivePayer, bip21, bip322TransactionToSignValues, bitcoinNetworkModeToCoreNetworkMode, bitcoinNetworkToCoreNetworkMap, btcAddressNetworkValidator, btcAddressValidator, btcSignerLibPaymentTypeToPaymentTypeMap, calculateMaxSpend, coinTypeMap, createBitcoinAddress, createNativeSegwitBitcoinJsSigner, createTaprootBitcoinJsSigner, createToSpendTx, createWalletIdDecoratedPath, decodeBitcoinTx, decodeCompressedWifPrivateKey, 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, initBitcoinAccount, initializeBitcoinAccountKeychainFromDescriptor, invalidAddress, isBitcoinAddress, isBtcBalanceSufficient, isBtcMinimumSpend, isBtcSignerLibPaymentType, isSupportedMessageSigningPaymentType, isValidBitcoinAddress, isValidBitcoinNetworkAddress, isValidBitcoinTransaction, legacyAddress, lookUpLedgerKeysByPath, 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 };
777
+ //#region src/utils/deconstruct-btc-address.d.ts
778
+ declare function deconstructBtcAddress(address: string): {
779
+ type: string;
780
+ hashbytes: Uint8Array<ArrayBufferLike>;
781
+ };
782
+ //#endregion
783
+ export { AllowedSighashTypes, BitcoinAccount, BitcoinAccountKeychain, BitcoinError, BitcoinErrorKey, BitcoinFees, BitcoinNativeSegwitPayer, BitcoinPayer, BitcoinPayerBase, BitcoinPayerInfo, BitcoinSigner, BitcoinTaprootPayer, BtcSignerDefaultBip32Derivation, BtcSignerLibPaymentTypeIdentifers, BtcSignerNetwork, BtcSignerTapBip32Derivation, CalculateMaxSpendResponse, CoinSelectionOutput, CoinSelectionRecipient, DeriveAddressesFromDescriptorArgs, DeriveAddressesFromDescriptorResult, DetermineUtxosForSpendArgs, GenerateBitcoinUnsignedTransactionArgs, GetBitcoinFeesArgs, 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, WithDerivePayer, bip21, bip322TransactionToSignValues, bitcoinNetworkModeToCoreNetworkMode, bitcoinNetworkToCoreNetworkMap, btcAddressNetworkValidator, btcAddressValidator, btcSignerLibPaymentTypeToPaymentTypeMap, calculateMaxSpend, coinTypeMap, 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, initBitcoinAccount, initializeBitcoinAccountKeychainFromDescriptor, invalidAddress, isBitcoinAddress, isBtcBalanceSufficient, isBtcMinimumSpend, isBtcSignerLibPaymentType, isNativeSegwitDerivationPath, isSupportedMessageSigningPaymentType, isTaprootDerivationPath, isValidBitcoinAddress, isValidBitcoinNetworkAddress, isValidBitcoinTransaction, legacyAddress, lookUpLedgerKeysByPath, 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 };
747
784
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/bip21/bip21.ts","../src/bip322/bip322-utils.ts","../src/bip322/sign-message-bip322-bitcoinjs.ts","../src/coin-selection/calculate-max-spend.ts","../src/coin-selection/coin-selection.ts","../src/coin-selection/coin-selection.utils.ts","../src/fees/bitcoin-fees.ts","../src/mocks/mocks.ts","../src/schemas/address-schema.ts","../src/utils/bitcoin.network.ts","../src/utils/bitcoin.utils.ts","../src/payments/p2tr-address-gen.ts","../src/payments/p2wpkh-address-gen.ts","../src/payments/p2wsh-p2sh-address-gen.ts","../src/psbt/psbt-inputs.ts","../src/psbt/psbt-outputs.ts","../src/psbt/psbt-totals.ts","../src/psbt/psbt-details.ts","../src/psbt/utils.ts","../src/signer/bitcoin-signer.ts","../src/transactions/generate-unsigned-transaction.ts","../src/validation/address-validation.ts","../src/validation/amount-validation.ts","../src/validation/bitcoin-address.ts","../src/validation/bitcoin-error.ts","../src/validation/transaction-validation.ts","../src/utils/bitcoin.descriptors.ts","../src/utils/lookup-derivation-by-address.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;UAIU,gBAAA;;;;KAKL,WAAA;;QAGO;;;;;cAOC;+CACgC;qCAcR;;;;iBCjBrB,oBAAA,MAA0B,aAAU,OAAA,CAAA;iBAWpC,iBAAA,UAA2B,sBAAmB,W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9Jd,UAAA,Ec8JoD,wBd9JpD,EAAA,CAAA,EAAA,MAAA,EAAA;;;UetEe;;;WAGN;cACG;SACL;;kCAEyB,2BAA2B;;iBAE7C;;;;;ApBzBqC,CAAA,CAAA,CAAA;EAI3C,OAAA;EAAA,YAAgB;EAAA,OAAA;EAAA,UAAA;EAAA,aAAA;EAAA,KAAA;EAAA;AAAA,CAAA,EoB+BvB,sCpB/BuB,CoB+BgB,CpB/BhB,CAAA,CAAA,EAAA;EAKrB,EAAA,iBAAW;EAUH,GAAA,EAAA,MAsBZ;;;;ACxBD,CAAA;;;iBoBXgB,4BAAA,UAAsC,sBAAsB;iBAO5D,qBAAA;iBAQA,4BAAA,2BAAuD;;;UClB7D,4BAAA;gBACM;YACJ;;iBAEI,sBAAA;;;GAAmD;iBAInD,iBAAA,eAAgC;;;iBCNhC,gBAAA,0BAA0C;iBAU1C,oBAAA,iBAAqC;;;cCbxC,YAAA,SAAqB,KAAA;WAChB;uBACK;;KAUX,eAAA,GACR;;;UCPM,kBAAA,SAA2B,KAAK;UAChC;SACD;aACI;WACF;;;iBAIK,yBAAA;;;;;;;;GAQb;;;iBCVa;;;oBACG;iBAYH,8BAAA,sBAAoD;iBAYpD,yBAAA;UAQC,iCAAA;;WAEN;;;UAIM,mCAAA;;;;iBAKD,6BAAA;;;;GAIb,oCAAoC;;;UC/C7B,6BAAA;;;;;iBAKM,yBAAA,OAAgC,0CAM7B"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/bip21/bip21.ts","../src/bip322/bip322-utils.ts","../src/bip322/sign-message-bip322-bitcoinjs.ts","../src/coin-selection/calculate-max-spend.ts","../src/coin-selection/coin-selection.ts","../src/coin-selection/coin-selection.utils.ts","../src/fees/bitcoin-fees.ts","../src/mocks/mocks.ts","../src/schemas/address-schema.ts","../src/utils/bitcoin.network.ts","../src/utils/bitcoin.utils.ts","../src/payments/p2tr-address-gen.ts","../src/payments/p2wpkh-address-gen.ts","../src/payments/p2wsh-p2sh-address-gen.ts","../src/psbt/psbt-inputs.ts","../src/psbt/psbt-outputs.ts","../src/psbt/psbt-totals.ts","../src/psbt/psbt-details.ts","../src/psbt/utils.ts","../src/signer/bitcoin-signer.ts","../src/transactions/generate-unsigned-transaction.ts","../src/validation/address-validation.ts","../src/validation/amount-validation.ts","../src/validation/bitcoin-address.ts","../src/validation/bitcoin-error.ts","../src/validation/transaction-validation.ts","../src/utils/bitcoin.descriptors.ts","../src/utils/lookup-derivation-by-address.ts","../src/utils/deconstruct-btc-address.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;UAIU,gBAAA;;;;KAKL,WAAA;;QAGO;;;;;cAOC;+CACgC;qCAcR;;;;iBCjBrB,oBAAA,MAA0B,aAAU,OAAA,CAAA;iBAWpC,iBAAA,UAA2B,sBAAmB,WAAA;cAMjD;eAIZ,WAAA;;;;iBAQe,oCAAA;;;;;iBAQA,wBAAA,eAAuC,WAAQ,OAAA;iBAS/C,WAAA,SAAoB,OAAA,CAAQ,qBAAyB,OAAA,CAAQ;;;iBChD7D,iCAAA,aAA8C,SAAM,OAAA,CAAA;iBAIpD,4BAAA,aAAyC,SAAM,OAAA,CAAA;iBAI/C,eAAA,UACL,0CAEA;;;;UAsCD,uBAAA;WACC;;WAEA;iBACM,OAAA,CAAQ,OAAO,QAAQ,GAAA,CAAI;;iBAEtB,uBAAA,OAA8B,0BAAuB;;;EFlEjE,YAAA,QAAgB,YAAA,CAAA;EAKrB,SAAA,EAAA,MAAW;AAUhB,CAAA,CAAA;;;UGZU,qBAAA;;;;;;aAKG;;;UAII,yBAAA;;UAEP;oBACU;;iBAEJ,iBAAA;;;;;GAKb,wBAAwB;;;UChBV,mBAAA;;;;UAKA,sBAAA;;UAEP;;UAGO;;cAEH;SACL;;iBAEO;;;;;;;GAIb,2BAA2B;EJzBpB,MAAA,GAAA,EAAA;EAKL,OAAA,EAAA;IAUQ,KAsBZ,EAAA,MAAA;;;;ECxBe,GAAA,OAAA;AAWhB,CAAA;A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ACJ;;iBAEI,sBAAA;;;GAAmD;iBAInD,iBAAA,eAAgC;;;iBCNhC,gBAAA,0BAA0C;iBAU1C,oBAAA,iBAAqC;;;cCbxC,YAAA,SAAqB,KAAA;WAChB;uBACK;;KAUX,eAAA,GACR;;;UCPM,kBAAA,SAA2B,KAAK;UAChC;SACD;aACI;WACF;;;iBAIK,yBAAA;;;;;;;;GAQb;;;iBCVa;;;oBACG;iBAYH,8BAAA,sBAAoD;iBAYpD,yBAAA;UAQC,iCAAA;;WAEN;;;UAIM,mCAAA;;;;iBAKD,6BAAA;;;;GAIb,oCAAoC;;;UC/C7B,6BAAA;;;;;iBAKM,yBAAA,OAAgC,0CAM7B;;;;;;;;;;;iBCvBH,qBAAA;;aAAqB,WAAA"}
package/dist/index.js CHANGED
@@ -91,8 +91,8 @@ function makeTaprootAccountDerivationPath(network, accountIndex) {
91
91
  }
92
92
  /** @deprecated Use makeTaprootAccountDerivationPath */
93
93
  const getTaprootAccountDerivationPath = makeTaprootAccountDerivationPath;
94
- function makeTaprootAddressIndexDerivationPath(network, accountIndex, addressIndex) {
95
- return makeTaprootAccountDerivationPath(network, accountIndex) + `/0/${addressIndex}`;
94
+ function makeTaprootAddressIndexDerivationPath({ network, accountIndex, changeIndex, addressIndex }) {
95
+ return makeTaprootAccountDerivationPath(network, accountIndex) + `/${changeIndex}/${addressIndex}`;
96
96
  }
97
97
  /** @deprecated Use makeTaprootAddressIndexDerivationPath */
98
98
  const getTaprootAddressIndexDerivationPath = makeTaprootAddressIndexDerivationPath;
@@ -129,8 +129,8 @@ function makeNativeSegwitAccountDerivationPath(network, accountIndex) {
129
129
  }
130
130
  /** @deprecated Use makeNativeSegwitAccountDerivationPath */
131
131
  const getNativeSegwitAccountDerivationPath = makeNativeSegwitAccountDerivationPath;
132
- function makeNativeSegwitAddressIndexDerivationPath(network, accountIndex, addressIndex) {
133
- return makeNativeSegwitAccountDerivationPath(network, accountIndex) + `/0/${addressIndex}`;
132
+ function makeNativeSegwitAddressIndexDerivationPath({ network, accountIndex, changeIndex, addressIndex }) {
133
+ return makeNativeSegwitAccountDerivationPath(network, accountIndex) + `/${changeIndex}/${addressIndex}`;
134
134
  }
135
135
  /** @deprecated Use makeNativeSegwitAddressIndexDerivationPath */
136
136
  const getNativeSegwitAddressIndexDerivationPath = makeNativeSegwitAddressIndexDerivationPath;
@@ -243,10 +243,13 @@ function getBitcoinCoinTypeIndexByNetwork(network) {
243
243
  }
244
244
  function deriveAddressIndexKeychainFromAccount(keychain) {
245
245
  if (keychain.depth !== DerivationPathDepth.Account) throw new Error("Keychain passed is not an account");
246
- return (index) => keychain.deriveChild(0).deriveChild(index);
246
+ return ({ changeIndex, addressIndex }) => keychain.deriveChild(changeIndex).deriveChild(addressIndex);
247
247
  }
248
248
  function deriveAddressIndexZeroFromAccount(keychain) {
249
- return deriveAddressIndexKeychainFromAccount(keychain)(0);
249
+ return deriveAddressIndexKeychainFromAccount(keychain)({
250
+ changeIndex: 0,
251
+ addressIndex: 0
252
+ });
250
253
  }
251
254
  const ecdsaPublicKeyLength = 33;
252
255
  function ecdsaPublicKeyToSchnorr(pubKey) {
@@ -357,21 +360,27 @@ function lookUpLedgerKeysByPath(getDerivationPath) {
357
360
  return initBitcoinAccount(path, account.policy);
358
361
  };
359
362
  }
360
- function getTaprootAddress({ index, keychain, network }) {
363
+ function getTaprootAddress({ changeIndex, addressIndex, keychain, network }) {
361
364
  if (!keychain) throw new Error("Expected keychain to be provided");
362
365
  if (keychain.depth !== DerivationPathDepth.Account) throw new Error("Expects keychain to be on the account index");
363
- const addressIndex = deriveAddressIndexKeychainFromAccount(keychain)(index);
364
- if (!addressIndex.publicKey) throw new Error("Expected publicKey to be defined");
365
- const payment = getTaprootPayment(addressIndex.publicKey, network);
366
+ const addresskeychain = deriveAddressIndexKeychainFromAccount(keychain)({
367
+ changeIndex,
368
+ addressIndex
369
+ });
370
+ if (!addresskeychain.publicKey) throw new Error("Expected publicKey to be defined");
371
+ const payment = getTaprootPayment(addresskeychain.publicKey, network);
366
372
  if (!payment.address) throw new Error("Expected address to be defined");
367
373
  return payment.address;
368
374
  }
369
- function getNativeSegwitAddress({ index, keychain, network }) {
375
+ function getNativeSegwitAddress({ changeIndex, addressIndex, keychain, network }) {
370
376
  if (!keychain) throw new Error("Expected keychain to be provided");
371
377
  if (keychain.depth !== DerivationPathDepth.Account) throw new Error("Expects keychain to be on the account index");
372
- const addressIndex = deriveAddressIndexKeychainFromAccount(keychain)(index);
373
- if (!addressIndex.publicKey) throw new Error("Expected publicKey to be defined");
374
- const payment = getNativeSegwitPaymentFromAddressIndex(addressIndex, network);
378
+ const addressKeychain = deriveAddressIndexKeychainFromAccount(keychain)({
379
+ changeIndex,
380
+ addressIndex
381
+ });
382
+ if (!addressKeychain.publicKey) throw new Error("Expected publicKey to be defined");
383
+ const payment = getNativeSegwitPaymentFromAddressIndex(addressKeychain, network);
375
384
  if (!payment.address) throw new Error("Expected address to be defined");
376
385
  return payment.address;
377
386
  }
@@ -415,6 +424,12 @@ function getBitcoinInputValue(input) {
415
424
  if (isDefined(input.nonWitnessUtxo) && isDefined(input.index)) return Number(input.nonWitnessUtxo.outputs[input.index]?.amount);
416
425
  return 0;
417
426
  }
427
+ function isTaprootDerivationPath(path) {
428
+ return extractPurposeFromPath(path) === 86;
429
+ }
430
+ function isNativeSegwitDerivationPath(path) {
431
+ return extractPurposeFromPath(path) === 84;
432
+ }
418
433
 
419
434
  //#endregion
420
435
  //#region src/bip322/bip322-utils.ts
@@ -1333,22 +1348,29 @@ function deriveAddressesFromDescriptor({ accountDescriptor, network, limit = 1 }
1333
1348
  p2wpkh: makeNativeSegwitAddressIndexDerivationPath
1334
1349
  });
1335
1350
  const results = [];
1336
- for (let i = 0; i < limit; i++) {
1351
+ for (let addressIndex = 0; addressIndex < limit; ++addressIndex) for (let changeIndex = 0; changeIndex < 2; ++changeIndex) {
1337
1352
  const address = whenSupportedPaymentType(paymentType)({
1338
1353
  p2tr: getTaprootAddress({
1339
- index: i,
1354
+ addressIndex,
1355
+ changeIndex,
1340
1356
  keychain: accountKeychain,
1341
1357
  network
1342
1358
  }),
1343
1359
  p2wpkh: getNativeSegwitAddress({
1344
- index: i,
1360
+ addressIndex,
1361
+ changeIndex,
1345
1362
  keychain: accountKeychain,
1346
1363
  network
1347
1364
  })
1348
1365
  });
1349
1366
  results.push({
1350
1367
  address,
1351
- path: derivationPathFn(network, accountKeychain.index - HARDENED_OFFSET, i)
1368
+ path: derivationPathFn({
1369
+ network,
1370
+ accountIndex: accountKeychain.index - HARDENED_OFFSET,
1371
+ addressIndex,
1372
+ changeIndex
1373
+ })
1352
1374
  });
1353
1375
  }
1354
1376
  return results;
@@ -1362,21 +1384,24 @@ function lookupDerivationByAddress(args) {
1362
1384
  const nativeSegwitKeychain = HDKey.fromExtendedKey(nativeSegwitXpub);
1363
1385
  return (address) => {
1364
1386
  const network = inferNetworkFromAddress(address);
1387
+ const changeIndex = 0;
1365
1388
  const paymentType = inferPaymentTypeFromAddress(address);
1366
1389
  const accountIndex = whenSupportedPaymentType(paymentType)({
1367
1390
  p2tr: taprootKeychain.index - HARDENED_OFFSET,
1368
1391
  p2wpkh: nativeSegwitKeychain.index - HARDENED_OFFSET
1369
1392
  });
1370
- function getTaprootAddressAtIndex(index) {
1393
+ function getTaprootAddressAtIndex(addressIndex) {
1371
1394
  return getTaprootAddress({
1372
- index,
1395
+ changeIndex,
1396
+ addressIndex,
1373
1397
  keychain: taprootKeychain,
1374
1398
  network
1375
1399
  });
1376
1400
  }
1377
- function getNativeSegwitAddressAtIndex(index) {
1401
+ function getNativeSegwitAddressAtIndex(addressIndex) {
1378
1402
  return getNativeSegwitAddress({
1379
- index,
1403
+ changeIndex,
1404
+ addressIndex,
1380
1405
  keychain: nativeSegwitKeychain,
1381
1406
  network
1382
1407
  });
@@ -1400,7 +1425,12 @@ function lookupDerivationByAddress(args) {
1400
1425
  return {
1401
1426
  status: "success",
1402
1427
  duration: performance.now() - t0,
1403
- path: derivationPathFn(network, accountIndex, currentIndex)
1428
+ path: derivationPathFn({
1429
+ network,
1430
+ accountIndex,
1431
+ addressIndex: currentIndex,
1432
+ changeIndex
1433
+ })
1404
1434
  };
1405
1435
  }
1406
1436
  return { status: "failure" };
@@ -1408,5 +1438,28 @@ function lookupDerivationByAddress(args) {
1408
1438
  }
1409
1439
 
1410
1440
  //#endregion
1411
- export { BitcoinError, 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, bip21, bip322TransactionToSignValues, bitcoinNetworkModeToCoreNetworkMode, bitcoinNetworkToCoreNetworkMap, btcAddressNetworkValidator, btcAddressValidator, btcSignerLibPaymentTypeToPaymentTypeMap, calculateMaxSpend, coinTypeMap, createBitcoinAddress, createNativeSegwitBitcoinJsSigner, createTaprootBitcoinJsSigner, createToSpendTx, createWalletIdDecoratedPath, decodeBitcoinTx, decodeCompressedWifPrivateKey, 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, initBitcoinAccount, initializeBitcoinAccountKeychainFromDescriptor, invalidAddress, isBitcoinAddress, isBtcBalanceSufficient, isBtcMinimumSpend, isBtcSignerLibPaymentType, isSupportedMessageSigningPaymentType, isValidBitcoinAddress, isValidBitcoinNetworkAddress, isValidBitcoinTransaction, legacyAddress, lookUpLedgerKeysByPath, 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 };
1441
+ //#region src/utils/deconstruct-btc-address.ts
1442
+ function deconstructBtcAddress(address) {
1443
+ const typeMapping = {
1444
+ [AddressType.p2pkh]: "0x00",
1445
+ [AddressType.p2sh]: "0x01",
1446
+ [AddressType.p2wpkh]: "0x04",
1447
+ [AddressType.p2wsh]: "0x05",
1448
+ [AddressType.p2tr]: "0x06"
1449
+ };
1450
+ const addressInfo = getAddressInfo(address);
1451
+ const { bech32 } = addressInfo;
1452
+ let hashbytes;
1453
+ if (bech32) hashbytes = bitcoinJs.address.fromBech32(address).data;
1454
+ else hashbytes = bitcoinJs.address.fromBase58Check(address).hash;
1455
+ const type = typeMapping[addressInfo.type];
1456
+ if (!type) throw new Error(`Unsupported address type: ${addressInfo.type}`);
1457
+ return {
1458
+ type,
1459
+ hashbytes
1460
+ };
1461
+ }
1462
+
1463
+ //#endregion
1464
+ export { BitcoinError, 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, bip21, bip322TransactionToSignValues, bitcoinNetworkModeToCoreNetworkMode, bitcoinNetworkToCoreNetworkMap, btcAddressNetworkValidator, btcAddressValidator, btcSignerLibPaymentTypeToPaymentTypeMap, calculateMaxSpend, coinTypeMap, 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, initBitcoinAccount, initializeBitcoinAccountKeychainFromDescriptor, invalidAddress, isBitcoinAddress, isBtcBalanceSufficient, isBtcMinimumSpend, isBtcSignerLibPaymentType, isNativeSegwitDerivationPath, isSupportedMessageSigningPaymentType, isTaprootDerivationPath, isValidBitcoinAddress, isValidBitcoinNetworkAddress, isValidBitcoinTransaction, legacyAddress, lookUpLedgerKeysByPath, 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 };
1412
1465
  //# sourceMappingURL=index.js.map