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

137 feat integrate ensip 16 v2 to manage domain page #152

Merged
merged 24 commits into from
Aug 28, 2024

Conversation

eduramme
Copy link
Collaborator

No description provided.

Copy link

vercel bot commented Aug 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nameful ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 28, 2024 0:47am
qa-nameful ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 28, 2024 0:47am

Comment on lines 333 to 335
const newAddress = addresses.find(
(address) => address.label === addressField.label
)?.address as string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const newAddress = addresses.find(
(address) => address.label === addressField.label
)?.address as string;
const inputtedNewAddressForLabel = addresses.find(
(address) => address.label === addressField.label
);
const addressValue = inputtedNewAddressForLabel || ""

Copy link
Contributor

Choose a reason for hiding this comment

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

@eduramme this is not resolved

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@FrancoAguzzi Please be more clear on future request changes. I've changed the function name.

the name inputtedNewAddressForLabel makes no sense in this context. The function responsibility is to populate the addresses tab context with values from the domain data, not inputted addresses.

Now I've created that fallback value to fix this 🤝🏻

Copy link
Contributor

Choose a reason for hiding this comment

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

@eduramme as done in the other PR and in other previous:

  1. We do not want type aliasing. Whenever a type is aliased it shall be nice to say why (either with an explainable doc around why you are even needing to use this typescript joker or with || "")
  2. We do not want ?. spread into the code so, the suggestion above is a conditional for wether the address is found or not, to set its value based on this.

The code shared above is pretty and well written, IMO

Yes, I might have mixed contexts on the name convention, please update it to addressesFieldsBasedOnDomainExistingData or something like

And sorry, what is the fallback value mentioned? Didn't catch it in code

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@FrancoAguzzi

  1. Could you clarify what you mean by type aliasing? I don't believe it's relevant to the code here.
  2. Using conditional chaining ?. is a good practice when a value might be undefined or null. In this case, we're filling address fields with ENS data, and since we can't always predict the response format, using ?. or || "" helps handle missing data safely.

Fallback implemented here: c3d8c21
const formattedNewAddress = newAddress || "";

Renaming of the variables implemented here: 78b0f94

Let me know if the code is clearer now

Comment on lines +59 to +60
name="Margaret Bourke"
variant="marble"
Copy link
Contributor

Choose a reason for hiding this comment

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

Perfect, @eduramme

I commented the issue, thanks for creating it. :)

square
name="Margaret Bourke"
variant="marble"
colors={["#44BCF0", "#7298F8", "#A099FF", "#FFFFFF"]}
Copy link
Contributor

Choose a reason for hiding this comment

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

Sweet :) Perfect approach, @eduramme

lib/domain-page/ensService.ts Show resolved Hide resolved

const metadataUrl = await publicClient.readContract({
address: resolverAdd!,
abi: [parseAbiItem("function metadata() returns (string)")],
Copy link
Contributor

Choose a reason for hiding this comment

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

👏🏼

Copy link
Contributor

@FrancoAguzzi FrancoAguzzi left a comment

Choose a reason for hiding this comment

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

I see this failed: https://vercel.com/shared-blockfuls-projects/nameful/GcnLbAARRnYTPPv2ioQtd2Yfo3CQ?filter=errors

Can you investigate why ? Hopefully it is easy to fix 🧑🏼‍💻

@eduramme
Copy link
Collaborator Author

eduramme commented Aug 27, 2024

@FrancoAguzzi

@eduramme very nice! I like it!

But the exclamation is yet a question for me: can you write a comment above it saying that if resolverAdd is null, the function will return an error which will be handled somehow?

Actually I just noticed that this function would not throw an explainative error for whoever called it because it is not inside a try catch block, can you add it? pls :) 🙏🏼 Then the comment mentioned can say that whenever resolverAdd is null, an error will be thrown by "readContract" call

I think the function will look shiny then + will share the error with the parent call

WDYT?

It's actually inside a try...catch block. The readContract function throws an error, which is caught by the getENSDomainDataThroughResolver function and then passed to getENSDomainData, within a try...catch block. If no resolver is found, the default ENS resolver will be used to resolve the domain's data.

I don't think this is the ideal behavior, but since we're focusing on the happy path to save time, I decided it's best not to worry about scenarios where a domain has no resolver for now. What do you think?

Comment on lines 333 to 335
const newAddress = addresses.find(
(address) => address.label === addressField.label
)?.address as string;
Copy link
Contributor

Choose a reason for hiding this comment

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

@eduramme this is not resolved

@eduramme eduramme merged commit e24f2ed into develop Aug 28, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

feat: integrate ENSIP-16 v2 to manage domain page
2 participants