@bitgo/wasm-utxo 4.3.0 → 4.5.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.
Files changed (31) hide show
  1. package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.d.ts +8 -3
  2. package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.js +22 -3
  3. package/dist/cjs/js/fixedScriptWallet/ZcashBitGoPsbt.d.ts +47 -2
  4. package/dist/cjs/js/fixedScriptWallet/ZcashBitGoPsbt.js +54 -0
  5. package/dist/cjs/js/fixedScriptWallet/chains.d.ts +1 -1
  6. package/dist/cjs/js/fixedScriptWallet/chains.js +1 -1
  7. package/dist/cjs/js/psbt.d.ts +3 -0
  8. package/dist/cjs/js/psbtBase.d.ts +6 -0
  9. package/dist/cjs/js/psbtBase.js +9 -0
  10. package/dist/cjs/js/transaction.d.ts +18 -0
  11. package/dist/cjs/js/transaction.js +28 -1
  12. package/dist/cjs/js/wasm/wasm_utxo.d.ts +41 -2
  13. package/dist/cjs/js/wasm/wasm_utxo.js +210 -7
  14. package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
  15. package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +45 -36
  16. package/dist/esm/js/fixedScriptWallet/BitGoPsbt.d.ts +8 -3
  17. package/dist/esm/js/fixedScriptWallet/BitGoPsbt.js +22 -3
  18. package/dist/esm/js/fixedScriptWallet/ZcashBitGoPsbt.d.ts +47 -2
  19. package/dist/esm/js/fixedScriptWallet/ZcashBitGoPsbt.js +54 -0
  20. package/dist/esm/js/fixedScriptWallet/chains.d.ts +1 -1
  21. package/dist/esm/js/fixedScriptWallet/chains.js +1 -1
  22. package/dist/esm/js/psbt.d.ts +3 -0
  23. package/dist/esm/js/psbtBase.d.ts +6 -0
  24. package/dist/esm/js/psbtBase.js +9 -0
  25. package/dist/esm/js/transaction.d.ts +18 -0
  26. package/dist/esm/js/transaction.js +28 -1
  27. package/dist/esm/js/wasm/wasm_utxo.d.ts +41 -2
  28. package/dist/esm/js/wasm/wasm_utxo_bg.js +210 -7
  29. package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
  30. package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +45 -36
  31. package/package.json +1 -1
@@ -15,10 +15,13 @@ interface WasmPsbtBase {
15
15
  remove_output(index: number): void;
16
16
  set_kv(key: unknown, value: Uint8Array): void;
17
17
  get_kv(key: unknown): Uint8Array | null | undefined;
18
+ delete_kv(key: unknown): void;
18
19
  set_input_kv(index: number, key: unknown, value: Uint8Array): void;
19
20
  get_input_kv(index: number, key: unknown): Uint8Array | null | undefined;
21
+ delete_input_kv(index: number, key: unknown): void;
20
22
  set_output_kv(index: number, key: unknown, value: Uint8Array): void;
21
23
  get_output_kv(index: number, key: unknown): Uint8Array | null | undefined;
24
+ delete_output_kv(index: number, key: unknown): void;
22
25
  }
