Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getName #91

Closed
ancjf opened this issue Dec 20, 2022 · 1 comment
Closed

getName #91

ancjf opened this issue Dec 20, 2022 · 1 comment

Comments

@ancjf
Copy link

ancjf commented Dec 20, 2022

I will run the code below:

async function test(){
let ens = new ENS();
try{
let name = await ens.getName('0xF11804c522753E2afd2a4a8d9c1BF7AB0ABAf60f')
console.log(name)
}catch (e){
console.log(e)
}
}

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/mnt/c/src/test/js/ens/node_modules/@ensdomains/ensjs/dist/cjs/functions/initialGetters' imported from /mnt/c/src/test/js/ens/node_modules/@ensdomains/ensjs/dist/cjs/index.js
at new NodeError (internal/errors.js:322:7)
at finalizeResolution (internal/modules/esm/resolve.js:308:11)
at moduleResolve (internal/modules/esm/resolve.js:731:10)
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:842:11)
at Loader.resolve (internal/modules/esm/loader.js:89:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:242:28)
at Loader.import (internal/modules/esm/loader.js:177:28)
at importModuleDynamically (internal/modules/cjs/loader.js:1028:27)
at exports.importModuleDynamicallyCallback (internal/process/esm_loader.js:30:14)
at ENS.mainFunc [as getName] (/mnt/c/src/test/js/ens/node_modules/@ensdomains/ensjs/dist/cjs/index.js:64:26) {
code: 'ERR_MODULE_NOT_FOUND'
}

"@ensdomains/ensjs@^3.0.0-alpha.39":
version "3.0.0-alpha.39"
node: v14.18.0

why?

@Magofoco
Copy link

Magofoco commented Jan 5, 2023

Can you show how:

  • you imported the ens library
  • how did you connect to it
  • which provider did you use
    ?

This works for me

import { ENS } from "@ensdomains/ensjs";
const INFURA_NODE_MAINNET = `https://mainnet.infura.io/v3/${INFURA_API_KEY}`;
const provider = new ethers.providers.JsonRpcProvider(INFURA_NODE_GOERLI);
const ENSInstance = new ENS();

const main = async ( ) => {
    
    const pollingFunction = async () => { 
        await ENSInstance.setProvider(provider);
        const name = await ENSInstance.getName(
          "0xF11804c522753E2afd2a4a8d9c1BF7AB0ABAf60f"
        );
        console.log(name);
    }
    
  setInterval(pollingFunction, 20000);

}
main()

@TateB TateB closed this as not planned Won't fix, can't repro, duplicate, stale Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants