@bitgo/wasm-utxo 3.1.0 → 4.0.1

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.
@@ -1108,6 +1108,40 @@ class BitGoPsbt {
1108
1108
  wasm.__wbindgen_add_to_stack_pointer(16);
1109
1109
  }
1110
1110
  }
1111
+ /**
1112
+ * Convert a half-signed legacy transaction to a psbt-lite.
1113
+ *
1114
+ * # Arguments
1115
+ * * `tx_bytes` - The serialized half-signed legacy transaction
1116
+ * * `network` - Network name (utxolib or coin name)
1117
+ * * `wallet_keys` - The wallet's root keys
1118
+ * * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
1119
+ * @param {Uint8Array} tx_bytes
1120
+ * @param {string} network
1121
+ * @param {WasmRootWalletKeys} wallet_keys
1122
+ * @param {any} unspents
1123
+ * @returns {BitGoPsbt}
1124
+ */
1125
+ static from_half_signed_legacy_transaction(tx_bytes, network, wallet_keys, unspents) {
1126
+ try {
1127
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1128
+ const ptr0 = passArray8ToWasm0(tx_bytes, wasm.__wbindgen_export);
1129
+ const len0 = WASM_VECTOR_LEN;
1130
+ const ptr1 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1131
+ const len1 = WASM_VECTOR_LEN;
1132
+ _assertClass(wallet_keys, WasmRootWalletKeys);
1133
+ wasm.bitgopsbt_from_half_signed_legacy_transaction(retptr, ptr0, len0, ptr1, len1, wallet_keys.__wbg_ptr, addHeapObject(unspents));
1134
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1135
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1136
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1137
+ if (r2) {
1138
+ throw takeObject(r1);
1139
+ }
1140
+ return BitGoPsbt.__wrap(r0);
1141
+ } finally {
1142
+ wasm.__wbindgen_add_to_stack_pointer(16);
1143
+ }
1144
+ }
1111
1145
  /**
1112
1146
  * Generate and store MuSig2 nonces for all MuSig2 inputs
1113
1147
  *
@@ -2910,6 +2944,63 @@ class WasmDashTransaction {
2910
2944
  wasm.__wbindgen_add_to_stack_pointer(16);
2911
2945
  }
2912
2946
  }
2947
+ /**
2948
+ * @returns {any}
2949
+ */
2950
+ get_inputs() {
2951
+ try {
2952
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2953
+ wasm.wasmdashtransaction_get_inputs(retptr, this.__wbg_ptr);
2954
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2955
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2956
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2957
+ if (r2) {
2958
+ throw takeObject(r1);
2959
+ }
2960
+ return takeObject(r0);
2961
+ } finally {
2962
+ wasm.__wbindgen_add_to_stack_pointer(16);
2963
+ }
2964
+ }
2965
+ /**
2966
+ * @returns {any}
2967
+ */
2968
+ get_outputs() {
2969
+ try {
2970
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2971
+ wasm.wasmdashtransaction_get_outputs(retptr, this.__wbg_ptr);
2972
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2973
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2974
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2975
+ if (r2) {
2976
+ throw takeObject(r1);
2977
+ }
2978
+ return takeObject(r0);
2979
+ } finally {
2980
+ wasm.__wbindgen_add_to_stack_pointer(16);
2981
+ }
2982
+ }
2983
+ /**
2984
+ * @param {string} coin
2985
+ * @returns {any}
2986
+ */
2987
+ get_outputs_with_address(coin) {
2988
+ try {
2989
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2990
+ const ptr0 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2991
+ const len0 = WASM_VECTOR_LEN;
2992
+ wasm.wasmdashtransaction_get_outputs_with_address(retptr, this.__wbg_ptr, ptr0, len0);
2993
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2994
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2995
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2996
+ if (r2) {
2997
+ throw takeObject(r1);
2998
+ }
2999
+ return takeObject(r0);
3000
+ } finally {
3001
+ wasm.__wbindgen_add_to_stack_pointer(16);
3002
+ }
3003
+ }
2913
3004
  /**
2914
3005
  * Get the transaction ID (txid)
2915
3006
  *
@@ -2947,6 +3038,27 @@ class WasmDashTransaction {
2947
3038
  wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
2948
3039
  }
2949
3040
  }
3041
+ /**
3042
+ * @returns {number}
3043
+ */
3044
+ input_count() {
3045
+ const ret = wasm.wasmdashtransaction_input_count(this.__wbg_ptr);
3046
+ return ret >>> 0;
3047
+ }
3048
+ /**
3049
+ * @returns {number}
3050
+ */
3051
+ lock_time() {
3052
+ const ret = wasm.wasmdashtransaction_lock_time(this.__wbg_ptr);
3053
+ return ret >>> 0;
3054
+ }
3055
+ /**
3056
+ * @returns {number}
3057
+ */
3058
+ output_count() {
3059
+ const ret = wasm.wasmdashtransaction_output_count(this.__wbg_ptr);
3060
+ return ret >>> 0;
3061
+ }
2950
3062
  /**
2951
3063
  * Serialize the Dash transaction to bytes (preserving tx_type and extra payload).
2952
3064
  * @returns {Uint8Array}
@@ -2969,6 +3081,13 @@ class WasmDashTransaction {
2969
3081
  wasm.__wbindgen_add_to_stack_pointer(16);
2970
3082
  }
2971
3083
  }
3084
+ /**
3085
+ * @returns {number}
3086
+ */
3087
+ version() {
3088
+ const ret = wasm.wasmdashtransaction_version(this.__wbg_ptr);
3089
+ return ret;
3090
+ }
2972
3091
  }
