question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v5 - Do i need to deploy ENS? Error: network does not support ENS

See original GitHub issue

Running a mocha test with gananche-cli. The test calls a library created with ts. The library deploys a contract.

Version

“ethers”: “^5.0.0-beta.158”

test.js

'use strict';
const expect = require('chai').expect;
const ethers = require('ethers')
const ganache = require('ganache-cli');
const MNEMONIC = 'popular stock metal artefact nasty venture oblige horror face glory predict coach'
const { contracts } = require('./../lib/index')

const provider =  new ethers.providers.Web3Provider(
    ganache.provider({
        "mnemonic": MNEMONIC,
        "gasLimit": 8000000,
        "default_balance_ether": 100000000,
    
    })
)

describe('contracts', async function () {
    this.timeout(9000);

    it("Setup accounts", async () => {
        this.DEVELOPER_SIGNER = ethers.Wallet.fromMnemonic(MNEMONIC).connect(provider)
        this.DEVELOPER = await this.DEVELOPER_SIGNER.getAddress()
    })

    it('deploy moloch', async () => {
        const contract = await contracts.moloch.deploy(this.DEVELOPER_SIGNER)
    });
});

index.ts

import { ethers, Signer } from "ethers";
import { abi as molochAbi, bytecode as molochBytecode } from "./compiled_contracts/Moloch.json";

const contract = (abi: any, bytecode: any) => {
    return {
        abi: abi,
        bytecode: bytecode,
        deploy: async (signer: Signer) => {
            return new Promise(async (resolve) => {
                const factory = new ethers.ContractFactory(abi, bytecode, signer)
                const contract = await factory.deploy()
                return resolve(await contract.deployed())
            })
        }
    }
}


export const contracts = {
    moloch: contract(molochAbi, molochBytecode)
}

The line const contract = await factory.deploy() triggers the error `UnhandledPromiseRejectionWarning: Error: network does not support ENS (operation=“ENS”, network=“unknown”``. Do i need to deploy ENS in these scenarios?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
VinayManalacommented, Mar 26, 2022

If you see this error, it almost always indicates you passed in a bad value to something that expected an address. If you are on a network that does not have ENS, you must pass in a normal Ethereum address. Check the value (with console.log) you pass into the kings that expect addresses, often the variable is null or the wrong type of object (not a string).

Yes, absolutely. I solved the issue by understanding your explaination. As explained by @ricmoo if you are on a network that dose not have ENS, you must convert the address passed from (in my case frontend React). I had been passing the string address as an param. Official docs ethers.io getAddress. conversion - ethers.utils.getAddress( address ) converts string address to address required for smart conteract to understand and then compile.

4reactions
bee-sancommented, Jan 9, 2022

Please just tell us how you fixed this for people who find via google

Read more comments on GitHub >

github_iconTop Results From Across the Web

json rpc - Error: network does not support ENS
I am currently trying to build an NFT Marketplace ...
Read more >
network does not support ENS
Error : network does not support ENS (operation=“getResolver”, network=“maticmum”, code=UNSUPPORTED_OPERATION, version=providers/5.6.0). Code :
Read more >
Using Truffle's ENS Integration
The ENS team has deployed a registry contract to Mainnet and several test networks. ... to by default if no registry address is...
Read more >
How to Build a Full Stack NFT Marketplace - V2 (2022)
but i want to deploy this to ropsten not localhost so other can interact with it ... Error: network does not support ENS...
Read more >
Error network does not support ENS taking balance
hi everybody… I am trying to capture the balance of the user connecting to my DAPP with ethers.js According to its documentation it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found