23
26
  export declare abstract class PsbtBase<W extends WasmPsbtBase> {
24
27
  protected _wasm: W;
@@ -40,5 +43,8 @@ export declare abstract class PsbtBase<W extends WasmPsbtBase> {
40
43
  getInputKV(index: number, key: PsbtKvKey): Uint8Array | undefined;
41
44
  setOutputKV(index: number, key: PsbtKvKey, value: Uint8Array): void;
42
45
  getOutputKV(index: number, key: PsbtKvKey): Uint8Array | undefined;
46
+ deleteKV(key: PsbtKvKey): void;
47
+ deleteInputKV(index: number, key: PsbtKvKey): void;
48
+ deleteOutputKV(index: number, key: PsbtKvKey): void;
43
49
  }
44
50
  export {};
@@ -55,4 +55,13 @@ export class PsbtBase {
55
55
  getOutputKV(index, key) {
56
56
  return this._wasm.get_output_kv(index, key) ?? undefined;
57
57
  }
58
+ deleteKV(key) {
59
+ this._wasm.delete_kv(key);
60
+ }
61
+ deleteInputKV(index, key) {
62
+ this._wasm.delete_input_kv(index, key);
63
+ }
64
+ deleteOutputKV(index, key) {
65
+ this._wasm.delete_output_kv(index, key);
66
+ }
58
67
  }
@@ -24,11 +24,19 @@ export interface ITransaction extends ITransactionCommon<TxInputData, TxOutputDa
24
24
  */
25
25
  export declare class Transaction extends TransactionBase<WasmTransaction> {
26
26
  private constructor();
27
+ /**
28
+ * Check if a coin is supported by this transaction class.
29
+ * Bitcoin-like transactions support all coins except Zcash and Dash.
30
+ */
31
+ static supportsCoin(coin: CoinName): boolean;
27
32
  /**
28
33
  * Create an empty transaction (version 1, locktime 0)
29
34
  */
30
35
  static create(): Transaction;
31
36
  static fromBytes(bytes: Uint8Array): Transaction;
37
+ static fromBytes(bytes: Uint8Array, coin: "zec" | "tzec"): ZcashTransaction;
38
+ static fromBytes(bytes: Uint8Array, coin: "dash" | "tdash"): DashTransaction;
39
+ static fromBytes(bytes: Uint8Array, coin: CoinName): Transaction | ZcashTransaction | DashTransaction;
32
40
  /** @internal Create from WASM instance directly (avoids re-parsing bytes) */
33
41
  static fromWasm(wasm: WasmTransaction): Transaction;
34
42
  /**
@@ -60,6 +68,11 @@ export declare class Transaction extends TransactionBase<WasmTransaction> {
60
68
  */
61
69
  export declare class ZcashTransaction extends TransactionBase<WasmZcashTransaction> {
62
70
  private constructor();
71
+ /**
72
+ * Check if a coin is supported by this transaction class.
73
+ * Zcash transactions support Zcash mainnet and testnet.
74
+ */
75
+ static supportsCoin(coin: CoinName): boolean;
63
76
  static fromBytes(bytes: Uint8Array): ZcashTransaction;
64
77
  /** @internal Create from WASM instance directly (avoids re-parsing bytes) */
65
78
  static fromWasm(wasm: WasmZcashTransaction): ZcashTransaction;
@@ -73,6 +86,11 @@ export declare class ZcashTransaction extends TransactionBase<WasmZcashTransacti
73
86
  */
74
87
  export declare class DashTransaction extends TransactionBase<WasmDashTransaction> {
75
88
  private constructor();
89
+ /**
90
+ * Check if a coin is supported by this transaction class.
91
+ * Dash transactions support Dash mainnet and testnet.
92
+ */
93
+ static supportsCoin(coin: CoinName): boolean;
76
94
  static fromBytes(bytes: Uint8Array): DashTransaction;
77
95
  /** @internal Create from WASM instance directly (avoids re-parsing bytes) */
78
96
  static fromWasm(wasm: WasmDashTransaction): DashTransaction;
@@ -9,13 +9,26 @@ export class Transaction extends TransactionBase {
9
9
  constructor(wasm) {
10
10
  super(wasm);
11
11
  }
12
+ /**
13
+ * Check if a coin is supported by this transaction class.
14
+ * Bitcoin-like transactions support all coins except Zcash and Dash.
15
+ */
16
+ static supportsCoin(coin) {
17
+ return !ZcashTransaction.supportsCoin(coin) && !DashTransaction.supportsCoin(coin);
18
+ }
12
19
  /**
13
20
  * Create an empty transaction (version 1, locktime 0)
14
21
  */
15
22
  static create() {
16
23
  return new Transaction(WasmTransaction.create());
17
24
  }
18
- static fromBytes(bytes) {
25
+ static fromBytes(bytes, coin) {
26
+ if (coin !== undefined) {
27
+ if (ZcashTransaction.supportsCoin(coin))
28
+ return ZcashTransaction.fromBytes(bytes);
29
+ if (DashTransaction.supportsCoin(coin))
30
+ return DashTransaction.fromBytes(bytes);
31
+ }
19
32
  return new Transaction(WasmTransaction.from_bytes(bytes));
20
33
  }
21
34
  /** @internal Create from WASM instance directly (avoids re-parsing bytes) */
@@ -65,6 +78,13 @@ export class ZcashTransaction extends TransactionBase {
65
78
  constructor(wasm) {
66
79
  super(wasm);
67
80
  }
81
+ /**
82
+ * Check if a coin is supported by this transaction class.
83
+ * Zcash transactions support Zcash mainnet and testnet.
84
+ */
85
+ static supportsCoin(coin) {
86
+ return coin === "zec" || coin === "tzec";
87
+ }
68
88
  static fromBytes(bytes) {
69
89
  return new ZcashTransaction(WasmZcashTransaction.from_bytes(bytes));
70
90
  }
@@ -86,6 +106,13 @@ export class DashTransaction extends TransactionBase {
86
106
  constructor(wasm) {
87
107
  super(wasm);
88
108
  }
109
+ /**
110
+ * Check if a coin is supported by this transaction class.
111
+ * Dash transactions support Dash mainnet and testnet.
112
+ */
113
+ static supportsCoin(coin) {
114
+ return coin === "dash" || coin === "tdash";
115
+ }
89
116
  static fromBytes(bytes) {
90
117
  return new DashTransaction(WasmDashTransaction.from_bytes(bytes));
91
118
  }
@@ -221,6 +221,9 @@ export class BitGoPsbt {
221
221
  * Returns error if block height is before Overwinter activation
222
222
  */
223
223
  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;
224
+ delete_input_kv(index: number, key: any): void;
225
+ delete_kv(key: any): void;
226
+ delete_output_kv(index: number, key: any): void;
224
227
  /**
225
228
  * Get the Zcash expiry height (returns None for non-Zcash PSBTs)
226
229
  */
@@ -298,12 +301,45 @@ export class BitGoPsbt {
298
301
  * Convert a half-signed legacy transaction to a psbt-lite.
299
302
  *
300
303
  * # Arguments
301
- * * `tx_bytes` - The serialized half-signed legacy transaction
304
+ * * `tx` - The decoded half-signed legacy transaction
302
305
  * * `network` - Network name (utxolib or coin name)
303
306
  * * `wallet_keys` - The wallet's root keys
304
307
  * * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
305
308
  */
306
- static from_half_signed_legacy_transaction(tx_bytes: Uint8Array, network: string, wallet_keys: WasmRootWalletKeys, unspents: any): BitGoPsbt;
309
+ static from_half_signed_legacy_transaction(tx: WasmTransaction, network: string, wallet_keys: WasmRootWalletKeys, unspents: any): BitGoPsbt;
310
+ /**
311
+ * Convert a half-signed legacy Dash transaction to a psbt-lite.
312
+ *
313
+ * # Arguments
314
+ * * `tx` - The decoded Dash transaction
315
+ * * `network` - Network name ("dash" or "tdash")
316
+ * * `wallet_keys` - The wallet's root keys
317
+ * * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
318
+ */
319
+ static from_half_signed_legacy_transaction_dash(tx: WasmDashTransaction, network: string, wallet_keys: WasmRootWalletKeys, unspents: any): BitGoPsbt;
320
+ /**
321
+ * Convert a half-signed legacy Zcash transaction to a psbt-lite (with block height).
322
+ * Thin wrapper: resolves block_height → consensus_branch_id and delegates to the explicit variant.
323
+ *
324
+ * # Arguments
325
+ * * `tx` - The decoded Zcash transaction
326
+ * * `network` - Network name ("zec" or "tzec")
327
+ * * `wallet_keys` - The wallet's root keys
328
+ * * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
329
+ * * `block_height` - Block height to determine consensus branch ID
330
+ */
331
+ static from_half_signed_legacy_transaction_zcash_with_block_height(tx: WasmZcashTransaction, network: string, wallet_keys: WasmRootWalletKeys, unspents: any, block_height: number): BitGoPsbt;
332
+ /**
333
+ * Convert a half-signed legacy Zcash transaction to a psbt-lite (with consensus branch ID).
334
+ *
335
+ * # Arguments
336
+ * * `tx` - The decoded Zcash transaction
337
+ * * `network` - Network name ("zec" or "tzec")
338
+ * * `wallet_keys` - The wallet's root keys
339
+ * * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
340
+ * * `consensus_branch_id` - Zcash consensus branch ID
341
+ */
342
+ static from_half_signed_legacy_transaction_zcash_with_branch_id(tx: WasmZcashTransaction, network: string, wallet_keys: WasmRootWalletKeys, unspents: any, consensus_branch_id: number): BitGoPsbt;
307
343
  /**
308
344
  * Generate and store MuSig2 nonces for all MuSig2 inputs
309
345
  *
@@ -1363,6 +1399,9 @@ export class WrapPsbt {
1363
1399
  */
1364
1400
  add_output_at_index(index: number, script: Uint8Array, value: bigint): number;
1365
1401
  clone(): WrapPsbt;
1402
+ delete_input_kv(index: number, key: any): void;
1403
+ delete_kv(key: any): void;
1404
+ delete_output_kv(index: number, key: any): void;
1366
1405
  static deserialize(psbt: Uint8Array): WrapPsbt;
1367
1406
  /**
1368
1407
  * Extract the final transaction from a finalized PSBT
@@ -916,6 +916,56 @@ export class BitGoPsbt {
916
916
  wasm.__wbindgen_add_to_stack_pointer(16);
917
917
  }
918
918
  }
919
+ /**
920
+ * @param {number} index
921
+ * @param {any} key
922
+ */
923
+ delete_input_kv(index, key) {
924
+ try {
925
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
926
+ wasm.bitgopsbt_delete_input_kv(retptr, this.__wbg_ptr, index, addHeapObject(key));
927
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
928
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
929
+ if (r1) {
930
+ throw takeObject(r0);
931
+ }
932
+ } finally {
933
+ wasm.__wbindgen_add_to_stack_pointer(16);
934
+ }
935
+ }
936
+ /**
937
+ * @param {any} key
938
+ */
939
+ delete_kv(key) {
940
+ try {
941
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
942
+ wasm.bitgopsbt_delete_kv(retptr, this.__wbg_ptr, addHeapObject(key));
943
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
944
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
945
+ if (r1) {
946
+ throw takeObject(r0);
947
+ }
948
+ } finally {
949
+ wasm.__wbindgen_add_to_stack_pointer(16);
950
+ }
951
+ }
952
+ /**
953
+ * @param {number} index
954
+ * @param {any} key
955
+ */
956
+ delete_output_kv(index, key) {
957
+ try {
958
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
959
+ wasm.bitgopsbt_delete_output_kv(retptr, this.__wbg_ptr, index, addHeapObject(key));
960
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
961
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
962
+ if (r1) {
963
+ throw takeObject(r0);
964
+ }
965
+ } finally {
966
+ wasm.__wbindgen_add_to_stack_pointer(16);
967
+ }
968
+ }
919
969
  /**
920
970
  * Get the Zcash expiry height (returns None for non-Zcash PSBTs)
921
971
  * @returns {number | undefined}
@@ -1108,25 +1158,128 @@ export class BitGoPsbt {
1108
1158
  * Convert a half-signed legacy transaction to a psbt-lite.
1109
1159
  *
1110
1160
  * # Arguments
1111
- * * `tx_bytes` - The serialized half-signed legacy transaction
1161
+ * * `tx` - The decoded half-signed legacy transaction
1112
1162
  * * `network` - Network name (utxolib or coin name)
1113
1163
  * * `wallet_keys` - The wallet's root keys
1114
1164
  * * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
1115
- * @param {Uint8Array} tx_bytes
1165
+ * @param {WasmTransaction} tx
1116
1166
  * @param {string} network
1117
1167
  * @param {WasmRootWalletKeys} wallet_keys
1118
1168
  * @param {any} unspents
1119
1169
  * @returns {BitGoPsbt}
1120
1170
  */
1121
- static from_half_signed_legacy_transaction(tx_bytes, network, wallet_keys, unspents) {
1171
+ static from_half_signed_legacy_transaction(tx, network, wallet_keys, unspents) {
1122
1172
  try {
1123
1173
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1124
- const ptr0 = passArray8ToWasm0(tx_bytes, wasm.__wbindgen_export);
1174
+ _assertClass(tx, WasmTransaction);
1175
+ const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1125
1176
  const len0 = WASM_VECTOR_LEN;
1126
- const ptr1 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1127
- const len1 = WASM_VECTOR_LEN;
1128
1177
  _assertClass(wallet_keys, WasmRootWalletKeys);
1129
- wasm.bitgopsbt_from_half_signed_legacy_transaction(retptr, ptr0, len0, ptr1, len1, wallet_keys.__wbg_ptr, addHeapObject(unspents));
1178
+ wasm.bitgopsbt_from_half_signed_legacy_transaction(retptr, tx.__wbg_ptr, ptr0, len0, wallet_keys.__wbg_ptr, addHeapObject(unspents));
1179
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1180
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1181
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1182
+ if (r2) {
1183
+ throw takeObject(r1);
1184
+ }
1185
+ return BitGoPsbt.__wrap(r0);
1186
+ } finally {
1187
+ wasm.__wbindgen_add_to_stack_pointer(16);
1188
+ }
1189
+ }
1190
+ /**
1191
+ * Convert a half-signed legacy Dash transaction to a psbt-lite.
1192
+ *
1193
+ * # Arguments
1194
+ * * `tx` - The decoded Dash transaction
1195
+ * * `network` - Network name ("dash" or "tdash")
1196
+ * * `wallet_keys` - The wallet's root keys
1197
+ * * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
1198
+ * @param {WasmDashTransaction} tx
1199
+ * @param {string} network
1200
+ * @param {WasmRootWalletKeys} wallet_keys
1201
+ * @param {any} unspents
1202
+ * @returns {BitGoPsbt}
1203
+ */
1204
+ static from_half_signed_legacy_transaction_dash(tx, network, wallet_keys, unspents) {
1205
+ try {
1206
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1207
+ _assertClass(tx, WasmDashTransaction);
1208
+ const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1209
+ const len0 = WASM_VECTOR_LEN;
1210
+ _assertClass(wallet_keys, WasmRootWalletKeys);
1211
+ wasm.bitgopsbt_from_half_signed_legacy_transaction_dash(retptr, tx.__wbg_ptr, ptr0, len0, wallet_keys.__wbg_ptr, addHeapObject(unspents));
1212
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1213
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1214
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1215
+ if (r2) {
1216
+ throw takeObject(r1);
1217
+ }
1218
+ return BitGoPsbt.__wrap(r0);
1219
+ } finally {
1220
+ wasm.__wbindgen_add_to_stack_pointer(16);
1221
+ }
1222
+ }
1223
+ /**
1224
+ * Convert a half-signed legacy Zcash transaction to a psbt-lite (with block height).
1225
+ * Thin wrapper: resolves block_height → consensus_branch_id and delegates to the explicit variant.
1226
+ *
1227
+ * # Arguments
1228
+ * * `tx` - The decoded Zcash transaction
1229
+ * * `network` - Network name ("zec" or "tzec")
1230
+ * * `wallet_keys` - The wallet's root keys
1231
+ * * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
1232
+ * * `block_height` - Block height to determine consensus branch ID
1233
+ * @param {WasmZcashTransaction} tx
1234
+ * @param {string} network
1235
+ * @param {WasmRootWalletKeys} wallet_keys
1236
+ * @param {any} unspents
1237
+ * @param {number} block_height
1238
+ * @returns {BitGoPsbt}
1239
+ */
1240
+ static from_half_signed_legacy_transaction_zcash_with_block_height(tx, network, wallet_keys, unspents, block_height) {
1241
+ try {
1242
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1243
+ _assertClass(tx, WasmZcashTransaction);
1244
+ const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1245
+ const len0 = WASM_VECTOR_LEN;
1246
+ _assertClass(wallet_keys, WasmRootWalletKeys);
1247
+ wasm.bitgopsbt_from_half_signed_legacy_transaction_zcash_with_block_height(retptr, tx.__wbg_ptr, ptr0, len0, wallet_keys.__wbg_ptr, addHeapObject(unspents), block_height);
1248
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1249
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1250
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1251
+ if (r2) {
1252
+ throw takeObject(r1);
1253
+ }
1254
+ return BitGoPsbt.__wrap(r0);
1255
+ } finally {
1256
+ wasm.__wbindgen_add_to_stack_pointer(16);
1257
+ }
1258
+ }
1259
+ /**
1260
+ * Convert a half-signed legacy Zcash transaction to a psbt-lite (with consensus branch ID).
1261
+ *
1262
+ * # Arguments
1263
+ * * `tx` - The decoded Zcash transaction
1264
+ * * `network` - Network name ("zec" or "tzec")
1265
+ * * `wallet_keys` - The wallet's root keys
1266
+ * * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
1267
+ * * `consensus_branch_id` - Zcash consensus branch ID
1268
+ * @param {WasmZcashTransaction} tx
1269
+ * @param {string} network
1270
+ * @param {WasmRootWalletKeys} wallet_keys
1271
+ * @param {any} unspents
1272
+ * @param {number} consensus_branch_id
1273
+ * @returns {BitGoPsbt}
1274
+ */
1275
+ static from_half_signed_legacy_transaction_zcash_with_branch_id(tx, network, wallet_keys, unspents, consensus_branch_id) {
1276
+ try {
1277
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1278
+ _assertClass(tx, WasmZcashTransaction);
1279
+ const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1280
+ const len0 = WASM_VECTOR_LEN;
1281
+ _assertClass(wallet_keys, WasmRootWalletKeys);
1282
+ wasm.bitgopsbt_from_half_signed_legacy_transaction_zcash_with_branch_id(retptr, tx.__wbg_ptr, ptr0, len0, wallet_keys.__wbg_ptr, addHeapObject(unspents), consensus_branch_id);
1130
1283
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1131
1284
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1132
1285
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -5029,6 +5182,56 @@ export class WrapPsbt {
5029
5182
  const ret = wasm.wrappsbt_clone(this.__wbg_ptr);
5030
5183
  return WrapPsbt.__wrap(ret);
5031
5184
  }
5185
+ /**
5186
+ * @param {number} index
5187
+ * @param {any} key
5188
+ */
5189
+ delete_input_kv(index, key) {
5190
+ try {
5191
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
5192
+ wasm.wrappsbt_delete_input_kv(retptr, this.__wbg_ptr, index, addHeapObject(key));
5193
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
5194
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
5195
+ if (r1) {
5196
+ throw takeObject(r0);
5197
+ }
5198
+ } finally {
5199
+ wasm.__wbindgen_add_to_stack_pointer(16);
5200
+ }
5201
+ }
5202
+ /**
5203
+ * @param {any} key
5204
+ */
5205
+ delete_kv(key) {
5206
+ try {
5207
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
5208
+ wasm.wrappsbt_delete_kv(retptr, this.__wbg_ptr, addHeapObject(key));
5209
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
5210
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
5211
+ if (r1) {
5212
+ throw takeObject(r0);
5213
+ }
5214
+ } finally {
5215
+ wasm.__wbindgen_add_to_stack_pointer(16);
5216
+ }
5217
+ }
5218
+ /**
5219
+ * @param {number} index
5220
+ * @param {any} key
5221
+ */
5222
+ delete_output_kv(index, key) {
5223
+ try {
5224
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
5225
+ wasm.wrappsbt_delete_output_kv(retptr, this.__wbg_ptr, index, addHeapObject(key));
5226
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
5227
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
5228
+ if (r1) {
5229
+ throw takeObject(r0);
5230
+ }
5231
+ } finally {
5232
+ wasm.__wbindgen_add_to_stack_pointer(16);
5233
+ }
5234
+ }
5032
5235
  /**
5033
5236
  * @param {Uint8Array} psbt
5034
5237
  * @returns {WrapPsbt}
Binary file
@@ -1,21 +1,28 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
5
+ export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
6
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
7
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
8
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
9
+ export const wasmrootwalletkeys_backup_key: (a: number) => number;
10
+ export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
11
+ export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
12
+ export const wasmrootwalletkeys_user_key: (a: number) => number;
13
+ 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;
4
14
  export const __wbg_addressnamespace_free: (a: number, b: number) => void;
5
15
  export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
6
16
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
7
17
  export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
8
18
  export const __wbg_wasmecpair_free: (a: number, b: number) => void;
9
19
  export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
10
- export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
11
20
  export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
12
21
  export const __wbg_wrappsbt_free: (a: number, b: number) => void;
13
22
  export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
14
23
  export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
15
24
  export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
16
25
  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;
17
- export const isInspectEnabled: () => number;
18
- export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
19
26
  export const wasmbip32_chain_code: (a: number) => number;
20
27
  export const wasmbip32_depth: (a: number) => number;
21
28
  export const wasmbip32_derive: (a: number, b: number, c: number) => void;
@@ -70,7 +77,6 @@ export const wasmtransaction_get_outputs_with_address: (a: number, b: number, c:
70
77
  export const wasmtransaction_get_txid: (a: number, b: number) => void;
71
78
  export const wasmtransaction_get_vsize: (a: number) => number;
72
79
  export const wasmtransaction_to_bytes: (a: number, b: number) => void;
73
- export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
74
80
  export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
75
81
  export const wasmzcashtransaction_get_inputs: (a: number, b: number) => void;
76
82
  export const wasmzcashtransaction_get_outputs: (a: number, b: number) => void;
@@ -82,6 +88,9 @@ export const wrappsbt_add_input_at_index: (a: number, b: number, c: number, d: n
82
88
  export const wrappsbt_add_output: (a: number, b: number, c: number, d: bigint) => number;
83
89
  export const wrappsbt_add_output_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint) => void;
84
90
  export const wrappsbt_clone: (a: number) => number;
91
+ export const wrappsbt_delete_input_kv: (a: number, b: number, c: number, d: number) => void;
92
+ export const wrappsbt_delete_kv: (a: number, b: number, c: number) => void;
93
+ export const wrappsbt_delete_output_kv: (a: number, b: number, c: number, d: number) => void;
85
94
  export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
86
95
  export const wrappsbt_extract_transaction: (a: number, b: number) => void;
87
96
  export const wrappsbt_finalize_mut: (a: number, b: number) => void;
@@ -118,20 +127,38 @@ export const wasmtransaction_input_count: (a: number) => number;
118
127
  export const wasmtransaction_output_count: (a: number) => number;
119
128
  export const wasmzcashtransaction_input_count: (a: number) => number;
120
129
  export const wasmzcashtransaction_output_count: (a: number) => number;
121
- export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
122
- export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
123
130
  export const wasmtransaction_lock_time: (a: number) => number;
124
131
  export const wasmtransaction_version: (a: number) => number;
125
132
  export const wasmzcashtransaction_lock_time: (a: number) => number;
126
133
  export const wasmzcashtransaction_version: (a: number) => number;
127
134
  export const wrappsbt_lock_time: (a: number) => number;
128
135
  export const wrappsbt_version: (a: number) => number;
136
+ export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
137
+ export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
138
+ export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
139
+ export const wrapdescriptor_descType: (a: number, b: number) => void;
140
+ export const wrapdescriptor_encode: (a: number, b: number) => void;
141
+ export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
142
+ export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
143
+ export const wrapdescriptor_hasWildcard: (a: number) => number;
144
+ export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
145
+ export const wrapdescriptor_node: (a: number, b: number) => void;
146
+ export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
147
+ export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
148
+ export const wrapdescriptor_toString: (a: number, b: number) => void;
149
+ export const wrapminiscript_encode: (a: number, b: number) => void;
150
+ export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
151
+ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
152
+ export const wrapminiscript_node: (a: number, b: number) => void;
153
+ export const wrapminiscript_toAsmString: (a: number, b: number) => void;
154
+ export const wrapminiscript_toString: (a: number, b: number) => void;
129
155
  export const __wbg_bip322namespace_free: (a: number, b: number) => void;
130
156
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
131
157
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
132
158
  export const __wbg_messagenamespace_free: (a: number, b: number) => void;
133
159
  export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
134
160
  export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
161
+ export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
135
162
  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;
136
163
  export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
137
164
  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,6 +182,9 @@ export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number)
155
182
  export const bitgopsbt_create_empty: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
156
183
  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;
157
184
  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;
185
+ export const bitgopsbt_delete_input_kv: (a: number, b: number, c: number, d: number) => void;
186
+ export const bitgopsbt_delete_kv: (a: number, b: number, c: number) => void;
187
+ export const bitgopsbt_delete_output_kv: (a: number, b: number, c: number, d: number) => void;
158
188
  export const bitgopsbt_expiry_height: (a: number) => number;
159
189
  export const bitgopsbt_extract_bitcoin_transaction: (a: number, b: number) => void;
160
190
  export const bitgopsbt_extract_dash_transaction: (a: number, b: number) => void;
@@ -163,7 +193,10 @@ export const bitgopsbt_extract_transaction: (a: number, b: number) => void;
163
193
  export const bitgopsbt_extract_zcash_transaction: (a: number, b: number) => void;
164
194
  export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
165
195
  export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
166
- export const bitgopsbt_from_half_signed_legacy_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
196
+ export const bitgopsbt_from_half_signed_legacy_transaction: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
197
+ export const bitgopsbt_from_half_signed_legacy_transaction_dash: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
198
+ export const bitgopsbt_from_half_signed_legacy_transaction_zcash_with_block_height: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
199
+ export const bitgopsbt_from_half_signed_legacy_transaction_zcash_with_branch_id: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
167
200
  export const bitgopsbt_generate_musig2_nonces: (a: number, b: number, c: number, d: number, e: number) => void;
168
201
  export const bitgopsbt_get_global_xpubs: (a: number) => number;
169
202
  export const bitgopsbt_get_input_kv: (a: number, b: number, c: number, d: number) => void;
@@ -210,8 +243,10 @@ export const fixedscriptwalletnamespace_output_script_with_network_str: (a: numb
210
243
  export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
211
244
  export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
212
245
  export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
246
+ export const isInspectEnabled: () => number;
213
247
  export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
214
248
  export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
249
+ export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
215
250
  export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
216
251
  export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
217
252
  export const wasmdimensions_empty: () => number;
@@ -229,38 +264,12 @@ export const wasmdimensions_get_weight: (a: number, b: number, c: number) => num
229
264
  export const wasmdimensions_has_segwit: (a: number) => number;
230
265
  export const wasmdimensions_plus: (a: number, b: number) => number;
231
266
  export const wasmdimensions_times: (a: number, b: number) => number;
267
+ export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
232
268
  export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
269
+ export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
270
+ export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
233
271
  export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
234
272
  export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
235
- export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
236
- export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
237
- export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
238
- export const wrapdescriptor_descType: (a: number, b: number) => void;
239
- export const wrapdescriptor_encode: (a: number, b: number) => void;
240
- export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
241
- export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
242
- export const wrapdescriptor_hasWildcard: (a: number) => number;
243
- export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
244
- export const wrapdescriptor_node: (a: number, b: number) => void;
245
- export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
246
- export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
247
- export const wrapdescriptor_toString: (a: number, b: number) => void;
248
- export const wrapminiscript_encode: (a: number, b: number) => void;
249
- export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
250
- export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
251
- export const wrapminiscript_node: (a: number, b: number) => void;
252
- export const wrapminiscript_toAsmString: (a: number, b: number) => void;
253
- export const wrapminiscript_toString: (a: number, b: number) => void;
254
- export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
255
- export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
256
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
257
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
258
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
259
- export const wasmrootwalletkeys_backup_key: (a: number) => number;
260
- export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
261
- export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
262
- export const wasmrootwalletkeys_user_key: (a: number) => number;
263
- 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;
264
273
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
265
274
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
266
275
  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.3.0",
4
+ "version": "4.5.0",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",