@bitgo/wasm-utxo 1.15.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -20,7 +20,16 @@ This project is under active development.
20
20
  | Descriptor Wallet: Address Support | ✅ Complete | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 |
21
21
  | Descriptor Wallet: Transaction Support | ✅ Complete | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 |
22
22
  | FixedScript Wallet: Address Generation | ✅ Complete | ✅ Complete | ✅ Complete | ✅ Complete | ✅ Complete | ✅ Complete | ✅ Complete |
23
- | FixedScript Wallet: Transaction Support | ✅ Complete | ✅ Complete | ✅ Complete | ⏳ TODO | ⏳ TODO | ✅ Complete | TODO |
23
+ | FixedScript Wallet: Transaction Support | ✅ Complete | ✅ Complete | ✅ Complete | ⏳ TODO | ⏳ TODO | ✅ Complete | Complete |
24
+
25
+ ### Zcash Features
26
+
27
+ Zcash support includes:
28
+
29
+ - **Network Upgrade Awareness**: Automatic consensus branch ID determination based on block height
30
+ - **All Network Upgrades**: Support for Overwinter, Sapling, Blossom, Heartwood, Canopy, Nu5, Nu6, and Nu6_1
31
+ - **Height-Based API**: Preferred `createEmpty()` method automatically selects correct consensus rules
32
+ - **Parity Testing**: Validated against `zebra-chain` for accuracy across all network upgrades
24
33
 
25
34
  ## Building
26
35
 
@@ -1,3 +1,4 @@
1
+ import { BitGoPsbt as WasmBitGoPsbt } from "../wasm/wasm_utxo.js";
1
2
  import { type WalletKeysArg } from "./RootWalletKeys.js";
2
3
  import { type ReplayProtectionArg } from "./ReplayProtection.js";
3
4
  import { type BIP32Arg } from "../bip32.js";
@@ -85,14 +86,16 @@ export type AddWalletOutputOptions = {
85
86
  value: bigint;
86
87
  };
