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

fix: ens lookup #297

Merged
merged 4 commits into from
Sep 14, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion static/scripts/rewards/cirip/query-reverse-ens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { app } from "../app-state";
import { useRpcHandler } from "../web3/use-rpc-handler";
import { ethers } from "ethers";

const mainnetRpcUrl = "https://eth.api.onfinality.io/public";
Keyrxng marked this conversation as resolved.
Show resolved Hide resolved

export async function queryReverseEns(address: string, networkId: number) {
// Try to get the ENS name from localStorage
const cachedEnsName = localStorage.getItem(address);
Expand All @@ -17,7 +19,7 @@ export async function queryReverseEns(address: string, networkId: number) {
return cachedEnsName;
} else {
// If the ENS name is not in localStorage, fetch it from the API
const web3Provider = new ethers.providers.Web3Provider(window.ethereum);
const web3Provider = new ethers.providers.JsonRpcProvider(mainnetRpcUrl);
const ensName = await web3Provider.lookupAddress(address);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Keyrxng You can test the resolution by hard-coding the address parameter in your local deployment!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it just grabs the first name you have from an array of all the ones you own. I own many, and it picks one consistently that is not my main.

I don't have the proper context to test against the spec but your right actually we both can test it.

@0x4007 what is your main? Which addresses should resolve to which ENS names?

@hhio618 You could provide a screenshot of the name being correctly resolved as QA. Each task should have some kind provided if possible

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0x4007 what is your main? Which addresses should resolve to which ENS names?

アレクサンダー.eth


if (ensName === null) {
Expand Down
Loading