@bitgo/wasm-utxo 3.0.0 → 4.0.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.
@@ -145,6 +145,35 @@ class Bip322Namespace {
145
145
  wasm.__wbindgen_add_to_stack_pointer(16);
146
146
  }
147
147
  }
148
+ /**
149
+ * Get the BIP322 message stored at a PSBT input index.
150
+ * Returns null if no message is stored.
151
+ * @param {BitGoPsbt} psbt
152
+ * @param {number} input_index
153
+ * @returns {string | undefined}
154
+ */
155
+ static get_bip322_message(psbt, input_index) {
156
+ try {
157
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
158
+ _assertClass(psbt, BitGoPsbt);
159
+ wasm.bip322namespace_get_bip322_message(retptr, psbt.__wbg_ptr, input_index);
160
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
161
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
162
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
163
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
164
+ if (r3) {
165
+ throw takeObject(r2);
166
+ }
167
+ let v1;
168
+ if (r0 !== 0) {
169
+ v1 = getStringFromWasm0(r0, r1).slice();
170
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
171
+ }
172
+ return v1;
173
+ } finally {
174
+ wasm.__wbindgen_add_to_stack_pointer(16);
175
+ }
176
+ }
148
177
  /**
149
178
  * Verify a single input of a BIP-0322 PSBT proof
150
179
  *
@@ -1079,6 +1108,40 @@ class BitGoPsbt {
1079
1108
  wasm.__wbindgen_add_to_stack_pointer(16);
1080
1109
  }
1081
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
+ }
1082
1145
  /**
1083
1146
  * Generate and store MuSig2 nonces for all MuSig2 inputs
1084
1147
  *
@@ -2881,6 +2944,63 @@ class WasmDashTransaction {
2881
2944
  wasm.__wbindgen_add_to_stack_pointer(16);
2882
2945
  }
2883
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
+ }
2884
3004
  /**
2885
3005
  * Get the transaction ID (txid)
2886
3006
  *
@@ -2918,6 +3038,27 @@ class WasmDashTransaction {
2918
3038
  wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
2919
3039
  }
2920
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
+ }
2921
3062
  /**
2922
3063
  * Serialize the Dash transaction to bytes (preserving tx_type and extra payload).
2923
3064
  * @returns {Uint8Array}
@@ -2940,6 +3081,13 @@ class WasmDashTransaction {
2940
3081
  wasm.__wbindgen_add_to_stack_pointer(16);
2941
3082
  }
2942
3083
  }
3084
+ /**
3085
+ * @returns {number}
3086
+ */
3087
+ version() {
3088
+ const ret = wasm.wasmdashtransaction_version(this.__wbg_ptr);
3089
+ return ret;
3090
+ }
2943
3091
  }
2944
3092
  if (Symbol.dispose) WasmDashTransaction.prototype[Symbol.dispose] = WasmDashTransaction.prototype.free;
2945
3093
  exports.WasmDashTransaction = WasmDashTransaction;
@@ -3800,6 +3948,63 @@ class WasmTransaction {
3800
3948
  wasm.__wbindgen_add_to_stack_pointer(16);
3801
3949
  }
3802
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
+ }
3803
4008
  /**
3804
4009
  * Get the transaction ID (txid)
3805
4010
  *
@@ -3841,6 +4046,27 @@ class WasmTransaction {
3841
4046
  const ret = wasm.wasmtransaction_get_vsize(this.__wbg_ptr);
3842
4047
  return ret >>> 0;
3843
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
+ }
3844
4070
  /**
3845
4071
  * Serialize the transaction to bytes
3846
4072
  *
@@ -3861,6 +4087,13 @@ class WasmTransaction {
3861
4087
  wasm.__wbindgen_add_to_stack_pointer(16);
3862
4088
  }
3863
4089
  }
4090
+ /**
4091
+ * @returns {number}
4092
+ */
4093
+ version() {
4094
+ const ret = wasm.wasmtransaction_version(this.__wbg_ptr);
4095
+ return ret;
4096
+ }
3864
4097
  }
3865
4098
  if (Symbol.dispose) WasmTransaction.prototype[Symbol.dispose] = WasmTransaction.prototype.free;
3866
4099
  exports.WasmTransaction = WasmTransaction;
@@ -3920,6 +4153,63 @@ class WasmZcashTransaction {
3920
4153
  wasm.__wbindgen_add_to_stack_pointer(16);
3921
4154
  }
3922
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
+ }
3923
4213
  /**
3924
4214
  * Get the transaction ID (txid)
3925
4215
  *
@@ -3957,6 +4247,27 @@ class WasmZcashTransaction {
3957
4247
  wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
3958
4248
  }
3959
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
+ }
3960
4271
  /**
3961
4272
  * Serialize the transaction to bytes
3962
4273
  *
@@ -3982,6 +4293,13 @@ class WasmZcashTransaction {
3982
4293
  wasm.__wbindgen_add_to_stack_pointer(16);
3983
4294
  }
3984
4295
  }
4296
+ /**
4297
+ * @returns {number}
4298
+ */
4299
+ version() {
4300
+ const ret = wasm.wasmtransaction_version(this.__wbg_ptr);
4301
+ return ret;
4302
+ }
3985
4303
  }
3986
4304
  if (Symbol.dispose) WasmZcashTransaction.prototype[Symbol.dispose] = WasmZcashTransaction.prototype.free;
3987
4305
  exports.WasmZcashTransaction = WasmZcashTransaction;
@@ -5274,9 +5592,17 @@ function __wbg_get_imports() {
5274
5592
  const ret = getObject(arg0).crypto;
5275
5593
  return addHeapObject(ret);
5276
5594
  },
5595
+ __wbg_from_bddd64e7d5ff6941: function(arg0) {
5596
+ const ret = Array.from(getObject(arg0));
5597
+ return addHeapObject(ret);
5598
+ },
5277
5599
  __wbg_getRandomValues_b8f5dbd5f3995a9e: function() { return handleError(function (arg0, arg1) {
5278
5600
  getObject(arg0).getRandomValues(getObject(arg1));
5279
5601
  }, arguments); },
5602
+ __wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
5603
+ const ret = getObject(arg0)[arg1 >>> 0];
5604
+ return addHeapObject(ret);
5605
+ },
5280
5606
  __wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {
5281
5607
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
5282
5608
  return addHeapObject(ret);
@@ -5285,6 +5611,10 @@ function __wbg_get_imports() {
5285
5611
  const ret = getObject(arg0).length;
5286
5612
  return ret;
5287
5613
  },
5614
+ __wbg_length_35a7bace40f36eac: function(arg0) {
5615
+ const ret = getObject(arg0).length;
5616
+ return ret;
5617
+ },
5288
5618
  __wbg_msCrypto_a61aeb35a24c1329: function(arg0) {
5289
5619
  const ret = getObject(arg0).msCrypto;
5290
5620
  return addHeapObject(ret);
Binary file