@bitgo/wasm-utxo 4.17.0 → 4.19.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.
@@ -546,6 +546,19 @@ export declare class BitGoPsbt extends PsbtBase<WasmBitGoPsbt> implements IPsbtW
546
546
  * ```
547
547
  */
548
548
  combineMusig2Nonces(sourcePsbt: BitGoPsbt): void;
549
+ /**
550
+ * Merge all input fields from a raw PSBT (bytes) into this PSBT.
551
+ *
552
+ * The source bytes are parsed with the underlying bitcoin PSBT deserializer,
553
+ * bypassing network-specific validation (e.g. ZCash consensusBranchId), so the
554
+ * source may be a stripped PSBT that lacks those fields.
555
+ *
556
+ * Copies per input: partial_sigs, tap_key_sig, tap_script_sigs, proprietary.
557
+ *
558
+ * @param otherPsbtBytes - Raw bytes of the PSBT to merge signatures from
559
+ * @throws Error if PSBT parsing fails or input counts don't match
560
+ */
561
+ combineInputs(otherPsbtBytes: Uint8Array): void;
549
562
  /**
550
563
  * Finalize all inputs in the PSBT
551
564
  *
@@ -555,10 +568,13 @@ export declare class BitGoPsbt extends PsbtBase<WasmBitGoPsbt> implements IPsbtW
555
568
  /**
556
569
  * Extract the final transaction from a finalized PSBT
557
570
  *
571
+ * @param maxFeeRate Optional maximum fee rate in **sat/vB**. `Infinity` skips
572
+ * the absurd-fee check; `undefined` uses rust-bitcoin's default check.
573
+ * Callers holding sat/kB thresholds must divide by 1000 before passing.
558
574
  * @returns The extracted transaction instance
559
575
  * @throws Error if the PSBT is not fully finalized or extraction fails
560
576
  */
561
- extractTransaction(): ITransaction;
577
+ extractTransaction(maxFeeRate?: number): ITransaction;
562
578
  /**
563
579
  * Extract a half-signed transaction in legacy format for p2ms-based script types.
564
580
  *
@@ -543,6 +543,21 @@ class BitGoPsbt extends psbtBase_js_1.PsbtBase {
543
543
  combineMusig2Nonces(sourcePsbt) {
544
544
  this._wasm.combine_musig2_nonces(sourcePsbt.wasm);
545
545
  }
546
+ /**
547
+ * Merge all input fields from a raw PSBT (bytes) into this PSBT.
548
+ *
549
+ * The source bytes are parsed with the underlying bitcoin PSBT deserializer,
550
+ * bypassing network-specific validation (e.g. ZCash consensusBranchId), so the
551
+ * source may be a stripped PSBT that lacks those fields.
552
+ *
553
+ * Copies per input: partial_sigs, tap_key_sig, tap_script_sigs, proprietary.
554
+ *
555
+ * @param otherPsbtBytes - Raw bytes of the PSBT to merge signatures from
556
+ * @throws Error if PSBT parsing fails or input counts don't match
557
+ */
558
+ combineInputs(otherPsbtBytes) {
559
+ this._wasm.combine_inputs(otherPsbtBytes);
560
+ }
546
561
  /**
547
562
  * Finalize all inputs in the PSBT
548
563
  *
@@ -554,12 +569,15 @@ class BitGoPsbt extends psbtBase_js_1.PsbtBase {
554
569
  /**
555
570
  * Extract the final transaction from a finalized PSBT
556
571
  *
572
+ * @param maxFeeRate Optional maximum fee rate in **sat/vB**. `Infinity` skips
573
+ * the absurd-fee check; `undefined` uses rust-bitcoin's default check.
574
+ * Callers holding sat/kB thresholds must divide by 1000 before passing.
557
575
  * @returns The extracted transaction instance
558
576
  * @throws Error if the PSBT is not fully finalized or extraction fails
559
577
  */
560
- extractTransaction() {
578
+ extractTransaction(maxFeeRate) {
561
579
  const networkType = this._wasm.get_network_type();
562
- const wasm = this._wasm.extract_transaction();
580
+ const wasm = this._wasm.extract_transaction(maxFeeRate);
563
581
  switch (networkType) {
564
582
  case "dash":
565
583
  return transaction_js_1.DashTransaction.fromWasm(wasm);
@@ -168,8 +168,11 @@ export declare class ZcashBitGoPsbt extends BitGoPsbt {
168
168
  /**
169
169
  * Extract the final Zcash transaction from a finalized PSBT
170
170
  *
171
+ * @param maxFeeRate Optional maximum fee rate in **sat/vB**. `Infinity` skips
172
+ * the absurd-fee check; `undefined` uses rust-bitcoin's default check.
173
+ * Callers holding sat/kB thresholds must divide by 1000 before passing.
171
174
  * @returns The extracted Zcash transaction instance
172
175
  * @throws Error if the PSBT is not fully finalized or extraction fails
173
176
  */
174
- extractTransaction(): ZcashTransaction;
177
+ extractTransaction(maxFeeRate?: number): ZcashTransaction;
175
178
  }
@@ -190,11 +190,14 @@ class ZcashBitGoPsbt extends BitGoPsbt_js_1.BitGoPsbt {
190
190
  /**
191
191
  * Extract the final Zcash transaction from a finalized PSBT
192
192
  *
193
+ * @param maxFeeRate Optional maximum fee rate in **sat/vB**. `Infinity` skips
194
+ * the absurd-fee check; `undefined` uses rust-bitcoin's default check.
195
+ * Callers holding sat/kB thresholds must divide by 1000 before passing.
193
196
  * @returns The extracted Zcash transaction instance
194
197
  * @throws Error if the PSBT is not fully finalized or extraction fails
195
198
  */
196
- extractTransaction() {
197
- return transaction_js_1.ZcashTransaction.fromWasm(this.wasm.extract_zcash_transaction());
199
+ extractTransaction(maxFeeRate) {
200
+ return transaction_js_1.ZcashTransaction.fromWasm(this.wasm.extract_zcash_transaction(maxFeeRate));
198
201
  }
199
202
  }
200
203
  exports.ZcashBitGoPsbt = ZcashBitGoPsbt;
@@ -159,6 +159,17 @@ export class BitGoPsbt {
159
159
  add_wallet_input_at_index(index: number, txid: string, vout: number, value: bigint, wallet_keys: WasmRootWalletKeys, chain: number, derivation_index: number, signer?: string | null, cosigner?: string | null, sequence?: number | null, prev_tx?: Uint8Array | null): number;
160
160
  add_wallet_output(chain: number, index: number, value: bigint, wallet_keys: WasmRootWalletKeys): number;
161
161
  add_wallet_output_at_index(index: number, chain: number, derivation_index: number, value: bigint, wallet_keys: WasmRootWalletKeys): number;
162
+ /**
163
+ * Merge all input fields from a raw PSBT (given as bytes) into this PSBT.
164
+ *
165
+ * The source bytes are parsed with the underlying bitcoin PSBT deserializer,
166
+ * bypassing any network-specific validation, so the source may be a partial
167
+ * PSBT that lacks fields like ZecConsensusBranchId.
168
+ *
169
+ * # Errors
170
+ * Returns error if PSBT parsing fails or input counts don't match
171
+ */
172
+ combine_inputs(other_bytes: Uint8Array): void;
162
173
  /**
163
174
  * Combine/merge data from another PSBT into this one
164
175
  *
@@ -238,14 +249,14 @@ export class BitGoPsbt {
238
249
  * This avoids re-parsing bytes by returning the transaction directly.
239
250
  * Only valid for Bitcoin-like networks (not Dash or Zcash).
240
251
  */
241
- extract_bitcoin_transaction(): WasmTransaction;
252
+ extract_bitcoin_transaction(max_fee_rate_sat_per_vb?: number | null): WasmTransaction;
242
253
  /**
243
254
  * Extract the final transaction as a WasmDashTransaction (for Dash networks)
244
255
  *
245
256
  * This avoids re-parsing bytes by returning the transaction directly.
246
257
  * Only valid for Dash networks.
247
258
  */
248
- extract_dash_transaction(): WasmDashTransaction;
259
+ extract_dash_transaction(max_fee_rate_sat_per_vb?: number | null): WasmDashTransaction;
249
260
  /**
250
261
  * Extract a half-signed transaction in legacy format for p2ms-based script types.
251
262
  *
@@ -278,14 +289,14 @@ export class BitGoPsbt {
278
289
  * - `Ok(JsValue)` containing the WASM transaction instance
279
290
  * - `Err(WasmUtxoError)` if the PSBT is not fully finalized or extraction fails
280
291
  */
281
- extract_transaction(): any;
292
+ extract_transaction(max_fee_rate_sat_per_vb?: number | null): any;
282
293
  /**
283
294
  * Extract the final transaction as a WasmZcashTransaction (for Zcash networks)
284
295
  *
285
296
  * This avoids re-parsing bytes by returning the transaction directly.
286
297
  * Only valid for Zcash networks.
287
298
  */
288
- extract_zcash_transaction(): WasmZcashTransaction;
299
+ extract_zcash_transaction(max_fee_rate_sat_per_vb?: number | null): WasmZcashTransaction;
289
300
  /**
290
301
  * Finalize all inputs in the PSBT
291
302
  *
@@ -772,6 +772,32 @@ class BitGoPsbt {
772
772
  wasm.__wbindgen_add_to_stack_pointer(16);
773
773
  }
774
774
  }
775
+ /**
776
+ * Merge all input fields from a raw PSBT (given as bytes) into this PSBT.
777
+ *
778
+ * The source bytes are parsed with the underlying bitcoin PSBT deserializer,
779
+ * bypassing any network-specific validation, so the source may be a partial
780
+ * PSBT that lacks fields like ZecConsensusBranchId.
781
+ *
782
+ * # Errors
783
+ * Returns error if PSBT parsing fails or input counts don't match
784
+ * @param {Uint8Array} other_bytes
785
+ */
786
+ combine_inputs(other_bytes) {
787
+ try {
788
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
789
+ const ptr0 = passArray8ToWasm0(other_bytes, wasm.__wbindgen_export);
790
+ const len0 = WASM_VECTOR_LEN;
791
+ wasm.bitgopsbt_combine_inputs(retptr, this.__wbg_ptr, ptr0, len0);
792
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
793
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
794
+ if (r1) {
795
+ throw takeObject(r0);
796
+ }
797
+ } finally {
798
+ wasm.__wbindgen_add_to_stack_pointer(16);
799
+ }
800
+ }
775
801
  /**
776
802
  * Combine/merge data from another PSBT into this one
777
803
  *
@@ -991,12 +1017,13 @@ class BitGoPsbt {
991
1017
  *
992
1018
  * This avoids re-parsing bytes by returning the transaction directly.
993
1019
  * Only valid for Bitcoin-like networks (not Dash or Zcash).
1020
+ * @param {number | null} [max_fee_rate_sat_per_vb]
994
1021
  * @returns {WasmTransaction}
995
1022
  */
996
- extract_bitcoin_transaction() {
1023
+ extract_bitcoin_transaction(max_fee_rate_sat_per_vb) {
997
1024
  try {
998
1025
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
999
- wasm.bitgopsbt_extract_bitcoin_transaction(retptr, this.__wbg_ptr);
1026
+ wasm.bitgopsbt_extract_bitcoin_transaction(retptr, this.__wbg_ptr, !isLikeNone(max_fee_rate_sat_per_vb), isLikeNone(max_fee_rate_sat_per_vb) ? 0 : max_fee_rate_sat_per_vb);
1000
1027
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1001
1028
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1002
1029
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1013,12 +1040,13 @@ class BitGoPsbt {
1013
1040
  *
1014
1041
  * This avoids re-parsing bytes by returning the transaction directly.
1015
1042
  * Only valid for Dash networks.
1043
+ * @param {number | null} [max_fee_rate_sat_per_vb]
1016
1044
  * @returns {WasmDashTransaction}
1017
1045
  */
1018
- extract_dash_transaction() {
1046
+ extract_dash_transaction(max_fee_rate_sat_per_vb) {
1019
1047
  try {
1020
1048
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1021
- wasm.bitgopsbt_extract_dash_transaction(retptr, this.__wbg_ptr);
1049
+ wasm.bitgopsbt_extract_dash_transaction(retptr, this.__wbg_ptr, !isLikeNone(max_fee_rate_sat_per_vb), isLikeNone(max_fee_rate_sat_per_vb) ? 0 : max_fee_rate_sat_per_vb);
1022
1050
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1023
1051
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1024
1052
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1079,12 +1107,13 @@ class BitGoPsbt {
1079
1107
  * # Returns
1080
1108
  * - `Ok(JsValue)` containing the WASM transaction instance
1081
1109
  * - `Err(WasmUtxoError)` if the PSBT is not fully finalized or extraction fails
1110
+ * @param {number | null} [max_fee_rate_sat_per_vb]
1082
1111
  * @returns {any}
1083
1112
  */
1084
- extract_transaction() {
1113
+ extract_transaction(max_fee_rate_sat_per_vb) {
1085
1114
  try {
1086
1115
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1087
- wasm.bitgopsbt_extract_transaction(retptr, this.__wbg_ptr);
1116
+ wasm.bitgopsbt_extract_transaction(retptr, this.__wbg_ptr, !isLikeNone(max_fee_rate_sat_per_vb), isLikeNone(max_fee_rate_sat_per_vb) ? 0 : max_fee_rate_sat_per_vb);
1088
1117
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1089
1118
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1090
1119
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1101,12 +1130,13 @@ class BitGoPsbt {
1101
1130
  *
1102
1131
  * This avoids re-parsing bytes by returning the transaction directly.
1103
1132
  * Only valid for Zcash networks.
1133
+ * @param {number | null} [max_fee_rate_sat_per_vb]
1104
1134
  * @returns {WasmZcashTransaction}
1105
1135
  */
1106
- extract_zcash_transaction() {
1136
+ extract_zcash_transaction(max_fee_rate_sat_per_vb) {
1107
1137
  try {
1108
1138
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1109
- wasm.bitgopsbt_extract_zcash_transaction(retptr, this.__wbg_ptr);
1139
+ wasm.bitgopsbt_extract_zcash_transaction(retptr, this.__wbg_ptr, !isLikeNone(max_fee_rate_sat_per_vb), isLikeNone(max_fee_rate_sat_per_vb) ? 0 : max_fee_rate_sat_per_vb);
1110
1140
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1111
1141
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1112
1142
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
Binary file
@@ -115,6 +115,7 @@ export const wrappsbt_lock_time: (a: number) => number;
115
115
  export const wrappsbt_version: (a: number) => number;
116
116
  export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
117
117
  export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
118
+ export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
118
119
  export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
119
120
  export const wrapdescriptor_descType: (a: number, b: number) => void;
120
121
  export const wrapdescriptor_encode: (a: number, b: number) => void;
@@ -135,13 +136,17 @@ export const wrapminiscript_fromStringExt: (a: number, b: number, c: number, d:
135
136
  export const wrapminiscript_node: (a: number, b: number) => void;
136
137
  export const wrapminiscript_toAsmString: (a: number, b: number) => void;
137
138
  export const wrapminiscript_toString: (a: number, b: number) => void;
139
+ export const isInspectEnabled: () => number;
140
+ export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
141
+ export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
142
+ export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
143
+ export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
138
144
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
139
145
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
140
146
  export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
141
147
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
142
148
  export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
143
149
  export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
144
- export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
145
150
  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;
146
151
  export const bitgopsbt_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number, j: number, k: number, l: number) => void;
147
152
  export const bitgopsbt_add_output: (a: number, b: number, c: number, d: number, e: bigint) => void;
@@ -155,6 +160,7 @@ export const bitgopsbt_add_wallet_input: (a: number, b: number, c: number, d: nu
155
160
  export const bitgopsbt_add_wallet_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number) => void;
156
161
  export const bitgopsbt_add_wallet_output: (a: number, b: number, c: number, d: number, e: bigint, f: number) => void;
157
162
  export const bitgopsbt_add_wallet_output_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number) => void;
163
+ export const bitgopsbt_combine_inputs: (a: number, b: number, c: number, d: number) => void;
158
164
  export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
159
165
  export const bitgopsbt_consensus_branch_id: (a: number) => number;
160
166
  export const bitgopsbt_create_empty: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
@@ -164,11 +170,11 @@ export const bitgopsbt_delete_input_kv: (a: number, b: number, c: number, d: num
164
170
  export const bitgopsbt_delete_kv: (a: number, b: number, c: number) => void;
165
171
  export const bitgopsbt_delete_output_kv: (a: number, b: number, c: number, d: number) => void;
166
172
  export const bitgopsbt_expiry_height: (a: number) => number;
167
- export const bitgopsbt_extract_bitcoin_transaction: (a: number, b: number) => void;
168
- export const bitgopsbt_extract_dash_transaction: (a: number, b: number) => void;
173
+ export const bitgopsbt_extract_bitcoin_transaction: (a: number, b: number, c: number, d: number) => void;
174
+ export const bitgopsbt_extract_dash_transaction: (a: number, b: number, c: number, d: number) => void;
169
175
  export const bitgopsbt_extract_half_signed_legacy_tx: (a: number, b: number) => void;
170
- export const bitgopsbt_extract_transaction: (a: number, b: number) => void;
171
- export const bitgopsbt_extract_zcash_transaction: (a: number, b: number) => void;
176
+ export const bitgopsbt_extract_transaction: (a: number, b: number, c: number, d: number) => void;
177
+ export const bitgopsbt_extract_zcash_transaction: (a: number, b: number, c: number, d: number) => void;
172
178
  export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
173
179
  export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
174
180
  export const bitgopsbt_from_half_signed_legacy_transaction: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
@@ -226,8 +232,6 @@ export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: num
226
232
  export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
227
233
  export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
228
234
  export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
229
- export const isInspectEnabled: () => number;
230
- export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
231
235
  export const wasmbip32_chain_code: (a: number) => number;
232
236
  export const wasmbip32_depth: (a: number) => number;
233
237
  export const wasmbip32_derive: (a: number, b: number, c: number) => void;
@@ -270,14 +274,11 @@ export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
270
274
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
271
275
  export const wasmrootwalletkeys_user_key: (a: number) => number;
272
276
  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;
273
- export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
274
277
  export const zcash_branch_id_for_height: (a: number, b: number, c: number, d: number) => void;
275
278
  export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
276
- export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
277
- export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
278
- export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
279
- export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
280
279
  export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
280
+ export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
281
+ export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
281
282
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
282
283
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
283
284
  export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
@@ -546,6 +546,19 @@ export declare class BitGoPsbt extends PsbtBase<WasmBitGoPsbt> implements IPsbtW
546
546
  * ```
