@bitgo/wasm-utxo 4.19.0 → 4.21.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.
@@ -5,6 +5,7 @@ export { outputScript, address } from "./address.js";
5
5
  export { Dimensions } from "./Dimensions.js";
6
6
  export { outputScriptTypes, inputScriptTypes, type OutputScriptType, type InputScriptType, type ScriptType, } from "./scriptType.js";
7
7
  export { ChainCode, chainCodes, assertChainCode, type Scope } from "./chains.js";
8
+ export { requiresPrevTxForP2sh } from "./prevTx.js";
8
9
  export { BitGoPsbt, getWalletKeysFromPsbt, type NetworkName, type ScriptId, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, type CreateEmptyOptions, type AddInputOptions, type AddOutputOptions, type AddWalletInputOptions, type AddWalletOutputOptions, type ParseTransactionOptions, type ParseOutputsOptions, type HydrationUnspent, } from "./BitGoPsbt.js";
9
10
  export { BitGoKeySubtype, type PsbtKvKey } from "./BitGoKeySubtype.js";
10
11
  export { ZcashBitGoPsbt, type ZcashNetworkName, type CreateEmptyZcashOptions, } from "./ZcashBitGoPsbt.js";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ZcashBitGoPsbt = exports.BitGoKeySubtype = exports.getWalletKeysFromPsbt = exports.BitGoPsbt = exports.assertChainCode = exports.chainCodes = exports.ChainCode = exports.inputScriptTypes = exports.outputScriptTypes = exports.Dimensions = exports.address = exports.outputScript = exports.ReplayProtection = exports.RootWalletKeys = void 0;
3
+ exports.ZcashBitGoPsbt = exports.BitGoKeySubtype = exports.getWalletKeysFromPsbt = exports.BitGoPsbt = exports.requiresPrevTxForP2sh = exports.assertChainCode = exports.chainCodes = exports.ChainCode = exports.inputScriptTypes = exports.outputScriptTypes = exports.Dimensions = exports.address = exports.outputScript = exports.ReplayProtection = exports.RootWalletKeys = void 0;
4
4
  exports.supportsScriptType = supportsScriptType;
5
5
  exports.createOpReturnScript = createOpReturnScript;
6
6
  exports.p2shP2pkOutputScript = p2shP2pkOutputScript;
@@ -21,6 +21,9 @@ var chains_js_1 = require("./chains.js");
21
21
  Object.defineProperty(exports, "ChainCode", { enumerable: true, get: function () { return chains_js_1.ChainCode; } });
22
22
  Object.defineProperty(exports, "chainCodes", { enumerable: true, get: function () { return chains_js_1.chainCodes; } });
23
23
  Object.defineProperty(exports, "assertChainCode", { enumerable: true, get: function () { return chains_js_1.assertChainCode; } });
24
+ // Previous-transaction inclusion policy (pure JS, no WASM init)
25
+ var prevTx_js_1 = require("./prevTx.js");
26
+ Object.defineProperty(exports, "requiresPrevTxForP2sh", { enumerable: true, get: function () { return prevTx_js_1.requiresPrevTxForP2sh; } });
24
27
  // Bitcoin-like PSBT (for all non-Zcash networks)
25
28
  var BitGoPsbt_js_1 = require("./BitGoPsbt.js");
26
29
  Object.defineProperty(exports, "BitGoPsbt", { enumerable: true, get: function () { return BitGoPsbt_js_1.BitGoPsbt; } });
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Previous-transaction inclusion policy for fixed-script wallet PSBT inputs.
3
+ *
4
+ * Decides whether a p2sh input requires the full previous transaction
5
+ * (PSBT_IN_NON_WITNESS_UTXO) or can be signed from witness_utxo-only.
6
+ *
7
+ * This is a pure-JS module (no WASM initialization) so callers can evaluate
8
+ * the policy cheaply without loading the wasm-utxo module.
9
+ */
10
+ import { type CoinName } from "../coinName.js";
11
+ /**
12
+ * Whether a p2sh input requires the full previous transaction
13
+ * (PSBT_IN_NON_WITNESS_UTXO). Callers are expected to have already
14
+ * confirmed the input is p2sh (non-segwit) and that the tx format
15
+ * includes prevTx (e.g. "psbt", not "psbt-lite"); this predicate only
16
+ * answers the coin-level question.
17
+ *
18
+ * Returns false for value-committing coins whose sighash commits the
19
+ * input amount, making `non_witness_utxo` (full prevTx) cryptographically
20
+ * pointless for signing p2sh inputs — `witness_utxo` (value +
21
+ * scriptPubKey) suffices:
22
+ *
23
+ * - Zcash (`zec`/`tzec`): ZIP-243 transparent sighash commits the amount.
24
+ * Including prevTx also crashes wasm-utxo, whose consensus::deserialize
25
+ * rejects Zcash overwintered transactions.
26
+ * - BCH family (`bch`/`bcha`/`bsv`/`btg` + testnets): replay-protected
27
+ * BIP-143 sighash (SIGHASH_FORKID, the default for the whole family)
28
+ * commits the 8-byte value as preimage item #6. eCash is `bcha`/`tbcha`.
29
+ * For the BCH family, skipping prevTx is an optimization (no DB fetch)
30
+ * plus defense-in-depth, with the same fee-validation risk that the
31
+ * existing `psbt-lite` path already accepts for all coins.
32
+ *
33
+ * Testnets are normalized via `getMainnet` before the switch. True
34
+ * otherwise.
35
+ */
36
+ export declare function requiresPrevTxForP2sh(coinName: CoinName): boolean;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requiresPrevTxForP2sh = requiresPrevTxForP2sh;
4
+ /**
5
+ * Previous-transaction inclusion policy for fixed-script wallet PSBT inputs.
6
+ *
7
+ * Decides whether a p2sh input requires the full previous transaction
8
+ * (PSBT_IN_NON_WITNESS_UTXO) or can be signed from witness_utxo-only.
9
+ *
10
+ * This is a pure-JS module (no WASM initialization) so callers can evaluate
11
+ * the policy cheaply without loading the wasm-utxo module.
12
+ */
13
+ const coinName_js_1 = require("../coinName.js");
14
+ /**
15
+ * Whether a p2sh input requires the full previous transaction
16
+ * (PSBT_IN_NON_WITNESS_UTXO). Callers are expected to have already
17
+ * confirmed the input is p2sh (non-segwit) and that the tx format
18
+ * includes prevTx (e.g. "psbt", not "psbt-lite"); this predicate only
19
+ * answers the coin-level question.
20
+ *
21
+ * Returns false for value-committing coins whose sighash commits the
22
+ * input amount, making `non_witness_utxo` (full prevTx) cryptographically
23
+ * pointless for signing p2sh inputs — `witness_utxo` (value +
24
+ * scriptPubKey) suffices:
25
+ *
26
+ * - Zcash (`zec`/`tzec`): ZIP-243 transparent sighash commits the amount.
27
+ * Including prevTx also crashes wasm-utxo, whose consensus::deserialize
28
+ * rejects Zcash overwintered transactions.
29
+ * - BCH family (`bch`/`bcha`/`bsv`/`btg` + testnets): replay-protected
30
+ * BIP-143 sighash (SIGHASH_FORKID, the default for the whole family)
31
+ * commits the 8-byte value as preimage item #6. eCash is `bcha`/`tbcha`.
32
+ * For the BCH family, skipping prevTx is an optimization (no DB fetch)
33
+ * plus defense-in-depth, with the same fee-validation risk that the
34
+ * existing `psbt-lite` path already accepts for all coins.
35
+ *
36
+ * Testnets are normalized via `getMainnet` before the switch. True
37
+ * otherwise.
38
+ */
39
+ function requiresPrevTxForP2sh(coinName) {
40
+ switch ((0, coinName_js_1.getMainnet)(coinName)) {
41
+ case "zec": // Zcash (ZIP-243)
42
+ case "bch": // Bitcoin Cash (BIP-143/FORKID)
43
+ case "bcha": // eCash (BIP-143/FORKID)
44
+ case "bsv": // Bitcoin SV (BIP-143/FORKID)
45
+ case "btg": // Bitcoin Gold (BIP-143/FORKID)
46
+ return false;
47
+ default:
48
+ return true;
49
+ }
50
+ }
@@ -17,6 +17,7 @@ export type WasmUtxoVersionInfo = {
17
17
  };
