diff --git a/package.json b/package.json index 9058f1b..5a12f96 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "fast-copy": "^2.1.1", "knex": "^0.95.14", "lodash": "^4.17.21", - "redstone-isomorphic": "1.1.5", + "redstone-isomorphic": "1.1.6", "redstone-wasm-metering": "1.0.0", "safe-stable-stringify": "2.3.1", "stream-buffers": "^3.0.2", diff --git a/src/core/modules/impl/HandlerExecutorFactory.ts b/src/core/modules/impl/HandlerExecutorFactory.ts index c2cb9da..a94e5f6 100644 --- a/src/core/modules/impl/HandlerExecutorFactory.ts +++ b/src/core/modules/impl/HandlerExecutorFactory.ts @@ -21,7 +21,7 @@ import { rustWasmImports } from './wasm/rust-wasm-imports'; import { Go } from './wasm/go-wasm-imports'; import BigNumber from 'bignumber.js'; import { NodeVM, VMScript } from 'vm2'; -import { Buffer as isomorphicBuffer } from 'redstone-isomorphic'; +import * as Buffer from 'buffer'; class ContractError extends Error { constructor(message) { @@ -58,17 +58,14 @@ export class HandlerExecutorFactory implements ExecutorFactory { @@ -112,7 +109,7 @@ export class HandlerExecutorFactory implements ExecutorFactory { + if (WebAssembly.compileStreaming) { + return await WebAssembly.compileStreaming(wasmResponse); + } else { + return await WebAssembly.compile(binary); + } +} + export interface InteractionData { interaction?: ContractInteraction; interactionTx: GQLNodeInterface; diff --git a/src/core/modules/impl/wasm/rust-wasm-imports.ts b/src/core/modules/impl/wasm/rust-wasm-imports.ts index 2143a00..86f568e 100644 --- a/src/core/modules/impl/wasm/rust-wasm-imports.ts +++ b/src/core/modules/impl/wasm/rust-wasm-imports.ts @@ -261,8 +261,6 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal imports['__wbindgen_placeholder__'] = module; - const { TextDecoder, TextEncoder } = require(`util`); - let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); cachedTextDecoder.decode(); @@ -301,6 +299,7 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal let WASM_VECTOR_LEN = 0; + // @ts-ignore let cachedTextEncoder = new TextEncoder('utf-8'); const encodeString = diff --git a/yarn.lock b/yarn.lock index 6882306..51e8d1e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6317,10 +6317,10 @@ rechoir@0.7.0: dependencies: resolve "^1.9.0" -redstone-isomorphic@1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/redstone-isomorphic/-/redstone-isomorphic-1.1.5.tgz#ffd357c32716825383c789a4e66231de4a6efc6b" - integrity sha512-3vSyHeO5TcZG3s9ERsoTRFvVksb+rbRwCw1f220ztTL3oCQA3rjsmzAk9Ri0CvxFdTppTTIadzYcjIw9xGJbpg== +redstone-isomorphic@1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/redstone-isomorphic/-/redstone-isomorphic-1.1.6.tgz#513eaf38a7ce14b7e1e84a973aa111066be43f9c" + integrity sha512-q9N6/B1KHFBxeRsaqMZUelLorp7BLh50R4fUTf9LNkZPTMZ+sRRVWVE0aZT7lyKbXTLiEdk8kSOHPY4yQu//7Q== dependencies: buffer "^6.0.3" safe-buffer "^5.1.2"