547
547
  */
548
548
  combineMusig2Nonces(sourcePsbt: BitGoPsbt): void;
549
+ /**
550
+ * Merge all input fields from a raw PSBT (bytes) into this PSBT.
551
+ *
552
+ * The source bytes are parsed with the underlying bitcoin PSBT deserializer,
553
+ * bypassing network-specific validation (e.g. ZCash consensusBranchId), so the
554
+ * source may be a stripped PSBT that lacks those fields.
555
+ *
556
+ * Copies per input: partial_sigs, tap_key_sig, tap_script_sigs, proprietary.
557
+ *
558
+ * @param otherPsbtBytes - Raw bytes of the PSBT to merge signatures from
559
+ * @throws Error if PSBT parsing fails or input counts don't match
560
+ */
561
+ combineInputs(otherPsbtBytes: Uint8Array): void;
549
562
  /**
550
563
  * Finalize all inputs in the PSBT
551
564
  *
@@ -555,10 +568,13 @@ export declare class BitGoPsbt extends PsbtBase<WasmBitGoPsbt> implements IPsbtW
555
568
  /**
556
569
  * Extract the final transaction from a finalized PSBT
557
570
  *
571
+ * @param maxFeeRate Optional maximum fee rate in **sat/vB**. `Infinity` skips
572
+ * the absurd-fee check; `undefined` uses rust-bitcoin's default check.
573
+ * Callers holding sat/kB thresholds must divide by 1000 before passing.
558
574
  * @returns The extracted transaction instance
559
575
  * @throws Error if the PSBT is not fully finalized or extraction fails
560
576
  */
