@leather.io/bitcoin 0.35.5 → 0.35.6
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 +13 -14
- package/CHANGELOG.md +21 -0
- package/dist/index.d.ts +474 -357
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1188 -1504
- package/dist/index.js.map +1 -1
- package/package.json +14 -13
- package/src/utils/lookup-derivation-by-address.spec.ts +1 -1
- package/tsconfig.json +3 -3
- package/tsdown.config.ts +7 -0
- package/vitest.config.js +1 -1
- package/tsup.config.ts +0 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,42 +1,44 @@
|
|
|
1
|
-
import { Bip21Options } from
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
5
|
-
import * as
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
1
|
+
import { Bip21Options } from "bip21";
|
|
2
|
+
import * as bitcoin from "bitcoinjs-lib";
|
|
3
|
+
import * as ecpair0 from "ecpair";
|
|
4
|
+
import { HDKey, Versions } from "@scure/bip32";
|
|
5
|
+
import * as btc from "@scure/btc-signer";
|
|
6
|
+
import { deriveBip39SeedFromMnemonic, deriveRootBip32Keychain } from "@leather.io/crypto";
|
|
7
|
+
import { Network } from "bitcoin-address-validation";
|
|
8
|
+
import BigNumber from "bignumber.js";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { RawPSBTV0, TransactionInput, TransactionOutput } from "@scure/btc-signer/psbt";
|
|
11
|
+
import * as _leather_io_models0 from "@leather.io/models";
|
|
12
|
+
import { AverageBitcoinFeeRates, BitcoinAddress, BitcoinNetworkModes, InscriptionAsset, Money, NetworkModes, TransactionErrorKey, ValueOf } from "@leather.io/models";
|
|
13
|
+
import * as _scure_btc_signer_payment0 from "@scure/btc-signer/payment";
|
|
14
|
+
import { P2Ret, P2TROut } from "@scure/btc-signer/payment";
|
|
15
|
+
import { BitcoinPaymentTypes, PaymentTypes, signatureHash } from "@leather.io/rpc";
|
|
16
|
+
import { SigHash } from "@scure/btc-signer/transaction";
|
|
17
17
|
|
|
18
|
+
//#region src/bip21/bip21.d.ts
|
|
18
19
|
interface Bip21ResultValue {
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
address: string;
|
|
21
|
+
[key: string]: string | number | undefined;
|
|
21
22
|
}
|
|
22
23
|
type Bip21Result = {
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
success: true;
|
|
25
|
+
data: Bip21ResultValue;
|
|
25
26
|
} | {
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
success: false;
|
|
28
|
+
error: string;
|
|
28
29
|
};
|
|
29
30
|
declare const bip21: {
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
decode: (uri: string, urnScheme?: string) => Bip21Result;
|
|
32
|
+
encode: (address: string, options: Bip21Options, urnScheme?: string) => string | null;
|
|
32
33
|
};
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/bip322/bip322-utils.d.ts
|
|
36
|
+
declare function ecPairFromPrivateKey(key: Uint8Array): ecpair0.ECPairInterface;
|
|
35
37
|
declare function hashBip322Message(message: Uint8Array | string): Uint8Array<ArrayBufferLike>;
|
|
36
38
|
declare const bip322TransactionToSignValues: {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
prevoutHash: Uint8Array<ArrayBufferLike>;
|
|
40
|
+
prevoutIndex: number;
|
|
41
|
+
sequence: number;
|
|
40
42
|
};
|
|
41
43
|
declare function isSupportedMessageSigningPaymentType(paymentType: string): boolean;
|
|
42
44
|
/**
|
|
@@ -45,194 +47,232 @@ declare function isSupportedMessageSigningPaymentType(paymentType: string): bool
|
|
|
45
47
|
*/
|
|
46
48
|
declare function encodeMessageWitnessData(witnessArray: Buffer[]): Buffer<ArrayBuffer>;
|
|
47
49
|
declare function tweakSigner(signer: bitcoin.Signer, opts?: any): bitcoin.Signer;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/bip322/sign-message-bip322-bitcoinjs.d.ts
|
|
52
|
+
declare function createNativeSegwitBitcoinJsSigner(privateKey: Buffer): ecpair0.ECPairInterface;
|
|
50
53
|
declare function createTaprootBitcoinJsSigner(privateKey: Buffer): bitcoin.Signer;
|
|
51
54
|
declare function createToSpendTx(address: BitcoinAddress, message: string, network: BitcoinNetworkModes): {
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
virtualToSpend: bitcoin.Transaction;
|
|
56
|
+
script: Buffer<ArrayBufferLike>;
|
|
54
57
|
};
|
|
55
58
|
interface SignBip322MessageSimple {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
address: BitcoinAddress;
|
|
60
|
+
message: string;
|
|
61
|
+
network: BitcoinNetworkModes;
|
|
62
|
+
signPsbt(psbt: bitcoin.Psbt): Promise<btc.Transaction>;
|
|
60
63
|
}
|
|
61
64
|
declare function signBip322MessageSimple(args: SignBip322MessageSimple): Promise<{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
virtualToSpend: bitcoin.Transaction;
|
|
66
|
+
virtualToSign: bitcoin.Transaction;
|
|
67
|
+
unencodedSig: Buffer<ArrayBuffer>;
|
|
68
|
+
signature: string;
|
|
66
69
|
}>;
|
|
67
|
-
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/coin-selection/calculate-max-spend.d.ts
|
|
68
72
|
interface CalculateMaxSpendArgs {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
recipient: string;
|
|
74
|
+
utxos: {
|
|
75
|
+
value: number;
|
|
76
|
+
txid: string;
|
|
77
|
+
}[];
|
|
78
|
+
feeRates?: AverageBitcoinFeeRates;
|
|
79
|
+
feeRate?: number;
|
|
76
80
|
}
|
|
77
81
|
interface CalculateMaxSpendResponse {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
declare function calculateMaxSpend({
|
|
83
|
-
|
|
82
|
+
spendAllFee: number;
|
|
83
|
+
amount: Money;
|
|
84
|
+
spendableBitcoin: BigNumber;
|
|
85
|
+
}
|
|
86
|
+
declare function calculateMaxSpend({
|
|
87
|
+
recipient,
|
|
88
|
+
utxos,
|
|
89
|
+
feeRate,
|
|
90
|
+
feeRates
|
|
91
|
+
}: CalculateMaxSpendArgs): CalculateMaxSpendResponse;
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/coin-selection/coin-selection.d.ts
|
|
84
94
|
interface CoinSelectionOutput {
|
|
85
|
-
|
|
86
|
-
|
|
95
|
+
value: bigint;
|
|
96
|
+
address?: string;
|
|
87
97
|
}
|
|
88
98
|
interface CoinSelectionRecipient {
|
|
89
|
-
|
|
90
|
-
|
|
99
|
+
address: string;
|
|
100
|
+
amount: Money;
|
|
91
101
|
}
|
|
92
102
|
interface DetermineUtxosForSpendArgs<T> {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
103
|
+
feeRate: number;
|
|
104
|
+
recipients: CoinSelectionRecipient[];
|
|
105
|
+
utxos: T[];
|
|
96
106
|
}
|
|
97
107
|
declare function determineUtxosForSpendAll<T extends {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}>({
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
value: number;
|
|
109
|
+
txid: string;
|
|
110
|
+
}>({
|
|
111
|
+
feeRate,
|
|
112
|
+
recipients,
|
|
113
|
+
utxos
|
|
114
|
+
}: DetermineUtxosForSpendArgs<T>): {
|
|
115
|
+
inputs: T[];
|
|
116
|
+
outputs: {
|
|
117
|
+
value: bigint;
|
|
118
|
+
address: string;
|
|
119
|
+
}[];
|
|
120
|
+
size: number;
|
|
121
|
+
fee: Money;
|
|
108
122
|
};
|
|
109
123
|
declare function determineUtxosForSpend<T extends {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}>({
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
124
|
+
value: number;
|
|
125
|
+
txid: string;
|
|
126
|
+
}>({
|
|
127
|
+
feeRate,
|
|
128
|
+
recipients,
|
|
129
|
+
utxos
|
|
130
|
+
}: DetermineUtxosForSpendArgs<T>): {
|
|
131
|
+
txVBytes: number;
|
|
132
|
+
txBytes: number;
|
|
133
|
+
txWeight: number;
|
|
134
|
+
filteredUtxos: T[];
|
|
135
|
+
inputs: T[];
|
|
136
|
+
outputs: CoinSelectionOutput[];
|
|
137
|
+
size: number;
|
|
138
|
+
fee: Money;
|
|
121
139
|
};
|
|
122
|
-
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/coin-selection/coin-selection.utils.d.ts
|
|
123
142
|
declare function getUtxoTotal<T extends {
|
|
124
|
-
|
|
143
|
+
value: number;
|
|
125
144
|
}>(utxos: T[]): BigNumber;
|
|
126
145
|
declare function getSizeInfo(payload: {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
146
|
+
inputLength: number;
|
|
147
|
+
recipients: CoinSelectionRecipient[];
|
|
148
|
+
isSendMax?: boolean;
|
|
130
149
|
}): {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
150
|
+
txVBytes: number;
|
|
151
|
+
txBytes: number;
|
|
152
|
+
txWeight: number;
|
|
134
153
|
};
|
|
135
154
|
interface GetSpendableAmountArgs<T> {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
155
|
+
utxos: T[];
|
|
156
|
+
feeRate: number;
|
|
157
|
+
recipients: CoinSelectionRecipient[];
|
|
158
|
+
isSendMax?: boolean;
|
|
140
159
|
}
|
|
141
160
|
declare function getSpendableAmount<T extends {
|
|
142
|
-
|
|
143
|
-
}>({
|
|
144
|
-
|
|
145
|
-
|
|
161
|
+
value: number;
|
|
162
|
+
}>({
|
|
163
|
+
utxos,
|
|
164
|
+
feeRate,
|
|
165
|
+
recipients
|
|
166
|
+
}: GetSpendableAmountArgs<T>): {
|
|
167
|
+
spendableAmount: BigNumber;
|
|
168
|
+
fee: number;
|
|
146
169
|
};
|
|
147
170
|
declare function filterUneconomicalUtxos<T extends {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}>({
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
171
|
+
value: number;
|
|
172
|
+
txid: string;
|
|
173
|
+
}>({
|
|
174
|
+
utxos,
|
|
175
|
+
feeRate,
|
|
176
|
+
recipients
|
|
177
|
+
}: {
|
|
178
|
+
utxos: T[];
|
|
179
|
+
feeRate: number;
|
|
180
|
+
recipients: CoinSelectionRecipient[];
|
|
154
181
|
}): T[];
|
|
155
|
-
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/fees/bitcoin-fees.d.ts
|
|
156
184
|
type GetBitcoinTransactionFeeArgs = DetermineUtxosForSpendArgs<{
|
|
157
|
-
|
|
158
|
-
|
|
185
|
+
value: number;
|
|
186
|
+
txid: string;
|
|
159
187
|
}> & {
|
|
160
|
-
|
|
188
|
+
isSendingMax?: boolean;
|
|
161
189
|
};
|
|
162
|
-
declare function getBitcoinTransactionFee({
|
|
190
|
+
declare function getBitcoinTransactionFee({
|
|
191
|
+
isSendingMax,
|
|
192
|
+
...props
|
|
193
|
+
}: GetBitcoinTransactionFeeArgs): Money | null;
|
|
163
194
|
interface BitcoinFees {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
195
|
+
blockchain: 'bitcoin';
|
|
196
|
+
high: {
|
|
197
|
+
fee: Money | null;
|
|
198
|
+
feeRate: number;
|
|
199
|
+
};
|
|
200
|
+
standard: {
|
|
201
|
+
fee: Money | null;
|
|
202
|
+
feeRate: number;
|
|
203
|
+
};
|
|
204
|
+
low: {
|
|
205
|
+
fee: Money | null;
|
|
206
|
+
feeRate: number;
|
|
207
|
+
};
|
|
177
208
|
}
|
|
178
209
|
interface GetBitcoinFeesArgs {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
declare function getBitcoinFees({
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
210
|
+
feeRates: AverageBitcoinFeeRates;
|
|
211
|
+
isSendingMax?: boolean;
|
|
212
|
+
recipients: CoinSelectionRecipient[];
|
|
213
|
+
utxos: {
|
|
214
|
+
value: number;
|
|
215
|
+
txid: string;
|
|
216
|
+
}[];
|
|
217
|
+
}
|
|
218
|
+
declare function getBitcoinFees({
|
|
219
|
+
feeRates,
|
|
220
|
+
isSendingMax,
|
|
221
|
+
recipients,
|
|
222
|
+
utxos
|
|
223
|
+
}: GetBitcoinFeesArgs): {
|
|
224
|
+
high: {
|
|
225
|
+
feeRate: number;
|
|
226
|
+
fee: Money | null;
|
|
227
|
+
};
|
|
228
|
+
standard: {
|
|
229
|
+
feeRate: number;
|
|
230
|
+
fee: Money | null;
|
|
231
|
+
};
|
|
232
|
+
low: {
|
|
233
|
+
feeRate: number;
|
|
234
|
+
fee: Money | null;
|
|
235
|
+
};
|
|
200
236
|
};
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
declare const
|
|
204
|
-
declare const
|
|
205
|
-
declare const
|
|
206
|
-
declare const
|
|
207
|
-
declare const
|
|
208
|
-
declare const
|
|
209
|
-
declare const
|
|
210
|
-
declare const
|
|
211
|
-
declare const
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region src/mocks/mocks.d.ts
|
|
239
|
+
declare const TEST_ACCOUNT_1_NATIVE_SEGWIT_ADDRESS: _leather_io_models0.BitcoinAddress;
|
|
240
|
+
declare const TEST_ACCOUNT_1_TAPROOT_ADDRESS: _leather_io_models0.BitcoinAddress;
|
|
241
|
+
declare const TEST_ACCOUNT_2_TAPROOT_ADDRESS: _leather_io_models0.BitcoinAddress;
|
|
242
|
+
declare const TEST_TESNET_ACCOUNT_1_NATIVE_SEGWIT_ADDRESS: _leather_io_models0.BitcoinAddress;
|
|
243
|
+
declare const TEST_TESTNET_ACCOUNT_2_BTC_ADDRESS: _leather_io_models0.BitcoinAddress;
|
|
244
|
+
declare const TEST_TESTNET_ACCOUNT_2_TAPROOT_ADDRESS: _leather_io_models0.BitcoinAddress;
|
|
245
|
+
declare const recipientAddress: _leather_io_models0.BitcoinAddress;
|
|
246
|
+
declare const legacyAddress: _leather_io_models0.BitcoinAddress;
|
|
247
|
+
declare const segwitAddress: _leather_io_models0.BitcoinAddress;
|
|
248
|
+
declare const taprootAddress: _leather_io_models0.BitcoinAddress;
|
|
212
249
|
declare const invalidAddress = "whoop-de-da-boop-da-de-not-a-bitcoin-address";
|
|
213
|
-
declare const inValidCharactersAddress:
|
|
214
|
-
declare const inValidLengthAddress:
|
|
215
|
-
|
|
250
|
+
declare const inValidCharactersAddress: _leather_io_models0.BitcoinAddress;
|
|
251
|
+
declare const inValidLengthAddress: _leather_io_models0.BitcoinAddress;
|
|
252
|
+
//#endregion
|
|
253
|
+
//#region src/schemas/address-schema.d.ts
|
|
216
254
|
declare function nonEmptyStringValidator(message?: string): z.ZodString;
|
|
217
255
|
declare function btcAddressValidator(): z.ZodString;
|
|
218
256
|
declare function getNetworkTypeFromAddress(address: string): BitcoinNetworkModes;
|
|
219
257
|
declare function btcAddressNetworkValidator(network: BitcoinNetworkModes): z.ZodString;
|
|
220
|
-
|
|
258
|
+
//#endregion
|
|
259
|
+
//#region src/utils/bitcoin.network.d.ts
|
|
221
260
|
interface BtcSignerNetwork {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
261
|
+
bech32: string;
|
|
262
|
+
pubKeyHash: number;
|
|
263
|
+
scriptHash: number;
|
|
264
|
+
wif: number;
|
|
226
265
|
}
|
|
227
266
|
declare function getBtcSignerLibNetworkConfigByMode(network: BitcoinNetworkModes): BtcSignerNetwork;
|
|
228
267
|
declare function getBitcoinJsLibNetworkConfigByMode(network: BitcoinNetworkModes): bitcoin.networks.Network;
|
|
229
|
-
|
|
268
|
+
//#endregion
|
|
269
|
+
//#region src/utils/bitcoin.utils.d.ts
|
|
230
270
|
interface BitcoinAccount {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
271
|
+
type: BitcoinPaymentTypes;
|
|
272
|
+
derivationPath: string;
|
|
273
|
+
keychain: HDKey;
|
|
274
|
+
accountIndex: number;
|
|
275
|
+
network: BitcoinNetworkModes;
|
|
236
276
|
}
|
|
237
277
|
declare function initBitcoinAccount(derivationPath: string, policy: string): BitcoinAccount;
|
|
238
278
|
/**
|
|
@@ -264,9 +304,9 @@ declare function getAddressFromOutScript(script: Uint8Array, bitcoinNetwork: Btc
|
|
|
264
304
|
*/
|
|
265
305
|
type BtcSignerLibPaymentTypeIdentifers = 'wpkh' | 'wsh' | 'tr' | 'pkh' | 'sh';
|
|
266
306
|
declare const paymentTypeMap: Record<BtcSignerLibPaymentTypeIdentifers, BitcoinPaymentTypes>;
|
|
267
|
-
declare function btcSignerLibPaymentTypeToPaymentTypeMap(payment: BtcSignerLibPaymentTypeIdentifers): "
|
|
307
|
+
declare function btcSignerLibPaymentTypeToPaymentTypeMap(payment: BtcSignerLibPaymentTypeIdentifers): "p2wpkh" | "p2tr" | "p2pkh" | "p2sh" | "p2wpkh-p2sh";
|
|
268
308
|
declare function isBtcSignerLibPaymentType(payment: string): payment is BtcSignerLibPaymentTypeIdentifers;
|
|
269
|
-
declare function parseKnownPaymentType(payment: BtcSignerLibPaymentTypeIdentifers | BitcoinPaymentTypes): "
|
|
309
|
+
declare function parseKnownPaymentType(payment: BtcSignerLibPaymentTypeIdentifers | BitcoinPaymentTypes): "p2wpkh" | "p2tr" | "p2pkh" | "p2sh" | "p2wpkh-p2sh";
|
|
270
310
|
type PaymentTypeMap<T> = Record<BitcoinPaymentTypes, T>;
|
|
271
311
|
declare function whenPaymentType(mode: BitcoinPaymentTypes | BtcSignerLibPaymentTypeIdentifers): <T>(paymentMap: PaymentTypeMap<T>) => T;
|
|
272
312
|
type SupportedPaymentType = 'p2wpkh' | 'p2tr';
|
|
@@ -286,15 +326,23 @@ declare function getHdKeyVersionsFromNetwork(network: NetworkModes): Versions |
|
|
|
286
326
|
declare function getBitcoinInputAddress(input: TransactionInput, bitcoinNetwork: BtcSignerNetwork): BitcoinAddress | null;
|
|
287
327
|
declare function getInputPaymentType(input: TransactionInput, network: BitcoinNetworkModes): BitcoinPaymentTypes;
|
|
288
328
|
declare function lookUpLedgerKeysByPath(getDerivationPath: (network: BitcoinNetworkModes, accountIndex: number) => string): (ledgerKeyMap: Record<string, {
|
|
289
|
-
|
|
329
|
+
policy: string;
|
|
290
330
|
} | undefined>, network: BitcoinNetworkModes) => (accountIndex: number) => BitcoinAccount | undefined;
|
|
291
331
|
interface GetAddressArgs {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
declare function getTaprootAddress({
|
|
297
|
-
|
|
332
|
+
index: number;
|
|
333
|
+
keychain?: HDKey;
|
|
334
|
+
network: BitcoinNetworkModes;
|
|
335
|
+
}
|
|
336
|
+
declare function getTaprootAddress({
|
|
337
|
+
index,
|
|
338
|
+
keychain,
|
|
339
|
+
network
|
|
340
|
+
}: GetAddressArgs): string;
|
|
341
|
+
declare function getNativeSegwitAddress({
|
|
342
|
+
index,
|
|
343
|
+
keychain,
|
|
344
|
+
network
|
|
345
|
+
}: GetAddressArgs): string;
|
|
298
346
|
/**
|
|
299
347
|
* @deprecated
|
|
300
348
|
* Use `deriveRootBip32Keychain` in `@leather.io/crypto` instead
|
|
@@ -305,7 +353,8 @@ declare function getPsbtTxOutputs(psbtTx: btc.Transaction): TransactionOutput[];
|
|
|
305
353
|
declare function inferNetworkFromAddress(address: BitcoinAddress): BitcoinNetworkModes;
|
|
306
354
|
declare function inferPaymentTypeFromAddress(address: BitcoinAddress): SupportedPaymentType;
|
|
307
355
|
declare function getBitcoinInputValue(input: TransactionInput): number;
|
|
308
|
-
|
|
356
|
+
//#endregion
|
|
357
|
+
//#region src/payments/p2tr-address-gen.d.ts
|
|
309
358
|
declare function makeTaprootAccountDerivationPath(network: BitcoinNetworkModes, accountIndex: number): string;
|
|
310
359
|
/** @deprecated Use makeTaprootAccountDerivationPath */
|
|
311
360
|
declare const getTaprootAccountDerivationPath: typeof makeTaprootAccountDerivationPath;
|
|
@@ -313,17 +362,21 @@ declare function makeTaprootAddressIndexDerivationPath(network: BitcoinNetworkMo
|
|
|
313
362
|
/** @deprecated Use makeTaprootAddressIndexDerivationPath */
|
|
314
363
|
declare const getTaprootAddressIndexDerivationPath: typeof makeTaprootAddressIndexDerivationPath;
|
|
315
364
|
declare function deriveTaprootAccount(keychain: HDKey, network: BitcoinNetworkModes): (accountIndex: number) => BitcoinAccount;
|
|
316
|
-
declare function getTaprootPayment(publicKey: Uint8Array, network: BitcoinNetworkModes):
|
|
317
|
-
declare function getTaprootPaymentFromAddressIndex(keychain: HDKey, network: BitcoinNetworkModes):
|
|
365
|
+
declare function getTaprootPayment(publicKey: Uint8Array, network: BitcoinNetworkModes): _scure_btc_signer_payment0.P2TROut;
|
|
366
|
+
declare function getTaprootPaymentFromAddressIndex(keychain: HDKey, network: BitcoinNetworkModes): _scure_btc_signer_payment0.P2TROut;
|
|
318
367
|
interface DeriveTaprootReceiveAddressIndexArgs {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
declare function deriveTaprootReceiveAddressIndexZero({
|
|
323
|
-
|
|
324
|
-
|
|
368
|
+
keychain: HDKey;
|
|
369
|
+
network: BitcoinNetworkModes;
|
|
370
|
+
}
|
|
371
|
+
declare function deriveTaprootReceiveAddressIndexZero({
|
|
372
|
+
keychain,
|
|
373
|
+
network
|
|
374
|
+
}: DeriveTaprootReceiveAddressIndexArgs): {
|
|
375
|
+
keychain: HDKey;
|
|
376
|
+
payment: _scure_btc_signer_payment0.P2TROut;
|
|
325
377
|
};
|
|
326
|
-
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/payments/p2wpkh-address-gen.d.ts
|
|
327
380
|
declare function makeNativeSegwitAccountDerivationPath(network: BitcoinNetworkModes, accountIndex: number): string;
|
|
328
381
|
/** @deprecated Use makeNativeSegwitAccountDerivationPath */
|
|
329
382
|
declare const getNativeSegwitAccountDerivationPath: typeof makeNativeSegwitAccountDerivationPath;
|
|
@@ -331,16 +384,20 @@ declare function makeNativeSegwitAddressIndexDerivationPath(network: BitcoinNetw
|
|
|
331
384
|
/** @deprecated Use makeNativeSegwitAddressIndexDerivationPath */
|
|
332
385
|
declare const getNativeSegwitAddressIndexDerivationPath: typeof makeNativeSegwitAddressIndexDerivationPath;
|
|
333
386
|
declare function deriveNativeSegwitAccountFromRootKeychain(keychain: HDKey, network: BitcoinNetworkModes): (accountIndex: number) => BitcoinAccount;
|
|
334
|
-
declare function getNativeSegwitPaymentFromAddressIndex(keychain: HDKey, network: BitcoinNetworkModes):
|
|
387
|
+
declare function getNativeSegwitPaymentFromAddressIndex(keychain: HDKey, network: BitcoinNetworkModes): _scure_btc_signer_payment0.P2Ret;
|
|
335
388
|
interface DeriveNativeSegwitReceiveAddressIndexArgs {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}
|
|
339
|
-
declare function deriveNativeSegwitReceiveAddressIndexZero({
|
|
340
|
-
|
|
341
|
-
|
|
389
|
+
keychain: HDKey;
|
|
390
|
+
network: BitcoinNetworkModes;
|
|
391
|
+
}
|
|
392
|
+
declare function deriveNativeSegwitReceiveAddressIndexZero({
|
|
393
|
+
keychain,
|
|
394
|
+
network
|
|
395
|
+
}: DeriveNativeSegwitReceiveAddressIndexArgs): {
|
|
396
|
+
keychain: HDKey;
|
|
397
|
+
payment: _scure_btc_signer_payment0.P2Ret;
|
|
342
398
|
};
|
|
343
|
-
|
|
399
|
+
//#endregion
|
|
400
|
+
//#region src/payments/p2wsh-p2sh-address-gen.d.ts
|
|
344
401
|
/**
|
|
345
402
|
* @deprecated
|
|
346
403
|
* Use `deriveBip39MnemonicFromSeed` from `@leather.io/crypto`
|
|
@@ -357,144 +414,169 @@ declare function makePayToScriptHashKeyHash(publicKey: Uint8Array): Uint8Array<A
|
|
|
357
414
|
declare function makePayToScriptHashAddressBytes(keyHash: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
358
415
|
declare function makePayToScriptHashAddress(addressBytes: Uint8Array, network: NetworkModes): string;
|
|
359
416
|
declare function publicKeyToPayToScriptHashAddress(publicKey: Uint8Array, network: NetworkModes): string;
|
|
360
|
-
|
|
417
|
+
//#endregion
|
|
418
|
+
//#region src/psbt/psbt-inputs.d.ts
|
|
361
419
|
interface PsbtInput {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
420
|
+
address: BitcoinAddress;
|
|
421
|
+
index?: number;
|
|
422
|
+
inscription?: InscriptionAsset;
|
|
423
|
+
isMutable: boolean;
|
|
424
|
+
toSign: boolean;
|
|
425
|
+
txid: string;
|
|
426
|
+
value: number;
|
|
427
|
+
bip32Derivation: TransactionInput['bip32Derivation'];
|
|
428
|
+
tapBip32Derivation: TransactionInput['tapBip32Derivation'];
|
|
371
429
|
}
|
|
372
430
|
interface GetParsedInputsArgs {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
431
|
+
inputs: TransactionInput[];
|
|
432
|
+
indexesToSign?: number[];
|
|
433
|
+
networkMode: BitcoinNetworkModes;
|
|
434
|
+
psbtAddresses: BitcoinAddress[];
|
|
377
435
|
}
|
|
378
436
|
interface GetParsedInputsResponse {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
}
|
|
382
|
-
declare function getParsedInputs({
|
|
383
|
-
|
|
437
|
+
isPsbtMutable: boolean;
|
|
438
|
+
parsedInputs: PsbtInput[];
|
|
439
|
+
}
|
|
440
|
+
declare function getParsedInputs({
|
|
441
|
+
inputs,
|
|
442
|
+
indexesToSign,
|
|
443
|
+
networkMode,
|
|
444
|
+
psbtAddresses
|
|
445
|
+
}: GetParsedInputsArgs): GetParsedInputsResponse;
|
|
446
|
+
//#endregion
|
|
447
|
+
//#region src/psbt/psbt-outputs.d.ts
|
|
384
448
|
interface PsbtOutput {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
449
|
+
address: BitcoinAddress | null;
|
|
450
|
+
isMutable: boolean;
|
|
451
|
+
toSign: boolean;
|
|
452
|
+
value: number;
|
|
389
453
|
}
|
|
390
454
|
interface PsbtOutputWithAddress extends PsbtOutput {
|
|
391
|
-
|
|
455
|
+
address: BitcoinAddress;
|
|
392
456
|
}
|
|
393
457
|
interface GetParsedOutputsArgs {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
}
|
|
399
|
-
declare function getParsedOutputs({
|
|
400
|
-
|
|
458
|
+
isPsbtMutable: boolean;
|
|
459
|
+
outputs: TransactionOutput[];
|
|
460
|
+
networkMode: BitcoinNetworkModes;
|
|
461
|
+
psbtAddresses: BitcoinAddress[];
|
|
462
|
+
}
|
|
463
|
+
declare function getParsedOutputs({
|
|
464
|
+
isPsbtMutable,
|
|
465
|
+
outputs,
|
|
466
|
+
networkMode,
|
|
467
|
+
psbtAddresses
|
|
468
|
+
}: GetParsedOutputsArgs): PsbtOutput[];
|
|
469
|
+
//#endregion
|
|
470
|
+
//#region src/psbt/psbt-totals.d.ts
|
|
401
471
|
interface GetPsbtTotalsProps {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}
|
|
406
|
-
declare function getPsbtTotals({
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
472
|
+
psbtAddresses: BitcoinAddress[];
|
|
473
|
+
parsedInputs: PsbtInput[];
|
|
474
|
+
parsedOutputs: PsbtOutput[];
|
|
475
|
+
}
|
|
476
|
+
declare function getPsbtTotals({
|
|
477
|
+
psbtAddresses,
|
|
478
|
+
parsedInputs,
|
|
479
|
+
parsedOutputs
|
|
480
|
+
}: GetPsbtTotalsProps): {
|
|
481
|
+
inputsTotalNativeSegwit: _leather_io_models0.Money;
|
|
482
|
+
inputsTotalTaproot: _leather_io_models0.Money;
|
|
483
|
+
outputsTotalNativeSegwit: _leather_io_models0.Money;
|
|
484
|
+
outputsTotalTaproot: _leather_io_models0.Money;
|
|
485
|
+
psbtInputsTotal: _leather_io_models0.Money;
|
|
486
|
+
psbtOutputsTotal: _leather_io_models0.Money;
|
|
413
487
|
};
|
|
414
|
-
|
|
488
|
+
//#endregion
|
|
489
|
+
//#region src/psbt/psbt-details.d.ts
|
|
415
490
|
interface GetPsbtDetailsArgs {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
}
|
|
421
|
-
declare function getPsbtDetails({
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
491
|
+
psbtHex: string;
|
|
492
|
+
psbtAddresses: BitcoinAddress[];
|
|
493
|
+
networkMode: BitcoinNetworkModes;
|
|
494
|
+
indexesToSign?: number[];
|
|
495
|
+
}
|
|
496
|
+
declare function getPsbtDetails({
|
|
497
|
+
psbtHex,
|
|
498
|
+
networkMode,
|
|
499
|
+
indexesToSign,
|
|
500
|
+
psbtAddresses
|
|
501
|
+
}: GetPsbtDetailsArgs): {
|
|
502
|
+
addressNativeSegwitTotal: _leather_io_models0.Money;
|
|
503
|
+
addressTaprootTotal: _leather_io_models0.Money;
|
|
504
|
+
fee: _leather_io_models0.Money;
|
|
505
|
+
isPsbtMutable: boolean;
|
|
506
|
+
psbtInputs: PsbtInput[];
|
|
507
|
+
psbtOutputs: PsbtOutput[];
|
|
428
508
|
};
|
|
429
|
-
|
|
509
|
+
//#endregion
|
|
510
|
+
//#region src/psbt/utils.d.ts
|
|
430
511
|
type RawPsbt = ReturnType<typeof RawPSBTV0.decode>;
|
|
431
512
|
declare function getPsbtAsTransaction(psbt: string | Uint8Array): btc.Transaction;
|
|
432
513
|
declare function getRawPsbt(psbt: string | Uint8Array): ReturnType<typeof RawPSBTV0.decode>;
|
|
433
|
-
|
|
514
|
+
//#endregion
|
|
515
|
+
//#region src/signer/bitcoin-signer.d.ts
|
|
434
516
|
type AllowedSighashTypes = ValueOf<typeof signatureHash> | SigHash;
|
|
435
517
|
interface BitcoinAccountKeychain {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
518
|
+
descriptor: string;
|
|
519
|
+
masterKeyFingerprint: string;
|
|
520
|
+
keyOrigin: string;
|
|
521
|
+
keychain: HDKey;
|
|
522
|
+
xpub: string;
|
|
441
523
|
}
|
|
442
524
|
type WithDerivePayer<T, P> = T & {
|
|
443
|
-
|
|
525
|
+
derivePayer: (args: BitcoinPayerInfo) => P;
|
|
444
526
|
};
|
|
445
527
|
interface BitcoinSigner<Payment> {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
528
|
+
network: BitcoinNetworkModes;
|
|
529
|
+
payment: Payment;
|
|
530
|
+
keychain: HDKey;
|
|
531
|
+
derivationPath: string;
|
|
532
|
+
address: BitcoinAddress;
|
|
533
|
+
publicKey: Uint8Array;
|
|
534
|
+
sign(tx: btc.Transaction): void;
|
|
535
|
+
signIndex(tx: btc.Transaction, index: number, allowedSighash?: AllowedSighashTypes[]): void;
|
|
454
536
|
}
|
|
455
537
|
interface BitcoinPayerBase {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
538
|
+
paymentType: PaymentTypes;
|
|
539
|
+
network: BitcoinNetworkModes;
|
|
540
|
+
address: BitcoinAddress;
|
|
541
|
+
keyOrigin: string;
|
|
542
|
+
masterKeyFingerprint: string;
|
|
543
|
+
publicKey: Uint8Array;
|
|
462
544
|
}
|
|
463
545
|
interface BitcoinNativeSegwitPayer extends BitcoinPayerBase {
|
|
464
|
-
|
|
465
|
-
|
|
546
|
+
paymentType: 'p2wpkh';
|
|
547
|
+
payment: P2Ret;
|
|
466
548
|
}
|
|
467
549
|
interface BitcoinTaprootPayer extends BitcoinPayerBase {
|
|
468
|
-
|
|
469
|
-
|
|
550
|
+
paymentType: 'p2tr';
|
|
551
|
+
payment: P2TROut;
|
|
470
552
|
}
|
|
471
553
|
type BitcoinPayer = BitcoinNativeSegwitPayer | BitcoinTaprootPayer;
|
|
472
554
|
declare function initializeBitcoinAccountKeychainFromDescriptor(descriptor: string): BitcoinAccountKeychain;
|
|
473
555
|
interface BitcoinPayerInfo {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
}
|
|
477
|
-
declare function deriveBitcoinPayerFromAccount(descriptor: string, network: BitcoinNetworkModes): ({
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
556
|
+
change: number;
|
|
557
|
+
addressIndex: number;
|
|
558
|
+
}
|
|
559
|
+
declare function deriveBitcoinPayerFromAccount(descriptor: string, network: BitcoinNetworkModes): ({
|
|
560
|
+
change,
|
|
561
|
+
addressIndex
|
|
562
|
+
}: BitcoinPayerInfo) => {
|
|
563
|
+
keyOrigin: string;
|
|
564
|
+
masterKeyFingerprint: string;
|
|
565
|
+
paymentType: SupportedPaymentType;
|
|
566
|
+
network: BitcoinNetworkModes;
|
|
567
|
+
payment: P2Ret;
|
|
568
|
+
readonly address: string;
|
|
569
|
+
readonly publicKey: Uint8Array<ArrayBufferLike>;
|
|
485
570
|
};
|
|
486
571
|
interface BtcSignerDerivationPath {
|
|
487
|
-
|
|
488
|
-
|
|
572
|
+
fingerprint: number;
|
|
573
|
+
path: number[];
|
|
489
574
|
}
|
|
490
575
|
type BtcSignerDefaultBip32Derivation = [Uint8Array, BtcSignerDerivationPath];
|
|
491
|
-
type BtcSignerTapBip32Derivation = [
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
der: BtcSignerDerivationPath;
|
|
496
|
-
}
|
|
497
|
-
];
|
|
576
|
+
type BtcSignerTapBip32Derivation = [Uint8Array, {
|
|
577
|
+
hashes: Uint8Array[];
|
|
578
|
+
der: BtcSignerDerivationPath;
|
|
579
|
+
}];
|
|
498
580
|
type BtcSignerBip32Derivation = BtcSignerDefaultBip32Derivation | BtcSignerTapBip32Derivation;
|
|
499
581
|
type PayerToBip32DerivationArgs = Pick<BitcoinPayer, 'masterKeyFingerprint' | 'keyOrigin' | 'publicKey'>;
|
|
500
582
|
/**
|
|
@@ -523,8 +605,8 @@ declare function payerToTapBip32DerivationBitcoinJsLib(args: PayerToBip32Derivat
|
|
|
523
605
|
type Bip32DerivationBitcoinJsLib = NonNullable<PsbtInputBitcoinJsLib['bip32Derivation']>['0'];
|
|
524
606
|
declare function payerToBip32DerivationBitcoinJsLib(args: PayerToBip32DerivationArgs): Bip32DerivationBitcoinJsLib;
|
|
525
607
|
declare function extractPayerInfoFromDerivationPath(path: string): {
|
|
526
|
-
|
|
527
|
-
|
|
608
|
+
change: number;
|
|
609
|
+
addressIndex: number;
|
|
528
610
|
};
|
|
529
611
|
/**
|
|
530
612
|
* @description
|
|
@@ -535,7 +617,10 @@ declare function extractPayerInfoFromDerivationPath(path: string): {
|
|
|
535
617
|
* const keyOrigin = serializeKeyOrigin(inputOne.bip32Derivation[0][1]);
|
|
536
618
|
* ```
|
|
537
619
|
*/
|
|
538
|
-
declare function serializeKeyOrigin({
|
|
620
|
+
declare function serializeKeyOrigin({
|
|
621
|
+
fingerprint,
|
|
622
|
+
path
|
|
623
|
+
}: BtcSignerDerivationPath): string;
|
|
539
624
|
/**
|
|
540
625
|
* @description
|
|
541
626
|
* Of a given set of a `tx.input`s bip32 derivation paths from
|
|
@@ -543,88 +628,120 @@ declare function serializeKeyOrigin({ fingerprint, path }: BtcSignerDerivationPa
|
|
|
543
628
|
* internally
|
|
544
629
|
*/
|
|
545
630
|
declare function extractRequiredKeyOrigins(derivation: BtcSignerBip32Derivation[]): string[];
|
|
546
|
-
|
|
631
|
+
//#endregion
|
|
632
|
+
//#region src/transactions/generate-unsigned-transaction.d.ts
|
|
547
633
|
interface GenerateBitcoinUnsignedTransactionArgs<T> {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
634
|
+
feeRate: number;
|
|
635
|
+
isSendingMax?: boolean;
|
|
636
|
+
network: BtcSignerNetwork;
|
|
637
|
+
recipients: CoinSelectionRecipient[];
|
|
638
|
+
utxos: T[];
|
|
639
|
+
changeAddress: string;
|
|
640
|
+
payerLookup(keyOrigin: string): BitcoinNativeSegwitPayer | BitcoinTaprootPayer | undefined;
|
|
555
641
|
}
|
|
556
642
|
declare function generateBitcoinUnsignedTransaction<T extends {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
}>({
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
643
|
+
txid: string;
|
|
644
|
+
vout: number;
|
|
645
|
+
value: number;
|
|
646
|
+
keyOrigin: string;
|
|
647
|
+
}>({
|
|
648
|
+
feeRate,
|
|
649
|
+
isSendingMax,
|
|
650
|
+
network,
|
|
651
|
+
recipients,
|
|
652
|
+
changeAddress,
|
|
653
|
+
utxos,
|
|
654
|
+
payerLookup
|
|
655
|
+
}: GenerateBitcoinUnsignedTransactionArgs<T>): {
|
|
656
|
+
tx: btc.Transaction;
|
|
657
|
+
hex: string;
|
|
658
|
+
psbt: Uint8Array<ArrayBufferLike>;
|
|
659
|
+
inputs: T[];
|
|
660
|
+
fee: _leather_io_models0.Money;
|
|
567
661
|
};
|
|
568
|
-
|
|
662
|
+
//#endregion
|
|
663
|
+
//#region src/validation/address-validation.d.ts
|
|
569
664
|
declare function getBitcoinAddressNetworkType(network: BitcoinNetworkModes): Network;
|
|
570
665
|
declare function isValidBitcoinAddress(address: string): boolean;
|
|
571
666
|
declare function isValidBitcoinNetworkAddress(address: string, network: BitcoinNetworkModes): boolean;
|
|
572
|
-
|
|
667
|
+
//#endregion
|
|
668
|
+
//#region src/validation/amount-validation.d.ts
|
|
573
669
|
interface isBtcBalanceSufficientParams {
|
|
574
|
-
|
|
575
|
-
|
|
670
|
+
desiredSpend: Money;
|
|
671
|
+
maxSpend: Money;
|
|
576
672
|
}
|
|
577
|
-
declare function isBtcBalanceSufficient({
|
|
673
|
+
declare function isBtcBalanceSufficient({
|
|
674
|
+
desiredSpend,
|
|
675
|
+
maxSpend
|
|
676
|
+
}: isBtcBalanceSufficientParams): boolean;
|
|
578
677
|
declare function isBtcMinimumSpend(desiredSpend: Money): boolean;
|
|
579
|
-
|
|
678
|
+
//#endregion
|
|
679
|
+
//#region src/validation/bitcoin-address.d.ts
|
|
580
680
|
declare function isBitcoinAddress(value: string): value is BitcoinAddress;
|
|
581
681
|
declare function createBitcoinAddress(value: string): BitcoinAddress;
|
|
582
|
-
|
|
682
|
+
//#endregion
|
|
683
|
+
//#region src/validation/bitcoin-error.d.ts
|
|
583
684
|
declare class BitcoinError extends Error {
|
|
584
|
-
|
|
585
|
-
|
|
685
|
+
message: BitcoinErrorKey;
|
|
686
|
+
constructor(message: BitcoinErrorKey);
|
|
586
687
|
}
|
|
587
688
|
type BitcoinErrorKey = TransactionErrorKey | 'InsufficientAmount' | 'NoInputsToSign' | 'NoOutputsToSign' | 'InscribedUtxos';
|
|
588
|
-
|
|
689
|
+
//#endregion
|
|
690
|
+
//#region src/validation/transaction-validation.d.ts
|
|
589
691
|
interface BitcoinTransaction extends Omit<GetBitcoinFeesArgs, 'recipients'> {
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
}
|
|
596
|
-
declare function isValidBitcoinTransaction({
|
|
597
|
-
|
|
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
|
+
//#region src/utils/bitcoin.descriptors.d.ts
|
|
598
709
|
declare function getDescriptorFromKeychain<T extends {
|
|
599
|
-
|
|
600
|
-
|
|
710
|
+
keyOrigin: string;
|
|
711
|
+
xpub: string;
|
|
601
712
|
}>(accountKeychain: T): string | undefined;
|
|
602
713
|
declare function inferPaymentTypeFromDescriptor(descriptor: string): SupportedPaymentType;
|
|
603
714
|
declare function extractXpubFromDescriptor(descriptor: string): string;
|
|
604
715
|
interface DeriveAddressesFromDescriptorArgs {
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
716
|
+
accountDescriptor: string;
|
|
717
|
+
network: BitcoinNetworkModes;
|
|
718
|
+
limit?: number;
|
|
608
719
|
}
|
|
609
720
|
interface DeriveAddressesFromDescriptorResult {
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
}
|
|
613
|
-
declare function deriveAddressesFromDescriptor({
|
|
614
|
-
|
|
721
|
+
address: string;
|
|
722
|
+
path: string;
|
|
723
|
+
}
|
|
724
|
+
declare function deriveAddressesFromDescriptor({
|
|
725
|
+
accountDescriptor,
|
|
726
|
+
network,
|
|
727
|
+
limit
|
|
728
|
+
}: DeriveAddressesFromDescriptorArgs): DeriveAddressesFromDescriptorResult[];
|
|
729
|
+
//#endregion
|
|
730
|
+
//#region src/utils/lookup-derivation-by-address.d.ts
|
|
615
731
|
interface LookUpDerivationByAddressArgs {
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
732
|
+
taprootXpub: string;
|
|
733
|
+
nativeSegwitXpub: string;
|
|
734
|
+
iterationLimit: number;
|
|
619
735
|
}
|
|
620
736
|
declare function lookupDerivationByAddress(args: LookUpDerivationByAddressArgs): (address: BitcoinAddress) => {
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
737
|
+
readonly status: "success";
|
|
738
|
+
readonly duration: number;
|
|
739
|
+
readonly path: string;
|
|
624
740
|
} | {
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
741
|
+
readonly status: "failure";
|
|
742
|
+
readonly duration?: undefined;
|
|
743
|
+
readonly path?: undefined;
|
|
628
744
|
};
|
|
629
|
-
|
|
630
|
-
export {
|
|
745
|
+
//#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 };
|
|
747
|
+
//# sourceMappingURL=index.d.ts.map
|