87
88
  export declare class BitGoPsbt {
88
- private wasm;
89
- private constructor();
89
+ protected wasm: WasmBitGoPsbt;
90
+ protected constructor(wasm: WasmBitGoPsbt);
90
91
  /**
91
92
  * Create an empty PSBT for the given network with wallet keys
92
93
  *
93
94
  * The wallet keys are used to set global xpubs in the PSBT, which identifies
94
95
  * the keys that will be used for signing.
95
96
  *
97
+ * For Zcash networks, use ZcashBitGoPsbt.createEmpty() instead.
98
+ *
96
99
  * @param network - Network name (utxolib name like "bitcoin" or coin name like "btc")
97
100
  * @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
98
101
  * @param options - Optional transaction parameters (version, lockTime)
@@ -17,6 +17,8 @@ class BitGoPsbt {
17
17
  * The wallet keys are used to set global xpubs in the PSBT, which identifies
18
18
  * the keys that will be used for signing.
19
19
  *
20
+ * For Zcash networks, use ZcashBitGoPsbt.createEmpty() instead.
21
+ *
20
22
  * @param network - Network name (utxolib name like "bitcoin" or coin name like "btc")
21
23
  * @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
22
24
  * @param options - Optional transaction parameters (version, lockTime)
@@ -0,0 +1,113 @@
1
+ import { type WalletKeysArg } from "./RootWalletKeys.js";
2
+ import { BitGoPsbt, type CreateEmptyOptions } from "./BitGoPsbt.js";
3
+ /** Zcash network names */
4
+ export type ZcashNetworkName = "zcash" | "zcashTest" | "zec" | "tzec";
5
+ /** Options for creating an empty Zcash PSBT (preferred method using block height) */
6
+ export type CreateEmptyZcashOptions = CreateEmptyOptions & {
7
+ /** Block height to determine consensus branch ID automatically */
8
+ blockHeight: number;
9
+ /** Zcash version group ID (defaults to Sapling: 0x892F2085) */
10
+ versionGroupId?: number;
11
+ /** Zcash transaction expiry height */
12
+ expiryHeight?: number;
13
+ };
14
+ /** Options for creating an empty Zcash PSBT with explicit consensus branch ID (advanced use) */
15
+ export type CreateEmptyZcashWithConsensusBranchIdOptions = CreateEmptyOptions & {
16
+ /** Zcash consensus branch ID (required, e.g., 0xC2D6D0B4 for NU5, 0x76B809BB for Sapling) */
17
+ consensusBranchId: number;
18
+ /** Zcash version group ID (defaults to Sapling: 0x892F2085) */
19
+ versionGroupId?: number;
20
+ /** Zcash transaction expiry height */
21
+ expiryHeight?: number;
22
+ };
23
+ /**
24
+ * Zcash-specific PSBT implementation
25
+ *
26
+ * This class extends BitGoPsbt with Zcash-specific functionality:
27
+ * - Required consensus branch ID for sighash computation
28
+ * - Version group ID for Zcash transaction format
29
+ * - Expiry height for transaction validity
30
+ *
31
+ * All Zcash-specific getters return non-optional types since they're
32
+ * guaranteed to be present for Zcash PSBTs.
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * // Create a new Zcash PSBT
37
+ * const psbt = ZcashBitGoPsbt.createEmpty("zcash", walletKeys, {
38
+ * consensusBranchId: 0x76B809BB, // Sapling
39
+ * });
40
+ *
41
+ * // Deserialize from bytes
42
+ * const psbt = ZcashBitGoPsbt.fromBytes(bytes, "zcash");
43
+ * ```
44
+ */
45
+ export declare class ZcashBitGoPsbt extends BitGoPsbt {
46
+ /**
47
+ * Create an empty Zcash PSBT with consensus branch ID determined from block height
48
+ *
49
+ * **This is the preferred method for creating Zcash PSBTs.** It automatically determines
50
+ * the correct consensus branch ID based on the network and block height using Zcash
51
+ * network upgrade activation heights, eliminating the need to manually look up branch IDs.
52
+ *
53
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
54
+ * @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
55
+ * @param options - Options including blockHeight to determine consensus rules
56
+ * @returns A new ZcashBitGoPsbt instance
57
+ * @throws Error if block height is before Overwinter activation
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * // Create PSBT for a specific block height (recommended)
62
+ * const psbt = ZcashBitGoPsbt.createEmpty("zcash", walletKeys, {
63
+ * blockHeight: 1687104, // Automatically uses Nu5 branch ID
64
+ * });
65
+ *
66
+ * // Create PSBT for current block height
67
+ * const currentHeight = await getBlockHeight();
68
+ * const psbt = ZcashBitGoPsbt.createEmpty("zcash", walletKeys, {
69
+ * blockHeight: currentHeight,
70
+ * });
71
+ * ```
72
+ */
73
+ static createEmpty(network: ZcashNetworkName, walletKeys: WalletKeysArg, options: CreateEmptyZcashOptions): ZcashBitGoPsbt;
74
+ /**
75
+ * Create an empty Zcash PSBT with explicit consensus branch ID
76
+ *
77
+ * **Advanced use only.** This method requires manually specifying the consensus branch ID.
78
+ * In most cases, you should use `createEmpty()` instead, which automatically determines
79
+ * the correct branch ID from the block height.
80
+ *
81
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
82
+ * @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
83
+ * @param options - Zcash-specific options including required consensusBranchId
84
+ * @returns A new ZcashBitGoPsbt instance
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * // Only use this if you need explicit control over the branch ID
89
+ * const psbt = ZcashBitGoPsbt.createEmptyWithConsensusBranchId("zcash", walletKeys, {
90
+ * consensusBranchId: 0xC2D6D0B4, // Nu5 branch ID
91
+ * });
92
+ * ```
93
+ */
94
+ static createEmptyWithConsensusBranchId(network: ZcashNetworkName, walletKeys: WalletKeysArg, options: CreateEmptyZcashWithConsensusBranchIdOptions): ZcashBitGoPsbt;
95
+ /**
96
+ * Deserialize a Zcash PSBT from bytes
97
+ *
98
+ * @param bytes - The PSBT bytes
99
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
100
+ * @returns A ZcashBitGoPsbt instance
101
+ */
102
+ static fromBytes(bytes: Uint8Array, network: ZcashNetworkName): ZcashBitGoPsbt;
103
+ /**
104
+ * Get the Zcash version group ID
105
+ * @returns The version group ID (e.g., 0x892F2085 for Sapling)
106
+ */
107
+ get versionGroupId(): number;
108
+ /**
109
+ * Get the Zcash expiry height
110
+ * @returns The expiry height (0 if not set)
111
+ */
112
+ get expiryHeight(): number;
113
+ }
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZcashBitGoPsbt = void 0;
4
+ const wasm_utxo_js_1 = require("../wasm/wasm_utxo.js");
5
+ const RootWalletKeys_js_1 = require("./RootWalletKeys.js");
6
+ const BitGoPsbt_js_1 = require("./BitGoPsbt.js");
7
+ /**
8
+ * Zcash-specific PSBT implementation
9
+ *
10
+ * This class extends BitGoPsbt with Zcash-specific functionality:
11
+ * - Required consensus branch ID for sighash computation
12
+ * - Version group ID for Zcash transaction format
13
+ * - Expiry height for transaction validity
14
+ *
15
+ * All Zcash-specific getters return non-optional types since they're
16
+ * guaranteed to be present for Zcash PSBTs.
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * // Create a new Zcash PSBT
21
+ * const psbt = ZcashBitGoPsbt.createEmpty("zcash", walletKeys, {
22
+ * consensusBranchId: 0x76B809BB, // Sapling
23
+ * });
24
+ *
25
+ * // Deserialize from bytes
26
+ * const psbt = ZcashBitGoPsbt.fromBytes(bytes, "zcash");
27
+ * ```
28
+ */
29
+ class ZcashBitGoPsbt extends BitGoPsbt_js_1.BitGoPsbt {
30
+ /**
31
+ * Create an empty Zcash PSBT with consensus branch ID determined from block height
32
+ *
33
+ * **This is the preferred method for creating Zcash PSBTs.** It automatically determines
34
+ * the correct consensus branch ID based on the network and block height using Zcash
35
+ * network upgrade activation heights, eliminating the need to manually look up branch IDs.
36
+ *
37
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
38
+ * @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
39
+ * @param options - Options including blockHeight to determine consensus rules
40
+ * @returns A new ZcashBitGoPsbt instance
41
+ * @throws Error if block height is before Overwinter activation
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * // Create PSBT for a specific block height (recommended)
46
+ * const psbt = ZcashBitGoPsbt.createEmpty("zcash", walletKeys, {
47
+ * blockHeight: 1687104, // Automatically uses Nu5 branch ID
48
+ * });
49
+ *
50
+ * // Create PSBT for current block height
51
+ * const currentHeight = await getBlockHeight();
52
+ * const psbt = ZcashBitGoPsbt.createEmpty("zcash", walletKeys, {
53
+ * blockHeight: currentHeight,
54
+ * });
55
+ * ```
56
+ */
57
+ static createEmpty(network, walletKeys, options) {
58
+ const keys = RootWalletKeys_js_1.RootWalletKeys.from(walletKeys);
59
+ const wasm = wasm_utxo_js_1.BitGoPsbt.create_empty_zcash_at_height(network, keys.wasm, options.blockHeight, options.version, options.lockTime, options.versionGroupId, options.expiryHeight);
60
+ return new ZcashBitGoPsbt(wasm);
61
+ }
62
+ /**
63
+ * Create an empty Zcash PSBT with explicit consensus branch ID
64
+ *
65
+ * **Advanced use only.** This method requires manually specifying the consensus branch ID.
66
+ * In most cases, you should use `createEmpty()` instead, which automatically determines
67
+ * the correct branch ID from the block height.
68
+ *
69
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
70
+ * @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
71
+ * @param options - Zcash-specific options including required consensusBranchId
72
+ * @returns A new ZcashBitGoPsbt instance
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * // Only use this if you need explicit control over the branch ID
77
+ * const psbt = ZcashBitGoPsbt.createEmptyWithConsensusBranchId("zcash", walletKeys, {
78
+ * consensusBranchId: 0xC2D6D0B4, // Nu5 branch ID
79
+ * });
80
+ * ```
81
+ */
82
+ static createEmptyWithConsensusBranchId(network, walletKeys, options) {
83
+ const keys = RootWalletKeys_js_1.RootWalletKeys.from(walletKeys);
84
+ const wasm = wasm_utxo_js_1.BitGoPsbt.create_empty_zcash(network, keys.wasm, options.consensusBranchId, options.version, options.lockTime, options.versionGroupId, options.expiryHeight);
85
+ return new ZcashBitGoPsbt(wasm);
86
+ }
87
+ /**
88
+ * Deserialize a Zcash PSBT from bytes
89
+ *
90
+ * @param bytes - The PSBT bytes
91
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
92
+ * @returns A ZcashBitGoPsbt instance
93
+ */
94
+ static fromBytes(bytes, network) {
95
+ const wasm = wasm_utxo_js_1.BitGoPsbt.from_bytes(bytes, network);
96
+ return new ZcashBitGoPsbt(wasm);
97
+ }
98
+ // --- Zcash-specific getters ---
99
+ /**
100
+ * Get the Zcash version group ID
101
+ * @returns The version group ID (e.g., 0x892F2085 for Sapling)
102
+ */
103
+ get versionGroupId() {
104
+ return this.wasm.version_group_id();
105
+ }
106
+ /**
107
+ * Get the Zcash expiry height
108
+ * @returns The expiry height (0 if not set)
109
+ */
110
+ get expiryHeight() {
111
+ return this.wasm.expiry_height();
112
+ }
113
+ }
114
+ exports.ZcashBitGoPsbt = ZcashBitGoPsbt;
@@ -1,4 +1,5 @@
1
1
  export { RootWalletKeys, type WalletKeysArg, type IWalletKeys } from "./RootWalletKeys.js";
2
2
  export { ReplayProtection, type ReplayProtectionArg } from "./ReplayProtection.js";
3
3
  export { outputScript, address } from "./address.js";
4
- export { BitGoPsbt, type NetworkName, type ScriptId, type InputScriptType, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, } from "./BitGoPsbt.js";
4
+ export { BitGoPsbt, type NetworkName, type ScriptId, type InputScriptType, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, type CreateEmptyOptions, type AddInputOptions, type AddOutputOptions, type AddWalletInputOptions, type AddWalletOutputOptions, } from "./BitGoPsbt.js";
5
+ 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.BitGoPsbt = exports.address = exports.outputScript = exports.ReplayProtection = exports.RootWalletKeys = void 0;
3
+ exports.ZcashBitGoPsbt = exports.BitGoPsbt = exports.address = exports.outputScript = exports.ReplayProtection = exports.RootWalletKeys = void 0;
4
4
  var RootWalletKeys_js_1 = require("./RootWalletKeys.js");
5
5
  Object.defineProperty(exports, "RootWalletKeys", { enumerable: true, get: function () { return RootWalletKeys_js_1.RootWalletKeys; } });
6
6
  var ReplayProtection_js_1 = require("./ReplayProtection.js");
@@ -8,5 +8,9 @@ Object.defineProperty(exports, "ReplayProtection", { enumerable: true, get: func
8
8
  var address_js_1 = require("./address.js");
9
9
  Object.defineProperty(exports, "outputScript", { enumerable: true, get: function () { return address_js_1.outputScript; } });
10
10
  Object.defineProperty(exports, "address", { enumerable: true, get: function () { return address_js_1.address; } });
11
+ // Bitcoin-like PSBT (for all non-Zcash networks)
11
12
  var BitGoPsbt_js_1 = require("./BitGoPsbt.js");
12
13
  Object.defineProperty(exports, "BitGoPsbt", { enumerable: true, get: function () { return BitGoPsbt_js_1.BitGoPsbt; } });
14
+ // Zcash-specific PSBT subclass
15
+ var ZcashBitGoPsbt_js_1 = require("./ZcashBitGoPsbt.js");
16
+ Object.defineProperty(exports, "ZcashBitGoPsbt", { enumerable: true, get: function () { return ZcashBitGoPsbt_js_1.ZcashBitGoPsbt; } });
@@ -38,6 +38,10 @@ export class BitGoPsbt {
38
38
  * * `lock_time` - Optional lock time (default: 0)
39
39
  */
40
40
  static create_empty(network: string, wallet_keys: WasmRootWalletKeys, version?: number | null, lock_time?: number | null): BitGoPsbt;
41
+ /**
42
+ * Get the Zcash expiry height (returns None for non-Zcash PSBTs)
43
+ */
44
+ expiry_height(): number | undefined;
41
45
  /**
42
46
  * Get the unsigned transaction ID
43
47
  */
@@ -84,6 +88,10 @@ export class BitGoPsbt {
84
88
  * The index of the newly added input
85
89
  */
86
90
  add_wallet_input(txid: string, vout: number, value: bigint, wallet_keys: WasmRootWalletKeys, chain: number, index: number, signer?: string | null, cosigner?: string | null, sequence?: number | null, prev_tx?: Uint8Array | null): number;
91
+ /**
92
+ * Get the Zcash version group ID (returns None for non-Zcash PSBTs)
93
+ */
94
+ version_group_id(): number | undefined;
87
95
  /**
88
96
  * Add a wallet output with full PSBT metadata
89
97
  *
@@ -120,6 +128,22 @@ export class BitGoPsbt {
120
128
  * - `Err(WasmUtxoError)` if signing fails
121
129
  */
122
130
  sign_with_privkey(input_index: number, ecpair: WasmECPair): void;
131
+ /**
132
+ * Create an empty Zcash PSBT with the required consensus branch ID
133
+ *
134
+ * This method is specifically for Zcash networks which require additional
135
+ * parameters for sighash computation.
136
+ *
137
+ * # Arguments
138
+ * * `network` - Network name (must be "zcash" or "zcashTest")
139
+ * * `wallet_keys` - The wallet's root keys (used to set global xpubs)
140
+ * * `consensus_branch_id` - Zcash consensus branch ID (e.g., 0xC2D6D0B4 for NU5)
141
+ * * `version` - Optional transaction version (default: 4 for Zcash Sapling+)
142
+ * * `lock_time` - Optional lock time (default: 0)
143
+ * * `version_group_id` - Optional version group ID (defaults to Sapling: 0x892F2085)
144
+ * * `expiry_height` - Optional expiry height
145
+ */
146
+ static create_empty_zcash(network: string, wallet_keys: WasmRootWalletKeys, consensus_branch_id: number, version?: number | null, lock_time?: number | null, version_group_id?: number | null, expiry_height?: number | null): BitGoPsbt;
123
147
  /**
124
148
  * Extract the final transaction from a finalized PSBT
125
149
  *
@@ -257,6 +281,25 @@ export class BitGoPsbt {
257
281
  * The index of the newly added input
258
282
  */
259
283
  add_replay_protection_input(ecpair: WasmECPair, txid: string, vout: number, value: bigint, sequence?: number | null): number;
284
+ /**
285
+ * Create an empty Zcash PSBT with consensus branch ID determined from block height
286
+ *
287
+ * This method automatically determines the correct consensus branch ID based on
288
+ * the network and block height using the network upgrade activation heights.
289
+ *
290
+ * # Arguments
291
+ * * `network` - Network name (must be "zcash" or "zcashTest")
292
+ * * `wallet_keys` - The wallet's root keys (used to set global xpubs)
293
+ * * `block_height` - Block height to determine consensus rules
294
+ * * `version` - Optional transaction version (default: 4 for Zcash Sapling+)
295
+ * * `lock_time` - Optional lock time (default: 0)
296
+ * * `version_group_id` - Optional version group ID (defaults to Sapling: 0x892F2085)
297
+ * * `expiry_height` - Optional expiry height
298
+ *
299
+ * # Errors
300
+ * Returns error if block height is before Overwinter activation
301
+ */
302
+ static create_empty_zcash_at_height(network: string, wallet_keys: WasmRootWalletKeys, block_height: number, version?: number | null, lock_time?: number | null, version_group_id?: number | null, expiry_height?: number | null): BitGoPsbt;
260
303
  /**
261
304
  * Parse outputs with wallet keys to identify which outputs belong to a wallet
262
305
  *
@@ -384,6 +384,14 @@ class BitGoPsbt {
384
384
  wasm.__wbindgen_add_to_stack_pointer(16);
385
385
  }
386
386
  }
387
+ /**
388
+ * Get the Zcash expiry height (returns None for non-Zcash PSBTs)
389
+ * @returns {number | undefined}
390
+ */
391
+ expiry_height() {
392
+ const ret = wasm.bitgopsbt_expiry_height(this.__wbg_ptr);
393
+ return ret === 0x100000001 ? undefined : ret;
394
+ }
387
395
  /**
388
396
  * Get the unsigned transaction ID
389
397
  * @returns {string}
@@ -495,6 +503,14 @@ class BitGoPsbt {
495
503
  wasm.__wbindgen_add_to_stack_pointer(16);
496
504
  }
497
505
  }
506
+ /**
507
+ * Get the Zcash version group ID (returns None for non-Zcash PSBTs)
508
+ * @returns {number | undefined}
509
+ */
510
+ version_group_id() {
511
+ const ret = wasm.bitgopsbt_version_group_id(this.__wbg_ptr);
512
+ return ret === 0x100000001 ? undefined : ret;
513
+ }
498
514
  /**
499
515
  * Add a wallet output with full PSBT metadata
500
516
  *
@@ -566,6 +582,47 @@ class BitGoPsbt {
566
582
  wasm.__wbindgen_add_to_stack_pointer(16);
567
583
  }
568
584
  }
585
+ /**
586
+ * Create an empty Zcash PSBT with the required consensus branch ID
587
+ *
588
+ * This method is specifically for Zcash networks which require additional
589
+ * parameters for sighash computation.
590
+ *
591
+ * # Arguments
592
+ * * `network` - Network name (must be "zcash" or "zcashTest")
593
+ * * `wallet_keys` - The wallet's root keys (used to set global xpubs)
594
+ * * `consensus_branch_id` - Zcash consensus branch ID (e.g., 0xC2D6D0B4 for NU5)
595
+ * * `version` - Optional transaction version (default: 4 for Zcash Sapling+)
596
+ * * `lock_time` - Optional lock time (default: 0)
597
+ * * `version_group_id` - Optional version group ID (defaults to Sapling: 0x892F2085)
598
+ * * `expiry_height` - Optional expiry height
599
+ * @param {string} network
600
+ * @param {WasmRootWalletKeys} wallet_keys
601
+ * @param {number} consensus_branch_id
602
+ * @param {number | null} [version]
603
+ * @param {number | null} [lock_time]
604
+ * @param {number | null} [version_group_id]
605
+ * @param {number | null} [expiry_height]
606
+ * @returns {BitGoPsbt}
607
+ */
608
+ static create_empty_zcash(network, wallet_keys, consensus_branch_id, version, lock_time, version_group_id, expiry_height) {
609
+ try {
610
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
611
+ const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
612
+ const len0 = WASM_VECTOR_LEN;
613
+ _assertClass(wallet_keys, WasmRootWalletKeys);
614
+ wasm.bitgopsbt_create_empty_zcash(retptr, ptr0, len0, wallet_keys.__wbg_ptr, consensus_branch_id, isLikeNone(version) ? 0x100000001 : (version) >> 0, isLikeNone(lock_time) ? 0x100000001 : (lock_time) >>> 0, isLikeNone(version_group_id) ? 0x100000001 : (version_group_id) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
615
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
616
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
617
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
618
+ if (r2) {
619
+ throw takeObject(r1);
620
+ }
621
+ return BitGoPsbt.__wrap(r0);
622
+ } finally {
623
+ wasm.__wbindgen_add_to_stack_pointer(16);
624
+ }
625
+ }
569
626
  /**
570
627
  * Extract the final transaction from a finalized PSBT
571
628
  *
@@ -842,6 +899,50 @@ class BitGoPsbt {
842
899
  wasm.__wbindgen_add_to_stack_pointer(16);
843
900
  }
844
901
  }
902
+ /**
903
+ * Create an empty Zcash PSBT with consensus branch ID determined from block height
904
+ *
905
+ * This method automatically determines the correct consensus branch ID based on
906
+ * the network and block height using the network upgrade activation heights.
907
+ *
908
+ * # Arguments
909
+ * * `network` - Network name (must be "zcash" or "zcashTest")
910
+ * * `wallet_keys` - The wallet's root keys (used to set global xpubs)
911
+ * * `block_height` - Block height to determine consensus rules
912
+ * * `version` - Optional transaction version (default: 4 for Zcash Sapling+)
913
+ * * `lock_time` - Optional lock time (default: 0)
914
+ * * `version_group_id` - Optional version group ID (defaults to Sapling: 0x892F2085)
915
+ * * `expiry_height` - Optional expiry height
916
+ *
917
+ * # Errors
918
+ * Returns error if block height is before Overwinter activation
919
+ * @param {string} network
920
+ * @param {WasmRootWalletKeys} wallet_keys
921
+ * @param {number} block_height
922
+ * @param {number | null} [version]
923
+ * @param {number | null} [lock_time]
924
+ * @param {number | null} [version_group_id]
925
+ * @param {number | null} [expiry_height]
926
+ * @returns {BitGoPsbt}
927
+ */
928
+ static create_empty_zcash_at_height(network, wallet_keys, block_height, version, lock_time, version_group_id, expiry_height) {
929
+ try {
930
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
931
+ const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
932
+ const len0 = WASM_VECTOR_LEN;
933
+ _assertClass(wallet_keys, WasmRootWalletKeys);
934
+ wasm.bitgopsbt_create_empty_zcash_at_height(retptr, ptr0, len0, wallet_keys.__wbg_ptr, block_height, isLikeNone(version) ? 0x100000001 : (version) >> 0, isLikeNone(lock_time) ? 0x100000001 : (lock_time) >>> 0, isLikeNone(version_group_id) ? 0x100000001 : (version_group_id) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
935
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
936
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
937
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
938
+ if (r2) {
939
+ throw takeObject(r1);
940
+ }
941
+ return BitGoPsbt.__wrap(r0);
942
+ } finally {
943
+ wasm.__wbindgen_add_to_stack_pointer(16);
944
+ }
945
+ }
845
946
  /**
846
947
  * Parse outputs with wallet keys to identify which outputs belong to a wallet
847
948
  *
Binary file
@@ -1,30 +1,7 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const __wbg_wasmbip32_free: (a: number, b: number) => void;
5
4
  export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
6
- export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
7
- export const __wbg_wrappsbt_free: (a: number, b: number) => void;
8
- export const wasmbip32_chain_code: (a: number) => number;
9
- export const wasmbip32_depth: (a: number) => number;
10
- export const wasmbip32_derive: (a: number, b: number, c: number) => void;
11
- export const wasmbip32_derive_hardened: (a: number, b: number, c: number) => void;
12
- export const wasmbip32_derive_path: (a: number, b: number, c: number, d: number) => void;
13
- export const wasmbip32_fingerprint: (a: number) => number;
14
- export const wasmbip32_from_base58: (a: number, b: number, c: number) => void;
15
- export const wasmbip32_from_bip32_interface: (a: number, b: number) => void;
16
- export const wasmbip32_from_seed: (a: number, b: number, c: number, d: number, e: number) => void;
17
- export const wasmbip32_from_xprv: (a: number, b: number, c: number) => void;
18
- export const wasmbip32_from_xpub: (a: number, b: number, c: number) => void;
19
- export const wasmbip32_identifier: (a: number) => number;
20
- export const wasmbip32_index: (a: number) => number;
21
- export const wasmbip32_is_neutered: (a: number) => number;
22
- export const wasmbip32_neutered: (a: number) => number;
23
- export const wasmbip32_parent_fingerprint: (a: number) => number;
24
- export const wasmbip32_private_key: (a: number) => number;
25
- export const wasmbip32_public_key: (a: number) => number;
26
- export const wasmbip32_to_base58: (a: number, b: number) => void;
27
- export const wasmbip32_to_wif: (a: number, b: number) => void;
28
5
  export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
29
6
  export const wrapdescriptor_descType: (a: number, b: number) => void;
30
7
  export const wrapdescriptor_encode: (a: number, b: number) => void;
@@ -36,28 +13,13 @@ export const wrapdescriptor_node: (a: number, b: number) => void;
36
13
  export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
37
14
  export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
38
15
  export const wrapdescriptor_toString: (a: number, b: number) => void;
39
- export const wrapminiscript_encode: (a: number, b: number) => void;
40
- export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
41
- export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
42
- export const wrapminiscript_node: (a: number, b: number) => void;
43
- export const wrapminiscript_toAsmString: (a: number, b: number) => void;
44
- export const wrapminiscript_toString: (a: number, b: number) => void;
45
- export const wrappsbt_clone: (a: number) => number;
46
- export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
47
- export const wrappsbt_finalize: (a: number, b: number) => void;
48
- export const wrappsbt_serialize: (a: number, b: number) => void;
49
- export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
50
- export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
51
- export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
52
- export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
53
- export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
54
16
  export const __wbg_addressnamespace_free: (a: number, b: number) => void;
55
17
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
56
18
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
57
- export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
19
+ export const __wbg_wasmbip32_free: (a: number, b: number) => void;
58
20
  export const __wbg_wasmecpair_free: (a: number, b: number) => void;
59
- export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
60
21
  export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
22
+ export const __wbg_wrappsbt_free: (a: number, b: number) => void;
61
23
  export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
62
24
  export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
63
25
  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;
@@ -68,6 +30,9 @@ export const bitgopsbt_add_wallet_input: (a: number, b: number, c: number, d: nu
68
30
  export const bitgopsbt_add_wallet_output: (a: number, b: number, c: number, d: number, e: bigint, f: number) => void;
69
31
  export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
70
32
  export const bitgopsbt_create_empty: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
33
+ export const bitgopsbt_create_empty_zcash: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
34
+ export const bitgopsbt_create_empty_zcash_at_height: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
35
+ export const bitgopsbt_expiry_height: (a: number) => number;
71
36
  export const bitgopsbt_extract_transaction: (a: number, b: number) => void;
72
37
  export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
73
38
  export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
@@ -84,10 +49,29 @@ export const bitgopsbt_verify_replay_protection_signature: (a: number, b: number
84
49
  export const bitgopsbt_verify_signature_with_pub: (a: number, b: number, c: number, d: number) => void;
85
50
  export const bitgopsbt_verify_signature_with_xpub: (a: number, b: number, c: number, d: number) => void;
86
51
  export const bitgopsbt_version: (a: number) => number;
52
+ export const bitgopsbt_version_group_id: (a: number) => number;
87
53
  export const fixedscriptwalletnamespace_address: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
88
54
  export const fixedscriptwalletnamespace_output_script: (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;
55
+ export const wasmbip32_chain_code: (a: number) => number;
56
+ export const wasmbip32_depth: (a: number) => number;
57
+ export const wasmbip32_derive: (a: number, b: number, c: number) => void;
58
+ export const wasmbip32_derive_hardened: (a: number, b: number, c: number) => void;
59
+ export const wasmbip32_derive_path: (a: number, b: number, c: number, d: number) => void;
60
+ export const wasmbip32_fingerprint: (a: number) => number;
61
+ export const wasmbip32_from_base58: (a: number, b: number, c: number) => void;
62
+ export const wasmbip32_from_bip32_interface: (a: number, b: number) => void;
63
+ export const wasmbip32_from_seed: (a: number, b: number, c: number, d: number, e: number) => void;
64
+ export const wasmbip32_from_xprv: (a: number, b: number, c: number) => void;
65
+ export const wasmbip32_from_xpub: (a: number, b: number, c: number) => void;
66
+ export const wasmbip32_identifier: (a: number) => number;
67
+ export const wasmbip32_index: (a: number) => number;
68
+ export const wasmbip32_is_neutered: (a: number) => number;
69
+ export const wasmbip32_neutered: (a: number) => number;
70
+ export const wasmbip32_parent_fingerprint: (a: number) => number;
71
+ export const wasmbip32_private_key: (a: number) => number;
72
+ export const wasmbip32_public_key: (a: number) => number;
73
+ export const wasmbip32_to_base58: (a: number, b: number) => void;
74
+ export const wasmbip32_to_wif: (a: number, b: number) => void;
91
75
  export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
92
76
  export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
93
77
  export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
@@ -98,14 +82,34 @@ export const wasmecpair_public_key: (a: number) => number;
98
82
  export const wasmecpair_to_wif: (a: number, b: number) => void;
99
83
  export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
100
84
  export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
101
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
102
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
103
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
104
85
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
105
86
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
106
87
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
107
88
  export const wasmrootwalletkeys_user_key: (a: number) => number;
108
89
  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;
90
+ export const wrappsbt_clone: (a: number) => number;
91
+ export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
92
+ export const wrappsbt_finalize: (a: number, b: number) => void;
93
+ export const wrappsbt_serialize: (a: number, b: number) => void;
94
+ export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
95
+ export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
96
+ export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
97
+ export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
98
+ export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
99
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
100
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
101
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
102
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
103
+ export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
104
+ export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
105
+ export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
106
+ export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
107
+ export const wrapminiscript_encode: (a: number, b: number) => void;
108
+ export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
109
+ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
110
+ export const wrapminiscript_node: (a: number, b: number) => void;
111
+ export const wrapminiscript_toAsmString: (a: number, b: number) => void;
112
+ export const wrapminiscript_toString: (a: number, b: number) => void;
109
113
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
110
114
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
111
115
  export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
@@ -1,3 +1,4 @@
1
+ import { BitGoPsbt as WasmBitGoPsbt } from "../wasm/wasm_utxo.js";
1
2
  import { type WalletKeysArg } from "./RootWalletKeys.js";
2
3
  import { type ReplayProtectionArg } from "./ReplayProtection.js";
3
4
  import { type BIP32Arg } from "../bip32.js";
@@ -85,14 +86,16 @@ export type AddWalletOutputOptions = {
85
86
  value: bigint;
86
87
  };
87
88
  export declare class BitGoPsbt {
88
- private wasm;
89
- private constructor();
89
+ protected wasm: WasmBitGoPsbt;
90
+ protected constructor(wasm: WasmBitGoPsbt);
90
91
  /**
91
92
  * Create an empty PSBT for the given network with wallet keys
92
93
  *
93
94
  * The wallet keys are used to set global xpubs in the PSBT, which identifies
94
95
  * the keys that will be used for signing.
95
96
  *
97
+ * For Zcash networks, use ZcashBitGoPsbt.createEmpty() instead.
98
+ *
96
99
  * @param network - Network name (utxolib name like "bitcoin" or coin name like "btc")
97
100
  * @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
98
101
  * @param options - Optional transaction parameters (version, lockTime)
@@ -14,6 +14,8 @@ export class BitGoPsbt {
14
14
  * The wallet keys are used to set global xpubs in the PSBT, which identifies
15
15
  * the keys that will be used for signing.
16
16
  *
17
+ * For Zcash networks, use ZcashBitGoPsbt.createEmpty() instead.
18
+ *
17
19
  * @param network - Network name (utxolib name like "bitcoin" or coin name like "btc")
18
20
  * @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
19
21
  * @param options - Optional transaction parameters (version, lockTime)
@@ -0,0 +1,113 @@
1
+ import { type WalletKeysArg } from "./RootWalletKeys.js";
2
+ import { BitGoPsbt, type CreateEmptyOptions } from "./BitGoPsbt.js";
3
+ /** Zcash network names */
4
+ export type ZcashNetworkName = "zcash" | "zcashTest" | "zec" | "tzec";
5
+ /** Options for creating an empty Zcash PSBT (preferred method using block height) */
6
+ export type CreateEmptyZcashOptions = CreateEmptyOptions & {
7
+ /** Block height to determine consensus branch ID automatically */
8
+ blockHeight: number;
9
+ /** Zcash version group ID (defaults to Sapling: 0x892F2085) */
10
+ versionGroupId?: number;
11
+ /** Zcash transaction expiry height */
12
+ expiryHeight?: number;
13
+ };
14
+ /** Options for creating an empty Zcash PSBT with explicit consensus branch ID (advanced use) */
15
+ export type CreateEmptyZcashWithConsensusBranchIdOptions = CreateEmptyOptions & {
16
+ /** Zcash consensus branch ID (required, e.g., 0xC2D6D0B4 for NU5, 0x76B809BB for Sapling) */
17
+ consensusBranchId: number;
18
+ /** Zcash version group ID (defaults to Sapling: 0x892F2085) */
19
+ versionGroupId?: number;
20
+ /** Zcash transaction expiry height */
21
+ expiryHeight?: number;
22
+ };
23
+ /**
24
+ * Zcash-specific PSBT implementation
25
+ *
26
+ * This class extends BitGoPsbt with Zcash-specific functionality:
27
+ * - Required consensus branch ID for sighash computation
28
+ * - Version group ID for Zcash transaction format
29
+ * - Expiry height for transaction validity
30
+ *
31
+ * All Zcash-specific getters return non-optional types since they're
32
+ * guaranteed to be present for Zcash PSBTs.
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * // Create a new Zcash PSBT
37
+ * const psbt = ZcashBitGoPsbt.createEmpty("zcash", walletKeys, {
38
+ * consensusBranchId: 0x76B809BB, // Sapling
39
+ * });
40
+ *
41
+ * // Deserialize from bytes
42
+ * const psbt = ZcashBitGoPsbt.fromBytes(bytes, "zcash");
43
+ * ```
44
+ */
45
+ export declare class ZcashBitGoPsbt extends BitGoPsbt {
46
+ /**
47
+ * Create an empty Zcash PSBT with consensus branch ID determined from block height
48
+ *
49
+ * **This is the preferred method for creating Zcash PSBTs.** It automatically determines
50
+ * the correct consensus branch ID based on the network and block height using Zcash
51
+ * network upgrade activation heights, eliminating the need to manually look up branch IDs.
52
+ *
53
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
54
+ * @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
55
+ * @param options - Options including blockHeight to determine consensus rules
56
+ * @returns A new ZcashBitGoPsbt instance
57
+ * @throws Error if block height is before Overwinter activation
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * // Create PSBT for a specific block height (recommended)
62
+ * const psbt = ZcashBitGoPsbt.createEmpty("zcash", walletKeys, {
63
+ * blockHeight: 1687104, // Automatically uses Nu5 branch ID
64
+ * });
65
+ *
66
+ * // Create PSBT for current block height
67
+ * const currentHeight = await getBlockHeight();
68
+ * const psbt = ZcashBitGoPsbt.createEmpty("zcash", walletKeys, {
69
+ * blockHeight: currentHeight,
70
+ * });
71
+ * ```
72
+ */
73
+ static createEmpty(network: ZcashNetworkName, walletKeys: WalletKeysArg, options: CreateEmptyZcashOptions): ZcashBitGoPsbt;
74
+ /**
75
+ * Create an empty Zcash PSBT with explicit consensus branch ID
76
+ *
77
+ * **Advanced use only.** This method requires manually specifying the consensus branch ID.
78
+ * In most cases, you should use `createEmpty()` instead, which automatically determines
79
+ * the correct branch ID from the block height.
80
+ *
81
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
82
+ * @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
83
+ * @param options - Zcash-specific options including required consensusBranchId
84
+ * @returns A new ZcashBitGoPsbt instance
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * // Only use this if you need explicit control over the branch ID
89
+ * const psbt = ZcashBitGoPsbt.createEmptyWithConsensusBranchId("zcash", walletKeys, {
90
+ * consensusBranchId: 0xC2D6D0B4, // Nu5 branch ID
91
+ * });
92
+ * ```
93
+ */
94
+ static createEmptyWithConsensusBranchId(network: ZcashNetworkName, walletKeys: WalletKeysArg, options: CreateEmptyZcashWithConsensusBranchIdOptions): ZcashBitGoPsbt;
95
+ /**
96
+ * Deserialize a Zcash PSBT from bytes
97
+ *
98
+ * @param bytes - The PSBT bytes
99
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
100
+ * @returns A ZcashBitGoPsbt instance
101
+ */
102
+ static fromBytes(bytes: Uint8Array, network: ZcashNetworkName): ZcashBitGoPsbt;
103
+ /**
104
+ * Get the Zcash version group ID
105
+ * @returns The version group ID (e.g., 0x892F2085 for Sapling)
106
+ */
107
+ get versionGroupId(): number;
108
+ /**
109
+ * Get the Zcash expiry height
110
+ * @returns The expiry height (0 if not set)
111
+ */
112
+ get expiryHeight(): number;
113
+ }
@@ -0,0 +1,110 @@
1
+ import { BitGoPsbt as WasmBitGoPsbt } from "../wasm/wasm_utxo.js";
2
+ import { RootWalletKeys } from "./RootWalletKeys.js";
3
+ import { BitGoPsbt } from "./BitGoPsbt.js";
4
+ /**
5
+ * Zcash-specific PSBT implementation
6
+ *
7
+ * This class extends BitGoPsbt with Zcash-specific functionality:
8
+ * - Required consensus branch ID for sighash computation
9
+ * - Version group ID for Zcash transaction format
10
+ * - Expiry height for transaction validity
11
+ *
12
+ * All Zcash-specific getters return non-optional types since they're
13
+ * guaranteed to be present for Zcash PSBTs.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * // Create a new Zcash PSBT
18
+ * const psbt = ZcashBitGoPsbt.createEmpty("zcash", walletKeys, {
19
+ * consensusBranchId: 0x76B809BB, // Sapling
20
+ * });
21
+ *
22
+ * // Deserialize from bytes
23
+ * const psbt = ZcashBitGoPsbt.fromBytes(bytes, "zcash");
24
+ * ```
25
+ */
26
+ export class ZcashBitGoPsbt extends BitGoPsbt {
27
+ /**
28
+ * Create an empty Zcash PSBT with consensus branch ID determined from block height
29
+ *
30
+ * **This is the preferred method for creating Zcash PSBTs.** It automatically determines
31
+ * the correct consensus branch ID based on the network and block height using Zcash
32
+ * network upgrade activation heights, eliminating the need to manually look up branch IDs.
33
+ *
34
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
35
+ * @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
36
+ * @param options - Options including blockHeight to determine consensus rules
37
+ * @returns A new ZcashBitGoPsbt instance
38
+ * @throws Error if block height is before Overwinter activation
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * // Create PSBT for a specific block height (recommended)
43
+ * const psbt = ZcashBitGoPsbt.createEmpty("zcash", walletKeys, {
44
+ * blockHeight: 1687104, // Automatically uses Nu5 branch ID
45
+ * });
46
+ *
47
+ * // Create PSBT for current block height
48
+ * const currentHeight = await getBlockHeight();
49
+ * const psbt = ZcashBitGoPsbt.createEmpty("zcash", walletKeys, {
50
+ * blockHeight: currentHeight,
51
+ * });
52
+ * ```
53
+ */
54
+ static createEmpty(network, walletKeys, options) {
55
+ const keys = RootWalletKeys.from(walletKeys);
56
+ const wasm = WasmBitGoPsbt.create_empty_zcash_at_height(network, keys.wasm, options.blockHeight, options.version, options.lockTime, options.versionGroupId, options.expiryHeight);
57
+ return new ZcashBitGoPsbt(wasm);
58
+ }
59
+ /**
60
+ * Create an empty Zcash PSBT with explicit consensus branch ID
61
+ *
62
+ * **Advanced use only.** This method requires manually specifying the consensus branch ID.
63
+ * In most cases, you should use `createEmpty()` instead, which automatically determines
64
+ * the correct branch ID from the block height.
65
+ *
66
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
67
+ * @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
68
+ * @param options - Zcash-specific options including required consensusBranchId
69
+ * @returns A new ZcashBitGoPsbt instance
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * // Only use this if you need explicit control over the branch ID
74
+ * const psbt = ZcashBitGoPsbt.createEmptyWithConsensusBranchId("zcash", walletKeys, {
75
+ * consensusBranchId: 0xC2D6D0B4, // Nu5 branch ID
76
+ * });
77
+ * ```
78
+ */
79
+ static createEmptyWithConsensusBranchId(network, walletKeys, options) {
80
+ const keys = RootWalletKeys.from(walletKeys);
81
+ const wasm = WasmBitGoPsbt.create_empty_zcash(network, keys.wasm, options.consensusBranchId, options.version, options.lockTime, options.versionGroupId, options.expiryHeight);
82
+ return new ZcashBitGoPsbt(wasm);
83
+ }
84
+ /**
85
+ * Deserialize a Zcash PSBT from bytes
86
+ *
87
+ * @param bytes - The PSBT bytes
88
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
89
+ * @returns A ZcashBitGoPsbt instance
90
+ */
91
+ static fromBytes(bytes, network) {
92
+ const wasm = WasmBitGoPsbt.from_bytes(bytes, network);
93
+ return new ZcashBitGoPsbt(wasm);
94
+ }
95
+ // --- Zcash-specific getters ---
96
+ /**
97
+ * Get the Zcash version group ID
98
+ * @returns The version group ID (e.g., 0x892F2085 for Sapling)
99
+ */
100
+ get versionGroupId() {
101
+ return this.wasm.version_group_id();
102
+ }
103
+ /**
104
+ * Get the Zcash expiry height
105
+ * @returns The expiry height (0 if not set)
106
+ */
107
+ get expiryHeight() {
108
+ return this.wasm.expiry_height();
109
+ }
110
+ }
@@ -1,4 +1,5 @@
1
1
  export { RootWalletKeys, type WalletKeysArg, type IWalletKeys } from "./RootWalletKeys.js";
2
2
  export { ReplayProtection, type ReplayProtectionArg } from "./ReplayProtection.js";
3
3
  export { outputScript, address } from "./address.js";
4
- export { BitGoPsbt, type NetworkName, type ScriptId, type InputScriptType, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, } from "./BitGoPsbt.js";
4
+ export { BitGoPsbt, type NetworkName, type ScriptId, type InputScriptType, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, type CreateEmptyOptions, type AddInputOptions, type AddOutputOptions, type AddWalletInputOptions, type AddWalletOutputOptions, } from "./BitGoPsbt.js";
5
+ export { ZcashBitGoPsbt, type ZcashNetworkName, type CreateEmptyZcashOptions, } from "./ZcashBitGoPsbt.js";
@@ -1,4 +1,7 @@
1
1
  export { RootWalletKeys } from "./RootWalletKeys.js";
2
2
  export { ReplayProtection } from "./ReplayProtection.js";
3
3
  export { outputScript, address } from "./address.js";
4
+ // Bitcoin-like PSBT (for all non-Zcash networks)
4
5
  export { BitGoPsbt, } from "./BitGoPsbt.js";
6
+ // Zcash-specific PSBT subclass
7
+ export { ZcashBitGoPsbt, } from "./ZcashBitGoPsbt.js";
@@ -38,6 +38,10 @@ export class BitGoPsbt {
38
38
  * * `lock_time` - Optional lock time (default: 0)
39
39
  */
40
40
  static create_empty(network: string, wallet_keys: WasmRootWalletKeys, version?: number | null, lock_time?: number | null): BitGoPsbt;
41
+ /**
42
+ * Get the Zcash expiry height (returns None for non-Zcash PSBTs)
43
+ */
44
+ expiry_height(): number | undefined;
41
45
  /**
42
46
  * Get the unsigned transaction ID
43
47
  */
@@ -84,6 +88,10 @@ export class BitGoPsbt {
84
88
  * The index of the newly added input
85
89
  */
86
90
  add_wallet_input(txid: string, vout: number, value: bigint, wallet_keys: WasmRootWalletKeys, chain: number, index: number, signer?: string | null, cosigner?: string | null, sequence?: number | null, prev_tx?: Uint8Array | null): number;
91
+ /**
92
+ * Get the Zcash version group ID (returns None for non-Zcash PSBTs)
93
+ */
94
+ version_group_id(): number | undefined;
87
95
  /**
88
96
  * Add a wallet output with full PSBT metadata
89
97
  *
@@ -120,6 +128,22 @@ export class BitGoPsbt {
120
128
  * - `Err(WasmUtxoError)` if signing fails
121
129
  */
122
130
  sign_with_privkey(input_index: number, ecpair: WasmECPair): void;
131
+ /**
132
+ * Create an empty Zcash PSBT with the required consensus branch ID
133
+ *
134
+ * This method is specifically for Zcash networks which require additional
135
+ * parameters for sighash computation.
136
+ *
137
+ * # Arguments
138
+ * * `network` - Network name (must be "zcash" or "zcashTest")
139
+ * * `wallet_keys` - The wallet's root keys (used to set global xpubs)
140
+ * * `consensus_branch_id` - Zcash consensus branch ID (e.g., 0xC2D6D0B4 for NU5)
141
+ * * `version` - Optional transaction version (default: 4 for Zcash Sapling+)
142
+ * * `lock_time` - Optional lock time (default: 0)
143
+ * * `version_group_id` - Optional version group ID (defaults to Sapling: 0x892F2085)
144
+ * * `expiry_height` - Optional expiry height
145
+ */
146
+ static create_empty_zcash(network: string, wallet_keys: WasmRootWalletKeys, consensus_branch_id: number, version?: number | null, lock_time?: number | null, version_group_id?: number | null, expiry_height?: number | null): BitGoPsbt;
123
147
  /**
124
148
  * Extract the final transaction from a finalized PSBT
125
149
  *
@@ -257,6 +281,25 @@ export class BitGoPsbt {
257
281
  * The index of the newly added input
258
282
  */
259
283
  add_replay_protection_input(ecpair: WasmECPair, txid: string, vout: number, value: bigint, sequence?: number | null): number;
284
+ /**
285
+ * Create an empty Zcash PSBT with consensus branch ID determined from block height
286
+ *
287
+ * This method automatically determines the correct consensus branch ID based on
288
+ * the network and block height using the network upgrade activation heights.
289
+ *
290
+ * # Arguments
291
+ * * `network` - Network name (must be "zcash" or "zcashTest")
292
+ * * `wallet_keys` - The wallet's root keys (used to set global xpubs)
293
+ * * `block_height` - Block height to determine consensus rules
294
+ * * `version` - Optional transaction version (default: 4 for Zcash Sapling+)
295
+ * * `lock_time` - Optional lock time (default: 0)
296
+ * * `version_group_id` - Optional version group ID (defaults to Sapling: 0x892F2085)
297
+ * * `expiry_height` - Optional expiry height
298
+ *
299
+ * # Errors
300
+ * Returns error if block height is before Overwinter activation
301
+ */
302
+ static create_empty_zcash_at_height(network: string, wallet_keys: WasmRootWalletKeys, block_height: number, version?: number | null, lock_time?: number | null, version_group_id?: number | null, expiry_height?: number | null): BitGoPsbt;
260
303
  /**
261
304
  * Parse outputs with wallet keys to identify which outputs belong to a wallet
262
305
  *
@@ -392,6 +392,14 @@ export class BitGoPsbt {
392
392
  wasm.__wbindgen_add_to_stack_pointer(16);
393
393
  }
394
394
  }
395
+ /**
396
+ * Get the Zcash expiry height (returns None for non-Zcash PSBTs)
397
+ * @returns {number | undefined}
398
+ */
399
+ expiry_height() {
400
+ const ret = wasm.bitgopsbt_expiry_height(this.__wbg_ptr);
401
+ return ret === 0x100000001 ? undefined : ret;
402
+ }
395
403
  /**
396
404
  * Get the unsigned transaction ID
397
405
  * @returns {string}
@@ -503,6 +511,14 @@ export class BitGoPsbt {
503
511
  wasm.__wbindgen_add_to_stack_pointer(16);
504
512
  }
505
513
  }
514
+ /**
515
+ * Get the Zcash version group ID (returns None for non-Zcash PSBTs)
516
+ * @returns {number | undefined}
517
+ */
518
+ version_group_id() {
519
+ const ret = wasm.bitgopsbt_version_group_id(this.__wbg_ptr);
520
+ return ret === 0x100000001 ? undefined : ret;
521
+ }
506
522
  /**
507
523
  * Add a wallet output with full PSBT metadata
508
524
  *
@@ -574,6 +590,47 @@ export class BitGoPsbt {
574
590
  wasm.__wbindgen_add_to_stack_pointer(16);
575
591
  }
576
592
  }
593
+ /**
594
+ * Create an empty Zcash PSBT with the required consensus branch ID
595
+ *
596
+ * This method is specifically for Zcash networks which require additional
597
+ * parameters for sighash computation.
598
+ *
599
+ * # Arguments
600
+ * * `network` - Network name (must be "zcash" or "zcashTest")
601
+ * * `wallet_keys` - The wallet's root keys (used to set global xpubs)
602
+ * * `consensus_branch_id` - Zcash consensus branch ID (e.g., 0xC2D6D0B4 for NU5)
603
+ * * `version` - Optional transaction version (default: 4 for Zcash Sapling+)
604
+ * * `lock_time` - Optional lock time (default: 0)
605
+ * * `version_group_id` - Optional version group ID (defaults to Sapling: 0x892F2085)
606
+ * * `expiry_height` - Optional expiry height
607
+ * @param {string} network
608
+ * @param {WasmRootWalletKeys} wallet_keys
609
+ * @param {number} consensus_branch_id
610
+ * @param {number | null} [version]
611
+ * @param {number | null} [lock_time]
612
+ * @param {number | null} [version_group_id]
613
+ * @param {number | null} [expiry_height]
614
+ * @returns {BitGoPsbt}
615
+ */
616
+ static create_empty_zcash(network, wallet_keys, consensus_branch_id, version, lock_time, version_group_id, expiry_height) {
617
+ try {
618
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
619
+ const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
620
+ const len0 = WASM_VECTOR_LEN;
621
+ _assertClass(wallet_keys, WasmRootWalletKeys);
622
+ wasm.bitgopsbt_create_empty_zcash(retptr, ptr0, len0, wallet_keys.__wbg_ptr, consensus_branch_id, isLikeNone(version) ? 0x100000001 : (version) >> 0, isLikeNone(lock_time) ? 0x100000001 : (lock_time) >>> 0, isLikeNone(version_group_id) ? 0x100000001 : (version_group_id) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
623
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
624
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
625
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
626
+ if (r2) {
627
+ throw takeObject(r1);
628
+ }
629
+ return BitGoPsbt.__wrap(r0);
630
+ } finally {
631
+ wasm.__wbindgen_add_to_stack_pointer(16);
632
+ }
633
+ }
577
634
  /**
578
635
  * Extract the final transaction from a finalized PSBT
579
636
  *
@@ -850,6 +907,50 @@ export class BitGoPsbt {
850
907
  wasm.__wbindgen_add_to_stack_pointer(16);
851
908
  }
852
909
  }
910
+ /**
911
+ * Create an empty Zcash PSBT with consensus branch ID determined from block height
912
+ *
913
+ * This method automatically determines the correct consensus branch ID based on
914
+ * the network and block height using the network upgrade activation heights.
915
+ *
916
+ * # Arguments
917
+ * * `network` - Network name (must be "zcash" or "zcashTest")
918
+ * * `wallet_keys` - The wallet's root keys (used to set global xpubs)
919
+ * * `block_height` - Block height to determine consensus rules
920
+ * * `version` - Optional transaction version (default: 4 for Zcash Sapling+)
921
+ * * `lock_time` - Optional lock time (default: 0)
922
+ * * `version_group_id` - Optional version group ID (defaults to Sapling: 0x892F2085)
923
+ * * `expiry_height` - Optional expiry height
924
+ *
925
+ * # Errors
926
+ * Returns error if block height is before Overwinter activation
927
+ * @param {string} network
928
+ * @param {WasmRootWalletKeys} wallet_keys
929
+ * @param {number} block_height
930
+ * @param {number | null} [version]
931
+ * @param {number | null} [lock_time]
932
+ * @param {number | null} [version_group_id]
933
+ * @param {number | null} [expiry_height]
934
+ * @returns {BitGoPsbt}
935
+ */
936
+ static create_empty_zcash_at_height(network, wallet_keys, block_height, version, lock_time, version_group_id, expiry_height) {
937
+ try {
938
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
939
+ const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
940
+ const len0 = WASM_VECTOR_LEN;
941
+ _assertClass(wallet_keys, WasmRootWalletKeys);
942
+ wasm.bitgopsbt_create_empty_zcash_at_height(retptr, ptr0, len0, wallet_keys.__wbg_ptr, block_height, isLikeNone(version) ? 0x100000001 : (version) >> 0, isLikeNone(lock_time) ? 0x100000001 : (lock_time) >>> 0, isLikeNone(version_group_id) ? 0x100000001 : (version_group_id) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
943
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
944
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
945
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
946
+ if (r2) {
947
+ throw takeObject(r1);
948
+ }
949
+ return BitGoPsbt.__wrap(r0);
950
+ } finally {
951
+ wasm.__wbindgen_add_to_stack_pointer(16);
952
+ }
953
+ }
853
954
  /**
854
955
  * Parse outputs with wallet keys to identify which outputs belong to a wallet
855
956
  *
Binary file
@@ -1,30 +1,7 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const __wbg_wasmbip32_free: (a: number, b: number) => void;
5
4
  export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
6
- export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
7
- export const __wbg_wrappsbt_free: (a: number, b: number) => void;
8
- export const wasmbip32_chain_code: (a: number) => number;
9
- export const wasmbip32_depth: (a: number) => number;
10
- export const wasmbip32_derive: (a: number, b: number, c: number) => void;
11
- export const wasmbip32_derive_hardened: (a: number, b: number, c: number) => void;
12
- export const wasmbip32_derive_path: (a: number, b: number, c: number, d: number) => void;
13
- export const wasmbip32_fingerprint: (a: number) => number;
14
- export const wasmbip32_from_base58: (a: number, b: number, c: number) => void;
15
- export const wasmbip32_from_bip32_interface: (a: number, b: number) => void;
16
- export const wasmbip32_from_seed: (a: number, b: number, c: number, d: number, e: number) => void;
17
- export const wasmbip32_from_xprv: (a: number, b: number, c: number) => void;
18
- export const wasmbip32_from_xpub: (a: number, b: number, c: number) => void;
19
- export const wasmbip32_identifier: (a: number) => number;
20
- export const wasmbip32_index: (a: number) => number;
21
- export const wasmbip32_is_neutered: (a: number) => number;
22
- export const wasmbip32_neutered: (a: number) => number;
23
- export const wasmbip32_parent_fingerprint: (a: number) => number;
24
- export const wasmbip32_private_key: (a: number) => number;
25
- export const wasmbip32_public_key: (a: number) => number;
26
- export const wasmbip32_to_base58: (a: number, b: number) => void;
27
- export const wasmbip32_to_wif: (a: number, b: number) => void;
28
5
  export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
29
6
  export const wrapdescriptor_descType: (a: number, b: number) => void;
30
7
  export const wrapdescriptor_encode: (a: number, b: number) => void;
@@ -36,28 +13,13 @@ export const wrapdescriptor_node: (a: number, b: number) => void;
36
13
  export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
37
14
  export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
38
15
  export const wrapdescriptor_toString: (a: number, b: number) => void;
39
- export const wrapminiscript_encode: (a: number, b: number) => void;
40
- export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
41
- export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
42
- export const wrapminiscript_node: (a: number, b: number) => void;
43
- export const wrapminiscript_toAsmString: (a: number, b: number) => void;
44
- export const wrapminiscript_toString: (a: number, b: number) => void;
45
- export const wrappsbt_clone: (a: number) => number;
46
- export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
47
- export const wrappsbt_finalize: (a: number, b: number) => void;
48
- export const wrappsbt_serialize: (a: number, b: number) => void;
49
- export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
50
- export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
51
- export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
52
- export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
53
- export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
54
16
  export const __wbg_addressnamespace_free: (a: number, b: number) => void;
55
17
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
56
18
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
57
- export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
19
+ export const __wbg_wasmbip32_free: (a: number, b: number) => void;
58
20
  export const __wbg_wasmecpair_free: (a: number, b: number) => void;
59
- export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
60
21
  export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
22
+ export const __wbg_wrappsbt_free: (a: number, b: number) => void;
61
23
  export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
62
24
  export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
63
25
  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;
@@ -68,6 +30,9 @@ export const bitgopsbt_add_wallet_input: (a: number, b: number, c: number, d: nu
68
30
  export const bitgopsbt_add_wallet_output: (a: number, b: number, c: number, d: number, e: bigint, f: number) => void;
69
31
  export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
70
32
  export const bitgopsbt_create_empty: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
33
+ export const bitgopsbt_create_empty_zcash: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
34
+ export const bitgopsbt_create_empty_zcash_at_height: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
35
+ export const bitgopsbt_expiry_height: (a: number) => number;
71
36
  export const bitgopsbt_extract_transaction: (a: number, b: number) => void;
72
37
  export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
73
38
  export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
@@ -84,10 +49,29 @@ export const bitgopsbt_verify_replay_protection_signature: (a: number, b: number
84
49
  export const bitgopsbt_verify_signature_with_pub: (a: number, b: number, c: number, d: number) => void;
85
50
  export const bitgopsbt_verify_signature_with_xpub: (a: number, b: number, c: number, d: number) => void;
86
51
  export const bitgopsbt_version: (a: number) => number;
52
+ export const bitgopsbt_version_group_id: (a: number) => number;
87
53
  export const fixedscriptwalletnamespace_address: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
88
54
  export const fixedscriptwalletnamespace_output_script: (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;
55
+ export const wasmbip32_chain_code: (a: number) => number;
56
+ export const wasmbip32_depth: (a: number) => number;
57
+ export const wasmbip32_derive: (a: number, b: number, c: number) => void;
58
+ export const wasmbip32_derive_hardened: (a: number, b: number, c: number) => void;
59
+ export const wasmbip32_derive_path: (a: number, b: number, c: number, d: number) => void;
60
+ export const wasmbip32_fingerprint: (a: number) => number;
61
+ export const wasmbip32_from_base58: (a: number, b: number, c: number) => void;
62
+ export const wasmbip32_from_bip32_interface: (a: number, b: number) => void;
63
+ export const wasmbip32_from_seed: (a: number, b: number, c: number, d: number, e: number) => void;
64
+ export const wasmbip32_from_xprv: (a: number, b: number, c: number) => void;
65
+ export const wasmbip32_from_xpub: (a: number, b: number, c: number) => void;
66
+ export const wasmbip32_identifier: (a: number) => number;
67
+ export const wasmbip32_index: (a: number) => number;
68
+ export const wasmbip32_is_neutered: (a: number) => number;
69
+ export const wasmbip32_neutered: (a: number) => number;
70
+ export const wasmbip32_parent_fingerprint: (a: number) => number;
71
+ export const wasmbip32_private_key: (a: number) => number;
72
+ export const wasmbip32_public_key: (a: number) => number;
73
+ export const wasmbip32_to_base58: (a: number, b: number) => void;
74
+ export const wasmbip32_to_wif: (a: number, b: number) => void;
91
75
  export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
92
76
  export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
93
77
  export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
@@ -98,14 +82,34 @@ export const wasmecpair_public_key: (a: number) => number;
98
82
  export const wasmecpair_to_wif: (a: number, b: number) => void;
99
83
  export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
100
84
  export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
101
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
102
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
103
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
104
85
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
105
86
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
106
87
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
107
88
  export const wasmrootwalletkeys_user_key: (a: number) => number;
108
89
  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;
90
+ export const wrappsbt_clone: (a: number) => number;
91
+ export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
92
+ export const wrappsbt_finalize: (a: number, b: number) => void;
93
+ export const wrappsbt_serialize: (a: number, b: number) => void;
94
+ export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
95
+ export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
96
+ export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
97
+ export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
98
+ export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
99
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
100
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
101
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
102
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
103
+ export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
104
+ export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
105
+ export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
106
+ export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
107
+ export const wrapminiscript_encode: (a: number, b: number) => void;
108
+ export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
109
+ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
110
+ export const wrapminiscript_node: (a: number, b: number) => void;
111
+ export const wrapminiscript_toAsmString: (a: number, b: number) => void;
112
+ export const wrapminiscript_toString: (a: number, b: number) => void;
109
113
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
110
114
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
111
115
  export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitgo/wasm-utxo",
3
3
  "description": "WebAssembly wrapper for rust-bitcoin (beta)",
4
- "version": "1.15.0",
4
+ "version": "1.16.0",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",