Need explanation, net node module return Not implemented error
I'm trying to understand the issue about Not implemented error on net module, so I could try to fix an issue with web3 package
Here the code and the error messages
import net from "https://deno.land/[email protected]/node/net.ts";
import Web3 from "https://deno.land/x/web3/mod.ts";
const provider = new Web3.providers.IpcProvider(
"/root/geth_data/geth.ipc",
net
);
const web3 = new Web3(provider);
error: Uncaught (in promise) Error: Not implemented
throw new Error(message);
^
at notImplemented (https://deno.land/[email protected]/node/_utils.ts:23:9)
at Pipe.connect (https://deno.land/[email protected]/node/internal_binding/pipe_wrap.ts:93:5)
at _internalConnect (https://deno.land/[email protected]/node/net.ts:470:36)
at defaultTriggerAsyncIdScope (https://deno.land/[email protected]/node/_async_hooks.ts:57:18)
at Socket.connect (https://deno.land/[email protected]/node/net.ts:926:7)
at Object.connect (https://deno.land/[email protected]/node/net.ts:1580:17)
at new IpcProvider (https://deno.land/x/[email protected]/packages/web3-providers-ipc/src/index.js:35:25)
Expected behavior No error, web3 will connect normally to the ipc
Environment
- OS: Ubuntu 20.04
- deno version: 1.18.2
- std version: 0.125.0
IPC feature is not yet implemented in Deno, and therefore IPC features of std/node are not available yet.
The feature is worked on this PR https://github.com/denoland/deno/pull/13566
Unix domain socket support as added in #2146
// demo.ts
import net from "https://deno.land/std/node/net.ts";
import Web3 from "https://deno.land/x/web3/mod.ts";
const provider = new Web3.providers.IpcProvider(
"/root/geth_data/geth.ipc",
net
);
const web3 = new Web3(provider);
console.log(web3);
$ deno run --unstable --allow-env --allow-read --allow-write ./demo.ts
...
Appears to be working as far as can tell. @billyadelphia would be good to confirm if all good your end?
I'm pretty sure this issue should be closed.
I confirmed the below script working now.
import net from "https://deno.land/[email protected]/node/net.ts";
import Web3 from "https://deno.land/x/web3/mod.ts";
const provider = new Web3.providers.IpcProvider("geth.ipc", net);
const web3 = new Web3(provider);