@bulletxyz/bullet-sdk 0.27.0-rc.1 → 0.27.0-rc.3

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.
@@ -11,10 +11,6 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
11
11
  var __commonJS = (cb, mod2) => function __require() {
12
12
  return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
13
13
  };
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
14
  var __copyProps = (to, from, except, desc) => {
19
15
  if (from && typeof from === "object" || typeof from === "function") {
20
16
  for (let key of __getOwnPropNames(from))
@@ -48,7 +44,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
48
44
 
49
45
  // ../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js
50
46
  var require_eventemitter3 = __commonJS({
51
- "../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js"(exports, module2) {
47
+ "../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js"(exports, module) {
52
48
  "use strict";
53
49
  var has = Object.prototype.hasOwnProperty;
54
50
  var prefix = "~";
@@ -202,8 +198,8 @@ var require_eventemitter3 = __commonJS({
202
198
  EventEmitter2.prototype.addListener = EventEmitter2.prototype.on;
203
199
  EventEmitter2.prefixed = prefix;
204
200
  EventEmitter2.EventEmitter = EventEmitter2;
205
- if ("undefined" !== typeof module2) {
206
- module2.exports = EventEmitter2;
201
+ if ("undefined" !== typeof module) {
202
+ module.exports = EventEmitter2;
207
203
  }
208
204
  }
209
205
  });
@@ -2389,7 +2385,7 @@ var decimal_default = Decimal;
2389
2385
  var imports = {};
2390
2386
  imports["__wbindgen_placeholder__"] = imports;
2391
2387
  var wasm;
2392
- var { TextEncoder: TextEncoder2, TextDecoder: TextDecoder2 } = globalThis;
2388
+ var { TextEncoder, TextDecoder } = globalThis;
2393
2389
  var WASM_VECTOR_LEN = 0;
2394
2390
  var cachedUint8ArrayMemory0 = null;
2395
2391
  function getUint8ArrayMemory0() {
@@ -2398,7 +2394,7 @@ function getUint8ArrayMemory0() {
2398
2394
  }
2399
2395
  return cachedUint8ArrayMemory0;
2400
2396
  }
2401
- var cachedTextEncoder = new TextEncoder2("utf-8");
2397
+ var cachedTextEncoder = new TextEncoder("utf-8");
2402
2398
  var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
2403
2399
  return cachedTextEncoder.encodeInto(arg, view);
2404
2400
  } : function(arg, view) {
@@ -2459,7 +2455,7 @@ function handleError(f, args) {
2459
2455
  wasm.__wbindgen_exn_store(idx);
2460
2456
  }
2461
2457
  }
2462
- var cachedTextDecoder = new TextDecoder2("utf-8", { ignoreBOM: true, fatal: true });
2458
+ var cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
2463
2459
  cachedTextDecoder.decode();
2464
2460
  function getStringFromWasm0(ptr, len) {
2465
2461
  ptr = ptr >>> 0;
@@ -8797,434 +8793,8 @@ var BulletError = class _BulletError extends Error {
8797
8793
  }
8798
8794
  };
8799
8795
 
8800
- // ../node_modules/.pnpm/@sovereign-sdk+universal-wallet-wasm@0.4.0_typescript@5.8.2/node_modules/@sovereign-sdk/universal-wallet-wasm/dist/esm/wallet_wasm_bg.wasm
8801
- var wallet_wasm_bg_exports = {};
8802
- __export(wallet_wasm_bg_exports, {
8803
- default: () => wallet_wasm_bg_default
8804
- });
8805
- var wallet_wasm_bg_default = "./wallet_wasm_bg-V72TF7PW.wasm";
8806
-
8807
- // ../node_modules/.pnpm/@sovereign-sdk+universal-wallet-wasm@0.4.0_typescript@5.8.2/node_modules/@sovereign-sdk/universal-wallet-wasm/dist/esm/wallet_wasm_bg.js
8808
- var wasm2;
8809
- function __wbg_set_wasm(val) {
8810
- wasm2 = val;
8811
- }
8812
- var lTextDecoder = typeof TextDecoder === "undefined" ? (0, module.require)("util").TextDecoder : TextDecoder;
8813
- var cachedTextDecoder2 = new lTextDecoder("utf-8", { ignoreBOM: true, fatal: true });
8814
- cachedTextDecoder2.decode();
8815
- var cachedUint8ArrayMemory02 = null;
8816
- function getUint8ArrayMemory02() {
8817
- if (cachedUint8ArrayMemory02 === null || cachedUint8ArrayMemory02.byteLength === 0) {
8818
- cachedUint8ArrayMemory02 = new Uint8Array(wasm2.memory.buffer);
8819
- }
8820
- return cachedUint8ArrayMemory02;
8821
- }
8822
- function getStringFromWasm02(ptr, len) {
8823
- ptr = ptr >>> 0;
8824
- return cachedTextDecoder2.decode(getUint8ArrayMemory02().subarray(ptr, ptr + len));
8825
- }
8826
- var heap = new Array(128).fill(void 0);
8827
- heap.push(void 0, null, true, false);
8828
- var heap_next = heap.length;
8829
- var WASM_VECTOR_LEN2 = 0;
8830
- var lTextEncoder = typeof TextEncoder === "undefined" ? (0, module.require)("util").TextEncoder : TextEncoder;
8831
- var cachedTextEncoder2 = new lTextEncoder("utf-8");
8832
- var encodeString2 = typeof cachedTextEncoder2.encodeInto === "function" ? function(arg, view) {
8833
- return cachedTextEncoder2.encodeInto(arg, view);
8834
- } : function(arg, view) {
8835
- const buf = cachedTextEncoder2.encode(arg);
8836
- view.set(buf);
8837
- return {
8838
- read: arg.length,
8839
- written: buf.length
8840
- };
8841
- };
8842
- function passStringToWasm02(arg, malloc, realloc) {
8843
- if (realloc === void 0) {
8844
- const buf = cachedTextEncoder2.encode(arg);
8845
- const ptr2 = malloc(buf.length, 1) >>> 0;
8846
- getUint8ArrayMemory02().subarray(ptr2, ptr2 + buf.length).set(buf);
8847
- WASM_VECTOR_LEN2 = buf.length;
8848
- return ptr2;
8849
- }
8850
- let len = arg.length;
8851
- let ptr = malloc(len, 1) >>> 0;
8852
- const mem = getUint8ArrayMemory02();
8853
- let offset = 0;
8854
- for (; offset < len; offset++) {
8855
- const code = arg.charCodeAt(offset);
8856
- if (code > 127) break;
8857
- mem[ptr + offset] = code;
8858
- }
8859
- if (offset !== len) {
8860
- if (offset !== 0) {
8861
- arg = arg.slice(offset);
8862
- }
8863
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
8864
- const view = getUint8ArrayMemory02().subarray(ptr + offset, ptr + len);
8865
- const ret = encodeString2(arg, view);
8866
- offset += ret.written;
8867
- ptr = realloc(ptr, len, offset, 1) >>> 0;
8868
- }
8869
- WASM_VECTOR_LEN2 = offset;
8870
- return ptr;
8871
- }
8872
- var cachedDataViewMemory02 = null;
8873
- function getDataViewMemory02() {
8874
- if (cachedDataViewMemory02 === null || cachedDataViewMemory02.buffer.detached === true || cachedDataViewMemory02.buffer.detached === void 0 && cachedDataViewMemory02.buffer !== wasm2.memory.buffer) {
8875
- cachedDataViewMemory02 = new DataView(wasm2.memory.buffer);
8876
- }
8877
- return cachedDataViewMemory02;
8878
- }
8879
- function getObject(idx) {
8880
- return heap[idx];
8881
- }
8882
- function dropObject(idx) {
8883
- if (idx < 132) return;
8884
- heap[idx] = heap_next;
8885
- heap_next = idx;
8886
- }
8887
- function takeObject(idx) {
8888
- const ret = getObject(idx);
8889
- dropObject(idx);
8890
- return ret;
8891
- }
8892
- function getArrayU8FromWasm02(ptr, len) {
8893
- ptr = ptr >>> 0;
8894
- return getUint8ArrayMemory02().subarray(ptr / 1, ptr / 1 + len);
8895
- }
8896
- function passArray8ToWasm0(arg, malloc) {
8897
- const ptr = malloc(arg.length * 1, 1) >>> 0;
8898
- getUint8ArrayMemory02().set(arg, ptr / 1);
8899
- WASM_VECTOR_LEN2 = arg.length;
8900
- return ptr;
8901
- }
8902
- var KnownTypeId = Object.freeze({
8903
- /**
8904
- * The type id of the transaction.
8905
- */
8906
- Transaction: 0,
8907
- "0": "Transaction",
8908
- /**
8909
- * The type id of the unsigned transaction.
8910
- */
8911
- UnsignedTransaction: 1,
8912
- "1": "UnsignedTransaction",
8913
- /**
8914
- * The type id of the runtime call.
8915
- */
8916
- RuntimeCall: 2,
8917
- "2": "RuntimeCall"
8918
- });
8919
- var SchemaFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
8920
- }, unregister: () => {
8921
- } } : new FinalizationRegistry((ptr) => wasm2.__wbg_schema_free(ptr >>> 0, 1));
8922
- var Schema = class _Schema {
8923
- static __wrap(ptr) {
8924
- ptr = ptr >>> 0;
8925
- const obj = Object.create(_Schema.prototype);
8926
- obj.__wbg_ptr = ptr;
8927
- SchemaFinalization.register(obj, obj.__wbg_ptr, obj);
8928
- return obj;
8929
- }
8930
- __destroy_into_raw() {
8931
- const ptr = this.__wbg_ptr;
8932
- this.__wbg_ptr = 0;
8933
- SchemaFinalization.unregister(this);
8934
- return ptr;
8935
- }
8936
- free() {
8937
- const ptr = this.__destroy_into_raw();
8938
- wasm2.__wbg_schema_free(ptr, 0);
8939
- }
8940
- /**
8941
- * Creates a `Schema` instance from the provided JSON descriptor.
8942
- * @param {string} json
8943
- * @returns {Schema}
8944
- */
8945
- static fromJSON(json) {
8946
- try {
8947
- const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
8948
- const ptr0 = passStringToWasm02(json, wasm2.__wbindgen_malloc, wasm2.__wbindgen_realloc);
8949
- const len0 = WASM_VECTOR_LEN2;
8950
- wasm2.schema_fromJSON(retptr, ptr0, len0);
8951
- var r0 = getDataViewMemory02().getInt32(retptr + 4 * 0, true);
8952
- var r1 = getDataViewMemory02().getInt32(retptr + 4 * 1, true);
8953
- var r2 = getDataViewMemory02().getInt32(retptr + 4 * 2, true);
8954
- if (r2) {
8955
- throw takeObject(r1);
8956
- }
8957
- return _Schema.__wrap(r0);
8958
- } finally {
8959
- wasm2.__wbindgen_add_to_stack_pointer(16);
8960
- }
8961
- }
8962
- /**
8963
- * Returns the JSON descriptor that was used to create this schema instance.
8964
- * @returns {string}
8965
- */
8966
- get descriptor() {
8967
- let deferred1_0;
8968
- let deferred1_1;
8969
- try {
8970
- const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
8971
- wasm2.schema_descriptor(retptr, this.__wbg_ptr);
8972
- var r0 = getDataViewMemory02().getInt32(retptr + 4 * 0, true);
8973
- var r1 = getDataViewMemory02().getInt32(retptr + 4 * 1, true);
8974
- deferred1_0 = r0;
8975
- deferred1_1 = r1;
8976
- return getStringFromWasm02(r0, r1);
8977
- } finally {
8978
- wasm2.__wbindgen_add_to_stack_pointer(16);
8979
- wasm2.__wbindgen_free(deferred1_0, deferred1_1, 1);
8980
- }
8981
- }
8982
- /**
8983
- * Converts the provided JSON to borsh according to the provided schema.
8984
- * @param {number} type_index
8985
- * @param {string} input
8986
- * @returns {Uint8Array}
8987
- */
8988
- jsonToBorsh(type_index, input) {
8989
- try {
8990
- const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
8991
- const ptr0 = passStringToWasm02(input, wasm2.__wbindgen_malloc, wasm2.__wbindgen_realloc);
8992
- const len0 = WASM_VECTOR_LEN2;
8993
- wasm2.schema_jsonToBorsh(retptr, this.__wbg_ptr, type_index, ptr0, len0);
8994
- var r0 = getDataViewMemory02().getInt32(retptr + 4 * 0, true);
8995
- var r1 = getDataViewMemory02().getInt32(retptr + 4 * 1, true);
8996
- var r2 = getDataViewMemory02().getInt32(retptr + 4 * 2, true);
8997
- var r3 = getDataViewMemory02().getInt32(retptr + 4 * 3, true);
8998
- if (r3) {
8999
- throw takeObject(r2);
9000
- }
9001
- var v2 = getArrayU8FromWasm02(r0, r1).slice();
9002
- wasm2.__wbindgen_free(r0, r1 * 1, 1);
9003
- return v2;
9004
- } finally {
9005
- wasm2.__wbindgen_add_to_stack_pointer(16);
9006
- }
9007
- }
9008
- /**
9009
- * Displays the provided borsh bytes as a string according to the provided schema.
9010
- * @param {number} type_index
9011
- * @param {Uint8Array} input
9012
- * @returns {string}
9013
- */
9014
- display(type_index, input) {
9015
- let deferred3_0;
9016
- let deferred3_1;
9017
- try {
9018
- const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
9019
- const ptr0 = passArray8ToWasm0(input, wasm2.__wbindgen_malloc);
9020
- const len0 = WASM_VECTOR_LEN2;
9021
- wasm2.schema_display(retptr, this.__wbg_ptr, type_index, ptr0, len0);
9022
- var r0 = getDataViewMemory02().getInt32(retptr + 4 * 0, true);
9023
- var r1 = getDataViewMemory02().getInt32(retptr + 4 * 1, true);
9024
- var r2 = getDataViewMemory02().getInt32(retptr + 4 * 2, true);
9025
- var r3 = getDataViewMemory02().getInt32(retptr + 4 * 3, true);
9026
- var ptr2 = r0;
9027
- var len2 = r1;
9028
- if (r3) {
9029
- ptr2 = 0;
9030
- len2 = 0;
9031
- throw takeObject(r2);
9032
- }
9033
- deferred3_0 = ptr2;
9034
- deferred3_1 = len2;
9035
- return getStringFromWasm02(ptr2, len2);
9036
- } finally {
9037
- wasm2.__wbindgen_add_to_stack_pointer(16);
9038
- wasm2.__wbindgen_free(deferred3_0, deferred3_1, 1);
9039
- }
9040
- }
9041
- /**
9042
- * Get the index of the provided known type within the schema.
9043
- * @param {KnownTypeId} known_type_id
9044
- * @returns {number}
9045
- */
9046
- knownTypeIndex(known_type_id) {
9047
- try {
9048
- const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
9049
- wasm2.schema_knownTypeIndex(retptr, this.__wbg_ptr, known_type_id);
9050
- var r0 = getDataViewMemory02().getInt32(retptr + 4 * 0, true);
9051
- var r1 = getDataViewMemory02().getInt32(retptr + 4 * 1, true);
9052
- var r2 = getDataViewMemory02().getInt32(retptr + 4 * 2, true);
9053
- if (r2) {
9054
- throw takeObject(r1);
9055
- }
9056
- return r0 >>> 0;
9057
- } finally {
9058
- wasm2.__wbindgen_add_to_stack_pointer(16);
9059
- }
9060
- }
9061
- /**
9062
- * Get the metadata hash from the schema.
9063
- * @returns {Uint8Array}
9064
- */
9065
- get metadataHash() {
9066
- try {
9067
- const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
9068
- wasm2.schema_metadataHash(retptr, this.__wbg_ptr);
9069
- var r0 = getDataViewMemory02().getInt32(retptr + 4 * 0, true);
9070
- var r1 = getDataViewMemory02().getInt32(retptr + 4 * 1, true);
9071
- var r2 = getDataViewMemory02().getInt32(retptr + 4 * 2, true);
9072
- var r3 = getDataViewMemory02().getInt32(retptr + 4 * 3, true);
9073
- if (r3) {
9074
- throw takeObject(r2);
9075
- }
9076
- var v1 = getArrayU8FromWasm02(r0, r1).slice();
9077
- wasm2.__wbindgen_free(r0, r1 * 1, 1);
9078
- return v1;
9079
- } finally {
9080
- wasm2.__wbindgen_add_to_stack_pointer(16);
9081
- }
9082
- }
9083
- /**
9084
- * Get the chain hash from the schema.
9085
- * @returns {Uint8Array}
9086
- */
9087
- get chainHash() {
9088
- try {
9089
- const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
9090
- wasm2.schema_chainHash(retptr, this.__wbg_ptr);
9091
- var r0 = getDataViewMemory02().getInt32(retptr + 4 * 0, true);
9092
- var r1 = getDataViewMemory02().getInt32(retptr + 4 * 1, true);
9093
- var r2 = getDataViewMemory02().getInt32(retptr + 4 * 2, true);
9094
- var r3 = getDataViewMemory02().getInt32(retptr + 4 * 3, true);
9095
- if (r3) {
9096
- throw takeObject(r2);
9097
- }
9098
- var v1 = getArrayU8FromWasm02(r0, r1).slice();
9099
- wasm2.__wbindgen_free(r0, r1 * 1, 1);
9100
- return v1;
9101
- } finally {
9102
- wasm2.__wbindgen_add_to_stack_pointer(16);
9103
- }
9104
- }
9105
- };
9106
-
9107
- // ../node_modules/.pnpm/@sovereign-sdk+universal-wallet-wasm@0.4.0_typescript@5.8.2/node_modules/@sovereign-sdk/universal-wallet-wasm/dist/esm/wallet_wasm.js
9108
- __wbg_set_wasm(wallet_wasm_bg_exports);
9109
-
9110
- // ../node_modules/.pnpm/@sovereign-sdk+serializers@0.1.1_typescript@5.8.2/node_modules/@sovereign-sdk/serializers/dist/wasm.mjs
9111
- var __defProp2 = Object.defineProperty;
9112
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9113
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
9114
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9115
- var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9116
- var __spreadValues = (a, b) => {
9117
- for (var prop in b || (b = {}))
9118
- if (__hasOwnProp2.call(b, prop))
9119
- __defNormalProp2(a, prop, b[prop]);
9120
- if (__getOwnPropSymbols)
9121
- for (var prop of __getOwnPropSymbols(b)) {
9122
- if (__propIsEnum.call(b, prop))
9123
- __defNormalProp2(a, prop, b[prop]);
9124
- }
9125
- return a;
9126
- };
9127
- var Serializer = class {
9128
- constructor(schema) {
9129
- this._schema = schema;
9130
- }
9131
- lookupKnownTypeIndex(id) {
9132
- return this._schema.root_type_indices[id];
9133
- }
9134
- /**
9135
- * Serialize an input to Borsh bytes.
9136
- *
9137
- * Treats `Uint8Array` as a plain array of numbers as this is the format used by universal-wallet
9138
- * to represent Borsh bytes.
9139
- *
9140
- * @param input - The input to serialize.
9141
- * @param index - The index of the type in the schema to serialize.
9142
- * @returns The serialized Borsh bytes.
9143
- */
9144
- serialize(input, index) {
9145
- const obj = convertUint8ArraysToArrays(input);
9146
- return this.jsonToBorsh(obj, index);
9147
- }
9148
- /**
9149
- * Serialize a runtime call to Borsh bytes.
9150
- *
9151
- * @param input - The runtime call to serialize.
9152
- * @returns The serialized Borsh bytes.
9153
- */
9154
- serializeRuntimeCall(input) {
9155
- return this.serialize(
9156
- input,
9157
- this.lookupKnownTypeIndex(
9158
- 2
9159
- /* RuntimeCall */
9160
- )
9161
- );
9162
- }
9163
- /**
9164
- * Serialize an unsigned transaction to Borsh bytes.
9165
- *
9166
- * @param input - The unsigned transaction to serialize.
9167
- * @returns The serialized Borsh bytes.
9168
- */
9169
- serializeUnsignedTx(input) {
9170
- return this.serialize(
9171
- input,
9172
- this.lookupKnownTypeIndex(
9173
- 1
9174
- /* UnsignedTransaction */
9175
- )
9176
- );
9177
- }
9178
- /**
9179
- * Serialize a transaction to Borsh bytes.
9180
- *
9181
- * @param input - The transaction to serialize.
9182
- * @returns The serialized Borsh bytes.
9183
- */
9184
- serializeTx(input) {
9185
- return this.serialize(
9186
- input,
9187
- this.lookupKnownTypeIndex(
9188
- 0
9189
- /* Transaction */
9190
- )
9191
- );
9192
- }
9193
- /** Returns the Schema JSON used by the serializer. */
9194
- get schema() {
9195
- return __spreadValues({}, this._schema);
9196
- }
9197
- };
9198
- function convertUint8ArraysToArrays(obj) {
9199
- if (obj === null || obj === void 0) {
9200
- return obj;
9201
- }
9202
- if (obj instanceof Uint8Array) {
9203
- return Array.from(obj);
9204
- }
9205
- if (Array.isArray(obj)) {
9206
- return obj.map((item) => convertUint8ArraysToArrays(item));
9207
- }
9208
- if (typeof obj === "object" && obj.constructor === Object) {
9209
- const result = {};
9210
- for (const key in obj) {
9211
- if (obj.hasOwnProperty(key)) {
9212
- result[key] = convertUint8ArraysToArrays(obj[key]);
9213
- }
9214
- }
9215
- return result;
9216
- }
9217
- return obj;
9218
- }
9219
- var WasmSerializer = class extends Serializer {
9220
- jsonToBorsh(input, index) {
9221
- const jsonString = typeof input === "string" ? input : JSON.stringify(input);
9222
- const schema = Schema.fromJSON(JSON.stringify(this._schema));
9223
- return schema.jsonToBorsh(index, jsonString);
9224
- }
9225
- };
9226
-
9227
8796
  // src/client.ts
8797
+ import { WasmSerializer } from "@sovereign-sdk/serializers/wasm";
9228
8798
  import {
9229
8799
  VersionMismatchError,
9230
8800
  createStandardRollup