2973
3092
  if (Symbol.dispose) WasmDashTransaction.prototype[Symbol.dispose] = WasmDashTransaction.prototype.free;
2974
3093
  exports.WasmDashTransaction = WasmDashTransaction;
@@ -3829,6 +3948,63 @@ class WasmTransaction {
3829
3948
  wasm.__wbindgen_add_to_stack_pointer(16);
3830
3949
  }
3831
3950
  }
3951
+ /**
3952
+ * @returns {any}
3953
+ */
3954
+ get_inputs() {
3955
+ try {
3956
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3957
+ wasm.wasmtransaction_get_inputs(retptr, this.__wbg_ptr);
3958
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3959
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3960
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3961
+ if (r2) {
3962
+ throw takeObject(r1);
3963
+ }
3964
+ return takeObject(r0);
3965
+ } finally {
3966
+ wasm.__wbindgen_add_to_stack_pointer(16);
3967
+ }
3968
+ }
3969
+ /**
3970
+ * @returns {any}
3971
+ */
3972
+ get_outputs() {
3973
+ try {
3974
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3975
+ wasm.wasmtransaction_get_outputs(retptr, this.__wbg_ptr);
3976
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3977
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3978
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3979
+ if (r2) {
3980
+ throw takeObject(r1);
3981
+ }
3982
+ return takeObject(r0);
3983
+ } finally {
3984
+ wasm.__wbindgen_add_to_stack_pointer(16);
3985
+ }
3986
+ }
3987
+ /**
3988
+ * @param {string} coin
3989
+ * @returns {any}
3990
+ */
3991
+ get_outputs_with_address(coin) {
3992
+ try {
3993
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3994
+ const ptr0 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
3995
+ const len0 = WASM_VECTOR_LEN;
3996
+ wasm.wasmtransaction_get_outputs_with_address(retptr, this.__wbg_ptr, ptr0, len0);
3997
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3998
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3999
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4000
+ if (r2) {
4001
+ throw takeObject(r1);
4002
+ }
4003
+ return takeObject(r0);
4004
+ } finally {
4005
+ wasm.__wbindgen_add_to_stack_pointer(16);
4006
+ }
4007
+ }
3832
4008
  /**
3833
4009
  * Get the transaction ID (txid)
3834
4010
  *
@@ -3870,6 +4046,27 @@ class WasmTransaction {
3870
4046
  const ret = wasm.wasmtransaction_get_vsize(this.__wbg_ptr);
3871
4047
  return ret >>> 0;
3872
4048
  }
4049
+ /**
4050
+ * @returns {number}
4051
+ */
4052
+ input_count() {
4053
+ const ret = wasm.wasmtransaction_input_count(this.__wbg_ptr);
4054
+ return ret >>> 0;
4055
+ }
4056
+ /**
4057
+ * @returns {number}
4058
+ */
4059
+ lock_time() {
4060
+ const ret = wasm.wasmtransaction_lock_time(this.__wbg_ptr);
4061
+ return ret >>> 0;
4062
+ }
4063
+ /**
4064
+ * @returns {number}
4065
+ */
4066
+ output_count() {
4067
+ const ret = wasm.wasmtransaction_output_count(this.__wbg_ptr);
4068
+ return ret >>> 0;
4069
+ }
3873
4070
  /**
3874
4071
  * Serialize the transaction to bytes
3875
4072
  *
@@ -3890,6 +4087,13 @@ class WasmTransaction {
3890
4087
  wasm.__wbindgen_add_to_stack_pointer(16);
3891
4088
  }
3892
4089
  }
4090
+ /**
4091
+ * @returns {number}
4092
+ */
4093
+ version() {
4094
+ const ret = wasm.wasmtransaction_version(this.__wbg_ptr);
4095
+ return ret;
4096
+ }
3893
4097
  }
