Open awnion opened 1 year ago
Working on it now)
Inside docker
If I try like this https://github.com/awnion/example-ever-sdk-deno/blob/main/sdk-deno-test.ts
Under docker image https://github.com/awnion/example-ever-sdk-deno/blob/main/sdk-deno-test.Dockerfile
IMAGE_TAG := sdk-deno-test
run:
docker build --progress=plain -t $(IMAGE_TAG) -f sdk-deno-test.Dockerfile .
docker run --rm -ti -v $$(pwd):/workdir $(IMAGE_TAG) deno run -A --unstable "./sdk-deno-test.ts"
make run
Throws error:
>>> 1.44.1
error: Uncaught {
code: 25,
message: "Unknown function: ",
data: { core_version: "1.44.1" }
}
make: *** [run] Error 1
So it partially works, might be a minor problem
Mac m2 natively built deno+eversdk.deno form source
❯ deno run -A --unstable sdk-deno-test.ts
>>> 1.44.1
[1] 32033 segmentation fault deno run -A --unstable sdk-deno-test.ts
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
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: 1) TonClient comes fromnpm:
and we can't easily vendor it from node_modules since its internals link to each other node-js (or rather CommonJS) way. 2) And vice versalib-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