-
Notifications
You must be signed in to change notification settings - Fork 363
Components support eip3770 prefixes #2896
Components support eip3770 prefixes #2896
Conversation
CLA Assistant Lite All Contributors have signed the CLA. |
ESLint Summary View Full Report
Report generated by eslint-plus-action |
|
5640525
to
a39cf15
Compare
…ding Limit options
E2E Tests Failed Failed tests:
|
I did not introduce the prefix where the connected network is explicit:
Also prefixing the InlineEthHashInfo with the shortName caused me some hesitation. Please let me know what do you think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you checked for instances where we render addresses outside of EthHashInfo
?
|
||
type ExplorerInfo = () => { url: string; alt: string } | ||
|
||
interface Props { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just import the interface from the component? If it's not exported, you could use Parameters<typeof PrefixedEthHashInfo>[0]
.
@@ -37,8 +37,7 @@ const Appearance = (): ReactElement => { | |||
<Heading tag="h2">Use Chain-Specific Addresses</Heading> | |||
<Paragraph>You can choose whether to prepend EIP-3770 short chain names accross Safes.</Paragraph> | |||
<Paragraph> | |||
{showShortName && <strong>{shortName}:</strong>} | |||
{safeAddress} | |||
<PrefixedEthHashInfo hash={safeAddress} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
explorerUrl?: ExplorerInfo | ||
} | ||
|
||
const PrefixedEthHashInfo: React.FC<Props> = ({ hash, ...rest }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A basic test for this new component would be in order.
@@ -158,7 +164,7 @@ const SafeHeader = ({ | |||
<ButtonHelper onClick={onReceiveClick}> | |||
<Icon size="sm" type="qrCode" tooltip="Show QR" /> | |||
</ButtonHelper> | |||
<CopyToClipboardBtn textToCopy={address} /> | |||
<CopyToClipboardBtn textToCopy={copyChainPrefix ? `${shortName}:${address}` : `${address}`} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CopyToClipboardBtn is used in two other places, should we also create a wrapper for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question. Should the checkbox in the modal of the safe QR code remember its status of checked/unchecked after you close it? It seems that it copies the status of the checkbox in Settings > Appearance, so I'm not sure is just "temporary add/remove prefix" kind of thing, or if that checkbox should also change the checkbox in the settings as well. |
The QR modal defaults to the value set in settings. Also, toggling the check box on the Receiving modal deliberately does not update the Settings > Appearance (store value) as described in #2888 (comment) |
Yes, that's how we intended it to be. |
Note:I'm ignoring inputs where addresses go, like this one: Places checked:
Question:Should Values that are used as inputs in contract interaction methods should have the prefix? I don't know if all the addresses you will use as values for contract interactions are always from the same chainID or not Places where the prefix is missing:1 - Sidebar doesn't show the prefix. Is it because they are already under the network label? Still, I think that for consistency sake they should have it 2 - The dropdown of the owner connected to the safe app: 3 - The safe in the sidebar itself 5 - There is a font that is not correct in the "Spending limit" section. I've checked other PR's but the font is fine on those, so I think it broke just in this PR |
@francovenica thank you for the detailed QA 🙏 I had left in a commentary above open to discussion all the places you point so thank you for the feedback!
|
ESLint Summary View Full Report
Report generated by eslint-plus-action |
16cc7cd
to
7df7897
Compare
@francovenica answering to the question
The answer we got -> "we can now safely assume that addresses are always meant fo the same chain id" So yeah, we should also display it there. I think is under the scope of #2954 however |
I think we agreed internally that you need not include the |
@iamacook True! though I found Franco's "sake of consistency" point valid as per the kickoff output. Also I implemented it and looks good indeed --> https://pr2896--safereact.review-safe.gnosisdev.com/app/rinkeby |
I would argue that all of the stated positions are already truncated. The user needs to see enough of their address to know which one it is. Your link 404s. |
We show the same number of characters with and without the chain prefix Again, just welcoming another round of feedback now that it was implemented. @katspaugh @francovenica |
I'm a terrible reader. Sorry :( Still, all the new prefixes in the sidebar, connect and safe list look fine I'm still seeing the wrong font in the Spending limit modal. I'm using Chrome in windows10 btw. We can ignore it for now since it not part of this ticket, and I'll check again when I do regression in the release branch. I'm ok approving this ticket. Moving it to QA done |
I feel like modals are a bit more important and should have a |
@DiogoSoaress The fix on the sidebar for safe looks fine |
What it solves
Resolves #2757 and #2842
How this PR fixes it
This PR allows to copy/display addresses as per settings
How to test it
Tweak the Appearence settings and verify if the addresses are displayed/copied with/without the chain prefix
Screenshots