3894
4098
  if (Symbol.dispose) WasmTransaction.prototype[Symbol.dispose] = WasmTransaction.prototype.free;
3895
4099
  exports.WasmTransaction = WasmTransaction;
@@ -3949,6 +4153,63 @@ class WasmZcashTransaction {
3949
4153
  wasm.__wbindgen_add_to_stack_pointer(16);
3950
4154
  }
3951
4155
  }
4156
+ /**
4157
+ * @returns {any}
4158
+ */
4159
+ get_inputs() {
4160
+ try {
4161
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4162
+ wasm.wasmzcashtransaction_get_inputs(retptr, this.__wbg_ptr);
4163
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4164
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4165
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4166
+ if (r2) {
4167
+ throw takeObject(r1);
4168
+ }
4169
+ return takeObject(r0);
4170
+ } finally {
4171
+ wasm.__wbindgen_add_to_stack_pointer(16);
4172
+ }
4173
+ }
4174
+ /**
4175
+ * @returns {any}
4176
+ */
4177
+ get_outputs() {
4178
+ try {
4179
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4180
+ wasm.wasmzcashtransaction_get_outputs(retptr, this.__wbg_ptr);
4181
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4182
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4183
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4184
+ if (r2) {
4185
+ throw takeObject(r1);
4186
+ }
4187
+ return takeObject(r0);
4188
+ } finally {
4189
+ wasm.__wbindgen_add_to_stack_pointer(16);
4190
+ }
4191
+ }
4192
+ /**
4193
+ * @param {string} coin
4194
+ * @returns {any}
4195
+ */
4196
+ get_outputs_with_address(coin) {
4197
+ try {
4198
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4199
+ const ptr0 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
4200
+ const len0 = WASM_VECTOR_LEN;
4201
+ wasm.wasmzcashtransaction_get_outputs_with_address(retptr, this.__wbg_ptr, ptr0, len0);
4202
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4203
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4204
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4205
+ if (r2) {
4206
+ throw takeObject(r1);
4207
+ }
4208
+ return takeObject(r0);
4209
+ } finally {
4210
+ wasm.__wbindgen_add_to_stack_pointer(16);
4211
+ }
4212
+ }
3952
4213
  /**
3953
4214
  * Get the transaction ID (txid)
3954
4215
  *
@@ -3986,6 +4247,27 @@ class WasmZcashTransaction {
3986
4247
  wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
3987
4248
  }
3988
4249
  }
4250
+ /**
4251
+ * @returns {number}
4252
+ */
4253
+ input_count() {
4254
+ const ret = wasm.wasmtransaction_input_count(this.__wbg_ptr);
4255
+ return ret >>> 0;
4256
+ }
4257
+ /**
4258
+ * @returns {number}
4259
+ */
4260
+ lock_time() {
4261
+ const ret = wasm.wasmtransaction_lock_time(this.__wbg_ptr);
4262
+ return ret >>> 0;
4263
+ }
4264
+ /**
4265
+ * @returns {number}
4266
+ */
4267
+ output_count() {
4268
+ const ret = wasm.wasmtransaction_output_count(this.__wbg_ptr);
4269
+ return ret >>> 0;
4270
+ }
3989
4271
  /**
3990
4272
  * Serialize the transaction to bytes
3991
4273
  *
@@ -4011,6 +4293,13 @@ class WasmZcashTransaction {
4011
4293
  wasm.__wbindgen_add_to_stack_pointer(16);
4012
4294
  }
4013
4295
  }
4296
+ /**
4297
+ * @returns {number}
4298
+ */
4299
+ version() {
4300
+ const ret = wasm.wasmtransaction_version(this.__wbg_ptr);
4301
+ return ret;
4302
+ }
4014
4303
  }
