@bitgo/wasm-utxo 1.20.0 → 1.22.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.
@@ -9,6 +9,106 @@ export class AddressNamespace {
9
9
  static from_output_script_with_coin(script: Uint8Array, coin: string, format?: string | null): string;
10
10
  }
11
11
 
12
+ export class Bip322Namespace {
13
+ private constructor();
14
+ free(): void;
15
+ [Symbol.dispose](): void;
16
+ /**
17
+ * Add a BIP-0322 message input to an existing BitGoPsbt
18
+ *
19
+ * If this is the first input, also adds the OP_RETURN output.
20
+ * The PSBT must have version 0 per BIP-0322 specification.
21
+ *
22
+ * # Arguments
23
+ * * `psbt` - The BitGoPsbt to add the input to
24
+ * * `message` - The message to sign
25
+ * * `chain` - The wallet chain (e.g., 10 for external, 20 for internal)
26
+ * * `index` - The address index
27
+ * * `wallet_keys` - The wallet's root keys
28
+ * * `signer` - Optional signer key name for taproot (e.g., "user", "backup", "bitgo")
29
+ * * `cosigner` - Optional cosigner key name for taproot
30
+ * * `tag` - Optional custom tag for message hashing
31
+ *
32
+ * # Returns
33
+ * The index of the added input
34
+ */
35
+ static add_bip322_input(psbt: BitGoPsbt, message: string, chain: number, index: number, wallet_keys: WasmRootWalletKeys, signer?: string | null, cosigner?: string | null, tag?: string | null): number;
36
+ /**
37
+ * Verify a single input of a BIP-0322 transaction proof
38
+ *
39
+ * # Arguments
40
+ * * `tx` - The signed transaction
41
+ * * `input_index` - The index of the input to verify
42
+ * * `message` - The message that was signed
43
+ * * `chain` - The wallet chain
44
+ * * `index` - The address index
45
+ * * `wallet_keys` - The wallet's root keys
46
+ * * `network` - Network name
47
+ * * `tag` - Optional custom tag for message hashing
48
+ *
49
+ * # Throws
50
+ * Throws an error if verification fails
51
+ */
52
+ static verify_bip322_tx_input(tx: WasmTransaction, input_index: number, message: string, chain: number, index: number, wallet_keys: WasmRootWalletKeys, network: string, tag?: string | null): void;
53
+ /**
54
+ * Verify a single input of a BIP-0322 PSBT proof
55
+ *
56
+ * # Arguments
57
+ * * `psbt` - The signed BitGoPsbt
58
+ * * `input_index` - The index of the input to verify
59
+ * * `message` - The message that was signed
60
+ * * `chain` - The wallet chain
61
+ * * `index` - The address index
62
+ * * `wallet_keys` - The wallet's root keys
63
+ * * `tag` - Optional custom tag for message hashing
64
+ *
65
+ * # Returns
66
+ * An array of signer names ("user", "backup", "bitgo") that have valid signatures
67
+ *
68
+ * # Throws
69
+ * Throws an error if verification fails or no valid signatures found
70
+ */
71
+ static verify_bip322_psbt_input(psbt: BitGoPsbt, input_index: number, message: string, chain: number, index: number, wallet_keys: WasmRootWalletKeys, tag?: string | null): string[];
72
+ /**
73
+ * Verify a single input of a BIP-0322 transaction proof using pubkeys directly
74
+ *
75
+ * # Arguments
76
+ * * `tx` - The signed transaction
77
+ * * `input_index` - The index of the input to verify
78
+ * * `message` - The message that was signed
79
+ * * `pubkeys` - Array of 3 hex-encoded pubkeys [user, backup, bitgo]
80
+ * * `script_type` - One of: "p2sh", "p2shP2wsh", "p2wsh", "p2tr", "p2trMusig2"
81
+ * * `is_script_path` - For taproot types, whether script path was used
82
+ * * `tag` - Optional custom tag for message hashing
83
+ *
84
+ * # Returns
85
+ * An array of pubkey indices (0, 1, 2) that have valid signatures
86
+ *
87
+ * # Throws
88
+ * Throws an error if verification fails
89
+ */
90
+ static verify_bip322_tx_input_with_pubkeys(tx: WasmTransaction, input_index: number, message: string, pubkeys: string[], script_type: string, is_script_path?: boolean | null, tag?: string | null): Uint32Array;
91
+ /**
92
+ * Verify a single input of a BIP-0322 PSBT proof using pubkeys directly
93
+ *
94
+ * # Arguments
95
+ * * `psbt` - The signed BitGoPsbt
96
+ * * `input_index` - The index of the input to verify
97
+ * * `message` - The message that was signed
98
+ * * `pubkeys` - Array of 3 hex-encoded pubkeys [user, backup, bitgo]
99
+ * * `script_type` - One of: "p2sh", "p2shP2wsh", "p2wsh", "p2tr", "p2trMusig2"
100
+ * * `is_script_path` - For taproot types, whether script path was used
101
+ * * `tag` - Optional custom tag for message hashing
102
+ *
103
+ * # Returns
104
+ * An array of pubkey indices (0, 1, 2) that have valid signatures
105
+ *
106
+ * # Throws
107
+ * Throws an error if verification fails or no valid signatures found
108
+ */
109
+ static verify_bip322_psbt_input_with_pubkeys(psbt: BitGoPsbt, input_index: number, message: string, pubkeys: string[], script_type: string, is_script_path?: boolean | null, tag?: string | null): Uint32Array;
110
+ }
111
+
12
112
  export class BitGoPsbt {
13
113
  private constructor();
14
114
  free(): void;
@@ -379,6 +479,22 @@ export class FixedScriptWalletNamespace {
379
479
  free(): void;
380
480
  [Symbol.dispose](): void;
381
481
  static output_script(keys: WasmRootWalletKeys, chain: number, index: number, network: any): Uint8Array;
482
+ /**
483
+ * Check if a network supports a given fixed-script wallet script type
484
+ *
485
+ * # Arguments
486
+ * * `coin` - Coin name (e.g., "btc", "ltc", "doge")
487
+ * * `script_type` - Script type name: "p2sh", "p2shP2wsh", "p2wsh", "p2tr", "p2trMusig2"
488
+ *
489
+ * # Returns
490
+ * `true` if the network supports the script type, `false` otherwise
491
+ *
492
+ * # Examples
493
+ * - Bitcoin supports all script types (p2sh, p2shP2wsh, p2wsh, p2tr, p2trMusig2)
494
+ * - Litecoin supports segwit but not taproot (p2sh, p2shP2wsh, p2wsh)
495
+ * - Dogecoin only supports legacy scripts (p2sh)
496
+ */
497
+ static supports_script_type(coin: string, script_type: string): boolean;
382
498
  static address(keys: WasmRootWalletKeys, chain: number, index: number, network: any, address_format?: string | null): string;
383
499
  }
384
500
 
@@ -29,6 +29,21 @@ function dropObject(idx) {
29
29
  heap_next = idx;
30
30
  }
31
31
 
32
+ function getArrayJsValueFromWasm0(ptr, len) {
33
+ ptr = ptr >>> 0;
34
+ const mem = getDataViewMemory0();
35
+ const result = [];
36
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
37
+ result.push(takeObject(mem.getUint32(i, true)));
38
+ }
39
+ return result;
40
+ }
41
+
42
+ function getArrayU32FromWasm0(ptr, len) {
43
+ ptr = ptr >>> 0;
44
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
45
+ }
46
+
32
47
  function getArrayU8FromWasm0(ptr, len) {
33
48
  ptr = ptr >>> 0;
34
49
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
@@ -47,6 +62,14 @@ function getStringFromWasm0(ptr, len) {
47
62
  return decodeText(ptr, len);
48
63
  }
49
64
 
65
+ let cachedUint32ArrayMemory0 = null;
66
+ function getUint32ArrayMemory0() {
67
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
68
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
69
+ }
70
+ return cachedUint32ArrayMemory0;
71
+ }
72
+
50
73
  let cachedUint8ArrayMemory0 = null;
