ensdomains / ensjs

ENS javascript library for contract interaction
MIT License
113 stars 46 forks source link

`getProfile` does not update at the same time of `getOwner` #96

Closed Magofoco closed 1 year ago

Magofoco commented 1 year ago

Let's assume I want to register this free ENS domain myensname.eth. In my application I check in every block if myensname.eth has been registered via polling. Inside my app, I call the functions .getProfile and .getOwner.

  const provider = new ethers.providers.JsonRpcProvider(INFURA_NODE);
  await ENSInstance.setProvider(provider);

  provider.on("block", async () => {
    const ensProfileObject = await ENSInstance.getProfile(
      "myensname.eth"
    );

    const ensRegisteredObject = await ENSInstance.getOwner(
      "myensname.eth"
    );

    console.log(ensProfileObject)
    console.log(ensRegisteredObject)

}

Before registration, I have two undefined as output of the console.log

    ensProfileObject: undefined
    ensRegisteredObject: undefined

then I register the ENS on https://app.ens.domains/ After the registration I get this:

    ensProfileObject: undefined
    ensRegisteredObject: {
          registrant: '0x...402',
          owner: '0x...402',
          ownershipLevel: 'registrar'
        }

Expected: Both .getProfile and .getOwner should return an object with the actual information Actual: Only .getOwner returns the object, .getProfile returns undefined

TateB commented 1 year ago

the subgraph needs to be up to date with the block in which the registration is done, nothing we can really do about the lag at the moment (although we are looking into it)