4015
4304
  if (Symbol.dispose) WasmZcashTransaction.prototype[Symbol.dispose] = WasmZcashTransaction.prototype.free;
4016
4305
  exports.WasmZcashTransaction = WasmZcashTransaction;
@@ -5246,6 +5535,12 @@ function __wbg_get_imports() {
5246
5535
  const ret = Error(getStringFromWasm0(arg0, arg1));
5247
5536
  return addHeapObject(ret);
5248
5537
  },
5538
+ __wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2: function(arg0, arg1) {
5539
+ const v = getObject(arg1);
5540
+ const ret = typeof(v) === 'bigint' ? v : undefined;
5541
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
5542
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
5543
+ },
5249
5544
  __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
5250
5545
  const ret = debugString(getObject(arg1));
5251
5546
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
@@ -5274,6 +5569,10 @@ function __wbg_get_imports() {
5274
5569
  const ret = getObject(arg0) === undefined;
5275
5570
  return ret;
5276
5571
  },
5572
+ __wbg___wbindgen_jsval_eq_11888390b0186270: function(arg0, arg1) {
5573
+ const ret = getObject(arg0) === getObject(arg1);
5574
+ return ret;
5575
+ },
5277
5576
  __wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {
5278
5577
  const obj = getObject(arg1);
5279
5578
  const ret = typeof(obj) === 'number' ? obj : undefined;
@@ -5303,9 +5602,17 @@ function __wbg_get_imports() {
5303
5602
  const ret = getObject(arg0).crypto;
5304
5603
  return addHeapObject(ret);
5305
5604
  },
5605
+ __wbg_from_bddd64e7d5ff6941: function(arg0) {
5606
+ const ret = Array.from(getObject(arg0));
5607
+ return addHeapObject(ret);
5608
+ },
5306
5609
  __wbg_getRandomValues_b8f5dbd5f3995a9e: function() { return handleError(function (arg0, arg1) {
5307
5610
  getObject(arg0).getRandomValues(getObject(arg1));
5308
5611
  }, arguments); },
5612
+ __wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
5613
+ const ret = getObject(arg0)[arg1 >>> 0];
5614
+ return addHeapObject(ret);
5615
+ },
5309
5616
  __wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {
5310
5617
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
5311
5618
  return addHeapObject(ret);
@@ -5314,6 +5621,10 @@ function __wbg_get_imports() {
5314
5621
  const ret = getObject(arg0).length;
5315
5622
  return ret;
5316
5623
  },
5624
+ __wbg_length_35a7bace40f36eac: function(arg0) {
5625
+ const ret = getObject(arg0).length;
5626
+ return ret;
5627
+ },
5317
5628
  __wbg_msCrypto_a61aeb35a24c1329: function(arg0) {
5318
5629
  const ret = getObject(arg0).msCrypto;
5319
5630
  return addHeapObject(ret);
Binary file
@@ -1,25 +1,8 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
5
- export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
6
- export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
7
4
  export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
8
- export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
9
- export const wasmdashtransaction_get_txid: (a: number, b: number) => void;
10
- export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
11
- export const wasmtransaction_add_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
12
- export const wasmtransaction_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
13
- export const wasmtransaction_add_output: (a: number, b: number, c: number, d: bigint) => number;
14
- export const wasmtransaction_add_output_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint) => void;
15
- export const wasmtransaction_create: () => number;
16
- export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
17
- export const wasmtransaction_get_txid: (a: number, b: number) => void;
18
- export const wasmtransaction_get_vsize: (a: number) => number;
19
- export const wasmtransaction_to_bytes: (a: number, b: number) => void;
20
- export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
21
- export const wasmzcashtransaction_get_txid: (a: number, b: number) => void;
22
- export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
5
+ export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
23
6
  export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
24
7
  export const wrapdescriptor_descType: (a: number, b: number) => void;
25
8
  export const wrapdescriptor_encode: (a: number, b: number) => void;
@@ -31,12 +14,18 @@ export const wrapdescriptor_node: (a: number, b: number) => void;
31
14
  export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
32
15
  export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
33
16
  export const wrapdescriptor_toString: (a: number, b: number) => void;
17
+ export const wrapminiscript_encode: (a: number, b: number) => void;
18
+ export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
19
+ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
20
+ export const wrapminiscript_node: (a: number, b: number) => void;
21
+ export const wrapminiscript_toAsmString: (a: number, b: number) => void;
22
+ export const wrapminiscript_toString: (a: number, b: number) => void;
34
23
  export const __wbg_bip322namespace_free: (a: number, b: number) => void;
35
24
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
36
25
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
37
26
  export const __wbg_messagenamespace_free: (a: number, b: number) => void;
38
27
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
39
- export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
28
+ export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
40
29
  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;
41
30
  export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
42
31
  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;
@@ -68,6 +57,7 @@ export const bitgopsbt_extract_transaction: (a: number, b: number) => void;
68
57
  export const bitgopsbt_extract_zcash_transaction: (a: number, b: number) => void;
69
58
  export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
70
59
  export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
60
+ export const bitgopsbt_from_half_signed_legacy_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
71
61
  export const bitgopsbt_generate_musig2_nonces: (a: number, b: number, c: number, d: number, e: number) => void;
72
62
  export const bitgopsbt_get_global_xpubs: (a: number) => number;
73
63
  export const bitgopsbt_get_inputs: (a: number, b: number) => void;
@@ -107,6 +97,7 @@ export const fixedscriptwalletnamespace_output_script_with_network_str: (a: numb
107
97
  export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
108
98
  export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
109
99
  export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
100
+ export const isInspectEnabled: () => number;
110
101
  export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
111
102
  export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
112
103
  export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
@@ -132,35 +123,32 @@ export const wasmbip32_private_key: (a: number) => number;
132
123
  export const wasmbip32_public_key: (a: number) => number;
133
124
  export const wasmbip32_to_base58: (a: number, b: number) => void;
134
125
  export const wasmbip32_to_wif: (a: number, b: number) => void;
135
- export const wasmdimensions_empty: () => number;
136
- export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
137
- export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
138
- export const wasmdimensions_from_output_script_length: (a: number) => number;
139
- export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
140
- export const wasmdimensions_from_psbt: (a: number, b: number) => void;
141
- export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
142
- export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
143
- export const wasmdimensions_get_output_vsize: (a: number) => number;
144
- export const wasmdimensions_get_output_weight: (a: number) => number;
145
- export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
146
- export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
147
- export const wasmdimensions_has_segwit: (a: number) => number;
148
- export const wasmdimensions_plus: (a: number, b: number) => number;
149
- export const wasmdimensions_times: (a: number, b: number) => number;
126
+ export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
127
+ export const wasmdashtransaction_get_inputs: (a: number, b: number) => void;
128
+ export const wasmdashtransaction_get_outputs: (a: number, b: number) => void;
129
+ export const wasmdashtransaction_get_outputs_with_address: (a: number, b: number, c: number, d: number) => void;
130
+ export const wasmdashtransaction_get_txid: (a: number, b: number) => void;
131
+ export const wasmdashtransaction_input_count: (a: number) => number;
132
+ export const wasmdashtransaction_lock_time: (a: number) => number;
133
+ export const wasmdashtransaction_output_count: (a: number) => number;
134
+ export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
135
+ export const wasmdashtransaction_version: (a: number) => number;
150
136
  export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
151
137
  export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
152
- export const isInspectEnabled: () => number;
153
138
  export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
154
139
  export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
155
140
  export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
156
141
  export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
157
142
  export const __wbg_addressnamespace_free: (a: number, b: number) => void;
143
+ export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
158
144
  export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
159
145
  export const __wbg_wasmecpair_free: (a: number, b: number) => void;
160
- export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
146
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
161
147
  export const __wbg_wrappsbt_free: (a: number, b: number) => void;
162
148
  export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
163
149
  export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
150
+ export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
151
+ 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;
164
152
  export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
165
153
  export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
166
154
  export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
@@ -173,12 +161,9 @@ export const wasmecpair_public_key: (a: number) => number;
173
161
  export const wasmecpair_to_wif: (a: number, b: number) => void;
174
162
  export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
175
163
  export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
176
- export const wrapminiscript_encode: (a: number, b: number) => void;
177
- export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
178
- export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
179
- export const wrapminiscript_node: (a: number, b: number) => void;
180
- export const wrapminiscript_toAsmString: (a: number, b: number) => void;
181
- export const wrapminiscript_toString: (a: number, b: number) => void;
164
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
165
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
166
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
182
167
  export const wrappsbt_add_input: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number) => void;
183
168
  export const wrappsbt_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number, j: number) => void;