51
74
  function getUint8ArrayMemory0() {
52
75
  if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
@@ -161,6 +184,10 @@ const AddressNamespaceFinalization = (typeof FinalizationRegistry === 'undefined
161
184
  ? { register: () => {}, unregister: () => {} }
162
185
  : new FinalizationRegistry(ptr => wasm.__wbg_addressnamespace_free(ptr >>> 0, 1));
163
186
 
187
+ const Bip322NamespaceFinalization = (typeof FinalizationRegistry === 'undefined')
188
+ ? { register: () => {}, unregister: () => {} }
189
+ : new FinalizationRegistry(ptr => wasm.__wbg_bip322namespace_free(ptr >>> 0, 1));
190
+
164
191
  const BitGoPsbtFinalization = (typeof FinalizationRegistry === 'undefined')
165
192
  ? { register: () => {}, unregister: () => {} }
166
193
  : new FinalizationRegistry(ptr => wasm.__wbg_bitgopsbt_free(ptr >>> 0, 1));
@@ -295,6 +322,278 @@ class AddressNamespace {
295
322
  if (Symbol.dispose) AddressNamespace.prototype[Symbol.dispose] = AddressNamespace.prototype.free;
296
323
  exports.AddressNamespace = AddressNamespace;
297
324
 
325
+ /**
326
+ * Namespace for BIP-0322 functions
327
+ */
328
+ class Bip322Namespace {
329
+ __destroy_into_raw() {
330
+ const ptr = this.__wbg_ptr;
331
+ this.__wbg_ptr = 0;
332
+ Bip322NamespaceFinalization.unregister(this);
333
+ return ptr;
334
+ }
335
+ free() {
336
+ const ptr = this.__destroy_into_raw();
337
+ wasm.__wbg_bip322namespace_free(ptr, 0);
338
+ }
339
+ /**
340
+ * Add a BIP-0322 message input to an existing BitGoPsbt
341
+ *
342
+ * If this is the first input, also adds the OP_RETURN output.
343
+ * The PSBT must have version 0 per BIP-0322 specification.
344
+ *
345
+ * # Arguments
346
+ * * `psbt` - The BitGoPsbt to add the input to
347
+ * * `message` - The message to sign
348
+ * * `chain` - The wallet chain (e.g., 10 for external, 20 for internal)
349
+ * * `index` - The address index
350
+ * * `wallet_keys` - The wallet's root keys
351
+ * * `signer` - Optional signer key name for taproot (e.g., "user", "backup", "bitgo")
352
+ * * `cosigner` - Optional cosigner key name for taproot
353
+ * * `tag` - Optional custom tag for message hashing
354
+ *
355
+ * # Returns
356
+ * The index of the added input
357
+ * @param {BitGoPsbt} psbt
358
+ * @param {string} message
359
+ * @param {number} chain
360
+ * @param {number} index
361
+ * @param {WasmRootWalletKeys} wallet_keys
362
+ * @param {string | null} [signer]
363
+ * @param {string | null} [cosigner]
364
+ * @param {string | null} [tag]
365
+ * @returns {number}
366
+ */
367
+ static add_bip322_input(psbt, message, chain, index, wallet_keys, signer, cosigner, tag) {
368
+ try {
369
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
370
+ _assertClass(psbt, BitGoPsbt);
371
+ const ptr0 = passStringToWasm0(message, wasm.__wbindgen_export, wasm.__wbindgen_export2);
372
+ const len0 = WASM_VECTOR_LEN;
373
+ _assertClass(wallet_keys, WasmRootWalletKeys);
374
+ var ptr1 = isLikeNone(signer) ? 0 : passStringToWasm0(signer, wasm.__wbindgen_export, wasm.__wbindgen_export2);
375
+ var len1 = WASM_VECTOR_LEN;
376
+ var ptr2 = isLikeNone(cosigner) ? 0 : passStringToWasm0(cosigner, wasm.__wbindgen_export, wasm.__wbindgen_export2);
377
+ var len2 = WASM_VECTOR_LEN;
378
+ var ptr3 = isLikeNone(tag) ? 0 : passStringToWasm0(tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
379
+ var len3 = WASM_VECTOR_LEN;
380
+ wasm.bip322namespace_add_bip322_input(retptr, psbt.__wbg_ptr, ptr0, len0, chain, index, wallet_keys.__wbg_ptr, ptr1, len1, ptr2, len2, ptr3, len3);
381
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
382
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
383
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
384
+ if (r2) {
385
+ throw takeObject(r1);
386
+ }
387
+ return r0 >>> 0;
388
+ } finally {
389
+ wasm.__wbindgen_add_to_stack_pointer(16);
390
+ }
391
+ }
392
+ /**
393
+ * Verify a single input of a BIP-0322 transaction proof
394
+ *
395
+ * # Arguments
396
+ * * `tx` - The signed transaction
397
+ * * `input_index` - The index of the input to verify
398
+ * * `message` - The message that was signed
399
+ * * `chain` - The wallet chain
400
+ * * `index` - The address index
401
+ * * `wallet_keys` - The wallet's root keys
402
+ * * `network` - Network name
403
+ * * `tag` - Optional custom tag for message hashing
404
+ *
405
+ * # Throws
406
+ * Throws an error if verification fails
407
+ * @param {WasmTransaction} tx
408
+ * @param {number} input_index
409
+ * @param {string} message
410
+ * @param {number} chain
411
+ * @param {number} index
412
+ * @param {WasmRootWalletKeys} wallet_keys
413
+ * @param {string} network
414
+ * @param {string | null} [tag]
415
+ */
416
+ static verify_bip322_tx_input(tx, input_index, message, chain, index, wallet_keys, network, tag) {
417
+ try {
418
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
419
+ _assertClass(tx, WasmTransaction);
420
+ const ptr0 = passStringToWasm0(message, wasm.__wbindgen_export, wasm.__wbindgen_export2);
421
+ const len0 = WASM_VECTOR_LEN;
422
+ _assertClass(wallet_keys, WasmRootWalletKeys);
423
+ const ptr1 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
424
+ const len1 = WASM_VECTOR_LEN;
425
+ var ptr2 = isLikeNone(tag) ? 0 : passStringToWasm0(tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
426
+ var len2 = WASM_VECTOR_LEN;
427
+ wasm.bip322namespace_verify_bip322_tx_input(retptr, tx.__wbg_ptr, input_index, ptr0, len0, chain, index, wallet_keys.__wbg_ptr, ptr1, len1, ptr2, len2);
428
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
429
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
430
+ if (r1) {
431
+ throw takeObject(r0);
432
+ }
433
+ } finally {
434
+ wasm.__wbindgen_add_to_stack_pointer(16);
435
+ }
436
+ }
437
+ /**
438
+ * Verify a single input of a BIP-0322 PSBT proof
439
+ *
440
+ * # Arguments
441
+ * * `psbt` - The signed BitGoPsbt
442
+ * * `input_index` - The index of the input to verify
443
+ * * `message` - The message that was signed
444
+ * * `chain` - The wallet chain
445
+ * * `index` - The address index
446
+ * * `wallet_keys` - The wallet's root keys
447
+ * * `tag` - Optional custom tag for message hashing
448
+ *
449
+ * # Returns
450
+ * An array of signer names ("user", "backup", "bitgo") that have valid signatures
451
+ *
452
+ * # Throws
453
+ * Throws an error if verification fails or no valid signatures found
454
+ * @param {BitGoPsbt} psbt
455
+ * @param {number} input_index
456
+ * @param {string} message
457
+ * @param {number} chain
458
+ * @param {number} index
459
+ * @param {WasmRootWalletKeys} wallet_keys
460
+ * @param {string | null} [tag]
461
+ * @returns {string[]}
462
+ */
463
+ static verify_bip322_psbt_input(psbt, input_index, message, chain, index, wallet_keys, tag) {
464
+ try {
465
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
466
+ _assertClass(psbt, BitGoPsbt);
467
+ const ptr0 = passStringToWasm0(message, wasm.__wbindgen_export, wasm.__wbindgen_export2);
468
+ const len0 = WASM_VECTOR_LEN;
469
+ _assertClass(wallet_keys, WasmRootWalletKeys);
470
+ var ptr1 = isLikeNone(tag) ? 0 : passStringToWasm0(tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
471
+ var len1 = WASM_VECTOR_LEN;
472
+ wasm.bip322namespace_verify_bip322_psbt_input(retptr, psbt.__wbg_ptr, input_index, ptr0, len0, chain, index, wallet_keys.__wbg_ptr, ptr1, len1);
473
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
474
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
475
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
476
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
477
+ if (r3) {
478
+ throw takeObject(r2);
479
+ }
480
+ var v3 = getArrayJsValueFromWasm0(r0, r1).slice();
481
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
482
+ return v3;
483
+ } finally {
484
+ wasm.__wbindgen_add_to_stack_pointer(16);
485
+ }
486
+ }
487
+ /**
488
+ * Verify a single input of a BIP-0322 transaction proof using pubkeys directly
489
+ *
490
+ * # Arguments
491
+ * * `tx` - The signed transaction
492
+ * * `input_index` - The index of the input to verify
493
+ * * `message` - The message that was signed
494
+ * * `pubkeys` - Array of 3 hex-encoded pubkeys [user, backup, bitgo]
495
+ * * `script_type` - One of: "p2sh", "p2shP2wsh", "p2wsh", "p2tr", "p2trMusig2"
496
+ * * `is_script_path` - For taproot types, whether script path was used
497
+ * * `tag` - Optional custom tag for message hashing
498
+ *
499
+ * # Returns
500
+ * An array of pubkey indices (0, 1, 2) that have valid signatures
501
+ *
502
+ * # Throws
503
+ * Throws an error if verification fails
504
+ * @param {WasmTransaction} tx
505
+ * @param {number} input_index
506
+ * @param {string} message
507
+ * @param {string[]} pubkeys
508
+ * @param {string} script_type
509
+ * @param {boolean | null} [is_script_path]
510
+ * @param {string | null} [tag]
511
+ * @returns {Uint32Array}
512
+ */
513
+ static verify_bip322_tx_input_with_pubkeys(tx, input_index, message, pubkeys, script_type, is_script_path, tag) {
514
+ try {
515
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
516
+ _assertClass(tx, WasmTransaction);
517
+ const ptr0 = passStringToWasm0(message, wasm.__wbindgen_export, wasm.__wbindgen_export2);
518
+ const len0 = WASM_VECTOR_LEN;
519
+ const ptr1 = passArrayJsValueToWasm0(pubkeys, wasm.__wbindgen_export);
520
+ const len1 = WASM_VECTOR_LEN;
521
+ const ptr2 = passStringToWasm0(script_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
522
+ const len2 = WASM_VECTOR_LEN;
523
+ var ptr3 = isLikeNone(tag) ? 0 : passStringToWasm0(tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
524
+ var len3 = WASM_VECTOR_LEN;
525
+ wasm.bip322namespace_verify_bip322_tx_input_with_pubkeys(retptr, tx.__wbg_ptr, input_index, ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(is_script_path) ? 0xFFFFFF : is_script_path ? 1 : 0, ptr3, len3);
526
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
527
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
528
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
529
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
530
+ if (r3) {
531
+ throw takeObject(r2);
532
+ }
533
+ var v5 = getArrayU32FromWasm0(r0, r1).slice();
534
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
535
+ return v5;
536
+ } finally {
537
+ wasm.__wbindgen_add_to_stack_pointer(16);
538
+ }
539
+ }
540
+ /**
541
+ * Verify a single input of a BIP-0322 PSBT proof using pubkeys directly
542
+ *
543
+ * # Arguments
544
+ * * `psbt` - The signed BitGoPsbt
545
+ * * `input_index` - The index of the input to verify
546
+ * * `message` - The message that was signed
547
+ * * `pubkeys` - Array of 3 hex-encoded pubkeys [user, backup, bitgo]
548
+ * * `script_type` - One of: "p2sh", "p2shP2wsh", "p2wsh", "p2tr", "p2trMusig2"
549
+ * * `is_script_path` - For taproot types, whether script path was used
550
+ * * `tag` - Optional custom tag for message hashing
551
+ *
552
+ * # Returns
553
+ * An array of pubkey indices (0, 1, 2) that have valid signatures
554
+ *
555
+ * # Throws
556
+ * Throws an error if verification fails or no valid signatures found
557
+ * @param {BitGoPsbt} psbt
558
+ * @param {number} input_index
559
+ * @param {string} message
560
+ * @param {string[]} pubkeys
561
+ * @param {string} script_type
562
+ * @param {boolean | null} [is_script_path]
563
+ * @param {string | null} [tag]
564
+ * @returns {Uint32Array}
565
+ */
566
+ static verify_bip322_psbt_input_with_pubkeys(psbt, input_index, message, pubkeys, script_type, is_script_path, tag) {
567
+ try {
568
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
569
+ _assertClass(psbt, BitGoPsbt);
570
+ const ptr0 = passStringToWasm0(message, wasm.__wbindgen_export, wasm.__wbindgen_export2);
571
+ const len0 = WASM_VECTOR_LEN;
572
+ const ptr1 = passArrayJsValueToWasm0(pubkeys, wasm.__wbindgen_export);
573
+ const len1 = WASM_VECTOR_LEN;
574
+ const ptr2 = passStringToWasm0(script_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
575
+ const len2 = WASM_VECTOR_LEN;
576
+ var ptr3 = isLikeNone(tag) ? 0 : passStringToWasm0(tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
577
+ var len3 = WASM_VECTOR_LEN;
578
+ wasm.bip322namespace_verify_bip322_psbt_input_with_pubkeys(retptr, psbt.__wbg_ptr, input_index, ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(is_script_path) ? 0xFFFFFF : is_script_path ? 1 : 0, ptr3, len3);
579
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
580
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
581
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
582
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
583
+ if (r3) {
584
+ throw takeObject(r2);
585
+ }
586
+ var v5 = getArrayU32FromWasm0(r0, r1).slice();
587
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
588
+ return v5;
589
+ } finally {
590
+ wasm.__wbindgen_add_to_stack_pointer(16);
591
+ }
592
+ }
593
+ }
594
+ if (Symbol.dispose) Bip322Namespace.prototype[Symbol.dispose] = Bip322Namespace.prototype.free;
595
+ exports.Bip322Namespace = Bip322Namespace;
596
+
298
597
  class BitGoPsbt {
299
598
  static __wrap(ptr) {
300
599
  ptr = ptr >>> 0;
@@ -1220,6 +1519,43 @@ class FixedScriptWalletNamespace {
1220
1519
  wasm.__wbindgen_add_to_stack_pointer(16);
1221
1520
  }
1222
1521
  }
1522
+ /**
1523
+ * Check if a network supports a given fixed-script wallet script type
1524
+ *
1525
+ * # Arguments
1526
+ * * `coin` - Coin name (e.g., "btc", "ltc", "doge")
1527
+ * * `script_type` - Script type name: "p2sh", "p2shP2wsh", "p2wsh", "p2tr", "p2trMusig2"
1528
+ *
1529
+ * # Returns
1530
+ * `true` if the network supports the script type, `false` otherwise
1531
+ *
1532
+ * # Examples
1533
+ * - Bitcoin supports all script types (p2sh, p2shP2wsh, p2wsh, p2tr, p2trMusig2)
1534
+ * - Litecoin supports segwit but not taproot (p2sh, p2shP2wsh, p2wsh)
1535
+ * - Dogecoin only supports legacy scripts (p2sh)
1536
+ * @param {string} coin
1537
+ * @param {string} script_type
1538
+ * @returns {boolean}
1539
+ */
1540
+ static supports_script_type(coin, script_type) {
1541
+ try {
1542
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1543
+ const ptr0 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1544
+ const len0 = WASM_VECTOR_LEN;
1545
+ const ptr1 = passStringToWasm0(script_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1546
+ const len1 = WASM_VECTOR_LEN;
1547
+ wasm.fixedscriptwalletnamespace_supports_script_type(retptr, ptr0, len0, ptr1, len1);
1548
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1549
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1550
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1551
+ if (r2) {
1552
+ throw takeObject(r1);
1553
+ }
1554
+ return r0 !== 0;
1555
+ } finally {
1556
+ wasm.__wbindgen_add_to_stack_pointer(16);
1557
+ }
1558
+ }
1223
1559
  /**
1224
1560
  * @param {WasmRootWalletKeys} keys
1225
1561
  * @param {number} chain
Binary file
@@ -1,21 +1,11 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
5
- export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
6
- export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
7
4
  export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
8
5
  export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
9
6
  export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
10
7
  export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
11
8
  export const __wbg_wrappsbt_free: (a: number, b: number) => void;
12
- export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
13
- export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
14
- export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
15
- export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
16
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
17
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
18
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
19
9
  export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
20
10
  export const wasmtransaction_get_vsize: (a: number) => number;
21
11
  export const wasmtransaction_to_bytes: (a: number, b: number) => void;
@@ -47,14 +37,23 @@ export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number)
47
37
  export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
48
38
  export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
49
39
  export const __wbg_addressnamespace_free: (a: number, b: number) => void;
40
+ export const __wbg_bip322namespace_free: (a: number, b: number) => void;
50
41
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
51
42
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
43
+ export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
52
44
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
45
+ export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
53
46
  export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
54
47
  export const __wbg_wasmecpair_free: (a: number, b: number) => void;
48
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
55
49
  export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
56
50
  export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
57
51
  export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
52
+ export const bip322namespace_add_bip322_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
53
+ export const bip322namespace_verify_bip322_psbt_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
54
+ export const bip322namespace_verify_bip322_psbt_input_with_pubkeys: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
55
+ export const bip322namespace_verify_bip322_tx_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
56
+ export const bip322namespace_verify_bip322_tx_input_with_pubkeys: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
58
57
  export const bitgopsbt_add_input: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number, j: number, k: number) => void;
59
58
  export const bitgopsbt_add_output: (a: number, b: number, c: number, d: number, e: bigint) => void;
60
59
  export const bitgopsbt_add_output_with_address: (a: number, b: number, c: number, d: number, e: bigint) => void;
@@ -86,6 +85,9 @@ export const bitgopsbt_version: (a: number) => number;
86
85
  export const bitgopsbt_version_group_id: (a: number) => number;
87
86
  export const fixedscriptwalletnamespace_address: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
88
87
  export const fixedscriptwalletnamespace_output_script: (a: number, b: number, c: number, d: number, e: number) => void;
88
+ export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
89
+ export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
90
+ export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
89
91
  export const wasmbip32_chain_code: (a: number) => number;
90
92
  export const wasmbip32_depth: (a: number) => number;
91
93
  export const wasmbip32_derive: (a: number, b: number, c: number) => void;
@@ -106,6 +108,8 @@ export const wasmbip32_private_key: (a: number) => number;
106
108
  export const wasmbip32_public_key: (a: number) => number;
107
109
  export const wasmbip32_to_base58: (a: number, b: number) => void;
108
110
  export const wasmbip32_to_wif: (a: number, b: number) => void;
111
+ export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
112
+ export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
109
113
  export const wasmdimensions_empty: () => number;
110
114
  export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
111
115
  export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number) => void;
@@ -125,6 +129,9 @@ export const wasmecpair_public_key: (a: number) => number;
125
129
  export const wasmecpair_to_wif: (a: number, b: number) => void;
126
130
  export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
127
131
  export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
132
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
133
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
134
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
128
135
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
129
136
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
130
137
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;