From 50992ba6d2f3d0f86ad9b137126439e08afca1f6 Mon Sep 17 00:00:00 2001 From: ppe Date: Thu, 23 Mar 2023 12:11:12 +0100 Subject: [PATCH] v1.3.1 --- package.json | 2 +- src/core/modules/impl/handler/JsHandlerApi.ts | 3 +- .../modules/impl/handler/WasmHandlerApi.ts | 5 +- .../modules/impl/wasm/rust-wasm-imports.ts | 307 ++++++++++-------- 4 files changed, 183 insertions(+), 134 deletions(-) diff --git a/package.json b/package.json index 3df439ec..aa400640 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "warp-contracts", - "version": "1.3.0", + "version": "1.3.1", "description": "An implementation of the SmartWeave smart contract protocol.", "types": "./lib/types/index.d.ts", "main": "./lib/cjs/index.js", diff --git a/src/core/modules/impl/handler/JsHandlerApi.ts b/src/core/modules/impl/handler/JsHandlerApi.ts index f09f3def..a48ffea5 100644 --- a/src/core/modules/impl/handler/JsHandlerApi.ts +++ b/src/core/modules/impl/handler/JsHandlerApi.ts @@ -45,8 +45,7 @@ export class JsHandlerApi extends AbstractContractHandler { } // eslint-disable-next-line - initState(state: State) { - } + initState(state: State) {} async maybeCallStateConstructor( initialState: State, diff --git a/src/core/modules/impl/handler/WasmHandlerApi.ts b/src/core/modules/impl/handler/WasmHandlerApi.ts index 47922922..d31ace0e 100644 --- a/src/core/modules/impl/handler/WasmHandlerApi.ts +++ b/src/core/modules/impl/handler/WasmHandlerApi.ts @@ -124,7 +124,10 @@ export class WasmHandlerApi extends AbstractContractHandler { if ('handle' in this.wasmExports) { return await this.doHandleLegacy(action); } - const handleResult = action.interactionType === 'write' ? await this.wasmExports.warpContractWrite(action.input) : await this.wasmExports.warpContractView(action.input); + const handleResult = + action.interactionType === 'write' + ? await this.wasmExports.warpContractWrite(action.input) + : await this.wasmExports.warpContractView(action.input); if (!handleResult) { return; } diff --git a/src/core/modules/impl/wasm/rust-wasm-imports.ts b/src/core/modules/impl/wasm/rust-wasm-imports.ts index de70c8cf..5bff02c1 100644 --- a/src/core/modules/impl/wasm/rust-wasm-imports.ts +++ b/src/core/modules/impl/wasm/rust-wasm-imports.ts @@ -39,7 +39,13 @@ export type WarpContractsCrateVersion = '__WARP_CONTRACTS_VERSION_LEGACY' | '__W // note: this is (somewhat heavily) modified code // of the js that is normally generated by the wasm-bindgen -export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorValue, warpContractsCrateVersion: WarpContractsCrateVersion): any => { +export const rustWasmImports = ( + swGlobal, + wbindgenImports, + wasmInstance, + dtorValue, + warpContractsCrateVersion: WarpContractsCrateVersion +): any => { const wasmLogger = LoggerFactory.INST.create('WASM:Rust'); // the raw functions, that we want to make available from the @@ -144,7 +150,7 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal const idx = heap_next; heap_next = heap[idx]; - if (typeof (heap_next) !== 'number') throw new Error('corrupt heap'); + if (typeof heap_next !== 'number') throw new Error('corrupt heap'); heap[idx] = obj; return idx; @@ -155,7 +161,7 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal } function _assertBoolean(n) { - if (typeof (n) !== 'boolean') { + if (typeof n !== 'boolean') { throw new Error('expected a boolean argument'); } } @@ -165,7 +171,7 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal } function _assertNum(n) { - if (typeof (n) !== 'number') throw new Error('expected a number argument'); + if (typeof n !== 'number') throw new Error('expected a number argument'); } let cachedFloat64Memory0 = null; @@ -192,27 +198,28 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal let cachedTextEncoder = new TextEncoder('utf-8'); const encodeString = - (typeof cachedTextEncoder.encodeInto === 'function' + typeof cachedTextEncoder.encodeInto === 'function' ? function (arg, view) { - return cachedTextEncoder.encodeInto(arg, view); - } + return cachedTextEncoder.encodeInto(arg, view); + } : function (arg, view) { - const buf = cachedTextEncoder.encode(arg); - view.set(buf); - return { - read: arg.length, - written: buf.length + const buf = cachedTextEncoder.encode(arg); + view.set(buf); + return { + read: arg.length, + written: buf.length + }; }; - }); function passStringToWasm0(arg, malloc, realloc) { - - if (typeof (arg) !== 'string') throw new Error('expected a string argument'); + if (typeof arg !== 'string') throw new Error('expected a string argument'); if (realloc === undefined) { const buf = cachedTextEncoder.encode(arg); const ptr = malloc(buf.length); - getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); + getUint8Memory0() + .subarray(ptr, ptr + buf.length) + .set(buf); WASM_VECTOR_LEN = buf.length; return ptr; } @@ -226,7 +233,7 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal for (; offset < len; offset++) { const code = arg.charCodeAt(offset); - if (code > 0x7F) break; + if (code > 0x7f) break; mem[ptr + offset] = code; } @@ -234,7 +241,7 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal if (offset !== 0) { arg = arg.slice(offset); } - ptr = realloc(ptr, len, len = offset + arg.length * 3); + ptr = realloc(ptr, len, (len = offset + arg.length * 3)); const view = getUint8Memory0().subarray(ptr + offset, ptr + len); const ret = encodeString(arg, view); if (ret.read !== arg.length) throw new Error('failed to pass whole string'); @@ -323,7 +330,7 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal } function _assertBigInt(n) { - if (typeof (n) !== 'bigint') throw new Error('expected a bigint argument'); + if (typeof n !== 'bigint') throw new Error('expected a bigint argument'); } let cachedBigInt64Memory0 = null; @@ -367,10 +374,10 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal try { return e instanceof Error ? `${e.message}\n\nStack:\n${e.stack}` : e.toString(); } catch (_) { - return ""; + return ''; } - }()); - console.error("wasm-bindgen: imported JS function that was not marked as `catch` threw an error:", error); + })(); + console.error('wasm-bindgen: imported JS function that was not marked as `catch` threw an error:', error); throw e; } } @@ -391,16 +398,15 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal function warpContractWrite(interaction) { const ret = wasmInstance.exports.warpContractWrite(addHeapObject(interaction)); return takeObject(ret); - }; -/** -* @param {any} interaction -* @returns {Promise} -*/ + } + /** + * @param {any} interaction + * @returns {Promise} + */ function handle(interaction) { - var ret = wasmInstance.exports.handle(addHeapObject(interaction)); - return takeObject(ret); -}; - + var ret = wasmInstance.exports.handle(addHeapObject(interaction)); + return takeObject(ret); + } let stack_pointer = 128; @@ -429,15 +435,14 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal wasmInstance.exports.__wbindgen_add_to_stack_pointer(16); heap[stack_pointer++] = undefined; } - }; + } function initStateLegacy(state) { try { - wasmInstance.exports.initState(addBorrowedObject(state)); + wasmInstance.exports.initState(addBorrowedObject(state)); } finally { - heap[stack_pointer++] = undefined; + heap[stack_pointer++] = undefined; } -}; - + } /** * @returns {any} @@ -445,23 +450,23 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal function currentState() { const ret = wasmInstance.exports.currentState(); return takeObject(ret); - }; + } /** * @returns {number} */ function version() { const ret = wasmInstance.exports.version(); - return ret - }; + return ret; + } /** * @returns {number} */ function lang() { const ret = wasmInstance.exports.lang(); - return ret - }; + return ret; + } /** * @param {any} interaction @@ -470,7 +475,7 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal function warpContractView(interaction) { const ret = wasmInstance.exports.warpContractView(addHeapObject(interaction)); return takeObject(ret); - }; + } function handleError(f, args) { try { @@ -532,7 +537,7 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal __wbindgen_number_get: function (arg0, arg1) { const obj = getObject(arg1); - const ret = typeof (obj) === 'number' ? obj : undefined; + const ret = typeof obj === 'number' ? obj : undefined; if (!isLikeNone(ret)) { _assertNum(ret); } @@ -542,7 +547,7 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal __wbindgen_boolean_get: function (arg0) { const v = getObject(arg0); - const ret = typeof (v) === 'boolean' ? (v ? 1 : 0) : 2; + const ret = typeof v === 'boolean' ? (v ? 1 : 0) : 2; _assertNum(ret); return ret; }, @@ -560,22 +565,24 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal __wbindgen_string_get: function (arg0, arg1) { const obj = getObject(arg1); - const ret = typeof (obj) === 'string' ? obj : undefined; - var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasmInstance.exports.__wbindgen_malloc, wasmInstance.exports.__wbindgen_realloc); + const ret = typeof obj === 'string' ? obj : undefined; + var ptr0 = isLikeNone(ret) + ? 0 + : passStringToWasm0(ret, wasmInstance.exports.__wbindgen_malloc, wasmInstance.exports.__wbindgen_realloc); var len0 = WASM_VECTOR_LEN; getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 0] = ptr0; }, __wbindgen_is_bigint: function (arg0) { - const ret = typeof (getObject(arg0)) === 'bigint'; + const ret = typeof getObject(arg0) === 'bigint'; _assertBoolean(ret); return ret; }, __wbindgen_is_object: function (arg0) { const val = getObject(arg0); - const ret = typeof (val) === 'object' && val !== null; + const ret = typeof val === 'object' && val !== null; _assertBoolean(ret); return ret; }, @@ -651,14 +658,14 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal } finally { wasmInstance.exports.__wbindgen_free(arg0, arg1); } - }, arguments) + }, arguments); }, __wbg_new_abda76e883ba8a5f: function () { return logError(function () { const ret = new Error(); return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_stack: function () { @@ -666,29 +673,37 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal let limit = Error.stackTraceLimit; Error.stackTraceLimit = 25; const ret = getObject(arg1).stack; - const ptr0 = passStringToWasm0(ret, wasmInstance.exports.__wbindgen_malloc, wasmInstance.exports.__wbindgen_realloc); + const ptr0 = passStringToWasm0( + ret, + wasmInstance.exports.__wbindgen_malloc, + wasmInstance.exports.__wbindgen_realloc + ); const len0 = WASM_VECTOR_LEN; getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 0] = ptr0; Error.stackTraceLimit = limit; - }, arguments) + }, arguments); }, __wbg_indephash: function () { return logError(function (arg0) { const ret = rawImports.Block.indep_hash(); - const ptr0 = passStringToWasm0(ret, wasmInstance.exports.__wbindgen_malloc, wasmInstance.exports.__wbindgen_realloc); + const ptr0 = passStringToWasm0( + ret, + wasmInstance.exports.__wbindgen_malloc, + wasmInstance.exports.__wbindgen_realloc + ); const len0 = WASM_VECTOR_LEN; getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }, arguments) + }, arguments); }, __wbg_height: function () { return logError(function () { const ret = rawImports.Block.height(); _assertNum(ret); return ret; - }, arguments) + }, arguments); }, __wbg_timestamp: function () { @@ -696,56 +711,76 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal const ret = rawImports.Block.timestamp(); _assertNum(ret); return ret; - }, arguments) + }, arguments); }, __wbg_contractId: function () { return logError(function (arg0) { const ret = rawImports.Contract.id(); - const ptr0 = passStringToWasm0(ret, wasmInstance.exports.__wbindgen_malloc, wasmInstance.exports.__wbindgen_realloc); + const ptr0 = passStringToWasm0( + ret, + wasmInstance.exports.__wbindgen_malloc, + wasmInstance.exports.__wbindgen_realloc + ); const len0 = WASM_VECTOR_LEN; getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }, arguments) + }, arguments); }, __wbg_contractOwner: function () { return logError(function (arg0) { const ret = rawImports.Contract.owner(); - const ptr0 = passStringToWasm0(ret, wasmInstance.exports.__wbindgen_malloc, wasmInstance.exports.__wbindgen_realloc); + const ptr0 = passStringToWasm0( + ret, + wasmInstance.exports.__wbindgen_malloc, + wasmInstance.exports.__wbindgen_realloc + ); const len0 = WASM_VECTOR_LEN; getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }, arguments) + }, arguments); }, __wbg_id: function () { return logError(function (arg0) { const ret = rawImports.Transaction.id(); - const ptr0 = passStringToWasm0(ret, wasmInstance.exports.__wbindgen_malloc, wasmInstance.exports.__wbindgen_realloc); + const ptr0 = passStringToWasm0( + ret, + wasmInstance.exports.__wbindgen_malloc, + wasmInstance.exports.__wbindgen_realloc + ); const len0 = WASM_VECTOR_LEN; getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }, arguments) + }, arguments); }, __wbg_owner: function () { return logError(function (arg0) { const ret = rawImports.Transaction.owner(); - const ptr0 = passStringToWasm0(ret, wasmInstance.exports.__wbindgen_malloc, wasmInstance.exports.__wbindgen_realloc); + const ptr0 = passStringToWasm0( + ret, + wasmInstance.exports.__wbindgen_malloc, + wasmInstance.exports.__wbindgen_realloc + ); const len0 = WASM_VECTOR_LEN; getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }, arguments) + }, arguments); }, __wbg_target: function () { return logError(function (arg0) { const ret = rawImports.Transaction.target(); - const ptr0 = passStringToWasm0(ret, wasmInstance.exports.__wbindgen_malloc, wasmInstance.exports.__wbindgen_realloc); + const ptr0 = passStringToWasm0( + ret, + wasmInstance.exports.__wbindgen_malloc, + wasmInstance.exports.__wbindgen_realloc + ); const len0 = WASM_VECTOR_LEN; getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }, arguments) + }, arguments); }, __wbg_caller: function () { @@ -759,27 +794,35 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal const len0 = WASM_VECTOR_LEN; getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }, arguments) + }, arguments); }, __wbg_value_b245bf3240b21a48: function () { return logError(function (arg0) { const ret = rawImports.Vrf.value(); - const ptr0 = passStringToWasm0(ret, wasmInstance.exports.__wbindgen_malloc, wasmInstance.exports.__wbindgen_realloc); + const ptr0 = passStringToWasm0( + ret, + wasmInstance.exports.__wbindgen_malloc, + wasmInstance.exports.__wbindgen_realloc + ); const len0 = WASM_VECTOR_LEN; getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }, arguments) + }, arguments); }, __wbg_value_7d69ddc3f1ad7876: function () { return logError(function (arg0) { const ret = rawImports.Vrf.value(); - const ptr0 = passStringToWasm0(ret, wasmInstance.exports.__wbindgen_malloc, wasmInstance.exports.__wbindgen_realloc); + const ptr0 = passStringToWasm0( + ret, + wasmInstance.exports.__wbindgen_malloc, + wasmInstance.exports.__wbindgen_realloc + ); const len0 = WASM_VECTOR_LEN; getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }, arguments) + }, arguments); }, __wbg_randomInt: function () { @@ -787,14 +830,13 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal const ret = rawImports.Vrf.randomInt(arg0); _assertNum(ret); return ret; - }, arguments) + }, arguments); }, - __wbg_log: function () { return logError(function (arg0, arg1) { rawImports.console.log(getStringFromWasm0(arg0, arg1)); - }, arguments) + }, arguments); }, __wbindgen_cb_drop: function (arg0) { @@ -811,30 +853,34 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal __wbg_debug: function () { return logError(function (arg0) { console.log(getObject(arg0)); - }, arguments) + }, arguments); }, __wbg_String: function () { return logError(function (arg0, arg1) { const ret = String(getObject(arg1)); - const ptr0 = passStringToWasm0(ret, wasmInstance.exports.__wbindgen_malloc, wasmInstance.exports.__wbindgen_realloc); + const ptr0 = passStringToWasm0( + ret, + wasmInstance.exports.__wbindgen_malloc, + wasmInstance.exports.__wbindgen_realloc + ); const len0 = WASM_VECTOR_LEN; getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }, arguments) + }, arguments); }, __wbg_getwithrefkey: function () { return logError(function (arg0, arg1) { const ret = getObject(arg0)[getObject(arg1)]; return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_set_841ac57cff3d672b: function () { return logError(function (arg0, arg1, arg2) { getObject(arg0)[takeObject(arg1)] = takeObject(arg2); - }, arguments) + }, arguments); }, __wbindgen_number_new: function (arg0) { @@ -848,12 +894,11 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal return ret; }, - __wbg_get_27fe3dac1c4d0224: function () { return logError(function (arg0, arg1) { const ret = getObject(arg0)[arg1 >>> 0]; return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_isArray: function () { @@ -861,7 +906,7 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal const ret = Array.isArray(getObject(arg0)); _assertBoolean(ret); return ret; - }, arguments) + }, arguments); }, __wbg_length_e498fbc24f9c1d4f: function () { @@ -869,7 +914,7 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal const ret = getObject(arg0).length; _assertNum(ret); return ret; - }, arguments) + }, arguments); }, __wbg_instanceof_ArrayBuffer: function () { @@ -883,14 +928,14 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal const ret = result; _assertBoolean(ret); return ret; - }, arguments) + }, arguments); }, __wbg_call_95d1ea488d03e4e8: function () { return handleError(function (arg0, arg1) { const ret = getObject(arg0).call(getObject(arg1)); return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_call_9495de66fdbe016b: function () { @@ -911,28 +956,28 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal return logError(function () { const ret = new Map(); return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_set_388c4c6422704173: function () { return logError(function (arg0, arg1, arg2) { const ret = getObject(arg0).set(getObject(arg1), getObject(arg2)); return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_next_88560ec06a094dea: function () { return handleError(function (arg0) { const ret = getObject(arg0).next(); return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_next_b7d530c04fd8b217: function () { return logError(function (arg0) { const ret = getObject(arg0).next; return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_done: function () { @@ -940,14 +985,14 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal const ret = getObject(arg0).done; _assertBoolean(ret); return ret; - }, arguments) + }, arguments); }, __wbg_value_6ac8da5cc5b3efda: function () { return logError(function (arg0) { const ret = getObject(arg0).value; return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_isSafeInteger: function () { @@ -955,28 +1000,28 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal const ret = Number.isSafeInteger(getObject(arg0)); _assertBoolean(ret); return ret; - }, arguments) + }, arguments); }, __wbg_entries: function () { return logError(function (arg0) { const ret = Object.entries(getObject(arg0)); return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_new_f9876326328f45ed: function () { return logError(function () { const ret = new Object(); return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_iterator: function () { return logError(function () { const ret = Symbol.iterator; return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_new_9d3a9ce4282a18a8: function () { @@ -997,7 +1042,7 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal } finally { state0.a = state0.b = 0; } - }, arguments) + }, arguments); }, __wbg_new_4beacc9c71572250: function () { @@ -1018,38 +1063,38 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal } finally { state0.a = state0.b = 0; } - }, arguments) + }, arguments); }, __wbg_resolve: function () { return logError(function (arg0) { const ret = Promise.resolve(getObject(arg0)); return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_then_ec5db6d509eb475f: function () { return logError(function (arg0, arg1) { const ret = getObject(arg0).then(getObject(arg1)); return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_then_a6860c82b90816ca: function () { return logError(function (arg0, arg1) { const ret = getObject(arg0).then(getObject(arg1)); return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_then_f753623316e2873a: function () { return logError(function (arg0, arg1, arg2) { const ret = getObject(arg0).then(getObject(arg1), getObject(arg2)); return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_then_58a04e42527f52c6: function () { return logError(function (arg0, arg1, arg2) { const ret = getObject(arg0).then(getObject(arg1), getObject(arg2)); return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_instanceof_Uint8Array: function () { @@ -1063,14 +1108,14 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal const ret = result; _assertBoolean(ret); return ret; - }, arguments) + }, arguments); }, __wbg_new_537b7341ce90bb31: function () { return logError(function (arg0) { const ret = new Uint8Array(getObject(arg0)); return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_length_27a2afe8ab42b09f: function () { @@ -1078,23 +1123,23 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal const ret = getObject(arg0).length; _assertNum(ret); return ret; - }, arguments) + }, arguments); }, __wbg_set_17499e8aa4003ebd: function () { return logError(function (arg0, arg1, arg2) { getObject(arg0).set(getObject(arg1), arg2 >>> 0); - }, arguments) + }, arguments); }, __wbindgen_is_function: function (arg0) { - const ret = typeof (getObject(arg0)) === 'function'; + const ret = typeof getObject(arg0) === 'function'; _assertBoolean(ret); return ret; }, __wbindgen_is_string: function (arg0) { - const ret = typeof (getObject(arg0)) === 'string'; + const ret = typeof getObject(arg0) === 'string'; _assertBoolean(ret); return ret; }, @@ -1103,14 +1148,14 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal return logError(function (arg0) { const ret = getObject(arg0).buffer; return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbg_get_baf4855f9a986186: function () { return handleError(function (arg0, arg1) { const ret = Reflect.get(getObject(arg0), getObject(arg1)); return addHeapObject(ret); - }, arguments) + }, arguments); }, __wbindgen_debug_string: function (arg0, arg1) { @@ -1127,7 +1172,7 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal __wbindgen_bigint_get_as_i64: function (arg0, arg1) { const v = getObject(arg1); - const ret = typeof (v) === 'bigint' ? v : undefined; + const ret = typeof v === 'bigint' ? v : undefined; if (!isLikeNone(ret)) { _assertBigInt(ret); } @@ -1148,30 +1193,32 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal return logError(function (arg0, arg1, arg2) { const ret = makeMutClosure(arg0, arg1, dtorValue, __wbg_adapter_52); return addHeapObject(ret); - }, arguments) - }, - + }, arguments); + } }; const baseImportsKeys = Object.keys(baseImports); // assigning functions to "real" import names from the currently // compiled wasm module - let module: any = wbindgenImports.reduce((acc, wbindgenKey) => { - const baseImportsKey = baseImportsKeys.find((key) => wbindgenKey.startsWith(key)); - if (baseImportsKey === undefined) { - throw new Error(`Cannot find import mapping for ${wbindgenKey}. Please file a bug.`); - } - if (baseImportsKeys.filter((key) => wbindgenKey.startsWith(key)).length != 1) { - throw new Error(`Multiple import mappings for ${wbindgenKey}. Please file a bug.`); - } - if (acc.usedKeys.has(baseImportsKey)) { - throw new Error(`Multiple methods maps to ${baseImportsKey}. Please file a bug.`); - } - acc.res[wbindgenKey] = baseImports[baseImportsKey]; - acc.usedKeys.add(baseImportsKey); - return acc; - }, { res: {}, usedKeys: new Set() }).res; + let module: any = wbindgenImports.reduce( + (acc, wbindgenKey) => { + const baseImportsKey = baseImportsKeys.find((key) => wbindgenKey.startsWith(key)); + if (baseImportsKey === undefined) { + throw new Error(`Cannot find import mapping for ${wbindgenKey}. Please file a bug.`); + } + if (baseImportsKeys.filter((key) => wbindgenKey.startsWith(key)).length != 1) { + throw new Error(`Multiple import mappings for ${wbindgenKey}. Please file a bug.`); + } + if (acc.usedKeys.has(baseImportsKey)) { + throw new Error(`Multiple methods maps to ${baseImportsKey}. Please file a bug.`); + } + acc.res[wbindgenKey] = baseImports[baseImportsKey]; + acc.usedKeys.add(baseImportsKey); + return acc; + }, + { res: {}, usedKeys: new Set() } + ).res; if (warpContractsCrateVersion === '__WARP_CONTRACTS_VERSION_LEGACY') { module.initStateLegacy = initStateLegacy; @@ -1192,7 +1239,7 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal imports['__wbindgen_placeholder__'] = module; /** -*/ + */ class StateWrapper { __destroy_into_raw() { // @ts-ignore