561
- extractTransaction(): ITransaction;
577
+ extractTransaction(maxFeeRate?: number): ITransaction;
562
578
  /**
563
579
  * Extract a half-signed transaction in legacy format for p2ms-based script types.
564
580
  *
@@ -539,6 +539,21 @@ export class BitGoPsbt extends PsbtBase {
539
539
  combineMusig2Nonces(sourcePsbt) {
540
540
  this._wasm.combine_musig2_nonces(sourcePsbt.wasm);
541
541
  }
542
+ /**
543
+ * Merge all input fields from a raw PSBT (bytes) into this PSBT.
544
+ *
545
+ * The source bytes are parsed with the underlying bitcoin PSBT deserializer,
546
+ * bypassing network-specific validation (e.g. ZCash consensusBranchId), so the
547
+ * source may be a stripped PSBT that lacks those fields.
548
+ *
549
+ * Copies per input: partial_sigs, tap_key_sig, tap_script_sigs, proprietary.
550
+ *
551
+ * @param otherPsbtBytes - Raw bytes of the PSBT to merge signatures from
552
+ * @throws Error if PSBT parsing fails or input counts don't match
553
+ */
554
+ combineInputs(otherPsbtBytes) {
555
+ this._wasm.combine_inputs(otherPsbtBytes);
556
+ }
542
557
  /**
543
558
  * Finalize all inputs in the PSBT
544
559
  *
@@ -550,12 +565,15 @@ export class BitGoPsbt extends PsbtBase {
550
565
  /**
551
566
  * Extract the final transaction from a finalized PSBT
552
567
  *
568
+ * @param maxFeeRate Optional maximum fee rate in **sat/vB**. `Infinity` skips
569
+ * the absurd-fee check; `undefined` uses rust-bitcoin's default check.
570
+ * Callers holding sat/kB thresholds must divide by 1000 before passing.
553
571
  * @returns The extracted transaction instance
554
572
  * @throws Error if the PSBT is not fully finalized or extraction fails
555
573
  */