184
169
  export const wrappsbt_add_output: (a: number, b: number, c: number, d: bigint) => number;
@@ -211,19 +196,56 @@ export const wrappsbt_update_output_with_descriptor: (a: number, b: number, c: n
211
196
  export const wrappsbt_validate_signature_at_input: (a: number, b: number, c: number, d: number, e: number) => void;
212
197
  export const wrappsbt_verify_signature_with_key: (a: number, b: number, c: number, d: number) => void;
213
198
  export const wrappsbt_version: (a: number) => number;
214
- export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
215
- export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
199
+ export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
216
200
  export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
217
- export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
218
- 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;
219
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
220
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
221
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
201
+ export const wasmdimensions_empty: () => number;
202
+ export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
203
+ export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
204
+ export const wasmdimensions_from_output_script_length: (a: number) => number;
205
+ export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
206
+ export const wasmdimensions_from_psbt: (a: number, b: number) => void;
207
+ export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
208
+ export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
209
+ export const wasmdimensions_get_output_vsize: (a: number) => number;
210
+ export const wasmdimensions_get_output_weight: (a: number) => number;
211
+ export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
212
+ export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
213
+ export const wasmdimensions_has_segwit: (a: number) => number;
214
+ export const wasmdimensions_plus: (a: number, b: number) => number;
215
+ export const wasmdimensions_times: (a: number, b: number) => number;
222
216
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
223
217
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
224
218
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
225
219
  export const wasmrootwalletkeys_user_key: (a: number) => number;
226
220
  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;
221
+ export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
222
+ export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
223
+ export const wasmtransaction_add_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
224
+ export const wasmtransaction_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
225
+ export const wasmtransaction_add_output: (a: number, b: number, c: number, d: bigint) => number;
226
+ export const wasmtransaction_add_output_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint) => void;
227
+ export const wasmtransaction_create: () => number;
228
+ export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
229
+ export const wasmtransaction_get_inputs: (a: number, b: number) => void;
230
+ export const wasmtransaction_get_outputs: (a: number, b: number) => void;
231
+ export const wasmtransaction_get_outputs_with_address: (a: number, b: number, c: number, d: number) => void;
232
+ export const wasmtransaction_get_txid: (a: number, b: number) => void;
233
+ export const wasmtransaction_get_vsize: (a: number) => number;
234
+ export const wasmtransaction_input_count: (a: number) => number;
235
+ export const wasmtransaction_lock_time: (a: number) => number;
236
+ export const wasmtransaction_output_count: (a: number) => number;
237
+ export const wasmtransaction_to_bytes: (a: number, b: number) => void;
238
+ export const wasmtransaction_version: (a: number) => number;
239
+ export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
240
+ export const wasmzcashtransaction_get_inputs: (a: number, b: number) => void;
241
+ export const wasmzcashtransaction_get_outputs: (a: number, b: number) => void;
242
+ export const wasmzcashtransaction_get_outputs_with_address: (a: number, b: number, c: number, d: number) => void;
243
+ export const wasmzcashtransaction_get_txid: (a: number, b: number) => void;
244
+ export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
245
+ export const wasmzcashtransaction_input_count: (a: number) => number;
246
+ export const wasmzcashtransaction_output_count: (a: number) => number;
247
+ export const wasmzcashtransaction_lock_time: (a: number) => number;
248
+ export const wasmzcashtransaction_version: (a: number) => number;
227
249
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
228
250
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
229
251
  export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
