@bitgo/wasm-utxo 1.10.0 → 1.12.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 +15 -2
- package/dist/cjs/js/wasm/wasm_utxo.js +66 -16
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +57 -56
- package/dist/cjs/package.json +1 -0
- 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 +15 -2
- package/dist/esm/js/wasm/wasm_utxo_bg.js +66 -16
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +57 -56
- package/package.json +3 -2
|
@@ -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.
|
|
@@ -81,6 +81,19 @@ export class BitGoPsbt {
|
|
|
81
81
|
* - `Err(WasmUtxoError)` if any input failed to finalize
|
|
82
82
|
*/
|
|
83
83
|
finalize_all_inputs(): void;
|
|
84
|
+
/**
|
|
85
|
+
* Add a PayGo attestation to a PSBT output
|
|
86
|
+
*
|
|
87
|
+
* # Arguments
|
|
88
|
+
* - `output_index`: The index of the output to add the attestation to
|
|
89
|
+
* - `entropy`: 64 bytes of entropy
|
|
90
|
+
* - `signature`: ECDSA signature bytes
|
|
91
|
+
*
|
|
92
|
+
* # Returns
|
|
93
|
+
* - `Ok(())` if the attestation was successfully added
|
|
94
|
+
* - `Err(WasmUtxoError)` if the output index is out of bounds or entropy is invalid
|
|
95
|
+
*/
|
|
96
|
+
add_paygo_attestation(output_index: number, entropy: Uint8Array, signature: Uint8Array): void;
|
|
84
97
|
/**
|
|
85
98
|
* Combine/merge data from another PSBT into this one
|
|
86
99
|
*
|
|
@@ -171,11 +184,11 @@ export class BitGoPsbt {
|
|
|
171
184
|
*
|
|
172
185
|
* Note: This method does NOT validate wallet inputs. It only parses outputs.
|
|
173
186
|
*/
|
|
174
|
-
parse_outputs_with_wallet_keys(wallet_keys: WasmRootWalletKeys): any;
|
|
187
|
+
parse_outputs_with_wallet_keys(wallet_keys: WasmRootWalletKeys, paygo_pubkeys?: WasmECPair[] | null): any;
|
|
175
188
|
/**
|
|
176
189
|
* Parse transaction with wallet keys to identify wallet inputs/outputs
|
|
177
190
|
*/
|
|
178
|
-
parse_transaction_with_wallet_keys(wallet_keys: WasmRootWalletKeys, replay_protection: WasmReplayProtection): any;
|
|
191
|
+
parse_transaction_with_wallet_keys(wallet_keys: WasmRootWalletKeys, replay_protection: WasmReplayProtection, paygo_pubkeys?: WasmECPair[] | null): any;
|
|
179
192
|
/**
|
|
180
193
|
* Verify if a replay protection input has a valid signature
|
|
181
194
|
*
|
|
@@ -133,12 +133,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
133
133
|
return ptr;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
function _assertClass(instance, klass) {
|
|
137
|
-
if (!(instance instanceof klass)) {
|
|
138
|
-
throw new Error(`expected instance of ${klass.name}`);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
136
|
function passArray8ToWasm0(arg, malloc) {
|
|
143
137
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
144
138
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
@@ -146,12 +140,10 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
146
140
|
return ptr;
|
|
147
141
|
}
|
|
148
142
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
heap[--stack_pointer] = obj;
|
|
154
|
-
return stack_pointer;
|
|
143
|
+
function _assertClass(instance, klass) {
|
|
144
|
+
if (!(instance instanceof klass)) {
|
|
145
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
146
|
+
}
|
|
155
147
|
}
|
|
156
148
|
|
|
157
149
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
@@ -164,6 +156,14 @@ function passArrayJsValueToWasm0(array, malloc) {
|
|
|
164
156
|
return ptr;
|
|
165
157
|
}
|
|
166
158
|
|
|
159
|
+
let stack_pointer = 128;
|
|
160
|
+
|
|
161
|
+
function addBorrowedObject(obj) {
|
|
162
|
+
if (stack_pointer == 1) throw new Error('out of js stack');
|
|
163
|
+
heap[--stack_pointer] = obj;
|
|
164
|
+
return stack_pointer;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
167
|
const AddressNamespaceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
168
168
|
? { register: () => {}, unregister: () => {} }
|
|
169
169
|
: new FinalizationRegistry(ptr => wasm.__wbg_addressnamespace_free(ptr >>> 0, 1));
|
|
@@ -441,6 +441,38 @@ class BitGoPsbt {
|
|
|
441
441
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
+
/**
|
|
445
|
+
* Add a PayGo attestation to a PSBT output
|
|
446
|
+
*
|
|
447
|
+
* # Arguments
|
|
448
|
+
* - `output_index`: The index of the output to add the attestation to
|
|
449
|
+
* - `entropy`: 64 bytes of entropy
|
|
450
|
+
* - `signature`: ECDSA signature bytes
|
|
451
|
+
*
|
|
452
|
+
* # Returns
|
|
453
|
+
* - `Ok(())` if the attestation was successfully added
|
|
454
|
+
* - `Err(WasmUtxoError)` if the output index is out of bounds or entropy is invalid
|
|
455
|
+
* @param {number} output_index
|
|
456
|
+
* @param {Uint8Array} entropy
|
|
457
|
+
* @param {Uint8Array} signature
|
|
458
|
+
*/
|
|
459
|
+
add_paygo_attestation(output_index, entropy, signature) {
|
|
460
|
+
try {
|
|
461
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
462
|
+
const ptr0 = passArray8ToWasm0(entropy, wasm.__wbindgen_export_1);
|
|
463
|
+
const len0 = WASM_VECTOR_LEN;
|
|
464
|
+
const ptr1 = passArray8ToWasm0(signature, wasm.__wbindgen_export_1);
|
|
465
|
+
const len1 = WASM_VECTOR_LEN;
|
|
466
|
+
wasm.bitgopsbt_add_paygo_attestation(retptr, this.__wbg_ptr, output_index, ptr0, len0, ptr1, len1);
|
|
467
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
468
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
469
|
+
if (r1) {
|
|
470
|
+
throw takeObject(r0);
|
|
471
|
+
}
|
|
472
|
+
} finally {
|
|
473
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
444
476
|
/**
|
|
445
477
|
* Combine/merge data from another PSBT into this one
|
|
446
478
|
*
|
|
@@ -598,13 +630,16 @@ class BitGoPsbt {
|
|
|
598
630
|
*
|
|
599
631
|
* Note: This method does NOT validate wallet inputs. It only parses outputs.
|
|
600
632
|
* @param {WasmRootWalletKeys} wallet_keys
|
|
633
|
+
* @param {WasmECPair[] | null} [paygo_pubkeys]
|
|
601
634
|
* @returns {any}
|
|
602
635
|
*/
|
|
603
|
-
parse_outputs_with_wallet_keys(wallet_keys) {
|
|
636
|
+
parse_outputs_with_wallet_keys(wallet_keys, paygo_pubkeys) {
|
|
604
637
|
try {
|
|
605
638
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
606
639
|
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
607
|
-
|
|
640
|
+
var ptr0 = isLikeNone(paygo_pubkeys) ? 0 : passArrayJsValueToWasm0(paygo_pubkeys, wasm.__wbindgen_export_1);
|
|
641
|
+
var len0 = WASM_VECTOR_LEN;
|
|
642
|
+
wasm.bitgopsbt_parse_outputs_with_wallet_keys(retptr, this.__wbg_ptr, wallet_keys.__wbg_ptr, ptr0, len0);
|
|
608
643
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
609
644
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
610
645
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -620,14 +655,17 @@ class BitGoPsbt {
|
|
|
620
655
|
* Parse transaction with wallet keys to identify wallet inputs/outputs
|
|
621
656
|
* @param {WasmRootWalletKeys} wallet_keys
|
|
622
657
|
* @param {WasmReplayProtection} replay_protection
|
|
658
|
+
* @param {WasmECPair[] | null} [paygo_pubkeys]
|
|
623
659
|
* @returns {any}
|
|
624
660
|
*/
|
|
625
|
-
parse_transaction_with_wallet_keys(wallet_keys, replay_protection) {
|
|
661
|
+
parse_transaction_with_wallet_keys(wallet_keys, replay_protection, paygo_pubkeys) {
|
|
626
662
|
try {
|
|
627
663
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
628
664
|
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
629
665
|
_assertClass(replay_protection, WasmReplayProtection);
|
|
630
|
-
|
|
666
|
+
var ptr0 = isLikeNone(paygo_pubkeys) ? 0 : passArrayJsValueToWasm0(paygo_pubkeys, wasm.__wbindgen_export_1);
|
|
667
|
+
var len0 = WASM_VECTOR_LEN;
|
|
668
|
+
wasm.bitgopsbt_parse_transaction_with_wallet_keys(retptr, this.__wbg_ptr, wallet_keys.__wbg_ptr, replay_protection.__wbg_ptr, ptr0, len0);
|
|
631
669
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
632
670
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
633
671
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1279,6 +1317,13 @@ class WasmECPair {
|
|
|
1279
1317
|
return obj;
|
|
1280
1318
|
}
|
|
1281
1319
|
|
|
1320
|
+
static __unwrap(jsValue) {
|
|
1321
|
+
if (!(jsValue instanceof WasmECPair)) {
|
|
1322
|
+
return 0;
|
|
1323
|
+
}
|
|
1324
|
+
return jsValue.__destroy_into_raw();
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1282
1327
|
__destroy_into_raw() {
|
|
1283
1328
|
const ptr = this.__wbg_ptr;
|
|
1284
1329
|
this.__wbg_ptr = 0;
|
|
@@ -2475,6 +2520,11 @@ exports.__wbg_versions_c01dfd4722a88165 = function(arg0) {
|
|
|
2475
2520
|
return addHeapObject(ret);
|
|
2476
2521
|
};
|
|
2477
2522
|
|
|
2523
|
+
exports.__wbg_wasmecpair_unwrap = function(arg0) {
|
|
2524
|
+
const ret = WasmECPair.__unwrap(takeObject(arg0));
|
|
2525
|
+
return ret;
|
|
2526
|
+
};
|
|
2527
|
+
|
|
2478
2528
|
exports.__wbg_wbindgenisfunction_8cee7dce3725ae74 = function(arg0) {
|
|
2479
2529
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
2480
2530
|
return ret;
|
|
Binary file
|
|
@@ -1,13 +1,64 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
6
|
+
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
7
|
+
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
8
|
+
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
9
|
+
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
10
|
+
export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
11
|
+
export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
|
|
12
|
+
export const wrapdescriptor_hasWildcard: (a: number) => number;
|
|
13
|
+
export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
|
|
14
|
+
export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
15
|
+
export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
|
|
16
|
+
export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
|
|
17
|
+
export const wrapdescriptor_toString: (a: number, b: number) => void;
|
|
18
|
+
export const wrapminiscript_encode: (a: number, b: number) => void;
|
|
19
|
+
export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
20
|
+
export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
21
|
+
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
22
|
+
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
23
|
+
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
24
|
+
export const wrappsbt_clone: (a: number) => number;
|
|
25
|
+
export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
|
|
26
|
+
export const wrappsbt_finalize: (a: number, b: number) => void;
|
|
27
|
+
export const wrappsbt_serialize: (a: number, b: number) => void;
|
|
28
|
+
export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
|
|
29
|
+
export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
|
|
30
|
+
export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
31
|
+
export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
32
|
+
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
33
|
+
export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
|
|
34
|
+
export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
|
|
4
35
|
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
36
|
+
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
37
|
+
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
38
|
+
export const bitgopsbt_add_paygo_attestation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
39
|
+
export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
|
|
40
|
+
export const bitgopsbt_extract_transaction: (a: number, b: number) => void;
|
|
41
|
+
export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
|
|
42
|
+
export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
43
|
+
export const bitgopsbt_generate_musig2_nonces: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
44
|
+
export const bitgopsbt_network: (a: number, b: number) => void;
|
|
45
|
+
export const bitgopsbt_parse_outputs_with_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
46
|
+
export const bitgopsbt_parse_transaction_with_wallet_keys: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
47
|
+
export const bitgopsbt_serialize: (a: number, b: number) => void;
|
|
48
|
+
export const bitgopsbt_sign_with_privkey: (a: number, b: number, c: number, d: number) => void;
|
|
49
|
+
export const bitgopsbt_sign_with_xpriv: (a: number, b: number, c: number, d: number) => void;
|
|
50
|
+
export const bitgopsbt_unsigned_txid: (a: number, b: number) => void;
|
|
51
|
+
export const bitgopsbt_verify_replay_protection_signature: (a: number, b: number, c: number, d: number) => void;
|
|
52
|
+
export const bitgopsbt_verify_signature_with_pub: (a: number, b: number, c: number, d: number) => void;
|
|
53
|
+
export const bitgopsbt_verify_signature_with_xpub: (a: number, b: number, c: number, d: number) => void;
|
|
54
|
+
export const fixedscriptwalletnamespace_address: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
55
|
+
export const fixedscriptwalletnamespace_output_script: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
56
|
+
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
57
|
+
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
5
58
|
export const __wbg_wasmbip32_free: (a: number, b: number) => void;
|
|
6
59
|
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
60
|
+
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
7
61
|
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
8
|
-
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
9
|
-
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
10
|
-
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
11
62
|
export const wasmbip32_chain_code: (a: number) => number;
|
|
12
63
|
export const wasmbip32_depth: (a: number) => number;
|
|
13
64
|
export const wasmbip32_derive: (a: number, b: number, c: number) => void;
|
|
@@ -38,65 +89,15 @@ export const wasmecpair_public_key: (a: number) => number;
|
|
|
38
89
|
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
39
90
|
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
40
91
|
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
92
|
+
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
93
|
+
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
94
|
+
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
41
95
|
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
42
96
|
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
43
97
|
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
44
98
|
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
45
99
|
export const wasmrootwalletkeys_with_derivation_prefixes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
46
|
-
export const wrappsbt_clone: (a: number) => number;
|
|
47
|
-
export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
|
|
48
|
-
export const wrappsbt_finalize: (a: number, b: number) => void;
|
|
49
|
-
export const wrappsbt_serialize: (a: number, b: number) => void;
|
|
50
|
-
export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
|
|
51
|
-
export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
|
|
52
|
-
export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
53
|
-
export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
54
100
|
export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
55
|
-
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
56
|
-
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
57
|
-
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
58
|
-
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
59
|
-
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
60
|
-
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
61
|
-
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
62
|
-
export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
|
|
63
|
-
export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
|
|
64
|
-
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
65
|
-
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
66
|
-
export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
|
|
67
|
-
export const bitgopsbt_extract_transaction: (a: number, b: number) => void;
|
|
68
|
-
export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
|
|
69
|
-
export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
70
|
-
export const bitgopsbt_generate_musig2_nonces: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
71
|
-
export const bitgopsbt_network: (a: number, b: number) => void;
|
|
72
|
-
export const bitgopsbt_parse_outputs_with_wallet_keys: (a: number, b: number, c: number) => void;
|
|
73
|
-
export const bitgopsbt_parse_transaction_with_wallet_keys: (a: number, b: number, c: number, d: number) => void;
|
|
74
|
-
export const bitgopsbt_serialize: (a: number, b: number) => void;
|
|
75
|
-
export const bitgopsbt_sign_with_privkey: (a: number, b: number, c: number, d: number) => void;
|
|
76
|
-
export const bitgopsbt_sign_with_xpriv: (a: number, b: number, c: number, d: number) => void;
|
|
77
|
-
export const bitgopsbt_unsigned_txid: (a: number, b: number) => void;
|
|
78
|
-
export const bitgopsbt_verify_replay_protection_signature: (a: number, b: number, c: number, d: number) => void;
|
|
79
|
-
export const bitgopsbt_verify_signature_with_pub: (a: number, b: number, c: number, d: number) => void;
|
|
80
|
-
export const bitgopsbt_verify_signature_with_xpub: (a: number, b: number, c: number, d: number) => void;
|
|
81
|
-
export const fixedscriptwalletnamespace_address: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
82
|
-
export const fixedscriptwalletnamespace_output_script: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
83
|
-
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
84
|
-
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
85
|
-
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
86
|
-
export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
87
|
-
export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
|
|
88
|
-
export const wrapdescriptor_hasWildcard: (a: number) => number;
|
|
89
|
-
export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
|
|
90
|
-
export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
91
|
-
export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
|
|
92
|
-
export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
|
|
93
|
-
export const wrapdescriptor_toString: (a: number, b: number) => void;
|
|
94
|
-
export const wrapminiscript_encode: (a: number, b: number) => void;
|
|
95
|
-
export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
96
|
-
export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
97
|
-
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
98
|
-
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
99
|
-
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
100
101
|
export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
|
|
101
102
|
export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
|
|
102
103
|
export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -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
|
*
|
|
@@ -29,12 +29,14 @@ export class BitGoPsbt {
|
|
|
29
29
|
* Parse transaction with wallet keys to identify wallet inputs/outputs
|
|
30
30
|
* @param walletKeys - The wallet keys to use for identification
|
|
31
31
|
* @param replayProtection - Scripts that are allowed as inputs without wallet validation
|
|
32
|
+
* @param payGoPubkeys - Optional public keys for PayGo attestation verification
|
|
32
33
|
* @returns Parsed transaction information
|
|
33
34
|
*/
|
|
34
|
-
parseTransactionWithWalletKeys(walletKeys, replayProtection) {
|
|
35
|
+
parseTransactionWithWalletKeys(walletKeys, replayProtection, payGoPubkeys) {
|
|
35
36
|
const keys = RootWalletKeys.from(walletKeys);
|
|
36
37
|
const rp = ReplayProtection.from(replayProtection, this.wasm.network());
|
|
37
|
-
|
|
38
|
+
const pubkeys = payGoPubkeys?.map((arg) => ECPair.from(arg).wasm);
|
|
39
|
+
return this.wasm.parse_transaction_with_wallet_keys(keys.wasm, rp.wasm, pubkeys);
|
|
38
40
|
}
|
|
39
41
|
/**
|
|
40
42
|
* Parse outputs with wallet keys to identify which outputs belong to a wallet
|
|
@@ -44,12 +46,28 @@ export class BitGoPsbt {
|
|
|
44
46
|
* wallet than the inputs.
|
|
45
47
|
*
|
|
46
48
|
* @param walletKeys - The wallet keys to use for identification
|
|
49
|
+
* @param payGoPubkeys - Optional public keys for PayGo attestation verification
|
|
47
50
|
* @returns Array of parsed outputs
|
|
48
51
|
* @note This method does NOT validate wallet inputs. It only parses outputs.
|
|
49
52
|
*/
|
|
50
|
-
parseOutputsWithWalletKeys(walletKeys) {
|
|
53
|
+
parseOutputsWithWalletKeys(walletKeys, payGoPubkeys) {
|
|
51
54
|
const keys = RootWalletKeys.from(walletKeys);
|
|
52
|
-
|
|
55
|
+
const pubkeys = payGoPubkeys?.map((arg) => ECPair.from(arg).wasm);
|
|
56
|
+
return this.wasm.parse_outputs_with_wallet_keys(keys.wasm, pubkeys);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Add a PayGo attestation to a PSBT output
|
|
60
|
+
*
|
|
61
|
+
* This adds a cryptographic proof that the output address was authorized by a signing authority.
|
|
62
|
+
* The attestation is stored in PSBT proprietary key-values and can be verified later.
|
|
63
|
+
*
|
|
64
|
+
* @param outputIndex - The index of the output to add the attestation to
|
|
65
|
+
* @param entropy - 64 bytes of entropy (must be exactly 64 bytes)
|
|
66
|
+
* @param signature - ECDSA signature bytes (typically 65 bytes in recoverable format)
|
|
67
|
+
* @throws Error if output index is out of bounds or entropy is not 64 bytes
|
|
68
|
+
*/
|
|
69
|
+
addPayGoAttestation(outputIndex, entropy, signature) {
|
|
70
|
+
this.wasm.add_paygo_attestation(outputIndex, entropy, signature);
|
|
53
71
|
}
|
|
54
72
|
/**
|
|
55
73
|
* Verify if a valid signature exists for a given key at the specified input index.
|
|
@@ -81,6 +81,19 @@ export class BitGoPsbt {
|
|
|
81
81
|
* - `Err(WasmUtxoError)` if any input failed to finalize
|
|
82
82
|
*/
|
|
83
83
|
finalize_all_inputs(): void;
|
|
84
|
+
/**
|
|
85
|
+
* Add a PayGo attestation to a PSBT output
|
|
86
|
+
*
|
|
87
|
+
* # Arguments
|
|
88
|
+
* - `output_index`: The index of the output to add the attestation to
|
|
89
|
+
* - `entropy`: 64 bytes of entropy
|
|
90
|
+
* - `signature`: ECDSA signature bytes
|
|
91
|
+
*
|
|
92
|
+
* # Returns
|
|
93
|
+
* - `Ok(())` if the attestation was successfully added
|
|
94
|
+
* - `Err(WasmUtxoError)` if the output index is out of bounds or entropy is invalid
|
|
95
|
+
*/
|
|
96
|
+
add_paygo_attestation(output_index: number, entropy: Uint8Array, signature: Uint8Array): void;
|
|
84
97
|
/**
|
|
85
98
|
* Combine/merge data from another PSBT into this one
|
|
86
99
|
*
|
|
@@ -171,11 +184,11 @@ export class BitGoPsbt {
|
|
|
171
184
|
*
|
|
172
185
|
* Note: This method does NOT validate wallet inputs. It only parses outputs.
|
|
173
186
|
*/
|
|
174
|
-
parse_outputs_with_wallet_keys(wallet_keys: WasmRootWalletKeys): any;
|
|
187
|
+
parse_outputs_with_wallet_keys(wallet_keys: WasmRootWalletKeys, paygo_pubkeys?: WasmECPair[] | null): any;
|
|
175
188
|
/**
|
|
176
189
|
* Parse transaction with wallet keys to identify wallet inputs/outputs
|
|
177
190
|
*/
|
|
178
|
-
parse_transaction_with_wallet_keys(wallet_keys: WasmRootWalletKeys, replay_protection: WasmReplayProtection): any;
|
|
191
|
+
parse_transaction_with_wallet_keys(wallet_keys: WasmRootWalletKeys, replay_protection: WasmReplayProtection, paygo_pubkeys?: WasmECPair[] | null): any;
|
|
179
192
|
/**
|
|
180
193
|
* Verify if a replay protection input has a valid signature
|
|
181
194
|
*
|
|
@@ -143,12 +143,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
143
143
|
return ptr;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
function _assertClass(instance, klass) {
|
|
147
|
-
if (!(instance instanceof klass)) {
|
|
148
|
-
throw new Error(`expected instance of ${klass.name}`);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
146
|
function passArray8ToWasm0(arg, malloc) {
|
|
153
147
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
154
148
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
@@ -156,12 +150,10 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
156
150
|
return ptr;
|
|
157
151
|
}
|
|
158
152
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
heap[--stack_pointer] = obj;
|
|
164
|
-
return stack_pointer;
|
|
153
|
+
function _assertClass(instance, klass) {
|
|
154
|
+
if (!(instance instanceof klass)) {
|
|
155
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
156
|
+
}
|
|
165
157
|
}
|
|
166
158
|
|
|
167
159
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
@@ -174,6 +166,14 @@ function passArrayJsValueToWasm0(array, malloc) {
|
|
|
174
166
|
return ptr;
|
|
175
167
|
}
|
|
176
168
|
|
|
169
|
+
let stack_pointer = 128;
|
|
170
|
+
|
|
171
|
+
function addBorrowedObject(obj) {
|
|
172
|
+
if (stack_pointer == 1) throw new Error('out of js stack');
|
|
173
|
+
heap[--stack_pointer] = obj;
|
|
174
|
+
return stack_pointer;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
177
|
const AddressNamespaceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
178
178
|
? { register: () => {}, unregister: () => {} }
|
|
179
179
|
: new FinalizationRegistry(ptr => wasm.__wbg_addressnamespace_free(ptr >>> 0, 1));
|
|
@@ -449,6 +449,38 @@ export class BitGoPsbt {
|
|
|
449
449
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
+
/**
|
|
453
|
+
* Add a PayGo attestation to a PSBT output
|
|
454
|
+
*
|
|
455
|
+
* # Arguments
|
|
456
|
+
* - `output_index`: The index of the output to add the attestation to
|
|
457
|
+
* - `entropy`: 64 bytes of entropy
|
|
458
|
+
* - `signature`: ECDSA signature bytes
|
|
459
|
+
*
|
|
460
|
+
* # Returns
|
|
461
|
+
* - `Ok(())` if the attestation was successfully added
|
|
462
|
+
* - `Err(WasmUtxoError)` if the output index is out of bounds or entropy is invalid
|
|
463
|
+
* @param {number} output_index
|
|
464
|
+
* @param {Uint8Array} entropy
|
|
465
|
+
* @param {Uint8Array} signature
|
|
466
|
+
*/
|
|
467
|
+
add_paygo_attestation(output_index, entropy, signature) {
|
|
468
|
+
try {
|
|
469
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
470
|
+
const ptr0 = passArray8ToWasm0(entropy, wasm.__wbindgen_export_1);
|
|
471
|
+
const len0 = WASM_VECTOR_LEN;
|
|
472
|
+
const ptr1 = passArray8ToWasm0(signature, wasm.__wbindgen_export_1);
|
|
473
|
+
const len1 = WASM_VECTOR_LEN;
|
|
474
|
+
wasm.bitgopsbt_add_paygo_attestation(retptr, this.__wbg_ptr, output_index, ptr0, len0, ptr1, len1);
|
|
475
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
476
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
477
|
+
if (r1) {
|
|
478
|
+
throw takeObject(r0);
|
|
479
|
+
}
|
|
480
|
+
} finally {
|
|
481
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
452
484
|
/**
|
|
453
485
|
* Combine/merge data from another PSBT into this one
|
|
454
486
|
*
|
|
@@ -606,13 +638,16 @@ export class BitGoPsbt {
|
|
|
606
638
|
*
|
|
607
639
|
* Note: This method does NOT validate wallet inputs. It only parses outputs.
|
|
608
640
|
* @param {WasmRootWalletKeys} wallet_keys
|
|
641
|
+
* @param {WasmECPair[] | null} [paygo_pubkeys]
|
|
609
642
|
* @returns {any}
|
|
610
643
|
*/
|
|
611
|
-
parse_outputs_with_wallet_keys(wallet_keys) {
|
|
644
|
+
parse_outputs_with_wallet_keys(wallet_keys, paygo_pubkeys) {
|
|
612
645
|
try {
|
|
613
646
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
614
647
|
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
615
|
-
|
|
648
|
+
var ptr0 = isLikeNone(paygo_pubkeys) ? 0 : passArrayJsValueToWasm0(paygo_pubkeys, wasm.__wbindgen_export_1);
|
|
649
|
+
var len0 = WASM_VECTOR_LEN;
|
|
650
|
+
wasm.bitgopsbt_parse_outputs_with_wallet_keys(retptr, this.__wbg_ptr, wallet_keys.__wbg_ptr, ptr0, len0);
|
|
616
651
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
617
652
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
618
653
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -628,14 +663,17 @@ export class BitGoPsbt {
|
|
|
628
663
|
* Parse transaction with wallet keys to identify wallet inputs/outputs
|
|
629
664
|
* @param {WasmRootWalletKeys} wallet_keys
|
|
630
665
|
* @param {WasmReplayProtection} replay_protection
|
|
666
|
+
* @param {WasmECPair[] | null} [paygo_pubkeys]
|
|
631
667
|
* @returns {any}
|
|
632
668
|
*/
|
|
633
|
-
parse_transaction_with_wallet_keys(wallet_keys, replay_protection) {
|
|
669
|
+
parse_transaction_with_wallet_keys(wallet_keys, replay_protection, paygo_pubkeys) {
|
|
634
670
|
try {
|
|
635
671
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
636
672
|
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
637
673
|
_assertClass(replay_protection, WasmReplayProtection);
|
|
638
|
-
|
|
674
|
+
var ptr0 = isLikeNone(paygo_pubkeys) ? 0 : passArrayJsValueToWasm0(paygo_pubkeys, wasm.__wbindgen_export_1);
|
|
675
|
+
var len0 = WASM_VECTOR_LEN;
|
|
676
|
+
wasm.bitgopsbt_parse_transaction_with_wallet_keys(retptr, this.__wbg_ptr, wallet_keys.__wbg_ptr, replay_protection.__wbg_ptr, ptr0, len0);
|
|
639
677
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
640
678
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
641
679
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1279,6 +1317,13 @@ export class WasmECPair {
|
|
|
1279
1317
|
return obj;
|
|
1280
1318
|
}
|
|
1281
1319
|
|
|
1320
|
+
static __unwrap(jsValue) {
|
|
1321
|
+
if (!(jsValue instanceof WasmECPair)) {
|
|
1322
|
+
return 0;
|
|
1323
|
+
}
|
|
1324
|
+
return jsValue.__destroy_into_raw();
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1282
1327
|
__destroy_into_raw() {
|
|
1283
1328
|
const ptr = this.__wbg_ptr;
|
|
1284
1329
|
this.__wbg_ptr = 0;
|
|
@@ -2463,6 +2508,11 @@ export function __wbg_versions_c01dfd4722a88165(arg0) {
|
|
|
2463
2508
|
return addHeapObject(ret);
|
|
2464
2509
|
};
|
|
2465
2510
|
|
|
2511
|
+
export function __wbg_wasmecpair_unwrap(arg0) {
|
|
2512
|
+
const ret = WasmECPair.__unwrap(takeObject(arg0));
|
|
2513
|
+
return ret;
|
|
2514
|
+
};
|
|
2515
|
+
|
|
2466
2516
|
export function __wbg_wbindgenisfunction_8cee7dce3725ae74(arg0) {
|
|
2467
2517
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
2468
2518
|
return ret;
|
|
Binary file
|
|
@@ -1,13 +1,64 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
6
|
+
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
7
|
+
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
8
|
+
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
9
|
+
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
10
|
+
export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
11
|
+
export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
|
|
12
|
+
export const wrapdescriptor_hasWildcard: (a: number) => number;
|
|
13
|
+
export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
|
|
14
|
+
export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
15
|
+
export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
|
|
16
|
+
export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
|
|
17
|
+
export const wrapdescriptor_toString: (a: number, b: number) => void;
|
|
18
|
+
export const wrapminiscript_encode: (a: number, b: number) => void;
|
|
19
|
+
export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
20
|
+
export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
21
|
+
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
22
|
+
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
23
|
+
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
24
|
+
export const wrappsbt_clone: (a: number) => number;
|
|
25
|
+
export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
|
|
26
|
+
export const wrappsbt_finalize: (a: number, b: number) => void;
|
|
27
|
+
export const wrappsbt_serialize: (a: number, b: number) => void;
|
|
28
|
+
export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
|
|
29
|
+
export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
|
|
30
|
+
export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
31
|
+
export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
32
|
+
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
33
|
+
export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
|
|
34
|
+
export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
|
|
4
35
|
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
36
|
+
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
37
|
+
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
38
|
+
export const bitgopsbt_add_paygo_attestation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
39
|
+
export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
|
|
40
|
+
export const bitgopsbt_extract_transaction: (a: number, b: number) => void;
|
|
41
|
+
export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
|
|
42
|
+
export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
43
|
+
export const bitgopsbt_generate_musig2_nonces: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
44
|
+
export const bitgopsbt_network: (a: number, b: number) => void;
|
|
45
|
+
export const bitgopsbt_parse_outputs_with_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
46
|
+
export const bitgopsbt_parse_transaction_with_wallet_keys: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
47
|
+
export const bitgopsbt_serialize: (a: number, b: number) => void;
|
|
48
|
+
export const bitgopsbt_sign_with_privkey: (a: number, b: number, c: number, d: number) => void;
|
|
49
|
+
export const bitgopsbt_sign_with_xpriv: (a: number, b: number, c: number, d: number) => void;
|
|
50
|
+
export const bitgopsbt_unsigned_txid: (a: number, b: number) => void;
|
|
51
|
+
export const bitgopsbt_verify_replay_protection_signature: (a: number, b: number, c: number, d: number) => void;
|
|
52
|
+
export const bitgopsbt_verify_signature_with_pub: (a: number, b: number, c: number, d: number) => void;
|
|
53
|
+
export const bitgopsbt_verify_signature_with_xpub: (a: number, b: number, c: number, d: number) => void;
|
|
54
|
+
export const fixedscriptwalletnamespace_address: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
55
|
+
export const fixedscriptwalletnamespace_output_script: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
56
|
+
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
57
|
+
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
5
58
|
export const __wbg_wasmbip32_free: (a: number, b: number) => void;
|
|
6
59
|
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
60
|
+
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
7
61
|
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
8
|
-
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
9
|
-
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
10
|
-
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
11
62
|
export const wasmbip32_chain_code: (a: number) => number;
|
|
12
63
|
export const wasmbip32_depth: (a: number) => number;
|
|
13
64
|
export const wasmbip32_derive: (a: number, b: number, c: number) => void;
|
|
@@ -38,65 +89,15 @@ export const wasmecpair_public_key: (a: number) => number;
|
|
|
38
89
|
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
39
90
|
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
40
91
|
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
92
|
+
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
93
|
+
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
94
|
+
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
41
95
|
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
42
96
|
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
43
97
|
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
44
98
|
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
45
99
|
export const wasmrootwalletkeys_with_derivation_prefixes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
46
|
-
export const wrappsbt_clone: (a: number) => number;
|
|
47
|
-
export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
|
|
48
|
-
export const wrappsbt_finalize: (a: number, b: number) => void;
|
|
49
|
-
export const wrappsbt_serialize: (a: number, b: number) => void;
|
|
50
|
-
export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
|
|
51
|
-
export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
|
|
52
|
-
export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
53
|
-
export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
54
100
|
export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
55
|
-
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
56
|
-
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
57
|
-
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
58
|
-
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
59
|
-
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
60
|
-
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
61
|
-
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
62
|
-
export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
|
|
63
|
-
export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
|
|
64
|
-
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
65
|
-
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
66
|
-
export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
|
|
67
|
-
export const bitgopsbt_extract_transaction: (a: number, b: number) => void;
|
|
68
|
-
export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
|
|
69
|
-
export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
70
|
-
export const bitgopsbt_generate_musig2_nonces: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
71
|
-
export const bitgopsbt_network: (a: number, b: number) => void;
|
|
72
|
-
export const bitgopsbt_parse_outputs_with_wallet_keys: (a: number, b: number, c: number) => void;
|
|
73
|
-
export const bitgopsbt_parse_transaction_with_wallet_keys: (a: number, b: number, c: number, d: number) => void;
|
|
74
|
-
export const bitgopsbt_serialize: (a: number, b: number) => void;
|
|
75
|
-
export const bitgopsbt_sign_with_privkey: (a: number, b: number, c: number, d: number) => void;
|
|
76
|
-
export const bitgopsbt_sign_with_xpriv: (a: number, b: number, c: number, d: number) => void;
|
|
77
|
-
export const bitgopsbt_unsigned_txid: (a: number, b: number) => void;
|
|
78
|
-
export const bitgopsbt_verify_replay_protection_signature: (a: number, b: number, c: number, d: number) => void;
|
|
79
|
-
export const bitgopsbt_verify_signature_with_pub: (a: number, b: number, c: number, d: number) => void;
|
|
80
|
-
export const bitgopsbt_verify_signature_with_xpub: (a: number, b: number, c: number, d: number) => void;
|
|
81
|
-
export const fixedscriptwalletnamespace_address: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
82
|
-
export const fixedscriptwalletnamespace_output_script: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
83
|
-
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
84
|
-
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
85
|
-
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
86
|
-
export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
87
|
-
export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
|
|
88
|
-
export const wrapdescriptor_hasWildcard: (a: number) => number;
|
|
89
|
-
export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
|
|
90
|
-
export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
91
|
-
export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
|
|
92
|
-
export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
|
|
93
|
-
export const wrapdescriptor_toString: (a: number, b: number) => void;
|
|
94
|
-
export const wrapminiscript_encode: (a: number, b: number) => void;
|
|
95
|
-
export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
96
|
-
export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
97
|
-
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
98
|
-
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
99
|
-
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
100
101
|
export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
|
|
101
102
|
export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
|
|
102
103
|
export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitgo/wasm-utxo",
|
|
3
3
|
"description": "WebAssembly wrapper for rust-bitcoin (beta)",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.12.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"files": [
|
|
12
12
|
"dist/esm/js/**/*",
|
|
13
|
-
"dist/cjs/js/**/*"
|
|
13
|
+
"dist/cjs/js/**/*",
|
|
14
|
+
"dist/cjs/package.json"
|
|
14
15
|
],
|
|
15
16
|
"exports": {
|
|
16
17
|
".": {
|