18
18
  export declare function getWasmUtxoVersion(): WasmUtxoVersionInfo;
19
19
  export { type CoinName, getMainnet, isMainnet, isTestnet, isCoinName } from "./coinName.js";
20
+ export { requiresPrevTxForP2sh } from "./fixedScriptWallet/prevTx.js";
20
21
  export type { Triple } from "./triple.js";
21
22
  export type { AddressFormat } from "./address.js";
22
23
  export type { TapLeafScript, PreparedInscriptionRevealData } from "./inscriptions.js";
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.hasPsbtMagic = exports.ZcashTransaction = exports.Transaction = exports.DashTransaction = exports.Psbt = exports.Miniscript = exports.Descriptor = exports.isCoinName = exports.isTestnet = exports.isMainnet = exports.getMainnet = exports.Dimensions = exports.BIP32 = exports.ECPair = exports.ecpair = exports.bip32 = exports.descriptorWallet = exports.fixedScriptWallet = exports.utxolibCompat = exports.message = exports.inscriptions = exports.bip322 = exports.ast = exports.address = void 0;
36
+ exports.hasPsbtMagic = exports.ZcashTransaction = exports.Transaction = exports.DashTransaction = exports.Psbt = exports.Miniscript = exports.Descriptor = exports.requiresPrevTxForP2sh = exports.isCoinName = exports.isTestnet = exports.isMainnet = exports.getMainnet = exports.Dimensions = exports.BIP32 = exports.ECPair = exports.ecpair = exports.bip32 = exports.descriptorWallet = exports.fixedScriptWallet = exports.utxolibCompat = exports.message = exports.inscriptions = exports.bip322 = exports.ast = exports.address = void 0;
37
37
  exports.getWasmUtxoVersion = getWasmUtxoVersion;
38
38
  exports.isWasmUtxoError = isWasmUtxoError;
39
39
  const wasm = __importStar(require("./wasm/wasm_utxo.js"));