@@ -98,6 +98,11 @@ export type ParseTransactionOptions = {
98
98
  export type ParseOutputsOptions = {
99
99
  payGoPubkeys?: ECPairArg[];
100
100
  };
101
+ export type HydrationUnspent = {
102
+ chain: number;
103
+ index: number;
104
+ value: bigint;
105
+ };
101
106
  export declare class BitGoPsbt implements IPsbtWithAddress {
102
107
  protected _wasm: WasmBitGoPsbt;
103
108
  protected constructor(_wasm: WasmBitGoPsbt);
@@ -136,6 +141,19 @@ export declare class BitGoPsbt implements IPsbtWithAddress {
136
141
  * @returns A BitGoPsbt instance
137
142
  */
138
143
  static fromBytes(bytes: Uint8Array, network: NetworkName): BitGoPsbt;
144
+ /**
145
+ * Convert a half-signed legacy transaction to a psbt-lite.
146
+ *
147
+ * Extracts partial signatures from scriptSig/witness and creates a PSBT
148
+ * with proper wallet metadata (bip32Derivation, scripts, witnessUtxo).
149
+ * Only supports p2sh, p2shP2wsh, and p2wsh inputs (not taproot).
150
+ *
151
+ * @param txBytes - The serialized half-signed legacy transaction
152
+ * @param network - Network name
153
+ * @param walletKeys - The wallet's root keys
154
+ * @param unspents - Chain, index, and value for each input
155
+ */
156
+ static fromHalfSignedLegacyTransaction(txBytes: Uint8Array, network: NetworkName, walletKeys: WalletKeysArg, unspents: HydrationUnspent[]): BitGoPsbt;
139
157
  /**
140
158
  * Add an input to the PSBT
141
159
  *
@@ -53,6 +53,23 @@ export class BitGoPsbt {
53
53
  const wasm = WasmBitGoPsbt.from_bytes(bytes, network);
54
54
  return new BitGoPsbt(wasm);
55
55
  }
56
+ /**
57
+ * Convert a half-signed legacy transaction to a psbt-lite.
58
+ *
59
+ * Extracts partial signatures from scriptSig/witness and creates a PSBT
60
+ * with proper wallet metadata (bip32Derivation, scripts, witnessUtxo).
61
+ * Only supports p2sh, p2shP2wsh, and p2wsh inputs (not taproot).
62
+ *
63
+ * @param txBytes - The serialized half-signed legacy transaction
64
+ * @param network - Network name
65
+ * @param walletKeys - The wallet's root keys
66
+ * @param unspents - Chain, index, and value for each input
67
+ */
68
+ static fromHalfSignedLegacyTransaction(txBytes, network, walletKeys, unspents) {
69
+ const keys = RootWalletKeys.from(walletKeys);
70
+ const wasm = WasmBitGoPsbt.from_half_signed_legacy_transaction(txBytes, network, keys.wasm, unspents);
71
+ return new BitGoPsbt(wasm);
72
+ }
56
73
  addInputAtIndex(index, txidOrOptions, voutOrScript, value, script, sequence) {
57
74
  if (typeof txidOrOptions === "string") {
58
75
  return this._wasm.add_input_at_index(index, txidOrOptions, voutOrScript, value, script, sequence);
@@ -5,7 +5,7 @@ export { outputScript, address } from "./address.js";
5
5
  export { Dimensions } from "./Dimensions.js";
6
6
  export { outputScriptTypes, inputScriptTypes, type OutputScriptType, type InputScriptType, type ScriptType, } from "./scriptType.js";
7
7
  export { ChainCode, chainCodes, assertChainCode, type Scope } from "./chains.js";
8
- export { BitGoPsbt, getWalletKeysFromPsbt, type NetworkName, type ScriptId, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, type CreateEmptyOptions, type AddInputOptions, type AddOutputOptions, type AddWalletInputOptions, type AddWalletOutputOptions, type ParseTransactionOptions, type ParseOutputsOptions, } from "./BitGoPsbt.js";
8
+ export { BitGoPsbt, getWalletKeysFromPsbt, type NetworkName, type ScriptId, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, type CreateEmptyOptions, type AddInputOptions, type AddOutputOptions, type AddWalletInputOptions, type AddWalletOutputOptions, type ParseTransactionOptions, type ParseOutputsOptions, type HydrationUnspent, } from "./BitGoPsbt.js";
9
9
  export { ZcashBitGoPsbt, type ZcashNetworkName, type CreateEmptyZcashOptions, } from "./ZcashBitGoPsbt.js";
10
10
  export type { PsbtBip32Derivation, PsbtInputData, PsbtOutputData, PsbtOutputDataWithAddress, PsbtWitnessUtxo, } from "../wasm/wasm_utxo.js";
11
11
  import type { ScriptType } from "./scriptType.js";