You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it's pretty easy to add Deno support. Deno can work almost like web runtime with wasm.
We just need to fix some hardcoded assumptions like fetch('/evernode.wasm') because this is too browser-specific.
Right now the naive approach doesn't work yet. Consider:
import{TonClient}from"npm:@eversdk/core";import{libWeb}from"npm:@eversdk/lib-web";// or lib-nodeTonClient.useBinaryLibrary(libWeb);constclient=newTonClient();const{ phrase }=awaitclient.crypto.mnemonic_from_random({});console.log(phrase);client.close();
import{TonClient}from"npm:@eversdk/core";// require npm i @eversdk/lib-webimport{libWeb,libWebSetup}from"./node_modules/@eversdk/lib-web/index.js";// require npm i @eversdk/lib-weblibWebSetup({disableSeparateWorker: true,binaryURL: newURL("./node_modules/@eversdk/lib-web/eversdk.wasm",import.meta.url,),});TonClient.useBinaryLibrary(libWeb);// ------------------------^^^^^^// here linter will complain but it's OKconstclient=newTonClient();const{ phrase }=awaitclient.crypto.mnemonic_from_random({});console.log(phrase);client.close();
Whilst it works it's not very convenient because we have to manually import index.js from node_modules. The main concern is that we use two different ways of distribution:
TonClient comes from npm: and we can't easily vendor it from node_modules since its internals link to each other node-js (or rather CommonJS) way.
And vice versa lib-web can be imported only via index.js directly and doesn't work with npm: deno-way.
The ideal solution would be to have libDeno (or rather libWasm / libWasi / etc) for server-side WASM + deno modules deployed on Deno
The text was updated successfully, but these errors were encountered:
Detail experiment can be found here: readme
I think it's pretty easy to add Deno support. Deno can work almost like web runtime with wasm.
We just need to fix some hardcoded assumptions like
fetch('/evernode.wasm')
because this is too browser-specific.Will give us:
lib-node
approach also doesn't work.In short:
Seems like something with dynamic linking made for nodejs runtime. It feels easily fixable since Deno is made on Rust and Eversdk too.
UPD
3. Workaround: https://github.com/awnion/example-ever-sdk-deno/blob/main/deno-custom-wasm-url.ts
Whilst it works it's not very convenient because we have to manually import
index.js
fromnode_modules
. The main concern is that we use two different ways of distribution:npm:
and we can't easily vendor it from node_modules since its internals link to each other node-js (or rather CommonJS) way.lib-web
can be imported only viaindex.js
directly and doesn't work withnpm:
deno-way.The ideal solution would be to have libDeno (or rather libWasm / libWasi / etc) for server-side WASM + deno modules deployed on Deno
The text was updated successfully, but these errors were encountered: