blockful-io / swaplace-subgraph

Swaplace is an open-source, ownerless and feeless token swap protocol
https://app.swaplace.xyz/
MIT License
3 stars 4 forks source link

fix: `client.getEnsName` not fetching Ens Data #34

Open RafaDSan opened 5 months ago

RafaDSan commented 5 months ago

Bug Report

Ponder version

0.3.10

Current behavior

We are using Viem through Ponder to make the communication with the Swaplace Smart Contract deployed on Sepolia to fetch Ens information about a user, but whenever the function is called, it always returns the same error Error resolving ENS for address AnyAddressHere: TypeError: Cannot read properties of undefined (reading 'toLowerCase').

Expected behavior

When running the script npm run dev the ponder should execute and do not bring any errors for address that are corrected passed.

Steps to reproduce

Run the command npm run dev as it's in the ponder branch, it will show the error previously presented.

Related code

export async function getEnsData(client: any, address: any) {
  try {
    const primaryName = await client.getEnsName(address);
    return primaryName;
  } catch (error) {
    console.error(`Error resolving ENS for address ${address}:`, error);
    throw error;
  }
}

Other information

Despite what the error is implying, the parameter being passed to the function is a correct address, an owner parameter that is also passed in other functions inside the same scope, and it works fine, meaning that the client.getEnsName(address); might be the problem.

In communication with the Ponder team, they've told us that they've realized a fix for the problem in version 0.3.10, but it could still be holding the error, so it needs further investigation.

We suggest working with the Ponder team to fix this error.

Ponder Telegram -> https://t.me/ponder_sh

Related code

getEns.ts Swaplace.ts

0xneves commented 5 months ago

We are leaving this issue on standby as we couldn't solve on our side. I'm also setting this as a Hot Task, doubling the rewards for community rewards.

Please help us :X