@leather.io/bitcoin 0.8.0

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/.eslintrc.yml ADDED
@@ -0,0 +1,4 @@
1
+ extends: '@leather.io/eslint-config'
2
+ parserOptions:
3
+ project: ./tsconfig.json
4
+ ignorePatterns: .eslintrc.js
@@ -0,0 +1,17 @@
1
+
2
+ > @leather.io/bitcoin@0.8.0 build /home/runner/work/mono/mono/packages/bitcoin
3
+ > tsup
4
+
5
+ CLI Building entry: src/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.1.0
8
+ CLI Using tsup config: /home/runner/work/mono/mono/packages/bitcoin/tsup.config.ts
9
+ CLI Target: es2022
10
+ CLI Cleaning output folder
11
+ ESM Build start
12
+ ESM dist/index.js 17.97 KB
13
+ ESM dist/index.js.map 33.41 KB
14
+ ESM ⚡️ Build success in 30ms
15
+ DTS Build start
16
+ DTS ⚡️ Build success in 1954ms
17
+ DTS dist/index.d.ts 9.39 KB
package/CHANGELOG.md ADDED
@@ -0,0 +1,283 @@
1
+ # Changelog
2
+
3
+ ### Dependencies
4
+
5
+ * The following workspace dependencies were updated
6
+ * dependencies
7
+ * @leather.io/models bumped to 0.6.2
8
+ * @leather.io/utils bumped to 0.6.2
9
+
10
+ ### Dependencies
11
+
12
+ * The following workspace dependencies were updated
13
+ * dependencies
14
+ * @leather.io/models bumped to 0.6.3
15
+ * @leather.io/utils bumped to 0.6.3
16
+
17
+ ### Dependencies
18
+
19
+ * The following workspace dependencies were updated
20
+ * dependencies
21
+ * @leather.io/models bumped to 0.6.4
22
+ * @leather.io/utils bumped to 0.6.4
23
+
24
+ ### Dependencies
25
+
26
+ * The following workspace dependencies were updated
27
+ * dependencies
28
+ * @leather.io/models bumped to 0.6.5
29
+ * @leather.io/utils bumped to 0.6.5
30
+
31
+ ### Dependencies
32
+
33
+ * The following workspace dependencies were updated
34
+ * dependencies
35
+ * @leather.io/models bumped to 0.6.6
36
+ * @leather.io/utils bumped to 0.6.6
37
+
38
+ ### Dependencies
39
+
40
+ * The following workspace dependencies were updated
41
+ * dependencies
42
+ * @leather.io/crypto bumped to 1.0.0
43
+
44
+ ### Dependencies
45
+
46
+ * The following workspace dependencies were updated
47
+ * dependencies
48
+ * @leather.io/crypto bumped to 1.0.1
49
+
50
+ ### Dependencies
51
+
52
+ * The following workspace dependencies were updated
53
+ * dependencies
54
+ * @leather.io/constants bumped to 0.6.3
55
+ * @leather.io/models bumped to 0.6.8
56
+ * @leather.io/utils bumped to 0.7.0
57
+ * devDependencies
58
+ * @leather.io/eslint-config bumped to 0.5.0
59
+ * @leather.io/rpc bumped to 1.0.1
60
+
61
+ ### Dependencies
62
+
63
+ * The following workspace dependencies were updated
64
+ * dependencies
65
+ * @leather.io/models bumped to 0.8.0
66
+ * @leather.io/utils bumped to 0.8.1
67
+ * devDependencies
68
+ * @leather.io/rpc bumped to 1.0.3
69
+
70
+ ### Dependencies
71
+
72
+ * The following workspace dependencies were updated
73
+ * dependencies
74
+ * @leather.io/constants bumped to 0.6.4
75
+ * @leather.io/utils bumped to 0.8.2
76
+
77
+ ### Dependencies
78
+
79
+ * The following workspace dependencies were updated
80
+ * dependencies
81
+ * @leather.io/constants bumped to 0.7.0
82
+ * @leather.io/models bumped to 0.9.0
83
+ * @leather.io/utils bumped to 0.8.3
84
+ * devDependencies
85
+ * @leather.io/rpc bumped to 1.0.4
86
+
87
+ ## [0.8.0](https://github.com/leather-io/mono/compare/@leather.io/bitcoin-v0.7.4...@leather.io/bitcoin-v0.8.0) (2024-06-21)
88
+
89
+
90
+ ### Features
91
+
92
+ * add stacks queries ([ba0ab05](https://github.com/leather-io/mono/commit/ba0ab053cf99c4fa5875079e956cdf7f58deb810))
93
+ * add turborepo + watch dev mode ([d415d79](https://github.com/leather-io/mono/commit/d415d79394488c0cb74765d367b3af8db1d24772))
94
+ * add web and mobile design system with storybook ([0769902](https://github.com/leather-io/mono/commit/076990210312448d583905ac78448ff5068c1f1e))
95
+ * bootstrap release-please ([76b995a](https://github.com/leather-io/mono/commit/76b995a37ecfda0aa006b90ab21cadc57dae8e80))
96
+ * move basic bitcoin queries from extension ([7ce5efe](https://github.com/leather-io/mono/commit/7ce5efe5e7383f2245ff3ec90ac429ba898a1410))
97
+ * prepare monorepo packages for extension development ([4fb2dbc](https://github.com/leather-io/mono/commit/4fb2dbc786987d50800cb80329c5986a51bec4c2))
98
+ * reset to pnpm workspaces ([fa7de49](https://github.com/leather-io/mono/commit/fa7de49928ee099419db9ff3e91c7dc7b15a4ffa))
99
+ * tweak bitcoin queries for extension ([dc92174](https://github.com/leather-io/mono/commit/dc9217421593ce35d809d5f555f055b716792837))
100
+
101
+
102
+ ### Bug Fixes
103
+
104
+ * [@leather-wallet](https://github.com/leather-wallet) sorting in prettier ([a44b063](https://github.com/leather-io/mono/commit/a44b0631b745c0ca4abe4d36eb5dfc34a33afce8))
105
+ * bundle packages so that those work in node envs too ([02b6347](https://github.com/leather-io/mono/commit/02b63476e4ea4a519718b31bcc1aeb53aae263f0))
106
+ * ecpair import ([c94718b](https://github.com/leather-io/mono/commit/c94718bec2d67f3c489caae3974f6605a2fa6bd9))
107
+ * **tokens:** bundle pkg ([75c05e1](https://github.com/leather-io/mono/commit/75c05e1a7ebc4e8fa93254f3cb7e73ba760f76bb))
108
+
109
+
110
+ ### Dependencies
111
+
112
+ * The following workspace dependencies were updated
113
+ * dependencies
114
+ * @leather.io/constants bumped to 0.8.0
115
+ * @leather.io/crypto bumped to 1.0.2
116
+ * @leather.io/models bumped to 0.10.0
117
+ * @leather.io/utils bumped to 0.9.0
118
+ * devDependencies
119
+ * @leather.io/eslint-config bumped to 0.6.0
120
+ * @leather.io/prettier-config bumped to 0.5.0
121
+ * @leather.io/rpc bumped to 2.0.0
122
+ * @leather.io/tsconfig-config bumped to 0.5.0
123
+
124
+ ## [0.7.2](https://github.com/leather-io/mono/compare/bitcoin-v0.7.1...bitcoin-v0.7.2) (2024-06-10)
125
+
126
+
127
+ ### Bug Fixes
128
+
129
+ * ecpair import ([c94718b](https://github.com/leather-io/mono/commit/c94718bec2d67f3c489caae3974f6605a2fa6bd9))
130
+
131
+ ## [0.7.0](https://github.com/leather-io/mono/compare/bitcoin-v0.6.10...bitcoin-v0.7.0) (2024-06-07)
132
+
133
+
134
+ ### Features
135
+
136
+ * add stacks queries ([ba0ab05](https://github.com/leather-io/mono/commit/ba0ab053cf99c4fa5875079e956cdf7f58deb810))
137
+
138
+
139
+ ### Dependencies
140
+
141
+ * The following workspace dependencies were updated
142
+ * dependencies
143
+ * @leather.io/models bumped to 0.7.0
144
+ * @leather.io/utils bumped to 0.8.0
145
+ * devDependencies
146
+ * @leather.io/rpc bumped to 1.0.2
147
+
148
+ ## [0.6.7](https://github.com/leather-io/mono/compare/bitcoin-v0.6.6...bitcoin-v0.6.7) (2024-06-05)
149
+
150
+
151
+ ### Bug Fixes
152
+
153
+ * [@leather.io](https://github.com/leather-io) sorting in prettier ([a44b063](https://github.com/leather-io/mono/commit/a44b0631b745c0ca4abe4d36eb5dfc34a33afce8))
154
+
155
+
156
+ ### Dependencies
157
+
158
+ * The following workspace dependencies were updated
159
+ * dependencies
160
+ * @leather.io/constants bumped to 0.6.2
161
+ * @leather.io/models bumped to 0.6.7
162
+ * @leather.io/utils bumped to 0.6.7
163
+ * devDependencies
164
+ * @leather.io/prettier-config bumped to 0.4.1
165
+ * @leather.io/rpc bumped to 1.0.0
166
+
167
+ ## [0.6.1](https://github.com/leather-io/mono/compare/bitcoin-v0.6.0...bitcoin-v0.6.1) (2024-05-20)
168
+
169
+
170
+ ### Bug Fixes
171
+
172
+ * bundle packages so that those work in node envs too ([02b6347](https://github.com/leather-io/mono/commit/02b63476e4ea4a519718b31bcc1aeb53aae263f0))
173
+
174
+
175
+ ### Dependencies
176
+
177
+ * The following workspace dependencies were updated
178
+ * dependencies
179
+ * @leather.io/constants bumped to 0.6.1
180
+ * @leather.io/models bumped to 0.6.1
181
+ * @leather.io/utils bumped to 0.6.1
182
+
183
+ ## [0.6.0](https://github.com/leather-io/mono/compare/bitcoin-v0.5.1...bitcoin-v0.6.0) (2024-05-17)
184
+
185
+
186
+ ### Features
187
+
188
+ * add turborepo + watch dev mode ([d415d79](https://github.com/leather-io/mono/commit/d415d79394488c0cb74765d367b3af8db1d24772))
189
+ * add web and mobile design system with storybook ([0769902](https://github.com/leather-io/mono/commit/076990210312448d583905ac78448ff5068c1f1e))
190
+ * bootstrap release-please ([76b995a](https://github.com/leather-io/mono/commit/76b995a37ecfda0aa006b90ab21cadc57dae8e80))
191
+ * move basic bitcoin queries from extension ([7ce5efe](https://github.com/leather-io/mono/commit/7ce5efe5e7383f2245ff3ec90ac429ba898a1410))
192
+ * prepare monorepo packages for extension development ([4fb2dbc](https://github.com/leather-io/mono/commit/4fb2dbc786987d50800cb80329c5986a51bec4c2))
193
+ * reset to pnpm workspaces ([fa7de49](https://github.com/leather-io/mono/commit/fa7de49928ee099419db9ff3e91c7dc7b15a4ffa))
194
+ * tweak bitcoin queries for extension ([dc92174](https://github.com/leather-io/mono/commit/dc9217421593ce35d809d5f555f055b716792837))
195
+
196
+
197
+ ### Bug Fixes
198
+
199
+ * **tokens:** bundle pkg ([75c05e1](https://github.com/leather-io/mono/commit/75c05e1a7ebc4e8fa93254f3cb7e73ba760f76bb))
200
+
201
+
202
+ ### Dependencies
203
+
204
+ * The following workspace dependencies were updated
205
+ * dependencies
206
+ * @leather.io/constants bumped to 0.6.0
207
+ * @leather.io/models bumped to 0.6.0
208
+ * @leather.io/utils bumped to 0.6.0
209
+ * devDependencies
210
+ * @leather.io/eslint-config bumped to 0.4.0
211
+ * @leather.io/prettier-config bumped to 0.4.0
212
+ * @leather.io/tsconfig-config bumped to 0.4.0
213
+
214
+ ## [0.5.0](https://github.com/leather-io/mono/compare/bitcoin-v0.4.1...bitcoin-v0.5.0) (2024-05-17)
215
+
216
+
217
+ ### Features
218
+
219
+ * add turborepo + watch dev mode ([d415d79](https://github.com/leather-io/mono/commit/d415d79394488c0cb74765d367b3af8db1d24772))
220
+ * add web and mobile design system with storybook ([0769902](https://github.com/leather-io/mono/commit/076990210312448d583905ac78448ff5068c1f1e))
221
+ * bootstrap release-please ([76b995a](https://github.com/leather-io/mono/commit/76b995a37ecfda0aa006b90ab21cadc57dae8e80))
222
+ * move basic bitcoin queries from extension ([7ce5efe](https://github.com/leather-io/mono/commit/7ce5efe5e7383f2245ff3ec90ac429ba898a1410))
223
+ * prepare monorepo packages for extension development ([4fb2dbc](https://github.com/leather-io/mono/commit/4fb2dbc786987d50800cb80329c5986a51bec4c2))
224
+ * reset to pnpm workspaces ([fa7de49](https://github.com/leather-io/mono/commit/fa7de49928ee099419db9ff3e91c7dc7b15a4ffa))
225
+ * tweak bitcoin queries for extension ([dc92174](https://github.com/leather-io/mono/commit/dc9217421593ce35d809d5f555f055b716792837))
226
+
227
+
228
+ ### Bug Fixes
229
+
230
+ * **tokens:** bundle pkg ([75c05e1](https://github.com/leather-io/mono/commit/75c05e1a7ebc4e8fa93254f3cb7e73ba760f76bb))
231
+
232
+
233
+ ### Dependencies
234
+
235
+ * The following workspace dependencies were updated
236
+ * dependencies
237
+ * @leather.io/constants bumped to 0.5.0
238
+ * @leather.io/models bumped to 0.5.0
239
+ * @leather.io/utils bumped to 0.5.0
240
+ * devDependencies
241
+ * @leather.io/eslint-config bumped to 0.3.0
242
+ * @leather.io/prettier-config bumped to 0.3.0
243
+ * @leather.io/tsconfig-config bumped to 0.3.0
244
+
245
+ ## [0.4.0](https://github.com/leather-io/mono/compare/bitcoin-v0.3.0...bitcoin-v0.4.0) (2024-05-07)
246
+
247
+ * refactor: pkg org and asset data models ([a46a82c](https://github.com/leather-io/mono/commit/4fb2dbc786987d50800cb80329c5986a51bec4c2))
248
+
249
+
250
+ ## [0.3.0](https://github.com/leather-io/mono/compare/bitcoin-v0.2.0...bitcoin-v0.3.0) (2024-05-07)
251
+
252
+
253
+ ### Features
254
+
255
+ * prepare monorepo packages for extension development ([4fb2dbc](https://github.com/leather-io/mono/commit/4fb2dbc786987d50800cb80329c5986a51bec4c2))
256
+ * tweak bitcoin queries for extension ([dc92174](https://github.com/leather-io/mono/commit/dc9217421593ce35d809d5f555f055b716792837))
257
+
258
+ ## [0.2.0](https://github.com/leather-io/mono/compare/bitcoin-v0.1.0...bitcoin-v0.2.0) (2024-04-23)
259
+
260
+ ### Features
261
+
262
+ - add turborepo + watch dev mode ([d415d79](https://github.com/leather-io/mono/commit/d415d79394488c0cb74765d367b3af8db1d24772))
263
+ - add web and mobile design system with storybook ([0769902](https://github.com/leather-io/mono/commit/076990210312448d583905ac78448ff5068c1f1e))
264
+ - bootstrap release-please ([76b995a](https://github.com/leather-io/mono/commit/76b995a37ecfda0aa006b90ab21cadc57dae8e80))
265
+ - move basic bitcoin queries from extension ([7ce5efe](https://github.com/leather-io/mono/commit/7ce5efe5e7383f2245ff3ec90ac429ba898a1410))
266
+ - reset to pnpm workspaces ([fa7de49](https://github.com/leather-io/mono/commit/fa7de49928ee099419db9ff3e91c7dc7b15a4ffa))
267
+
268
+ ### Bug Fixes
269
+
270
+ - **tokens:** bundle pkg ([75c05e1](https://github.com/leather-io/mono/commit/75c05e1a7ebc4e8fa93254f3cb7e73ba760f76bb))
271
+
272
+ ## [0.1.0](https://github.com/leather-io/mono/compare/bitcoin-v0.0.2...bitcoin-v0.1.0) (2024-04-23)
273
+
274
+ ### Features
275
+
276
+ - add turborepo + watch dev mode ([d415d79](https://github.com/leather-io/mono/commit/d415d79394488c0cb74765d367b3af8db1d24772))
277
+ - add web and mobile design system with storybook ([0769902](https://github.com/leather-io/mono/commit/076990210312448d583905ac78448ff5068c1f1e))
278
+ - move basic bitcoin queries from extension ([7ce5efe](https://github.com/leather-io/mono/commit/7ce5efe5e7383f2245ff3ec90ac429ba898a1410))
279
+ - reset to pnpm workspaces ([fa7de49](https://github.com/leather-io/mono/commit/fa7de49928ee099419db9ff3e91c7dc7b15a4ffa))
280
+
281
+ ### Bug Fixes
282
+
283
+ - **tokens:** bundle pkg ([75c05e1](https://github.com/leather-io/mono/commit/75c05e1a7ebc4e8fa93254f3cb7e73ba760f76bb))
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Leather Wallet LLC [a subsidiary of Nassau Machines]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @leather.io/bitcoin
2
+
3
+ This package is a copy of [bitcoin](https://github.com/leather-io/extension/tree/dev/src/shared/crypto/bitcoin) shared directory in extension repo.
@@ -0,0 +1,134 @@
1
+ import * as ecpair from 'ecpair';
2
+ import * as bitcoin from 'bitcoinjs-lib';
3
+ import * as btc from '@scure/btc-signer';
4
+ import { BitcoinNetworkModes, NetworkModes } from '@leather.io/models';
5
+ import { HDKey, Versions } from '@scure/bip32';
6
+ import { SigHash } from '@scure/btc-signer/transaction';
7
+ import { SignatureHash, PaymentTypes } from '@leather.io/rpc';
8
+ import { TransactionInput, TransactionOutput } from '@scure/btc-signer/psbt';
9
+ import * as _scure_btc_signer_payment from '@scure/btc-signer/payment';
10
+ import { deriveBip39MnemonicFromSeed, deriveRootBip32Keychain } from '@leather.io/crypto';
11
+
12
+ declare function ecPairFromPrivateKey(key: Uint8Array): ecpair.ECPairInterface;
13
+ declare function hashBip322Message(message: Uint8Array | string): Uint8Array;
14
+ declare const bip322TransactionToSignValues: {
15
+ prevoutHash: Uint8Array;
16
+ prevoutIndex: number;
17
+ sequence: number;
18
+ };
19
+ declare function isSupportedMessageSigningPaymentType(paymentType: string): boolean;
20
+ declare function encodeMessageWitnessData(witnessArray: Buffer[]): Buffer;
21
+ declare function tweakSigner(signer: bitcoin.Signer, opts?: any): bitcoin.Signer;
22
+
23
+ declare function createNativeSegwitBitcoinJsSigner(privateKey: Buffer): ecpair.ECPairInterface;
24
+ declare function createTaprootBitcoinJsSigner(privateKey: Buffer): bitcoin.Signer;
25
+ declare function createToSpendTx(address: string, message: string, network: BitcoinNetworkModes): {
26
+ virtualToSpend: bitcoin.Transaction;
27
+ script: Buffer;
28
+ };
29
+ interface SignBip322MessageSimple {
30
+ address: string;
31
+ message: string;
32
+ network: BitcoinNetworkModes;
33
+ signPsbt(psbt: bitcoin.Psbt): Promise<btc.Transaction>;
34
+ }
35
+ declare function signBip322MessageSimple(args: SignBip322MessageSimple): Promise<{
36
+ virtualToSpend: bitcoin.Transaction;
37
+ virtualToSign: bitcoin.Transaction;
38
+ unencodedSig: Buffer;
39
+ signature: string;
40
+ }>;
41
+
42
+ type AllowedSighashTypes = SignatureHash | SigHash;
43
+ interface Signer<Payment> {
44
+ network: BitcoinNetworkModes;
45
+ payment: Payment;
46
+ keychain: HDKey;
47
+ derivationPath: string;
48
+ address: string;
49
+ publicKey: Uint8Array;
50
+ sign(tx: btc.Transaction): void;
51
+ signIndex(tx: btc.Transaction, index: number, allowedSighash?: AllowedSighashTypes[]): void;
52
+ }
53
+
54
+ interface BtcSignerNetwork {
55
+ bech32: string;
56
+ pubKeyHash: number;
57
+ scriptHash: number;
58
+ wif: number;
59
+ }
60
+ declare function getBtcSignerLibNetworkConfigByMode(network: BitcoinNetworkModes): BtcSignerNetwork;
61
+ declare function getBitcoinJsLibNetworkConfigByMode(network: BitcoinNetworkModes): bitcoin.networks.Network;
62
+
63
+ interface BitcoinAccount {
64
+ type: PaymentTypes;
65
+ derivationPath: string;
66
+ keychain: HDKey;
67
+ accountIndex: number;
68
+ network: BitcoinNetworkModes;
69
+ }
70
+ declare function initBitcoinAccount(derivationPath: string, policy: string): BitcoinAccount;
71
+ declare const bitcoinNetworkToCoreNetworkMap: Record<BitcoinNetworkModes, NetworkModes>;
72
+ declare function bitcoinNetworkModeToCoreNetworkMode(mode: BitcoinNetworkModes): "mainnet" | "testnet";
73
+ declare const coinTypeMap: Record<NetworkModes, 0 | 1>;
74
+ declare function getBitcoinCoinTypeIndexByNetwork(network: BitcoinNetworkModes): 0 | 1;
75
+ declare function deriveAddressIndexKeychainFromAccount(keychain: HDKey): (index: number) => HDKey;
76
+ declare function deriveAddressIndexZeroFromAccount(keychain: HDKey): HDKey;
77
+ declare const ecdsaPublicKeyLength = 33;
78
+ declare function ecdsaPublicKeyToSchnorr(pubKey: Uint8Array): Uint8Array;
79
+ declare const toXOnly: (pubKey: Buffer) => Buffer;
80
+ declare function decodeBitcoinTx(tx: string): ReturnType<typeof btc.RawTx.decode>;
81
+ declare function getAddressFromOutScript(script: Uint8Array, bitcoinNetwork: BtcSignerNetwork): string;
82
+ type BtcSignerLibPaymentTypeIdentifers = 'wpkh' | 'wsh' | 'tr' | 'pkh' | 'sh';
83
+ declare const paymentTypeMap: Record<BtcSignerLibPaymentTypeIdentifers, PaymentTypes>;
84
+ declare function btcSignerLibPaymentTypeToPaymentTypeMap(payment: BtcSignerLibPaymentTypeIdentifers): PaymentTypes;
85
+ declare function isBtcSignerLibPaymentType(payment: string): payment is BtcSignerLibPaymentTypeIdentifers;
86
+ declare function parseKnownPaymentType(payment: BtcSignerLibPaymentTypeIdentifers | PaymentTypes): PaymentTypes;
87
+ type PaymentTypeMap<T> = Record<PaymentTypes, T>;
88
+ declare function whenPaymentType(mode: PaymentTypes | BtcSignerLibPaymentTypeIdentifers): <T extends unknown>(paymentMap: PaymentTypeMap<T>) => T;
89
+ declare function inferPaymentTypeFromPath(path: string): PaymentTypes;
90
+ declare function inferNetworkFromPath(path: string): NetworkModes;
91
+ declare function extractExtendedPublicKeyFromPolicy(policy: string): string;
92
+ declare function createWalletIdDecoratedPath(policy: string, walletId: string): string;
93
+ declare function getHdKeyVersionsFromNetwork(network: NetworkModes): Versions | undefined;
94
+ declare function getBitcoinInputAddress(input: TransactionInput, bitcoinNetwork: BtcSignerNetwork): string;
95
+ declare function getInputPaymentType(input: TransactionInput, network: BitcoinNetworkModes): PaymentTypes;
96
+ declare function lookUpLedgerKeysByPath(getDerivationPath: (network: BitcoinNetworkModes, accountIndex: number) => string): (ledgerKeyMap: Record<string, {
97
+ policy: string;
98
+ } | undefined>, network: BitcoinNetworkModes) => (accountIndex: number) => BitcoinAccount | undefined;
99
+ interface GetTaprootAddressArgs {
100
+ index: number;
101
+ keychain?: HDKey;
102
+ network: BitcoinNetworkModes;
103
+ }
104
+ declare function getTaprootAddress({ index, keychain, network }: GetTaprootAddressArgs): string;
105
+ declare function mnemonicToRootNode(secretKey: string): HDKey;
106
+ declare function getPsbtTxInputs(psbtTx: btc.Transaction): TransactionInput[];
107
+ declare function getPsbtTxOutputs(psbtTx: btc.Transaction): TransactionOutput[];
108
+
109
+ declare function getTaprootAccountDerivationPath(network: BitcoinNetworkModes, accountIndex: number): string;
110
+ declare function getTaprootAddressIndexDerivationPath(network: BitcoinNetworkModes, accountIndex: number, addressIndex: number): string;
111
+ declare function deriveTaprootAccount(keychain: HDKey, network: BitcoinNetworkModes): (accountIndex: number) => BitcoinAccount;
112
+ declare function getTaprootPayment(publicKey: Uint8Array, network: BitcoinNetworkModes): _scure_btc_signer_payment.P2TROut;
113
+ declare function getTaprootPaymentFromAddressIndex(keychain: HDKey, network: BitcoinNetworkModes): _scure_btc_signer_payment.P2TROut;
114
+
115
+ declare function getNativeSegwitAccountDerivationPath(network: BitcoinNetworkModes, accountIndex: number): string;
116
+ declare function getNativeSegwitAddressIndexDerivationPath(network: BitcoinNetworkModes, accountIndex: number, addressIndex: number): string;
117
+ declare function deriveNativeSegwitAccountFromRootKeychain(keychain: HDKey, network: BitcoinNetworkModes): (accountIndex: number) => BitcoinAccount;
118
+ declare function getNativeSegWitPaymentFromAddressIndex(keychain: HDKey, network: BitcoinNetworkModes): _scure_btc_signer_payment.P2Ret;
119
+ interface DeriveNativeSegWitReceiveAddressIndexArgs {
120
+ xpub: string;
121
+ network: BitcoinNetworkModes;
122
+ }
123
+ declare function deriveNativeSegWitReceiveAddressIndex({ xpub, network, }: DeriveNativeSegWitReceiveAddressIndexArgs): _scure_btc_signer_payment.P2Ret | undefined;
124
+
125
+ declare const deriveBtcBip49SeedFromMnemonic: typeof deriveBip39MnemonicFromSeed;
126
+ declare const deriveRootBtcKeychain: typeof deriveRootBip32Keychain;
127
+ declare function decodeCompressedWifPrivateKey(key: string): Uint8Array;
128
+ declare const payToScriptHashTestnetPrefix = 196;
129
+ declare function makePayToScriptHashKeyHash(publicKey: Uint8Array): Uint8Array;
130
+ declare function makePayToScriptHashAddressBytes(keyHash: Uint8Array): Uint8Array;
131
+ declare function makePayToScriptHashAddress(addressBytes: Uint8Array, network: NetworkModes): string;
132
+ declare function publicKeyToPayToScriptHashAddress(publicKey: Uint8Array, network: NetworkModes): string;
133
+
134
+ export { type AllowedSighashTypes, type BitcoinAccount, type BtcSignerLibPaymentTypeIdentifers, type BtcSignerNetwork, type GetTaprootAddressArgs, type PaymentTypeMap, type Signer, bip322TransactionToSignValues, bitcoinNetworkModeToCoreNetworkMode, bitcoinNetworkToCoreNetworkMap, btcSignerLibPaymentTypeToPaymentTypeMap, coinTypeMap, createNativeSegwitBitcoinJsSigner, createTaprootBitcoinJsSigner, createToSpendTx, createWalletIdDecoratedPath, decodeBitcoinTx, decodeCompressedWifPrivateKey, deriveAddressIndexKeychainFromAccount, deriveAddressIndexZeroFromAccount, deriveBtcBip49SeedFromMnemonic, deriveNativeSegWitReceiveAddressIndex, deriveNativeSegwitAccountFromRootKeychain, deriveRootBtcKeychain, deriveTaprootAccount, ecPairFromPrivateKey, ecdsaPublicKeyLength, ecdsaPublicKeyToSchnorr, encodeMessageWitnessData, extractExtendedPublicKeyFromPolicy, getAddressFromOutScript, getBitcoinCoinTypeIndexByNetwork, getBitcoinInputAddress, getBitcoinJsLibNetworkConfigByMode, getBtcSignerLibNetworkConfigByMode, getHdKeyVersionsFromNetwork, getInputPaymentType, getNativeSegWitPaymentFromAddressIndex, getNativeSegwitAccountDerivationPath, getNativeSegwitAddressIndexDerivationPath, getPsbtTxInputs, getPsbtTxOutputs, getTaprootAccountDerivationPath, getTaprootAddress, getTaprootAddressIndexDerivationPath, getTaprootPayment, getTaprootPaymentFromAddressIndex, hashBip322Message, inferNetworkFromPath, inferPaymentTypeFromPath, initBitcoinAccount, isBtcSignerLibPaymentType, isSupportedMessageSigningPaymentType, lookUpLedgerKeysByPath, makePayToScriptHashAddress, makePayToScriptHashAddressBytes, makePayToScriptHashKeyHash, mnemonicToRootNode, parseKnownPaymentType, payToScriptHashTestnetPrefix, paymentTypeMap, publicKeyToPayToScriptHashAddress, signBip322MessageSimple, toXOnly, tweakSigner, whenPaymentType };