@leather.io/bitcoin 0.35.8 → 0.36.3
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.
- package/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +52 -0
- package/dist/index.d.ts +50 -33
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +81 -46
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/coin-selection/calculate-max-spend.spec.ts +6 -11
- package/src/coin-selection/calculate-max-spend.ts +7 -13
- package/src/index.ts +1 -1
- package/src/payments/p2tr-address-gen.spec.ts +73 -21
- package/src/payments/p2tr-address-gen.ts +14 -6
- package/src/payments/p2wpkh-address-gen.spec.ts +37 -1
- package/src/payments/p2wpkh-address-gen.ts +14 -6
- package/src/utils/bitcoin.descriptors.ts +21 -9
- package/src/utils/bitcoin.utils.spec.ts +110 -1
- package/src/utils/bitcoin.utils.ts +40 -11
- package/src/utils/deconstruct-btc-address.ts +32 -0
- package/src/utils/lookup-derivation-by-address.ts +16 -5
- package/src/validation/transaction-validation.spec.ts +0 -97
- package/src/validation/transaction-validation.ts +0 -44
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @leather.io/bitcoin@0.
|
|
2
|
+
> @leather.io/bitcoin@0.36.3 build /home/runner/work/mono/mono/packages/bitcoin
|
|
3
3
|
> tsdown
|
|
4
4
|
|
|
5
5
|
[34mℹ[39m tsdown [2mv0.16.5[22m powered by rolldown [2mv1.0.0-beta.50[22m
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
[34mℹ[39m entry: [34msrc/index.ts[39m
|
|
8
8
|
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
9
9
|
[34mℹ[39m Build start
|
|
10
|
-
[34mℹ[39m [2mdist/[22m[1mindex.js[22m [2m
|
|
11
|
-
[34mℹ[39m [2mdist/[22mindex.js.map [
|
|
12
|
-
[34mℹ[39m [2mdist/[22mindex.d.ts.map [2m 10.
|
|
13
|
-
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.ts[22m[39m [2m 30.
|
|
14
|
-
[34mℹ[39m 4 files, total:
|
|
15
|
-
[32m✔[39m Build complete in [
|
|
10
|
+
[34mℹ[39m [2mdist/[22m[1mindex.js[22m [2m 56.22 kB[22m [2m│ gzip: 13.31 kB[22m
|
|
11
|
+
[34mℹ[39m [2mdist/[22mindex.js.map [2m113.42 kB[22m [2m│ gzip: 26.77 kB[22m
|
|
12
|
+
[34mℹ[39m [2mdist/[22mindex.d.ts.map [2m 10.29 kB[22m [2m│ gzip: 4.29 kB[22m
|
|
13
|
+
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.ts[22m[39m [2m 30.85 kB[22m [2m│ gzip: 6.36 kB[22m
|
|
14
|
+
[34mℹ[39m 4 files, total: 210.79 kB
|
|
15
|
+
[32m✔[39m Build complete in [32m4134ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -939,6 +939,58 @@
|
|
|
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.3](https://github.com/leather-io/mono/compare/@leather.io/bitcoin-v0.36.2...@leather.io/bitcoin-v0.36.3) (2026-01-21)
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
### Dependencies
|
|
946
|
+
|
|
947
|
+
* The following workspace dependencies were updated
|
|
948
|
+
* dependencies
|
|
949
|
+
* @leather.io/constants bumped to 0.30.0
|
|
950
|
+
* @leather.io/crypto bumped to 1.12.13
|
|
951
|
+
* @leather.io/utils bumped to 0.49.7
|
|
952
|
+
* devDependencies
|
|
953
|
+
* @leather.io/rpc bumped to 2.21.7
|
|
954
|
+
|
|
955
|
+
## [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)
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
### Bug Fixes
|
|
959
|
+
|
|
960
|
+
* change addresses support ([7469bcc](https://github.com/leather-io/mono/commit/7469bcc3bc4b44bda655c5d86b0a66397aea419b))
|
|
961
|
+
|
|
962
|
+
## [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)
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
### Dependencies
|
|
966
|
+
|
|
967
|
+
* The following workspace dependencies were updated
|
|
968
|
+
* dependencies
|
|
969
|
+
* @leather.io/constants bumped to 0.29.0
|
|
970
|
+
* @leather.io/crypto bumped to 1.12.12
|
|
971
|
+
* @leather.io/utils bumped to 0.49.6
|
|
972
|
+
* devDependencies
|
|
973
|
+
* @leather.io/rpc bumped to 2.21.6
|
|
974
|
+
|
|
975
|
+
## [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)
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
### Features
|
|
979
|
+
|
|
980
|
+
* add withdrawal and fee logic to sbtc swap provider service ([3d277dd](https://github.com/leather-io/mono/commit/3d277dd8e1f56eae7772b4a042f66288b87101ba))
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
### Dependencies
|
|
984
|
+
|
|
985
|
+
* The following workspace dependencies were updated
|
|
986
|
+
* dependencies
|
|
987
|
+
* @leather.io/constants bumped to 0.28.5
|
|
988
|
+
* @leather.io/crypto bumped to 1.12.11
|
|
989
|
+
* @leather.io/models bumped to 0.52.0
|
|
990
|
+
* @leather.io/utils bumped to 0.49.5
|
|
991
|
+
* devDependencies
|
|
992
|
+
* @leather.io/rpc bumped to 2.21.5
|
|
993
|
+
|
|
942
994
|
## [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)
|
|
943
995
|
|
|
944
996
|
|
package/dist/index.d.ts
CHANGED
|
@@ -69,14 +69,13 @@ declare function signBip322MessageSimple(args: SignBip322MessageSimple): Promise
|
|
|
69
69
|
}>;
|
|
70
70
|
//#endregion
|
|
71
71
|
//#region src/coin-selection/calculate-max-spend.d.ts
|
|
72
|
-
interface
|
|
72
|
+
interface CalculateMaxSpendParams {
|
|
73
73
|
recipient: string;
|
|
74
74
|
utxos: {
|
|
75
75
|
value: number;
|
|
76
76
|
txid: string;
|
|
77
77
|
}[];
|
|
78
|
-
|
|
79
|
-
feeRate?: number;
|
|
78
|
+
feeRate: number;
|
|
80
79
|
}
|
|
81
80
|
interface CalculateMaxSpendResponse {
|
|
82
81
|
spendAllFee: number;
|
|
@@ -86,9 +85,8 @@ interface CalculateMaxSpendResponse {
|
|
|
86
85
|
declare function calculateMaxSpend({
|
|
87
86
|
recipient,
|
|
88
87
|
utxos,
|
|
89
|
-
feeRate
|
|
90
|
-
|
|
91
|
-
}: CalculateMaxSpendArgs): CalculateMaxSpendResponse;
|
|
88
|
+
feeRate
|
|
89
|
+
}: CalculateMaxSpendParams): CalculateMaxSpendResponse;
|
|
92
90
|
//#endregion
|
|
93
91
|
//#region src/coin-selection/coin-selection.d.ts
|
|
94
92
|
interface CoinSelectionOutput {
|
|
@@ -292,7 +290,13 @@ declare function whenBitcoinNetwork(mode: BitcoinNetworkModes): <T extends Bitco
|
|
|
292
290
|
*/
|
|
293
291
|
declare const coinTypeMap: Record<NetworkModes, 0 | 1>;
|
|
294
292
|
declare function getBitcoinCoinTypeIndexByNetwork(network: BitcoinNetworkModes): 0 | 1;
|
|
295
|
-
declare function deriveAddressIndexKeychainFromAccount(keychain: HDKey): (
|
|
293
|
+
declare function deriveAddressIndexKeychainFromAccount(keychain: HDKey): ({
|
|
294
|
+
changeIndex,
|
|
295
|
+
addressIndex
|
|
296
|
+
}: {
|
|
297
|
+
changeIndex: number;
|
|
298
|
+
addressIndex: number;
|
|
299
|
+
}) => HDKey;
|
|
296
300
|
declare function deriveAddressIndexZeroFromAccount(keychain: HDKey): HDKey;
|
|
297
301
|
declare const ecdsaPublicKeyLength = 33;
|
|
298
302
|
declare function ecdsaPublicKeyToSchnorr(pubKey: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
@@ -304,9 +308,9 @@ declare function getAddressFromOutScript(script: Uint8Array, bitcoinNetwork: Btc
|
|
|
304
308
|
*/
|
|
305
309
|
type BtcSignerLibPaymentTypeIdentifers = 'wpkh' | 'wsh' | 'tr' | 'pkh' | 'sh';
|
|
306
310
|
declare const paymentTypeMap: Record<BtcSignerLibPaymentTypeIdentifers, BitcoinPaymentTypes>;
|
|
307
|
-
declare function btcSignerLibPaymentTypeToPaymentTypeMap(payment: BtcSignerLibPaymentTypeIdentifers): "
|
|
311
|
+
declare function btcSignerLibPaymentTypeToPaymentTypeMap(payment: BtcSignerLibPaymentTypeIdentifers): "p2pkh" | "p2sh" | "p2wpkh" | "p2tr" | "p2wpkh-p2sh";
|
|
308
312
|
declare function isBtcSignerLibPaymentType(payment: string): payment is BtcSignerLibPaymentTypeIdentifers;
|
|
309
|
-
declare function parseKnownPaymentType(payment: BtcSignerLibPaymentTypeIdentifers | BitcoinPaymentTypes): "
|
|
313
|
+
declare function parseKnownPaymentType(payment: BtcSignerLibPaymentTypeIdentifers | BitcoinPaymentTypes): "p2pkh" | "p2sh" | "p2wpkh" | "p2tr" | "p2wpkh-p2sh";
|
|
310
314
|
type PaymentTypeMap<T> = Record<BitcoinPaymentTypes, T>;
|
|
311
315
|
declare function whenPaymentType(mode: BitcoinPaymentTypes | BtcSignerLibPaymentTypeIdentifers): <T>(paymentMap: PaymentTypeMap<T>) => T;
|
|
312
316
|
type SupportedPaymentType = 'p2wpkh' | 'p2tr';
|
|
@@ -329,17 +333,20 @@ declare function lookUpLedgerKeysByPath(getDerivationPath: (network: BitcoinNetw
|
|
|
329
333
|
policy: string;
|
|
330
334
|
} | undefined>, network: BitcoinNetworkModes) => (accountIndex: number) => BitcoinAccount | undefined;
|
|
331
335
|
interface GetAddressArgs {
|
|
332
|
-
|
|
336
|
+
changeIndex: number;
|
|
337
|
+
addressIndex: number;
|
|
333
338
|
keychain?: HDKey;
|
|
334
339
|
network: BitcoinNetworkModes;
|
|
335
340
|
}
|
|
336
341
|
declare function getTaprootAddress({
|
|
337
|
-
|
|
342
|
+
changeIndex,
|
|
343
|
+
addressIndex,
|
|
338
344
|
keychain,
|
|
339
345
|
network
|
|
340
346
|
}: GetAddressArgs): string;
|
|
341
347
|
declare function getNativeSegwitAddress({
|
|
342
|
-
|
|
348
|
+
changeIndex,
|
|
349
|
+
addressIndex,
|
|
343
350
|
keychain,
|
|
344
351
|
network
|
|
345
352
|
}: GetAddressArgs): string;
|
|
@@ -353,12 +360,24 @@ declare function getPsbtTxOutputs(psbtTx: btc.Transaction): TransactionOutput[];
|
|
|
353
360
|
declare function inferNetworkFromAddress(address: BitcoinAddress): BitcoinNetworkModes;
|
|
354
361
|
declare function inferPaymentTypeFromAddress(address: BitcoinAddress): SupportedPaymentType;
|
|
355
362
|
declare function getBitcoinInputValue(input: TransactionInput): number;
|
|
363
|
+
declare function isTaprootDerivationPath(path: string): boolean;
|
|
364
|
+
declare function isNativeSegwitDerivationPath(path: string): boolean;
|
|
356
365
|
//#endregion
|
|
357
366
|
//#region src/payments/p2tr-address-gen.d.ts
|
|
358
367
|
declare function makeTaprootAccountDerivationPath(network: BitcoinNetworkModes, accountIndex: number): string;
|
|
359
368
|
/** @deprecated Use makeTaprootAccountDerivationPath */
|
|
360
369
|
declare const getTaprootAccountDerivationPath: typeof makeTaprootAccountDerivationPath;
|
|
361
|
-
declare function makeTaprootAddressIndexDerivationPath(
|
|
370
|
+
declare function makeTaprootAddressIndexDerivationPath({
|
|
371
|
+
network,
|
|
372
|
+
accountIndex,
|
|
373
|
+
changeIndex,
|
|
374
|
+
addressIndex
|
|
375
|
+
}: {
|
|
376
|
+
network: BitcoinNetworkModes;
|
|
377
|
+
accountIndex: number;
|
|
378
|
+
changeIndex: number;
|
|
379
|
+
addressIndex: number;
|
|
380
|
+
}): string;
|
|
362
381
|
/** @deprecated Use makeTaprootAddressIndexDerivationPath */
|
|
363
382
|
declare const getTaprootAddressIndexDerivationPath: typeof makeTaprootAddressIndexDerivationPath;
|
|
364
383
|
declare function deriveTaprootAccount(keychain: HDKey, network: BitcoinNetworkModes): (accountIndex: number) => BitcoinAccount;
|
|
@@ -380,7 +399,17 @@ declare function deriveTaprootReceiveAddressIndexZero({
|
|
|
380
399
|
declare function makeNativeSegwitAccountDerivationPath(network: BitcoinNetworkModes, accountIndex: number): string;
|
|
381
400
|
/** @deprecated Use makeNativeSegwitAccountDerivationPath */
|
|
382
401
|
declare const getNativeSegwitAccountDerivationPath: typeof makeNativeSegwitAccountDerivationPath;
|
|
383
|
-
declare function makeNativeSegwitAddressIndexDerivationPath(
|
|
402
|
+
declare function makeNativeSegwitAddressIndexDerivationPath({
|
|
403
|
+
network,
|
|
404
|
+
accountIndex,
|
|
405
|
+
changeIndex,
|
|
406
|
+
addressIndex
|
|
407
|
+
}: {
|
|
408
|
+
network: BitcoinNetworkModes;
|
|
409
|
+
accountIndex: number;
|
|
410
|
+
changeIndex: number;
|
|
411
|
+
addressIndex: number;
|
|
412
|
+
}): string;
|
|
384
413
|
/** @deprecated Use makeNativeSegwitAddressIndexDerivationPath */
|
|
385
414
|
declare const getNativeSegwitAddressIndexDerivationPath: typeof makeNativeSegwitAddressIndexDerivationPath;
|
|
386
415
|
declare function deriveNativeSegwitAccountFromRootKeychain(keychain: HDKey, network: BitcoinNetworkModes): (accountIndex: number) => BitcoinAccount;
|
|
@@ -687,24 +716,6 @@ declare class BitcoinError extends Error {
|
|
|
687
716
|
}
|
|
688
717
|
type BitcoinErrorKey = TransactionErrorKey | 'InsufficientAmount' | 'NoInputsToSign' | 'NoOutputsToSign' | 'InscribedUtxos';
|
|
689
718
|
//#endregion
|
|
690
|
-
//#region src/validation/transaction-validation.d.ts
|
|
691
|
-
interface BitcoinTransaction extends Omit<GetBitcoinFeesArgs, 'recipients'> {
|
|
692
|
-
amount: Money;
|
|
693
|
-
payer: BitcoinAddress;
|
|
694
|
-
recipient: BitcoinAddress;
|
|
695
|
-
network: BitcoinNetworkModes;
|
|
696
|
-
feeRate: number;
|
|
697
|
-
}
|
|
698
|
-
declare function isValidBitcoinTransaction({
|
|
699
|
-
amount,
|
|
700
|
-
payer,
|
|
701
|
-
recipient,
|
|
702
|
-
network,
|
|
703
|
-
utxos,
|
|
704
|
-
feeRate,
|
|
705
|
-
feeRates
|
|
706
|
-
}: BitcoinTransaction): void;
|
|
707
|
-
//#endregion
|
|
708
719
|
//#region src/utils/bitcoin.descriptors.d.ts
|
|
709
720
|
declare function getDescriptorFromKeychain<T extends {
|
|
710
721
|
keyOrigin: string;
|
|
@@ -743,5 +754,11 @@ declare function lookupDerivationByAddress(args: LookUpDerivationByAddressArgs):
|
|
|
743
754
|
readonly path?: undefined;
|
|
744
755
|
};
|
|
745
756
|
//#endregion
|
|
746
|
-
|
|
757
|
+
//#region src/utils/deconstruct-btc-address.d.ts
|
|
758
|
+
declare function deconstructBtcAddress(address: string): {
|
|
759
|
+
type: string;
|
|
760
|
+
hashbytes: Uint8Array<ArrayBufferLike>;
|
|
761
|
+
};
|
|
762
|
+
//#endregion
|
|
763
|
+
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, 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
764
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,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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C,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/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;;;;;iBA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AAA,MAAA;;;;;AAiBF;;AAEE,iBc6Jc,yBAAA,Cd7Jd,UAAA,Ec6JoD,wBd7JpD,EAAA,CAAA,EAAA,MAAA,EAAA;;;UevEe;;;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;;;iBCDY;;;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) +
|
|
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) +
|
|
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 (
|
|
246
|
+
return ({ changeIndex, addressIndex }) => keychain.deriveChild(changeIndex).deriveChild(addressIndex);
|
|
247
247
|
}
|
|
248
248
|
function deriveAddressIndexZeroFromAccount(keychain) {
|
|
249
|
-
return deriveAddressIndexKeychainFromAccount(keychain)(
|
|
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({
|
|
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
|
|
364
|
-
|
|
365
|
-
|
|
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({
|
|
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
|
|
373
|
-
|
|
374
|
-
|
|
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
|
|
@@ -746,23 +761,22 @@ function filterUneconomicalUtxos({ utxos, feeRate, recipients }) {
|
|
|
746
761
|
|
|
747
762
|
//#endregion
|
|
748
763
|
//#region src/coin-selection/calculate-max-spend.ts
|
|
749
|
-
function calculateMaxSpend({ recipient, utxos, feeRate
|
|
750
|
-
if (!utxos.length
|
|
764
|
+
function calculateMaxSpend({ recipient, utxos, feeRate }) {
|
|
765
|
+
if (!utxos.length) return {
|
|
751
766
|
spendAllFee: 0,
|
|
752
767
|
amount: createMoney(0, "BTC"),
|
|
753
768
|
spendableBitcoin: new BigNumber(0)
|
|
754
769
|
};
|
|
755
|
-
const currentFeeRate = feeRate ?? feeRates.halfHourFee.toNumber();
|
|
756
770
|
const { spendableAmount, fee } = getSpendableAmount({
|
|
757
771
|
utxos: filterUneconomicalUtxos({
|
|
758
772
|
utxos,
|
|
759
|
-
feeRate
|
|
773
|
+
feeRate,
|
|
760
774
|
recipients: [{
|
|
761
775
|
address: recipient,
|
|
762
776
|
amount: createMoney(0, "BTC")
|
|
763
777
|
}]
|
|
764
778
|
}),
|
|
765
|
-
feeRate
|
|
779
|
+
feeRate,
|
|
766
780
|
recipients: [{
|
|
767
781
|
address: recipient,
|
|
768
782
|
amount: createMoney(0, "BTC")
|
|
@@ -1287,23 +1301,6 @@ function isBtcMinimumSpend(desiredSpend) {
|
|
|
1287
1301
|
return !desiredSpend.amount.isLessThan(BITCOIN_MINIMUM_SPEND_IN_SATS);
|
|
1288
1302
|
}
|
|
1289
1303
|
|
|
1290
|
-
//#endregion
|
|
1291
|
-
//#region src/validation/transaction-validation.ts
|
|
1292
|
-
function isValidBitcoinTransaction({ amount, payer, recipient, network, utxos, feeRate, feeRates }) {
|
|
1293
|
-
if (!isValidBitcoinAddress(payer) || !isValidBitcoinAddress(recipient)) throw new BitcoinError("InvalidAddress");
|
|
1294
|
-
if (!isValidBitcoinNetworkAddress(payer, network) || !isValidBitcoinNetworkAddress(recipient, network)) throw new BitcoinError("InvalidNetworkAddress");
|
|
1295
|
-
if (!isBtcMinimumSpend(amount)) throw new BitcoinError("InsufficientAmount");
|
|
1296
|
-
if (!isBtcBalanceSufficient({
|
|
1297
|
-
desiredSpend: amount,
|
|
1298
|
-
maxSpend: calculateMaxSpend({
|
|
1299
|
-
recipient,
|
|
1300
|
-
utxos,
|
|
1301
|
-
feeRate,
|
|
1302
|
-
feeRates
|
|
1303
|
-
}).amount
|
|
1304
|
-
})) throw new BitcoinError("InsufficientFunds");
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
1304
|
//#endregion
|
|
1308
1305
|
//#region src/utils/bitcoin.descriptors.ts
|
|
1309
1306
|
function getDescriptorFromKeychain(accountKeychain) {
|
|
@@ -1333,22 +1330,29 @@ function deriveAddressesFromDescriptor({ accountDescriptor, network, limit = 1 }
|
|
|
1333
1330
|
p2wpkh: makeNativeSegwitAddressIndexDerivationPath
|
|
1334
1331
|
});
|
|
1335
1332
|
const results = [];
|
|
1336
|
-
for (let
|
|
1333
|
+
for (let addressIndex = 0; addressIndex < limit; ++addressIndex) for (let changeIndex = 0; changeIndex < 2; ++changeIndex) {
|
|
1337
1334
|
const address = whenSupportedPaymentType(paymentType)({
|
|
1338
1335
|
p2tr: getTaprootAddress({
|
|
1339
|
-
|
|
1336
|
+
addressIndex,
|
|
1337
|
+
changeIndex,
|
|
1340
1338
|
keychain: accountKeychain,
|
|
1341
1339
|
network
|
|
1342
1340
|
}),
|
|
1343
1341
|
p2wpkh: getNativeSegwitAddress({
|
|
1344
|
-
|
|
1342
|
+
addressIndex,
|
|
1343
|
+
changeIndex,
|
|
1345
1344
|
keychain: accountKeychain,
|
|
1346
1345
|
network
|
|
1347
1346
|
})
|
|
1348
1347
|
});
|
|
1349
1348
|
results.push({
|
|
1350
1349
|
address,
|
|
1351
|
-
path: derivationPathFn(
|
|
1350
|
+
path: derivationPathFn({
|
|
1351
|
+
network,
|
|
1352
|
+
accountIndex: accountKeychain.index - HARDENED_OFFSET,
|
|
1353
|
+
addressIndex,
|
|
1354
|
+
changeIndex
|
|
1355
|
+
})
|
|
1352
1356
|
});
|
|
1353
1357
|
}
|
|
1354
1358
|
return results;
|
|
@@ -1362,21 +1366,24 @@ function lookupDerivationByAddress(args) {
|
|
|
1362
1366
|
const nativeSegwitKeychain = HDKey.fromExtendedKey(nativeSegwitXpub);
|
|
1363
1367
|
return (address) => {
|
|
1364
1368
|
const network = inferNetworkFromAddress(address);
|
|
1369
|
+
const changeIndex = 0;
|
|
1365
1370
|
const paymentType = inferPaymentTypeFromAddress(address);
|
|
1366
1371
|
const accountIndex = whenSupportedPaymentType(paymentType)({
|
|
1367
1372
|
p2tr: taprootKeychain.index - HARDENED_OFFSET,
|
|
1368
1373
|
p2wpkh: nativeSegwitKeychain.index - HARDENED_OFFSET
|
|
1369
1374
|
});
|
|
1370
|
-
function getTaprootAddressAtIndex(
|
|
1375
|
+
function getTaprootAddressAtIndex(addressIndex) {
|
|
1371
1376
|
return getTaprootAddress({
|
|
1372
|
-
|
|
1377
|
+
changeIndex,
|
|
1378
|
+
addressIndex,
|
|
1373
1379
|
keychain: taprootKeychain,
|
|
1374
1380
|
network
|
|
1375
1381
|
});
|
|
1376
1382
|
}
|
|
1377
|
-
function getNativeSegwitAddressAtIndex(
|
|
1383
|
+
function getNativeSegwitAddressAtIndex(addressIndex) {
|
|
1378
1384
|
return getNativeSegwitAddress({
|
|
1379
|
-
|
|
1385
|
+
changeIndex,
|
|
1386
|
+
addressIndex,
|
|
1380
1387
|
keychain: nativeSegwitKeychain,
|
|
1381
1388
|
network
|
|
1382
1389
|
});
|
|
@@ -1400,7 +1407,12 @@ function lookupDerivationByAddress(args) {
|
|
|
1400
1407
|
return {
|
|
1401
1408
|
status: "success",
|
|
1402
1409
|
duration: performance.now() - t0,
|
|
1403
|
-
path: derivationPathFn(
|
|
1410
|
+
path: derivationPathFn({
|
|
1411
|
+
network,
|
|
1412
|
+
accountIndex,
|
|
1413
|
+
addressIndex: currentIndex,
|
|
1414
|
+
changeIndex
|
|
1415
|
+
})
|
|
1404
1416
|
};
|
|
1405
1417
|
}
|
|
1406
1418
|
return { status: "failure" };
|
|
@@ -1408,5 +1420,28 @@ function lookupDerivationByAddress(args) {
|
|
|
1408
1420
|
}
|
|
1409
1421
|
|
|
1410
1422
|
//#endregion
|
|
1411
|
-
|
|
1423
|
+
//#region src/utils/deconstruct-btc-address.ts
|
|
1424
|
+
function deconstructBtcAddress(address) {
|
|
1425
|
+
const typeMapping = {
|
|
1426
|
+
[AddressType.p2pkh]: "0x00",
|
|
1427
|
+
[AddressType.p2sh]: "0x01",
|
|
1428
|
+
[AddressType.p2wpkh]: "0x04",
|
|
1429
|
+
[AddressType.p2wsh]: "0x05",
|
|
1430
|
+
[AddressType.p2tr]: "0x06"
|
|
1431
|
+
};
|
|
1432
|
+
const addressInfo = getAddressInfo(address);
|
|
1433
|
+
const { bech32 } = addressInfo;
|
|
1434
|
+
let hashbytes;
|
|
1435
|
+
if (bech32) hashbytes = bitcoinJs.address.fromBech32(address).data;
|
|
1436
|
+
else hashbytes = bitcoinJs.address.fromBase58Check(address).hash;
|
|
1437
|
+
const type = typeMapping[addressInfo.type];
|
|
1438
|
+
if (!type) throw new Error(`Unsupported address type: ${addressInfo.type}`);
|
|
1439
|
+
return {
|
|
1440
|
+
type,
|
|
1441
|
+
hashbytes
|
|
1442
|
+
};
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
//#endregion
|
|
1446
|
+
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, 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
1447
|
//# sourceMappingURL=index.js.map
|