-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Token allowance screen updated #16157
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. |
b5287f0
to
da2438d
Compare
Verified by QA |
Builds ready [7be0fcc]
Page Load Metrics (2576 ± 99 ms)
highlights:storybook
|
@brad-decker @georgewrmarshall |
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.
Stories and UI lgtm!
- tested using the test app
@@ -2938,6 +2938,9 @@ | |||
"message": "By revoking permission, the following $1 will no longer be able to access your $2", | |||
"description": "$1 is either key 'account' or 'contract', and $2 is either a string or link of a given token symbol or name" | |||
}, | |||
"revokeSpendingCap": { | |||
"message": "Revoke spending cap for your" |
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.
I realize that the existing translations are like this, but this should have a $1
here where the value that will come after "your" will be placed. Here is a ticket to fix this. We can fix it after this PR is merged: #16234
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.
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.
looks like PR is here #16347, so your question is addressed
I am unable enter a decimal number for the custom approval amount, unless I copy and paste from elsewhere Peek.2022-10-19.12-24.mp4 |
@bschorchit should we show a warning if the amount the user sets (or the amount the dapp proposes) is equal to their total balance? |
@@ -128,17 +145,36 @@ export default function TokenAllowance({ | |||
fullTxData.originalApprovalAmount = dappProposedTokenAmount; | |||
} | |||
|
|||
if (customTokenAmount) { | |||
txData.customTokenAmount = customTokenAmount; |
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.
Should this be fullTxData
instead of txData
?
Updating txData
here does not seem to have any effect
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.
Good catch!
Yes, I accidentally used txData
instead of fullTxData
.
Fixed here: 679cab6
@@ -128,17 +145,36 @@ export default function TokenAllowance({ | |||
fullTxData.originalApprovalAmount = dappProposedTokenAmount; | |||
} | |||
|
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.
fullTxData.txParams.data
is not updated anywhere, so if a user enters a custom amount, the approval will still be submitted with the default amount
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.
Good catch once again! 🙌
I fixed it here: 679cab6
We can improve how state management is done for the custom token data. I created a PR with suggested changes #16236 Its possible my changes break something... maybe there is a case that the code I am replacing was meant to handle. If so, we can discuss and modify. |
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.
I have left a few comments that need to be addressed before we merge.
There is a problem with |
You are right. I made this 'mistake' as I thought the input value should be forwarded back to the container and when a user clicks on the |
Builds ready [679cab6]
Page Load Metrics (2447 ± 63 ms)
highlights:storybook
|
Oh good catch. Yes, we should also show the warning in this case. cc: @SayaGT |
@@ -58,7 +63,7 @@ export default function TokenAllowance({ | |||
data, | |||
isSetApproveForAll, | |||
isApprovalOrRejection, | |||
customTxParamsData, |
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.
Is it okay to stop using the customTxParamsData
that is being passed into the component?
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.
Actually yes, because I fixed the issue with the customTxParamsData
you had mentioned before (#16157 (review)).
It is now being placed inside the token-allowance
container - here.
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.
right, okay, and I see how the customdata that was being passed in is only used in the ConfirmApproveContent
component
Edit: I think it is okay to make this change in another PR |
@georgewrmarshall Can you reapprove when you get a chance? there have not been any UI or CSS changes since you last approved |
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.
Reapproving!
Explanation
Updated the
Token allowance
screen.More Information
Screenshots/Screencaps
Before
Before.mov
After
After.mov
Manual Testing Steps
BEFORE TESTING - in your
.metamaskrc
file, setTOKEN_ALLOWANCE_IMPROVEMENTS=1
and then start the appSend Tokens
click onCREATE TOKEN
APPROVE TOKENS
orAPPROVE TOKENS WITHOUT GAS
in order to see the newly created screenTo see how the screen looks like when the enhanced gas fee is enabled, go to
Settings (Experimental tab)
and enable it (Enable enhanced gas fee UI
toggle).