556
- extractTransaction() {
574
+ extractTransaction(maxFeeRate) {
557
575
  const networkType = this._wasm.get_network_type();
558
- const wasm = this._wasm.extract_transaction();
576
+ const wasm = this._wasm.extract_transaction(maxFeeRate);
559
577
  switch (networkType) {
560
578
  case "dash":
561
579
  return DashTransaction.fromWasm(wasm);
@@ -168,8 +168,11 @@ export declare class ZcashBitGoPsbt extends BitGoPsbt {
168
168
  /**
169
169
  * Extract the final Zcash transaction from a finalized PSBT
170
170
  *
171
+ * @param maxFeeRate Optional maximum fee rate in **sat/vB**. `Infinity` skips
172
+ * the absurd-fee check; `undefined` uses rust-bitcoin's default check.
173
+ * Callers holding sat/kB thresholds must divide by 1000 before passing.
171
174
  * @returns The extracted Zcash transaction instance
172
175
  * @throws Error if the PSBT is not fully finalized or extraction fails
173
176
  */
174
- extractTransaction(): ZcashTransaction;
177
+ extractTransaction(maxFeeRate?: number): ZcashTransaction;
175
178
  }
@@ -187,10 +187,13 @@ export class ZcashBitGoPsbt extends BitGoPsbt {
187
187
  /**
188
188
  * Extract the final Zcash transaction from a finalized PSBT
189
189
  *
190
+ * @param maxFeeRate Optional maximum fee rate in **sat/vB**. `Infinity` skips
191
+ * the absurd-fee check; `undefined` uses rust-bitcoin's default check.
192
+ * Callers holding sat/kB thresholds must divide by 1000 before passing.
190
193
  * @returns The extracted Zcash transaction instance
191
194
  * @throws Error if the PSBT is not fully finalized or extraction fails
192
195
  */
193
- extractTransaction() {
194
- return ZcashTransaction.fromWasm(this.wasm.extract_zcash_transaction());
196
+ extractTransaction(maxFeeRate) {
197
+ return ZcashTransaction.fromWasm(this.wasm.extract_zcash_transaction(maxFeeRate));
195
198
  }
196
199
  }
@@ -159,6 +159,17 @@ export class BitGoPsbt {
159
159
  add_wallet_input_at_index(index: number, txid: string, vout: number, value: bigint, wallet_keys: WasmRootWalletKeys, chain: number, derivation_index: number, signer?: string | null, cosigner?: string | null, sequence?: number | null, prev_tx?: Uint8Array | null): number;
160
160
  add_wallet_output(chain: number, index: number, value: bigint, wallet_keys: WasmRootWalletKeys): number;
161
161
  add_wallet_output_at_index(index: number, chain: number, derivation_index: number, value: bigint, wallet_keys: WasmRootWalletKeys): number;
162
+ /**
163
+ * Merge all input fields from a raw PSBT (given as bytes) into this PSBT.
164
+ *
165
+ * The source bytes are parsed with the underlying bitcoin PSBT deserializer,
166
+ * bypassing any network-specific validation, so the source may be a partial
167
+ * PSBT that lacks fields like ZecConsensusBranchId.
168
+ *
169
+ * # Errors
170
+ * Returns error if PSBT parsing fails or input counts don't match
171
+ */
172
+ combine_inputs(other_bytes: Uint8Array): void;
162
173
  /**
163
174
  * Combine/merge data from another PSBT into this one
164
175
  *
@@ -238,14 +249,14 @@ export class BitGoPsbt {
238
249
  * This avoids re-parsing bytes by returning the transaction directly.
239
250
  * Only valid for Bitcoin-like networks (not Dash or Zcash).
240
251
  */
241
- extract_bitcoin_transaction(): WasmTransaction;
252
+ extract_bitcoin_transaction(max_fee_rate_sat_per_vb?: number | null): WasmTransaction;
242
253
  /**
243
254
  * Extract the final transaction as a WasmDashTransaction (for Dash networks)
244
255
  *
245
256
  * This avoids re-parsing bytes by returning the transaction directly.
246
257
  * Only valid for Dash networks.
247
258
  */
248
- extract_dash_transaction(): WasmDashTransaction;
259
+ extract_dash_transaction(max_fee_rate_sat_per_vb?: number | null): WasmDashTransaction;
249
260
  /**
250
261
  * Extract a half-signed transaction in legacy format for p2ms-based script types.
251
262
  *
@@ -278,14 +289,14 @@ export class BitGoPsbt {
278
289
  * - `Ok(JsValue)` containing the WASM transaction instance
279
290
  * - `Err(WasmUtxoError)` if the PSBT is not fully finalized or extraction fails
280
291
  */
281
- extract_transaction(): any;
292
+ extract_transaction(max_fee_rate_sat_per_vb?: number | null): any;
282
293
  /**
283
294
  * Extract the final transaction as a WasmZcashTransaction (for Zcash networks)
284
295
  *
285
296
  * This avoids re-parsing bytes by returning the transaction directly.
286
297
  * Only valid for Zcash networks.
287
298
  */
288
- extract_zcash_transaction(): WasmZcashTransaction;
299
+ extract_zcash_transaction(max_fee_rate_sat_per_vb?: number | null): WasmZcashTransaction;
289
300
  /**
290
301
  * Finalize all inputs in the PSBT
291
302
  *
@@ -768,6 +768,32 @@ export class BitGoPsbt {
768
768
  wasm.__wbindgen_add_to_stack_pointer(16);
769
769
  }
770
770
  }
771
+ /**
772
+ * Merge all input fields from a raw PSBT (given as bytes) into this PSBT.
773
+ *
774
+ * The source bytes are parsed with the underlying bitcoin PSBT deserializer,
775
+ * bypassing any network-specific validation, so the source may be a partial
776
+ * PSBT that lacks fields like ZecConsensusBranchId.
777
+ *
778
+ * # Errors
779
+ * Returns error if PSBT parsing fails or input counts don't match
780
+ * @param {Uint8Array} other_bytes
781
+ */
782
+ combine_inputs(other_bytes) {
783
+ try {
784
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
785
+ const ptr0 = passArray8ToWasm0(other_bytes, wasm.__wbindgen_export);
786
+ const len0 = WASM_VECTOR_LEN;
787
+ wasm.bitgopsbt_combine_inputs(retptr, this.__wbg_ptr, ptr0, len0);
788
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
789
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
790
+ if (r1) {
791
+ throw takeObject(r0);
792
+ }
793
+ } finally {
794
+ wasm.__wbindgen_add_to_stack_pointer(16);
795
+ }
796
+ }
771
797
  /**
772
798
  * Combine/merge data from another PSBT into this one
773
799
  *
@@ -987,12 +1013,13 @@ export class BitGoPsbt {
987
1013
  *
988
1014
  * This avoids re-parsing bytes by returning the transaction directly.
989
1015
  * Only valid for Bitcoin-like networks (not Dash or Zcash).
1016
+ * @param {number | null} [max_fee_rate_sat_per_vb]
990
1017
  * @returns {WasmTransaction}
991
1018
  */
992
- extract_bitcoin_transaction() {
1019
+ extract_bitcoin_transaction(max_fee_rate_sat_per_vb) {
993
1020
  try {
994
1021
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
995
- wasm.bitgopsbt_extract_bitcoin_transaction(retptr, this.__wbg_ptr);
1022
+ wasm.bitgopsbt_extract_bitcoin_transaction(retptr, this.__wbg_ptr, !isLikeNone(max_fee_rate_sat_per_vb), isLikeNone(max_fee_rate_sat_per_vb) ? 0 : max_fee_rate_sat_per_vb);
996
1023
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
997
1024
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
998
1025
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1009,12 +1036,13 @@ export class BitGoPsbt {
1009
1036
  *
1010
1037
  * This avoids re-parsing bytes by returning the transaction directly.
1011
1038
  * Only valid for Dash networks.
1039
+ * @param {number | null} [max_fee_rate_sat_per_vb]
1012
1040
  * @returns {WasmDashTransaction}
1013
1041
  */
1014
- extract_dash_transaction() {
1042
+ extract_dash_transaction(max_fee_rate_sat_per_vb) {
1015
1043
  try {
1016
1044
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1017
- wasm.bitgopsbt_extract_dash_transaction(retptr, this.__wbg_ptr);
1045
+ wasm.bitgopsbt_extract_dash_transaction(retptr, this.__wbg_ptr, !isLikeNone(max_fee_rate_sat_per_vb), isLikeNone(max_fee_rate_sat_per_vb) ? 0 : max_fee_rate_sat_per_vb);
1018
1046
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1019
1047
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1020
1048
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1075,12 +1103,13 @@ export class BitGoPsbt {
1075
1103
  * # Returns
1076
1104
  * - `Ok(JsValue)` containing the WASM transaction instance
1077
1105
  * - `Err(WasmUtxoError)` if the PSBT is not fully finalized or extraction fails
1106
+ * @param {number | null} [max_fee_rate_sat_per_vb]
1078
1107
  * @returns {any}
1079
1108
  */
1080
- extract_transaction() {
1109
+ extract_transaction(max_fee_rate_sat_per_vb) {
1081
1110
  try {
1082
1111
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1083
- wasm.bitgopsbt_extract_transaction(retptr, this.__wbg_ptr);
1112
+ wasm.bitgopsbt_extract_transaction(retptr, this.__wbg_ptr, !isLikeNone(max_fee_rate_sat_per_vb), isLikeNone(max_fee_rate_sat_per_vb) ? 0 : max_fee_rate_sat_per_vb);
1084
1113
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1085
1114
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1086
1115
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1097,12 +1126,13 @@ export class BitGoPsbt {
1097
1126
  *
1098
1127
  * This avoids re-parsing bytes by returning the transaction directly.
1099
1128
  * Only valid for Zcash networks.
1129
+ * @param {number | null} [max_fee_rate_sat_per_vb]
1100
1130
  * @returns {WasmZcashTransaction}
1101
1131
  */
1102
- extract_zcash_transaction() {
1132
+ extract_zcash_transaction(max_fee_rate_sat_per_vb) {
1103
1133
  try {
1104
1134
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1105
- wasm.bitgopsbt_extract_zcash_transaction(retptr, this.__wbg_ptr);
1135
+ wasm.bitgopsbt_extract_zcash_transaction(retptr, this.__wbg_ptr, !isLikeNone(max_fee_rate_sat_per_vb), isLikeNone(max_fee_rate_sat_per_vb) ? 0 : max_fee_rate_sat_per_vb);
1106
1136
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1107
1137
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1108
1138
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
Binary file
@@ -115,6 +115,7 @@ export const wrappsbt_lock_time: (a: number) => number;
115
115
  export const wrappsbt_version: (a: number) => number;
116
116
  export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
117
117
  export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
118
+ export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
118
119
  export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
119
120
  export const wrapdescriptor_descType: (a: number, b: number) => void;
120
121
  export const wrapdescriptor_encode: (a: number, b: number) => void;
@@ -135,13 +136,17 @@ export const wrapminiscript_fromStringExt: (a: number, b: number, c: number, d:
135
136
  export const wrapminiscript_node: (a: number, b: number) => void;
136
137
  export const wrapminiscript_toAsmString: (a: number, b: number) => void;
137
138
  export const wrapminiscript_toString: (a: number, b: number) => void;
139
+ export const isInspectEnabled: () => number;
140
+ export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
141
+ export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
142
+ export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
143
+ export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
138
144
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
139
145
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
140
146
  export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
141
147
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
142
148
  export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
143
149
  export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
144
- export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
145
150
  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;
146
151
  export const bitgopsbt_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number, j: number, k: number, l: number) => void;
147
152
  export const bitgopsbt_add_output: (a: number, b: number, c: number, d: number, e: bigint) => void;
@@ -155,6 +160,7 @@ export const bitgopsbt_add_wallet_input: (a: number, b: number, c: number, d: nu
155
160
  export const bitgopsbt_add_wallet_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number) => void;
156
161
  export const bitgopsbt_add_wallet_output: (a: number, b: number, c: number, d: number, e: bigint, f: number) => void;
157
162
  export const bitgopsbt_add_wallet_output_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number) => void;
163
+ export const bitgopsbt_combine_inputs: (a: number, b: number, c: number, d: number) => void;
158
164
  export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
159
165
  export const bitgopsbt_consensus_branch_id: (a: number) => number;
160
166
  export const bitgopsbt_create_empty: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
@@ -164,11 +170,11 @@ export const bitgopsbt_delete_input_kv: (a: number, b: number, c: number, d: num
164
170
  export const bitgopsbt_delete_kv: (a: number, b: number, c: number) => void;
165
171
  export const bitgopsbt_delete_output_kv: (a: number, b: number, c: number, d: number) => void;
166
172
  export const bitgopsbt_expiry_height: (a: number) => number;
167
- export const bitgopsbt_extract_bitcoin_transaction: (a: number, b: number) => void;
168
- export const bitgopsbt_extract_dash_transaction: (a: number, b: number) => void;
173
+ export const bitgopsbt_extract_bitcoin_transaction: (a: number, b: number, c: number, d: number) => void;
174
+ export const bitgopsbt_extract_dash_transaction: (a: number, b: number, c: number, d: number) => void;
169
175
  export const bitgopsbt_extract_half_signed_legacy_tx: (a: number, b: number) => void;
170
- export const bitgopsbt_extract_transaction: (a: number, b: number) => void;
171
- export const bitgopsbt_extract_zcash_transaction: (a: number, b: number) => void;
176
+ export const bitgopsbt_extract_transaction: (a: number, b: number, c: number, d: number) => void;
177
+ export const bitgopsbt_extract_zcash_transaction: (a: number, b: number, c: number, d: number) => void;
172
178
  export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
173
179
  export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
174
180
  export const bitgopsbt_from_half_signed_legacy_transaction: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
@@ -226,8 +232,6 @@ export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: num
226
232
  export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
227
233
  export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
228
234
  export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
229
- export const isInspectEnabled: () => number;
230
- export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
231
235
  export const wasmbip32_chain_code: (a: number) => number;
232
236
  export const wasmbip32_depth: (a: number) => number;
233
237
  export const wasmbip32_derive: (a: number, b: number, c: number) => void;
@@ -270,14 +274,11 @@ export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
270
274
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
271
275
  export const wasmrootwalletkeys_user_key: (a: number) => number;
272
276
  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;
273
- export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
274
277
  export const zcash_branch_id_for_height: (a: number, b: number, c: number, d: number) => void;
275
278
  export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
276
- export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
277
- export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
278
- export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
279
- export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
280
279
  export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
280
+ export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
281
+ export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
281
282
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
282
283
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
283
284
  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.17.0",
4
+ "version": "4.19.0",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",