Add Petnames Name Component to Transaction Approval Screen#22190
Add Petnames Name Component to Transaction Approval Screen#22190
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
1f3852f to
ae07d8e
Compare
Builds ready [fec59c1]
Page Load Metrics (1271 ± 37 ms)
Bundle size diffs
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #22190 +/- ##
===========================================
- Coverage 68.15% 68.15% -0.00%
===========================================
Files 1081 1081
Lines 42346 42348 +2
Branches 11316 11314 -2
===========================================
+ Hits 28858 28859 +1
- Misses 13488 13489 +1 ☔ View full report in Codecov by Sentry. |
Builds ready [ab1f76c]
Page Load Metrics (1379 ± 126 ms)
Bundle size diffs
|
| if (name) { | ||
| const input = await driver.findElement('.form-combo-field input'); | ||
| await input.fill(name); | ||
| await input.press(driver.Key.ENTER); |
There was a problem hiding this comment.
For sure not related with this PR, but do you happen to know the intention of pressing "Enter" here?
I was wondering maybe this is not needed since we click "Save" afterwards.
There was a problem hiding this comment.
Good observation. I removed it and the tests continue to pass.
There was a problem hiding this comment.
It turns out, pressing enter before saving is needed for firefox to get the dropdown to go away. I re-added it along with a comment to explain why.
| }; | ||
|
|
||
| export function RecipientWithAddress({ | ||
| recipientAddress, |
There was a problem hiding this comment.
Do we need the non-normalized address? Does the Name component and hook not normalize any input?
| recipientEns || | ||
| shortenAddress(checksummedRecipientAddress); | ||
|
|
||
| if (addressOnly && !displayName) { |
There was a problem hiding this comment.
Looking at the original logic, is the newContract fallback used only when addressOnly is false?
| ); | ||
| } | ||
|
|
||
| let displayName; |
There was a problem hiding this comment.
Minor, but could we instead assign to a const using a ternary to avoid the uninitialised let?
| await driver.delay(3000); | ||
| } | ||
|
|
||
| describe('Petnames', function () { |
There was a problem hiding this comment.
Should we use alternate names here to distinguish the two sets of tests, maybe Petnames - Signatures and Petnames - Transactions?
| await createTransactionRequest(driver); | ||
| await switchToNotificationWindow(driver, 3); | ||
| await expectName(driver, '0x0c54F...7AaFb', false); | ||
| await saveName(driver, '0x0c54F...7AaFb', 'test.lens', undefined); |
There was a problem hiding this comment.
In the signature tests, there were multiple addresses per confirmation, so for some we used a proposed name, and for one we saved a custom name.
Here we are exclusively using a proposed name so there is an argument that we could have a separate test for saving a transaction with a custom name, though it's low risk since we know it's fundamentally the same underlying component.
Equally we know that most transaction types ultimately use the sender-to-recipient component we've updated but for the sake of coverage, we could also add additional tests for different transaction types such as send transactions from within the wallet, or an approve transaction which uses some alternate components.
Description
Currently
The extension uses the SenderToRecipient React component to display the from and to address when creating most types of transaction. This is displayed in the header of most transaction confirmations:
This internally uses a RecipientWithAddress component to render the target of the transaction.
This currently also supports names and nicknames but by using state from the AddressBookController, EnsController, and the names of the wallet accounts.
Goal of this PR
Notes
Once petnames is in main, the build feature can be removed and the legacy code removed in a separate PR.
See the Name component storybook entry for usage details.
Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/1625
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/1626
Manual testing steps
In a flask build:
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist