@bitgo/wasm-utxo 1.11.0 → 1.13.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/dist/cjs/js/fixedScriptWallet/BitGoPsbt.d.ts +17 -2
- package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.js +22 -4
- package/dist/cjs/js/wasm/wasm_utxo.d.ts +26 -16
- package/dist/cjs/js/wasm/wasm_utxo.js +297 -293
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +53 -52
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.d.ts +17 -2
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.js +22 -4
- package/dist/esm/js/wasm/wasm_utxo.d.ts +26 -16
- package/dist/esm/js/wasm/wasm_utxo_bg.js +303 -289
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +53 -52
- package/package.json +1 -1
|
@@ -27,6 +27,7 @@ export type ParsedOutput = {
|
|
|
27
27
|
script: Uint8Array;
|
|
28
28
|
value: bigint;
|
|
29
29
|
scriptId: ScriptId | null;
|
|
30
|
+
paygo: boolean;
|
|
30
31
|
};
|
|
31
32
|
export type ParsedTransaction = {
|
|
32
33
|
inputs: ParsedInput[];
|
|
@@ -54,9 +55,10 @@ export declare class BitGoPsbt {
|
|
|
54
55
|
* Parse transaction with wallet keys to identify wallet inputs/outputs
|
|
55
56
|
* @param walletKeys - The wallet keys to use for identification
|
|
56
57
|
* @param replayProtection - Scripts that are allowed as inputs without wallet validation
|
|
58
|
+
* @param payGoPubkeys - Optional public keys for PayGo attestation verification
|
|
57
59
|
* @returns Parsed transaction information
|
|
58
60
|
*/
|
|
59
|
-
parseTransactionWithWalletKeys(walletKeys: WalletKeysArg, replayProtection: ReplayProtectionArg): ParsedTransaction;
|
|
61
|
+
parseTransactionWithWalletKeys(walletKeys: WalletKeysArg, replayProtection: ReplayProtectionArg, payGoPubkeys?: ECPairArg[]): ParsedTransaction;
|
|
60
62
|
/**
|
|
61
63
|
* Parse outputs with wallet keys to identify which outputs belong to a wallet
|
|
62
64
|
* with the given wallet keys.
|
|
@@ -65,10 +67,23 @@ export declare class BitGoPsbt {
|
|
|
65
67
|
* wallet than the inputs.
|
|
66
68
|
*
|
|
67
69
|
* @param walletKeys - The wallet keys to use for identification
|
|
70
|
+
* @param payGoPubkeys - Optional public keys for PayGo attestation verification
|
|
68
71
|
* @returns Array of parsed outputs
|
|
69
72
|
* @note This method does NOT validate wallet inputs. It only parses outputs.
|
|
70
73
|
*/
|
|
71
|
-
parseOutputsWithWalletKeys(walletKeys: WalletKeysArg): ParsedOutput[];
|
|
74
|
+
parseOutputsWithWalletKeys(walletKeys: WalletKeysArg, payGoPubkeys?: ECPairArg[]): ParsedOutput[];
|
|
75
|
+
/**
|
|
76
|
+
* Add a PayGo attestation to a PSBT output
|
|
77
|
+
*
|
|
78
|
+
* This adds a cryptographic proof that the output address was authorized by a signing authority.
|
|
79
|
+
* The attestation is stored in PSBT proprietary key-values and can be verified later.
|
|
80
|
+
*
|
|
81
|
+
* @param outputIndex - The index of the output to add the attestation to
|
|
82
|
+
* @param entropy - 64 bytes of entropy (must be exactly 64 bytes)
|
|
83
|
+
* @param signature - ECDSA signature bytes (typically 65 bytes in recoverable format)
|
|
84
|
+
* @throws Error if output index is out of bounds or entropy is not 64 bytes
|
|
85
|
+
*/
|
|
86
|
+
addPayGoAttestation(outputIndex: number, entropy: Uint8Array, signature: Uint8Array): void;
|
|
72
87
|
/**
|
|
73
88
|
* Verify if a valid signature exists for a given key at the specified input index.
|
|
74
89
|
*
|
|
@@ -32,12 +32,14 @@ class BitGoPsbt {
|
|
|
32
32
|
* Parse transaction with wallet keys to identify wallet inputs/outputs
|
|
33
33
|
* @param walletKeys - The wallet keys to use for identification
|
|
34
34
|
* @param replayProtection - Scripts that are allowed as inputs without wallet validation
|
|
35
|
+
* @param payGoPubkeys - Optional public keys for PayGo attestation verification
|
|
35
36
|
* @returns Parsed transaction information
|
|
36
37
|
*/
|
|
37
|
-
parseTransactionWithWalletKeys(walletKeys, replayProtection) {
|
|
38
|
+
parseTransactionWithWalletKeys(walletKeys, replayProtection, payGoPubkeys) {
|
|
38
39
|
const keys = RootWalletKeys_js_1.RootWalletKeys.from(walletKeys);
|
|
39
40
|
const rp = ReplayProtection_js_1.ReplayProtection.from(replayProtection, this.wasm.network());
|
|
40
|
-
|
|
41
|
+
const pubkeys = payGoPubkeys?.map((arg) => ecpair_js_1.ECPair.from(arg).wasm);
|
|
42
|
+
return this.wasm.parse_transaction_with_wallet_keys(keys.wasm, rp.wasm, pubkeys);
|
|
41
43
|
}
|
|
42
44
|
/**
|
|
43
45
|
* Parse outputs with wallet keys to identify which outputs belong to a wallet
|
|
@@ -47,12 +49,28 @@ class BitGoPsbt {
|
|
|
47
49
|
* wallet than the inputs.
|
|
48
50
|
*
|
|
49
51
|
* @param walletKeys - The wallet keys to use for identification
|
|
52
|
+
* @param payGoPubkeys - Optional public keys for PayGo attestation verification
|
|
50
53
|
* @returns Array of parsed outputs
|
|
51
54
|
* @note This method does NOT validate wallet inputs. It only parses outputs.
|
|
52
55
|
*/
|
|
53
|
-
parseOutputsWithWalletKeys(walletKeys) {
|
|
56
|
+
parseOutputsWithWalletKeys(walletKeys, payGoPubkeys) {
|
|
54
57
|
const keys = RootWalletKeys_js_1.RootWalletKeys.from(walletKeys);
|
|
55
|
-
|
|
58
|
+
const pubkeys = payGoPubkeys?.map((arg) => ecpair_js_1.ECPair.from(arg).wasm);
|
|
59
|
+
return this.wasm.parse_outputs_with_wallet_keys(keys.wasm, pubkeys);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Add a PayGo attestation to a PSBT output
|
|
63
|
+
*
|
|
64
|
+
* This adds a cryptographic proof that the output address was authorized by a signing authority.
|
|
65
|
+
* The attestation is stored in PSBT proprietary key-values and can be verified later.
|
|
66
|
+
*
|
|
67
|
+
* @param outputIndex - The index of the output to add the attestation to
|
|
68
|
+
* @param entropy - 64 bytes of entropy (must be exactly 64 bytes)
|
|
69
|
+
* @param signature - ECDSA signature bytes (typically 65 bytes in recoverable format)
|
|
70
|
+
* @throws Error if output index is out of bounds or entropy is not 64 bytes
|
|
71
|
+
*/
|
|
72
|
+
addPayGoAttestation(outputIndex, entropy, signature) {
|
|
73
|
+
this.wasm.add_paygo_attestation(outputIndex, entropy, signature);
|
|
56
74
|
}
|
|
57
75
|
/**
|
|
58
76
|
* Verify if a valid signature exists for a given key at the specified input index.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
|
|
3
4
|
export class AddressNamespace {
|
|
4
5
|
private constructor();
|
|
5
6
|
free(): void;
|
|
@@ -7,6 +8,7 @@ export class AddressNamespace {
|
|
|
7
8
|
static to_output_script_with_coin(address: string, coin: string): Uint8Array;
|
|
8
9
|
static from_output_script_with_coin(script: Uint8Array, coin: string, format?: string | null): string;
|
|
9
10
|
}
|
|
11
|
+
|
|
10
12
|
export class BitGoPsbt {
|
|
11
13
|
private constructor();
|
|
12
14
|
free(): void;
|
|
@@ -81,6 +83,19 @@ export class BitGoPsbt {
|
|
|
81
83
|
* - `Err(WasmUtxoError)` if any input failed to finalize
|
|
82
84
|
*/
|
|
83
85
|
finalize_all_inputs(): void;
|
|
86
|
+
/**
|
|
87
|
+
* Add a PayGo attestation to a PSBT output
|
|
88
|
+
*
|
|
89
|
+
* # Arguments
|
|
90
|
+
* - `output_index`: The index of the output to add the attestation to
|
|
91
|
+
* - `entropy`: 64 bytes of entropy
|
|
92
|
+
* - `signature`: ECDSA signature bytes
|
|
93
|
+
*
|
|
94
|
+
* # Returns
|
|
95
|
+
* - `Ok(())` if the attestation was successfully added
|
|
96
|
+
* - `Err(WasmUtxoError)` if the output index is out of bounds or entropy is invalid
|
|
97
|
+
*/
|
|
98
|
+
add_paygo_attestation(output_index: number, entropy: Uint8Array, signature: Uint8Array): void;
|
|
84
99
|
/**
|
|
85
100
|
* Combine/merge data from another PSBT into this one
|
|
86
101
|
*
|
|
@@ -171,11 +186,11 @@ export class BitGoPsbt {
|
|
|
171
186
|
*
|
|
172
187
|
* Note: This method does NOT validate wallet inputs. It only parses outputs.
|
|
173
188
|
*/
|
|
174
|
-
parse_outputs_with_wallet_keys(wallet_keys: WasmRootWalletKeys): any;
|
|
189
|
+
parse_outputs_with_wallet_keys(wallet_keys: WasmRootWalletKeys, paygo_pubkeys?: WasmECPair[] | null): any;
|
|
175
190
|
/**
|
|
176
191
|
* Parse transaction with wallet keys to identify wallet inputs/outputs
|
|
177
192
|
*/
|
|
178
|
-
parse_transaction_with_wallet_keys(wallet_keys: WasmRootWalletKeys, replay_protection: WasmReplayProtection): any;
|
|
193
|
+
parse_transaction_with_wallet_keys(wallet_keys: WasmRootWalletKeys, replay_protection: WasmReplayProtection, paygo_pubkeys?: WasmECPair[] | null): any;
|
|
179
194
|
/**
|
|
180
195
|
* Verify if a replay protection input has a valid signature
|
|
181
196
|
*
|
|
@@ -206,6 +221,7 @@ export class BitGoPsbt {
|
|
|
206
221
|
*/
|
|
207
222
|
serialize(): Uint8Array;
|
|
208
223
|
}
|
|
224
|
+
|
|
209
225
|
export class FixedScriptWalletNamespace {
|
|
210
226
|
private constructor();
|
|
211
227
|
free(): void;
|
|
@@ -213,6 +229,7 @@ export class FixedScriptWalletNamespace {
|
|
|
213
229
|
static output_script(keys: WasmRootWalletKeys, chain: number, index: number, network: any): Uint8Array;
|
|
214
230
|
static address(keys: WasmRootWalletKeys, chain: number, index: number, network: any, address_format?: string | null): string;
|
|
215
231
|
}
|
|
232
|
+
|
|
216
233
|
export class UtxolibCompatNamespace {
|
|
217
234
|
private constructor();
|
|
218
235
|
free(): void;
|
|
@@ -236,10 +253,7 @@ export class UtxolibCompatNamespace {
|
|
|
236
253
|
*/
|
|
237
254
|
static from_output_script(script: Uint8Array, network: any, format?: string | null): string;
|
|
238
255
|
}
|
|
239
|
-
|
|
240
|
-
* WASM wrapper for BIP32 extended keys (Xpub/Xpriv)
|
|
241
|
-
* Implements the BIP32Interface TypeScript interface
|
|
242
|
-
*/
|
|
256
|
+
|
|
243
257
|
export class WasmBIP32 {
|
|
244
258
|
private constructor();
|
|
245
259
|
free(): void;
|
|
@@ -332,9 +346,7 @@ export class WasmBIP32 {
|
|
|
332
346
|
*/
|
|
333
347
|
readonly index: number;
|
|
334
348
|
}
|
|
335
|
-
|
|
336
|
-
* WASM wrapper for elliptic curve key pairs (always uses compressed keys)
|
|
337
|
-
*/
|
|
349
|
+
|
|
338
350
|
export class WasmECPair {
|
|
339
351
|
private constructor();
|
|
340
352
|
free(): void;
|
|
@@ -380,9 +392,7 @@ export class WasmECPair {
|
|
|
380
392
|
*/
|
|
381
393
|
readonly private_key: Uint8Array | undefined;
|
|
382
394
|
}
|
|
383
|
-
|
|
384
|
-
* WASM wrapper for ReplayProtection
|
|
385
|
-
*/
|
|
395
|
+
|
|
386
396
|
export class WasmReplayProtection {
|
|
387
397
|
private constructor();
|
|
388
398
|
free(): void;
|
|
@@ -400,10 +410,7 @@ export class WasmReplayProtection {
|
|
|
400
410
|
*/
|
|
401
411
|
static from_output_scripts(output_scripts: Uint8Array[]): WasmReplayProtection;
|
|
402
412
|
}
|
|
403
|
-
|
|
404
|
-
* WASM wrapper for RootWalletKeys
|
|
405
|
-
* Represents a set of three extended public keys with their derivation prefixes
|
|
406
|
-
*/
|
|
413
|
+
|
|
407
414
|
export class WasmRootWalletKeys {
|
|
408
415
|
free(): void;
|
|
409
416
|
[Symbol.dispose](): void;
|
|
@@ -442,6 +449,7 @@ export class WasmRootWalletKeys {
|
|
|
442
449
|
*/
|
|
443
450
|
bitgo_key(): WasmBIP32;
|
|
444
451
|
}
|
|
452
|
+
|
|
445
453
|
export class WrapDescriptor {
|
|
446
454
|
private constructor();
|
|
447
455
|
free(): void;
|
|
@@ -456,6 +464,7 @@ export class WrapDescriptor {
|
|
|
456
464
|
descType(): any;
|
|
457
465
|
toString(): string;
|
|
458
466
|
}
|
|
467
|
+
|
|
459
468
|
export class WrapMiniscript {
|
|
460
469
|
private constructor();
|
|
461
470
|
free(): void;
|
|
@@ -465,6 +474,7 @@ export class WrapMiniscript {
|
|
|
465
474
|
encode(): Uint8Array;
|
|
466
475
|
toString(): string;
|
|
467
476
|
}
|
|
477
|
+
|
|
468
478
|
export class WrapPsbt {
|
|
469
479
|
private constructor();
|
|
470
480
|
free(): void;
|