@@ -68,6 +68,8 @@ Object.defineProperty(exports, "getMainnet", { enumerable: true, get: function (
68
68
  Object.defineProperty(exports, "isMainnet", { enumerable: true, get: function () { return coinName_js_1.isMainnet; } });
69
69
  Object.defineProperty(exports, "isTestnet", { enumerable: true, get: function () { return coinName_js_1.isTestnet; } });
70
70
  Object.defineProperty(exports, "isCoinName", { enumerable: true, get: function () { return coinName_js_1.isCoinName; } });
71
+ var prevTx_js_1 = require("./fixedScriptWallet/prevTx.js");
72
+ Object.defineProperty(exports, "requiresPrevTxForP2sh", { enumerable: true, get: function () { return prevTx_js_1.requiresPrevTxForP2sh; } });
71
73
  const WASM_UTXO_ERROR_SYMBOL = Symbol.for("@bitgo/wasm-utxo/error");
72
74
  function isWasmUtxoError(e) {
73
75
  return (e instanceof Error &&
@@ -1456,7 +1456,29 @@ export class WrapPsbt {
1456
1456
  * - `Err(WasmUtxoError)` if the PSBT is not fully finalized or extraction fails
1457
1457
  */
1458
1458
  extract_transaction(): WasmTransaction;
1459
+ /**
1460
+ * Extract the finalized PSBT as a Zcash overwintered transaction.
1461
+ *
1462
+ * Must be called after `finalize_mut_zcash()`.
1463
+ *
1464
+ * # Arguments
1465
+ * * `version_group_id` - Version group ID (default: Sapling `0x892F2085`)
1466
+ * * `expiry_height` - Transaction expiry height (default: 0)
1467
+ */
1468
+ extract_zcash_transaction(version_group_id?: number | null, expiry_height?: number | null): WasmZcashTransaction;
1459
1469
  finalize_mut(): void;
1470
+ /**
1471
+ * Finalize all Zcash transparent inputs using ZIP-243 sighash verification.
1472
+ *
1473
+ * Use this instead of `finalize_mut()` for Zcash PSBTs signed with
1474
+ * `sign_zcash_with_prv` / `sign_zcash_all_with_ecpair`.
1475
+ *
1476
+ * # Arguments
1477
+ * * `consensus_branch_id` - Zcash network upgrade branch ID
1478
+ * * `version_group_id` - Version group ID (default: Sapling `0x892F2085`)
1479
+ * * `expiry_height` - Transaction expiry height (default: 0)
1480
+ */
1481
+ finalize_mut_zcash(consensus_branch_id: number, version_group_id?: number | null, expiry_height?: number | null): void;
1460
1482
  get_global_xpubs(): any;
1461
1483
  get_input_kv(index: number, key: any): Uint8Array | undefined;
1462
1484
  get_inputs(): any;
@@ -1518,6 +1540,26 @@ export class WrapPsbt {
1518
1540
  sign_all_with_ecpair(key: WasmECPair): any;
1519
1541
  sign_with_prv(prv: Uint8Array): any;
1520
1542
  sign_with_xprv(xprv: string): any;
1543
+ /**
1544
+ * Sign all Zcash transparent inputs with a WasmECPair key using ZIP-243 sighash.
1545
+ *
1546
+ * # Arguments
1547
+ * * `key` - The WasmECPair key to sign with
1548
+ * * `consensus_branch_id` - Zcash network upgrade branch ID
1549
+ * * `version_group_id` - Version group ID (default: Sapling `0x892F2085`)
1550
+ * * `expiry_height` - Transaction expiry height (default: 0)
1551
+ */
1552
+ sign_zcash_all_with_ecpair(key: WasmECPair, consensus_branch_id: number, version_group_id?: number | null, expiry_height?: number | null): any;
1553
+ /**
1554
+ * Sign all Zcash transparent inputs with a raw private key using ZIP-243 sighash.
1555
+ *
1556
+ * # Arguments
1557
+ * * `prv` - Raw private key bytes
1558
+ * * `consensus_branch_id` - Zcash network upgrade branch ID
1559
+ * * `version_group_id` - Version group ID (default: Sapling `0x892F2085`)
1560
+ * * `expiry_height` - Transaction expiry height (default: 0)
1561
+ */
1562
+ sign_zcash_with_prv(prv: Uint8Array, consensus_branch_id: number, version_group_id?: number | null, expiry_height?: number | null): any;
1521
1563
  unsigned_tx_id(): string;
1522
1564
  update_input_with_descriptor(input_index: number, descriptor: WrapDescriptor): void;
1523
1565
  update_output_with_descriptor(output_index: number, descriptor: WrapDescriptor): void;
@@ -5520,6 +5520,33 @@ class WrapPsbt {
5520
5520
  wasm.__wbindgen_add_to_stack_pointer(16);
5521
5521
  }
5522
5522
  }
5523
+ /**
5524
+ * Extract the finalized PSBT as a Zcash overwintered transaction.
5525
+ *
5526
+ * Must be called after `finalize_mut_zcash()`.
5527
+ *
5528
+ * # Arguments
5529
+ * * `version_group_id` - Version group ID (default: Sapling `0x892F2085`)
5530
+ * * `expiry_height` - Transaction expiry height (default: 0)
5531
+ * @param {number | null} [version_group_id]
5532
+ * @param {number | null} [expiry_height]
5533
+ * @returns {WasmZcashTransaction}
5534
+ */
5535
+ extract_zcash_transaction(version_group_id, expiry_height) {
5536
+ try {
5537
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
5538
+ wasm.wrappsbt_extract_zcash_transaction(retptr, this.__wbg_ptr, isLikeNone(version_group_id) ? 0x100000001 : (version_group_id) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
5539
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
5540
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
5541
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
5542
+ if (r2) {
5543
+ throw takeObject(r1);
5544
+ }
5545
+ return WasmZcashTransaction.__wrap(r0);
5546
+ } finally {
5547
+ wasm.__wbindgen_add_to_stack_pointer(16);
5548
+ }
5549
+ }
5523
5550
  finalize_mut() {
5524
5551
  try {
5525
5552
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
@@ -5533,6 +5560,33 @@ class WrapPsbt {
5533
5560
  wasm.__wbindgen_add_to_stack_pointer(16);
5534
5561
  }
5535
5562
  }
5563
+ /**
5564
+ * Finalize all Zcash transparent inputs using ZIP-243 sighash verification.
5565
+ *
5566
+ * Use this instead of `finalize_mut()` for Zcash PSBTs signed with
5567
+ * `sign_zcash_with_prv` / `sign_zcash_all_with_ecpair`.
5568
+ *
5569
+ * # Arguments
5570
+ * * `consensus_branch_id` - Zcash network upgrade branch ID
5571
+ * * `version_group_id` - Version group ID (default: Sapling `0x892F2085`)
5572
+ * * `expiry_height` - Transaction expiry height (default: 0)
5573
+ * @param {number} consensus_branch_id
5574
+ * @param {number | null} [version_group_id]
5575
+ * @param {number | null} [expiry_height]
5576
+ */
5577
+ finalize_mut_zcash(consensus_branch_id, version_group_id, expiry_height) {
5578
+ try {
5579
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
5580
+ wasm.wrappsbt_finalize_mut_zcash(retptr, this.__wbg_ptr, consensus_branch_id, isLikeNone(version_group_id) ? 0x100000001 : (version_group_id) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
5581
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
5582
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
5583
+ if (r1) {
5584
+ throw takeObject(r0);
5585
+ }
5586
+ } finally {
5587
+ wasm.__wbindgen_add_to_stack_pointer(16);
5588
+ }
5589
+ }
5536
5590
  /**
5537
5591
  * @returns {any}
5538
5592
  */
@@ -5977,6 +6031,67 @@ class WrapPsbt {
5977
6031
  wasm.__wbindgen_add_to_stack_pointer(16);
5978
6032
  }
5979
6033
  }
6034
+ /**
6035
+ * Sign all Zcash transparent inputs with a WasmECPair key using ZIP-243 sighash.
6036
+ *
6037
+ * # Arguments
6038
+ * * `key` - The WasmECPair key to sign with
6039
+ * * `consensus_branch_id` - Zcash network upgrade branch ID
6040
+ * * `version_group_id` - Version group ID (default: Sapling `0x892F2085`)
6041
+ * * `expiry_height` - Transaction expiry height (default: 0)
6042
+ * @param {WasmECPair} key
6043
+ * @param {number} consensus_branch_id
6044
+ * @param {number | null} [version_group_id]
6045
+ * @param {number | null} [expiry_height]
6046
+ * @returns {any}
6047
+ */
6048
+ sign_zcash_all_with_ecpair(key, consensus_branch_id, version_group_id, expiry_height) {
6049
+ try {
6050
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6051
+ _assertClass(key, WasmECPair);
6052
+ wasm.wrappsbt_sign_zcash_all_with_ecpair(retptr, this.__wbg_ptr, key.__wbg_ptr, consensus_branch_id, isLikeNone(version_group_id) ? 0x100000001 : (version_group_id) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
6053
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6054
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6055
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6056
+ if (r2) {
6057
+ throw takeObject(r1);
6058
+ }
6059
+ return takeObject(r0);
6060
+ } finally {
6061
+ wasm.__wbindgen_add_to_stack_pointer(16);
6062
+ }
6063
+ }
6064
+ /**
6065
+ * Sign all Zcash transparent inputs with a raw private key using ZIP-243 sighash.
6066
+ *
6067
+ * # Arguments
6068
+ * * `prv` - Raw private key bytes
6069
+ * * `consensus_branch_id` - Zcash network upgrade branch ID
6070
+ * * `version_group_id` - Version group ID (default: Sapling `0x892F2085`)
6071
+ * * `expiry_height` - Transaction expiry height (default: 0)
6072
+ * @param {Uint8Array} prv
6073
+ * @param {number} consensus_branch_id
6074
+ * @param {number | null} [version_group_id]
6075
+ * @param {number | null} [expiry_height]
6076
+ * @returns {any}
6077
+ */
6078
+ sign_zcash_with_prv(prv, consensus_branch_id, version_group_id, expiry_height) {
6079
+ try {
6080
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6081
+ const ptr0 = passArray8ToWasm0(prv, wasm.__wbindgen_export);
6082
+ const len0 = WASM_VECTOR_LEN;
6083
+ wasm.wrappsbt_sign_zcash_with_prv(retptr, this.__wbg_ptr, ptr0, len0, consensus_branch_id, isLikeNone(version_group_id) ? 0x100000001 : (version_group_id) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
6084
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6085
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6086
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6087
+ if (r2) {
6088
+ throw takeObject(r1);
6089
+ }
6090
+ return takeObject(r0);
6091
+ } finally {
6092
+ wasm.__wbindgen_add_to_stack_pointer(16);
6093
+ }
6094
+ }
5980
6095
  /**
5981
6096
  * @returns {string}
5982
6097
  */
Binary file
@@ -2,25 +2,23 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_addressnamespace_free: (a: number, b: number) => void;
5
- export const __wbg_bip322namespace_free: (a: number, b: number) => void;
5
+ export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
6
6
  export const __wbg_messagenamespace_free: (a: number, b: number) => void;
7
7
  export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
8
8
  export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
9
- export const __wbg_wasmecpair_free: (a: number, b: number) => void;
10
- export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
9
+ export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
11
10
  export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
11
+ export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
12
12
  export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
13
13
  export const __wbg_wrappsbt_free: (a: number, b: number) => void;
14
14
  export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
15
15
  export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
16
- 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;
17
- export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
18
- 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;
19
- 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;
20
- 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;
21
- 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;
16
+ export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
17
+ export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
18
+ export const isInspectEnabled: () => number;
22
19
  export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
23
20
  export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
21
+ export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
24
22
  export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
25
23
  export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
26
24
  export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
@@ -33,19 +31,21 @@ export const wasmdashtransaction_lock_time: (a: number) => number;
33
31
  export const wasmdashtransaction_output_count: (a: number) => number;
34
32
  export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
35
33
  export const wasmdashtransaction_version: (a: number) => number;
36
- export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
37
- export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
38
- export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
39
- export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
40
- export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
41
- export const wasmecpair_private_key: (a: number) => number;
42
- export const wasmecpair_public_key: (a: number) => number;
43
- export const wasmecpair_to_wif: (a: number, b: number) => void;
44
- export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
45
- export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
46
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
47
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
48
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
34
+ export const wasmdimensions_empty: () => number;
35
+ export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
36
+ export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
37
+ export const wasmdimensions_from_output_script_length: (a: number) => number;
38
+ export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
39
+ export const wasmdimensions_from_psbt: (a: number, b: number) => void;
40
+ export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
41
+ export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
42
+ export const wasmdimensions_get_output_vsize: (a: number) => number;
43
+ export const wasmdimensions_get_output_weight: (a: number) => number;
44
+ export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
45
+ export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
46
+ export const wasmdimensions_has_segwit: (a: number) => number;
47
+ export const wasmdimensions_plus: (a: number, b: number) => number;
48
+ export const wasmdimensions_times: (a: number, b: number) => number;
49
49
  export const wasmtransaction_add_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
50
50
  export const wasmtransaction_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
51
51
  export const wasmtransaction_add_output: (a: number, b: number, c: number, d: bigint) => number;
@@ -58,6 +58,7 @@ export const wasmtransaction_get_outputs_with_address: (a: number, b: number, c:
58
58
  export const wasmtransaction_get_txid: (a: number, b: number) => void;
59
59
  export const wasmtransaction_get_vsize: (a: number) => number;
60
60
  export const wasmtransaction_to_bytes: (a: number, b: number) => void;
61
+ export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
61
62
  export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
62
63
  export const wasmzcashtransaction_get_inputs: (a: number, b: number) => void;
63
64
  export const wasmzcashtransaction_get_outputs: (a: number, b: number) => void;
@@ -74,7 +75,9 @@ export const wrappsbt_delete_kv: (a: number, b: number, c: number) => void;
74
75
  export const wrappsbt_delete_output_kv: (a: number, b: number, c: number, d: number) => void;
75
76
  export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
76
77
  export const wrappsbt_extract_transaction: (a: number, b: number) => void;
78
+ export const wrappsbt_extract_zcash_transaction: (a: number, b: number, c: number, d: number) => void;
77
79
  export const wrappsbt_finalize_mut: (a: number, b: number) => void;
80
+ export const wrappsbt_finalize_mut_zcash: (a: number, b: number, c: number, d: number, e: number) => void;
78
81
  export const wrappsbt_get_global_xpubs: (a: number) => number;
79
82
  export const wrappsbt_get_input_kv: (a: number, b: number, c: number, d: number) => void;
80
83
  export const wrappsbt_get_inputs: (a: number, b: number) => void;
@@ -98,6 +101,8 @@ export const wrappsbt_sign_all: (a: number, b: number, c: number) => void;
98
101
  export const wrappsbt_sign_all_with_ecpair: (a: number, b: number, c: number) => void;
99
102
  export const wrappsbt_sign_with_prv: (a: number, b: number, c: number, d: number) => void;
100
103
  export const wrappsbt_sign_with_xprv: (a: number, b: number, c: number, d: number) => void;
104
+ export const wrappsbt_sign_zcash_all_with_ecpair: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
105
+ export const wrappsbt_sign_zcash_with_prv: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
101
106
  export const wrappsbt_unsigned_tx_id: (a: number, b: number) => void;
102
107
  export const wrappsbt_update_input_with_descriptor: (a: number, b: number, c: number, d: number) => void;
103
108
  export const wrappsbt_update_output_with_descriptor: (a: number, b: number, c: number, d: number) => void;
@@ -107,6 +112,8 @@ export const wasmtransaction_input_count: (a: number) => number;
107
112
  export const wasmtransaction_output_count: (a: number) => number;
108
113
  export const wasmzcashtransaction_input_count: (a: number) => number;
109
114
  export const wasmzcashtransaction_output_count: (a: number) => number;
115
+ export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
116
+ export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
110
117
  export const wasmtransaction_lock_time: (a: number) => number;
111
118
  export const wasmtransaction_version: (a: number) => number;
112
119
  export const wasmzcashtransaction_lock_time: (a: number) => number;
@@ -115,7 +122,6 @@ export const wrappsbt_lock_time: (a: number) => number;
115
122
  export const wrappsbt_version: (a: number) => number;
116
123
  export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
117
124
  export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
118
- export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
119
125
  export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
120
126
  export const wrapdescriptor_descType: (a: number, b: number) => void;
121
127
  export const wrapdescriptor_encode: (a: number, b: number) => void;
@@ -136,17 +142,19 @@ export const wrapminiscript_fromStringExt: (a: number, b: number, c: number, d:
136
142
  export const wrapminiscript_node: (a: number, b: number) => void;
137
143
  export const wrapminiscript_toAsmString: (a: number, b: number) => void;
138
144
  export const wrapminiscript_toString: (a: number, b: number) => void;
139
- export const isInspectEnabled: () => number;
140
- export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
141
- export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
142
- export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
143
- export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
145
+ export const __wbg_bip322namespace_free: (a: number, b: number) => void;
144
146
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
145
147
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
146
- export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
147
148
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
148
- export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
149
+ export const __wbg_wasmecpair_free: (a: number, b: number) => void;
150
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
149
151
  export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
152
+ 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;
153
+ export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
154
+ 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;
155
+ 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;
156
+ 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;
157
+ 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;
150
158
  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;
151
159
  export const bitgopsbt_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number, j: number, k: number, l: number) => void;
152
160
  export const bitgopsbt_add_output: (a: number, b: number, c: number, d: number, e: bigint) => void;
@@ -230,8 +238,6 @@ export const fixedscriptwalletnamespace_output_script_with_network_str: (a: numb
230
238
  export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
231
239
  export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
232
240
  export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
233
- export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
234
- export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
235
241
  export const wasmbip32_chain_code: (a: number) => number;
236
242
  export const wasmbip32_depth: (a: number) => number;
237
243
  export const wasmbip32_derive: (a: number, b: number, c: number) => void;
@@ -254,21 +260,19 @@ export const wasmbip32_private_key: (a: number) => number;
254
260
  export const wasmbip32_public_key: (a: number) => number;
255
261
  export const wasmbip32_to_base58: (a: number, b: number) => void;
256
262
  export const wasmbip32_to_wif: (a: number, b: number) => void;
257
- export const wasmdimensions_empty: () => number;
258
- export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
259
- export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
260
- export const wasmdimensions_from_output_script_length: (a: number) => number;
261
- export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
262
- export const wasmdimensions_from_psbt: (a: number, b: number) => void;
263
- export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
264
- export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
265
- export const wasmdimensions_get_output_vsize: (a: number) => number;
266
- export const wasmdimensions_get_output_weight: (a: number) => number;
267
- export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
268
- export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
269
- export const wasmdimensions_has_segwit: (a: number) => number;
270
- export const wasmdimensions_plus: (a: number, b: number) => number;
271
- export const wasmdimensions_times: (a: number, b: number) => number;
263
+ export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
264
+ export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
265
+ export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
266
+ export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
267
+ export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
268
+ export const wasmecpair_private_key: (a: number) => number;
269
+ export const wasmecpair_public_key: (a: number) => number;
270
+ export const wasmecpair_to_wif: (a: number, b: number) => void;
271
+ export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
272
+ export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
273
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
274
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
275
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
272
276
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
273
277
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
274
278
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
@@ -276,9 +280,9 @@ export const wasmrootwalletkeys_user_key: (a: number) => number;
276
280
  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;
277
281
  export const zcash_branch_id_for_height: (a: number, b: number, c: number, d: number) => void;
278
282
  export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
279
- export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
280
283
  export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
281
284
  export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
285
+ export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
282
286
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
283
287
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
284
288
  export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
@@ -5,6 +5,7 @@ export { outputScript, address } from "./address.js";
5
5
  export { Dimensions } from "./Dimensions.js";
6
6
  export { outputScriptTypes, inputScriptTypes, type OutputScriptType, type InputScriptType, type ScriptType, } from "./scriptType.js";
7
7
  export { ChainCode, chainCodes, assertChainCode, type Scope } from "./chains.js";
8
+ export { requiresPrevTxForP2sh } from "./prevTx.js";
8
9
  export { BitGoPsbt, getWalletKeysFromPsbt, type NetworkName, type ScriptId, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, type CreateEmptyOptions, type AddInputOptions, type AddOutputOptions, type AddWalletInputOptions, type AddWalletOutputOptions, type ParseTransactionOptions, type ParseOutputsOptions, type HydrationUnspent, } from "./BitGoPsbt.js";
9
10
  export { BitGoKeySubtype, type PsbtKvKey } from "./BitGoKeySubtype.js";
10
11
  export { ZcashBitGoPsbt, type ZcashNetworkName, type CreateEmptyZcashOptions, } from "./ZcashBitGoPsbt.js";
@@ -5,6 +5,8 @@ export { outputScript, address } from "./address.js";
5
5
  export { Dimensions } from "./Dimensions.js";
6
6
  export { outputScriptTypes, inputScriptTypes, } from "./scriptType.js";
7
7
  export { ChainCode, chainCodes, assertChainCode } from "./chains.js";
8
+ // Previous-transaction inclusion policy (pure JS, no WASM init)
9
+ export { requiresPrevTxForP2sh } from "./prevTx.js";
8
10
  // Bitcoin-like PSBT (for all non-Zcash networks)
9
11
  export { BitGoPsbt, getWalletKeysFromPsbt, } from "./BitGoPsbt.js";
10
12
  export { BitGoKeySubtype } from "./BitGoKeySubtype.js";
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Previous-transaction inclusion policy for fixed-script wallet PSBT inputs.
3
+ *
4
+ * Decides whether a p2sh input requires the full previous transaction
5
+ * (PSBT_IN_NON_WITNESS_UTXO) or can be signed from witness_utxo-only.
6
+ *
7
+ * This is a pure-JS module (no WASM initialization) so callers can evaluate
8
+ * the policy cheaply without loading the wasm-utxo module.
9
+ */
10
+ import { type CoinName } from "../coinName.js";
11
+ /**
12
+ * Whether a p2sh input requires the full previous transaction
13
+ * (PSBT_IN_NON_WITNESS_UTXO). Callers are expected to have already
14
+ * confirmed the input is p2sh (non-segwit) and that the tx format
15
+ * includes prevTx (e.g. "psbt", not "psbt-lite"); this predicate only
16
+ * answers the coin-level question.
17
+ *
18
+ * Returns false for value-committing coins whose sighash commits the
19
+ * input amount, making `non_witness_utxo` (full prevTx) cryptographically
20
+ * pointless for signing p2sh inputs — `witness_utxo` (value +
21
+ * scriptPubKey) suffices:
22
+ *
23
+ * - Zcash (`zec`/`tzec`): ZIP-243 transparent sighash commits the amount.
24
+ * Including prevTx also crashes wasm-utxo, whose consensus::deserialize
25
+ * rejects Zcash overwintered transactions.
26
+ * - BCH family (`bch`/`bcha`/`bsv`/`btg` + testnets): replay-protected
27
+ * BIP-143 sighash (SIGHASH_FORKID, the default for the whole family)
28
+ * commits the 8-byte value as preimage item #6. eCash is `bcha`/`tbcha`.
29
+ * For the BCH family, skipping prevTx is an optimization (no DB fetch)
30
+ * plus defense-in-depth, with the same fee-validation risk that the
31
+ * existing `psbt-lite` path already accepts for all coins.
32
+ *
33
+ * Testnets are normalized via `getMainnet` before the switch. True
34
+ * otherwise.
35
+ */
36
+ export declare function requiresPrevTxForP2sh(coinName: CoinName): boolean;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Previous-transaction inclusion policy for fixed-script wallet PSBT inputs.
3
+ *
4
+ * Decides whether a p2sh input requires the full previous transaction
5
+ * (PSBT_IN_NON_WITNESS_UTXO) or can be signed from witness_utxo-only.
6
+ *
7
+ * This is a pure-JS module (no WASM initialization) so callers can evaluate
8
+ * the policy cheaply without loading the wasm-utxo module.
9
+ */
10
+ import { getMainnet } from "../coinName.js";
11
+ /**
12
+ * Whether a p2sh input requires the full previous transaction
13
+ * (PSBT_IN_NON_WITNESS_UTXO). Callers are expected to have already
14
+ * confirmed the input is p2sh (non-segwit) and that the tx format
15
+ * includes prevTx (e.g. "psbt", not "psbt-lite"); this predicate only
16
+ * answers the coin-level question.
17
+ *
18
+ * Returns false for value-committing coins whose sighash commits the
19
+ * input amount, making `non_witness_utxo` (full prevTx) cryptographically
20
+ * pointless for signing p2sh inputs — `witness_utxo` (value +
21
+ * scriptPubKey) suffices:
22
+ *
23
+ * - Zcash (`zec`/`tzec`): ZIP-243 transparent sighash commits the amount.
24
+ * Including prevTx also crashes wasm-utxo, whose consensus::deserialize
25
+ * rejects Zcash overwintered transactions.
26
+ * - BCH family (`bch`/`bcha`/`bsv`/`btg` + testnets): replay-protected
27
+ * BIP-143 sighash (SIGHASH_FORKID, the default for the whole family)
28
+ * commits the 8-byte value as preimage item #6. eCash is `bcha`/`tbcha`.
29
+ * For the BCH family, skipping prevTx is an optimization (no DB fetch)
30
+ * plus defense-in-depth, with the same fee-validation risk that the
31
+ * existing `psbt-lite` path already accepts for all coins.
32
+ *
33
+ * Testnets are normalized via `getMainnet` before the switch. True
34
+ * otherwise.
35
+ */
36
+ export function requiresPrevTxForP2sh(coinName) {
37
+ switch (getMainnet(coinName)) {
38
+ case "zec": // Zcash (ZIP-243)
39
+ case "bch": // Bitcoin Cash (BIP-143/FORKID)
40
+ case "bcha": // eCash (BIP-143/FORKID)
41
+ case "bsv": // Bitcoin SV (BIP-143/FORKID)
42
+ case "btg": // Bitcoin Gold (BIP-143/FORKID)
43
+ return false;
44
+ default:
45
+ return true;
46
+ }
47
+ }
@@ -17,6 +17,7 @@ export type WasmUtxoVersionInfo = {
17
17
  };
18
18
  export declare function getWasmUtxoVersion(): WasmUtxoVersionInfo;
19
19
  export { type CoinName, getMainnet, isMainnet, isTestnet, isCoinName } from "./coinName.js";
20
+ export { requiresPrevTxForP2sh } from "./fixedScriptWallet/prevTx.js";
20
21
  export type { Triple } from "./triple.js";
21
22
  export type { AddressFormat } from "./address.js";
22
23
  export type { TapLeafScript, PreparedInscriptionRevealData } from "./inscriptions.js";
@@ -23,6 +23,7 @@ export function getWasmUtxoVersion() {
23
23
  return WasmUtxoNamespace.get_wasm_utxo_version();
24
24
  }
25
25
  export { getMainnet, isMainnet, isTestnet, isCoinName } from "./coinName.js";
26
+ export { requiresPrevTxForP2sh } from "./fixedScriptWallet/prevTx.js";
26
27
  const WASM_UTXO_ERROR_SYMBOL = Symbol.for("@bitgo/wasm-utxo/error");
27
28
  export function isWasmUtxoError(e) {
28
29
  return (e instanceof Error &&
@@ -1456,7 +1456,29 @@ export class WrapPsbt {
1456
1456
  * - `Err(WasmUtxoError)` if the PSBT is not fully finalized or extraction fails
1457
1457
  */
1458
1458
  extract_transaction(): WasmTransaction;
1459
+ /**
1460
+ * Extract the finalized PSBT as a Zcash overwintered transaction.
1461
+ *
1462
+ * Must be called after `finalize_mut_zcash()`.
1463
+ *
1464
+ * # Arguments
1465
+ * * `version_group_id` - Version group ID (default: Sapling `0x892F2085`)
1466
+ * * `expiry_height` - Transaction expiry height (default: 0)
1467
+ */
1468
+ extract_zcash_transaction(version_group_id?: number | null, expiry_height?: number | null): WasmZcashTransaction;
1459
1469
  finalize_mut(): void;
1470
+ /**
1471
+ * Finalize all Zcash transparent inputs using ZIP-243 sighash verification.
1472
+ *
1473
+ * Use this instead of `finalize_mut()` for Zcash PSBTs signed with
1474
+ * `sign_zcash_with_prv` / `sign_zcash_all_with_ecpair`.
1475
+ *
1476
+ * # Arguments
1477
+ * * `consensus_branch_id` - Zcash network upgrade branch ID
1478
+ * * `version_group_id` - Version group ID (default: Sapling `0x892F2085`)
1479
+ * * `expiry_height` - Transaction expiry height (default: 0)
1480
+ */
1481
+ finalize_mut_zcash(consensus_branch_id: number, version_group_id?: number | null, expiry_height?: number | null): void;
1460
1482
  get_global_xpubs(): any;
1461
1483
  get_input_kv(index: number, key: any): Uint8Array | undefined;
1462
1484
  get_inputs(): any;
@@ -1518,6 +1540,26 @@ export class WrapPsbt {
1518
1540
  sign_all_with_ecpair(key: WasmECPair): any;
1519
1541
  sign_with_prv(prv: Uint8Array): any;
1520
1542
  sign_with_xprv(xprv: string): any;
1543
+ /**
1544
+ * Sign all Zcash transparent inputs with a WasmECPair key using ZIP-243 sighash.
1545
+ *
1546
+ * # Arguments
1547
+ * * `key` - The WasmECPair key to sign with
1548
+ * * `consensus_branch_id` - Zcash network upgrade branch ID
1549
+ * * `version_group_id` - Version group ID (default: Sapling `0x892F2085`)
1550
+ * * `expiry_height` - Transaction expiry height (default: 0)
1551
+ */
1552
+ sign_zcash_all_with_ecpair(key: WasmECPair, consensus_branch_id: number, version_group_id?: number | null, expiry_height?: number | null): any;
1553
+ /**
1554
+ * Sign all Zcash transparent inputs with a raw private key using ZIP-243 sighash.
1555
+ *
1556
+ * # Arguments
1557
+ * * `prv` - Raw private key bytes
1558
+ * * `consensus_branch_id` - Zcash network upgrade branch ID
1559
+ * * `version_group_id` - Version group ID (default: Sapling `0x892F2085`)
1560
+ * * `expiry_height` - Transaction expiry height (default: 0)
1561
+ */
1562
+ sign_zcash_with_prv(prv: Uint8Array, consensus_branch_id: number, version_group_id?: number | null, expiry_height?: number | null): any;
1521
1563
  unsigned_tx_id(): string;
1522
1564
  update_input_with_descriptor(input_index: number, descriptor: WrapDescriptor): void;
1523
1565
  update_output_with_descriptor(output_index: number, descriptor: WrapDescriptor): void;
@@ -5500,6 +5500,33 @@ export class WrapPsbt {
5500
5500
  wasm.__wbindgen_add_to_stack_pointer(16);
5501
5501
  }
5502
5502
  }
5503
+ /**
5504
+ * Extract the finalized PSBT as a Zcash overwintered transaction.
5505
+ *
5506
+ * Must be called after `finalize_mut_zcash()`.
5507
+ *
5508
+ * # Arguments
5509
+ * * `version_group_id` - Version group ID (default: Sapling `0x892F2085`)
5510
+ * * `expiry_height` - Transaction expiry height (default: 0)
5511
+ * @param {number | null} [version_group_id]
5512
+ * @param {number | null} [expiry_height]
5513
+ * @returns {WasmZcashTransaction}
5514
+ */
5515
+ extract_zcash_transaction(version_group_id, expiry_height) {
5516
+ try {
5517
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
5518
+ wasm.wrappsbt_extract_zcash_transaction(retptr, this.__wbg_ptr, isLikeNone(version_group_id) ? 0x100000001 : (version_group_id) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
5519
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
5520
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
5521
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
5522
+ if (r2) {
5523
+ throw takeObject(r1);
5524
+ }
5525
+ return WasmZcashTransaction.__wrap(r0);
5526
+ } finally {
5527
+ wasm.__wbindgen_add_to_stack_pointer(16);
5528
+ }
5529
+ }
5503
5530
  finalize_mut() {
5504
5531
  try {
5505
5532
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
@@ -5513,6 +5540,33 @@ export class WrapPsbt {
5513
5540
  wasm.__wbindgen_add_to_stack_pointer(16);
5514
5541
  }
5515
5542
  }
5543
+ /**
5544
+ * Finalize all Zcash transparent inputs using ZIP-243 sighash verification.
5545
+ *
5546
+ * Use this instead of `finalize_mut()` for Zcash PSBTs signed with
5547
+ * `sign_zcash_with_prv` / `sign_zcash_all_with_ecpair`.
5548
+ *
5549
+ * # Arguments
5550
+ * * `consensus_branch_id` - Zcash network upgrade branch ID
5551
+ * * `version_group_id` - Version group ID (default: Sapling `0x892F2085`)
5552
+ * * `expiry_height` - Transaction expiry height (default: 0)
5553
+ * @param {number} consensus_branch_id
5554
+ * @param {number | null} [version_group_id]
5555
+ * @param {number | null} [expiry_height]
5556
+ */
5557
+ finalize_mut_zcash(consensus_branch_id, version_group_id, expiry_height) {
5558
+ try {
5559
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
5560
+ wasm.wrappsbt_finalize_mut_zcash(retptr, this.__wbg_ptr, consensus_branch_id, isLikeNone(version_group_id) ? 0x100000001 : (version_group_id) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
5561
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
5562
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
5563
+ if (r1) {
5564
+ throw takeObject(r0);
5565
+ }
5566
+ } finally {
5567
+ wasm.__wbindgen_add_to_stack_pointer(16);
5568
+ }
5569
+ }
5516
5570
  /**
5517
5571
  * @returns {any}
5518
5572
  */
@@ -5957,6 +6011,67 @@ export class WrapPsbt {
5957
6011
  wasm.__wbindgen_add_to_stack_pointer(16);
5958
6012
  }
5959
6013
  }
6014
+ /**
6015
+ * Sign all Zcash transparent inputs with a WasmECPair key using ZIP-243 sighash.
6016
+ *
6017
+ * # Arguments
6018
+ * * `key` - The WasmECPair key to sign with
6019
+ * * `consensus_branch_id` - Zcash network upgrade branch ID
6020
+ * * `version_group_id` - Version group ID (default: Sapling `0x892F2085`)
6021
+ * * `expiry_height` - Transaction expiry height (default: 0)
6022
+ * @param {WasmECPair} key
6023
+ * @param {number} consensus_branch_id
6024
+ * @param {number | null} [version_group_id]
6025
+ * @param {number | null} [expiry_height]
6026
+ * @returns {any}
6027
+ */
6028
+ sign_zcash_all_with_ecpair(key, consensus_branch_id, version_group_id, expiry_height) {
6029
+ try {
6030
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6031
+ _assertClass(key, WasmECPair);
6032
+ wasm.wrappsbt_sign_zcash_all_with_ecpair(retptr, this.__wbg_ptr, key.__wbg_ptr, consensus_branch_id, isLikeNone(version_group_id) ? 0x100000001 : (version_group_id) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
6033
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6034
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6035
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6036
+ if (r2) {
6037
+ throw takeObject(r1);
6038
+ }
6039
+ return takeObject(r0);
6040
+ } finally {
6041
+ wasm.__wbindgen_add_to_stack_pointer(16);
6042
+ }
6043
+ }
6044
+ /**
6045
+ * Sign all Zcash transparent inputs with a raw private key using ZIP-243 sighash.
6046
+ *
6047
+ * # Arguments
6048
+ * * `prv` - Raw private key bytes
6049
+ * * `consensus_branch_id` - Zcash network upgrade branch ID
6050
+ * * `version_group_id` - Version group ID (default: Sapling `0x892F2085`)
6051
+ * * `expiry_height` - Transaction expiry height (default: 0)
6052
+ * @param {Uint8Array} prv
6053
+ * @param {number} consensus_branch_id
6054
+ * @param {number | null} [version_group_id]
6055
+ * @param {number | null} [expiry_height]
6056
+ * @returns {any}
6057
+ */
6058
+ sign_zcash_with_prv(prv, consensus_branch_id, version_group_id, expiry_height) {
6059
+ try {
6060
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6061
+ const ptr0 = passArray8ToWasm0(prv, wasm.__wbindgen_export);
6062
+ const len0 = WASM_VECTOR_LEN;
6063
+ wasm.wrappsbt_sign_zcash_with_prv(retptr, this.__wbg_ptr, ptr0, len0, consensus_branch_id, isLikeNone(version_group_id) ? 0x100000001 : (version_group_id) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
6064
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6065
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6066
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6067
+ if (r2) {
6068
+ throw takeObject(r1);
6069
+ }
6070
+ return takeObject(r0);
6071
+ } finally {
6072
+ wasm.__wbindgen_add_to_stack_pointer(16);
6073
+ }
6074
+ }
5960
6075
  /**
5961
6076
  * @returns {string}
5962
6077
  */
Binary file
@@ -2,25 +2,23 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_addressnamespace_free: (a: number, b: number) => void;
5
- export const __wbg_bip322namespace_free: (a: number, b: number) => void;
5
+ export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
6
6
  export const __wbg_messagenamespace_free: (a: number, b: number) => void;
7
7
  export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
8
8
  export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
9
- export const __wbg_wasmecpair_free: (a: number, b: number) => void;
10
- export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
9
+ export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
11
10
  export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
11
+ export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
12
12
  export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
13
13
  export const __wbg_wrappsbt_free: (a: number, b: number) => void;
14
14
  export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
15
15
  export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
16
- 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;
17
- export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
18
- 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;
19
- 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;
20
- 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;
21
- 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;
16
+ export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
17
+ export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
18
+ export const isInspectEnabled: () => number;
22
19
  export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
23
20
  export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
21
+ export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
24
22
  export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
25
23
  export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
26
24
  export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
@@ -33,19 +31,21 @@ export const wasmdashtransaction_lock_time: (a: number) => number;
33
31
  export const wasmdashtransaction_output_count: (a: number) => number;
34
32
  export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
35
33
  export const wasmdashtransaction_version: (a: number) => number;
36
- export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
37
- export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
38
- export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
39
- export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
40
- export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
41
- export const wasmecpair_private_key: (a: number) => number;
42
- export const wasmecpair_public_key: (a: number) => number;
43
- export const wasmecpair_to_wif: (a: number, b: number) => void;
44
- export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
45
- export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
46
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
47
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
48
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
34
+ export const wasmdimensions_empty: () => number;
35
+ export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
36
+ export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
37
+ export const wasmdimensions_from_output_script_length: (a: number) => number;
38
+ export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
39
+ export const wasmdimensions_from_psbt: (a: number, b: number) => void;
40
+ export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
41
+ export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
42
+ export const wasmdimensions_get_output_vsize: (a: number) => number;
43
+ export const wasmdimensions_get_output_weight: (a: number) => number;
44
+ export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
45
+ export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
46
+ export const wasmdimensions_has_segwit: (a: number) => number;
47
+ export const wasmdimensions_plus: (a: number, b: number) => number;
48
+ export const wasmdimensions_times: (a: number, b: number) => number;
49
49
  export const wasmtransaction_add_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
50
50
  export const wasmtransaction_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
51
51
  export const wasmtransaction_add_output: (a: number, b: number, c: number, d: bigint) => number;
@@ -58,6 +58,7 @@ export const wasmtransaction_get_outputs_with_address: (a: number, b: number, c:
58
58
  export const wasmtransaction_get_txid: (a: number, b: number) => void;
59
59
  export const wasmtransaction_get_vsize: (a: number) => number;
60
60
  export const wasmtransaction_to_bytes: (a: number, b: number) => void;
61
+ export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
61
62
  export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
62
63
  export const wasmzcashtransaction_get_inputs: (a: number, b: number) => void;
63
64
  export const wasmzcashtransaction_get_outputs: (a: number, b: number) => void;
@@ -74,7 +75,9 @@ export const wrappsbt_delete_kv: (a: number, b: number, c: number) => void;
74
75
  export const wrappsbt_delete_output_kv: (a: number, b: number, c: number, d: number) => void;
75
76
  export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
76
77
  export const wrappsbt_extract_transaction: (a: number, b: number) => void;
78
+ export const wrappsbt_extract_zcash_transaction: (a: number, b: number, c: number, d: number) => void;
77
79
  export const wrappsbt_finalize_mut: (a: number, b: number) => void;
80
+ export const wrappsbt_finalize_mut_zcash: (a: number, b: number, c: number, d: number, e: number) => void;
78
81
  export const wrappsbt_get_global_xpubs: (a: number) => number;
79
82
  export const wrappsbt_get_input_kv: (a: number, b: number, c: number, d: number) => void;
80
83
  export const wrappsbt_get_inputs: (a: number, b: number) => void;
@@ -98,6 +101,8 @@ export const wrappsbt_sign_all: (a: number, b: number, c: number) => void;
98
101
  export const wrappsbt_sign_all_with_ecpair: (a: number, b: number, c: number) => void;
99
102
  export const wrappsbt_sign_with_prv: (a: number, b: number, c: number, d: number) => void;
100
103
  export const wrappsbt_sign_with_xprv: (a: number, b: number, c: number, d: number) => void;
104
+ export const wrappsbt_sign_zcash_all_with_ecpair: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
105
+ export const wrappsbt_sign_zcash_with_prv: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
101
106
  export const wrappsbt_unsigned_tx_id: (a: number, b: number) => void;
102
107
  export const wrappsbt_update_input_with_descriptor: (a: number, b: number, c: number, d: number) => void;
103
108
  export const wrappsbt_update_output_with_descriptor: (a: number, b: number, c: number, d: number) => void;
@@ -107,6 +112,8 @@ export const wasmtransaction_input_count: (a: number) => number;
107
112
  export const wasmtransaction_output_count: (a: number) => number;
108
113
  export const wasmzcashtransaction_input_count: (a: number) => number;
109
114
  export const wasmzcashtransaction_output_count: (a: number) => number;
115
+ export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
116
+ export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
110
117
  export const wasmtransaction_lock_time: (a: number) => number;
111
118
  export const wasmtransaction_version: (a: number) => number;
112
119
  export const wasmzcashtransaction_lock_time: (a: number) => number;
@@ -115,7 +122,6 @@ export const wrappsbt_lock_time: (a: number) => number;
115
122
  export const wrappsbt_version: (a: number) => number;
116
123
  export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
117
124
  export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
118
- export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
119
125
  export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
120
126
  export const wrapdescriptor_descType: (a: number, b: number) => void;
121
127
  export const wrapdescriptor_encode: (a: number, b: number) => void;
@@ -136,17 +142,19 @@ export const wrapminiscript_fromStringExt: (a: number, b: number, c: number, d:
136
142
  export const wrapminiscript_node: (a: number, b: number) => void;
137
143
  export const wrapminiscript_toAsmString: (a: number, b: number) => void;
138
144
  export const wrapminiscript_toString: (a: number, b: number) => void;
139
- export const isInspectEnabled: () => number;
140
- export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
141
- export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
142
- export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
143
- export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
145
+ export const __wbg_bip322namespace_free: (a: number, b: number) => void;
144
146
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
145
147
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
146
- export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
147
148
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
148
- export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
149
+ export const __wbg_wasmecpair_free: (a: number, b: number) => void;
150
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
149
151
  export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
152
+ 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;
153
+ export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
154
+ 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;
155
+ 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;
156
+ 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;
157
+ 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;
150
158
  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;
151
159
  export const bitgopsbt_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number, j: number, k: number, l: number) => void;
152
160
  export const bitgopsbt_add_output: (a: number, b: number, c: number, d: number, e: bigint) => void;
@@ -230,8 +238,6 @@ export const fixedscriptwalletnamespace_output_script_with_network_str: (a: numb
230
238
  export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
231
239
  export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
232
240
  export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
233
- export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
234
- export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
235
241
  export const wasmbip32_chain_code: (a: number) => number;
236
242
  export const wasmbip32_depth: (a: number) => number;
237
243
  export const wasmbip32_derive: (a: number, b: number, c: number) => void;
@@ -254,21 +260,19 @@ export const wasmbip32_private_key: (a: number) => number;
254
260
  export const wasmbip32_public_key: (a: number) => number;
255
261
  export const wasmbip32_to_base58: (a: number, b: number) => void;
256
262
  export const wasmbip32_to_wif: (a: number, b: number) => void;
257
- export const wasmdimensions_empty: () => number;
258
- export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
259
- export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
260
- export const wasmdimensions_from_output_script_length: (a: number) => number;
261
- export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
262
- export const wasmdimensions_from_psbt: (a: number, b: number) => void;
263
- export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
264
- export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
265
- export const wasmdimensions_get_output_vsize: (a: number) => number;
266
- export const wasmdimensions_get_output_weight: (a: number) => number;
267
- export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
268
- export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
269
- export const wasmdimensions_has_segwit: (a: number) => number;
270
- export const wasmdimensions_plus: (a: number, b: number) => number;
271
- export const wasmdimensions_times: (a: number, b: number) => number;
263
+ export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
264
+ export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
265
+ export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
266
+ export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
267
+ export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
268
+ export const wasmecpair_private_key: (a: number) => number;
269
+ export const wasmecpair_public_key: (a: number) => number;
270
+ export const wasmecpair_to_wif: (a: number, b: number) => void;
271
+ export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
272
+ export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
273
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
274
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
275
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
272
276
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
273
277
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
274
278
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
@@ -276,9 +280,9 @@ export const wasmrootwalletkeys_user_key: (a: number) => number;
276
280
  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;
277
281
  export const zcash_branch_id_for_height: (a: number, b: number, c: number, d: number) => void;
278
282
  export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
279
- export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
280
283
  export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
281
284
  export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
285
+ export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
282
286
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
283
287
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
284
288
  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": "4.19.0",
4
+ "version": "4.21.0",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",