Skip to content

fix: display 'unlimited' for max approval amount #17550

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

Merged

Conversation

josheleonard
Copy link
Contributor

@josheleonard josheleonard commented Mar 9, 2023

Resolves brave/brave-browser#23666

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run lint, npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

It should instead read "Unlimited ". For any other amount less than MAX_UNINT256, it should rendered as usual.

Before:

Screen.Recording.2023-03-09.at.4.37.07.PM.mov

After:

Screen.Recording.2023-03-09.at.5.02.55.PM.mov

@josheleonard josheleonard requested a review from a team as a code owner March 9, 2023 21:46
@josheleonard josheleonard self-assigned this Mar 9, 2023
@github-actions github-actions bot added CI/storybook-url Deploy storybook and provide a unique URL for each build feature/web3/wallet labels Mar 9, 2023
@josheleonard josheleonard force-pushed the fix-normalize-displayed-unlimited-token-approval-amount branch 3 times, most recently from 7cd32f1 to b1c1088 Compare March 9, 2023 22:08
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@@ -78,6 +79,8 @@ export const usePendingTransactions = () => {
])
const [baseFeePerGas, setBaseFeePerGas] = React.useState<string>(transactionGasEstimates?.baseFeePerGas || '')
const [currentTokenAllowance, setCurrentTokenAllowance] = React.useState<string>('')
const [isCurrentAllowanceUnlimited, setIsCurrentAllowanceUnlimited] =
Copy link
Member

Choose a reason for hiding this comment

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

Does this need to be an additional state vs a memo based on currentTokenAllowance?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll refactor this to use less state

Copy link
Contributor Author

Choose a reason for hiding this comment

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

refactored

@josheleonard josheleonard force-pushed the fix-normalize-displayed-unlimited-token-approval-amount branch from b1c1088 to 4e24a90 Compare March 10, 2023 17:15
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@josheleonard josheleonard force-pushed the fix-normalize-displayed-unlimited-token-approval-amount branch 2 times, most recently from 0ecdfcd to 97427b0 Compare March 10, 2023 21:27
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

Copy link
Contributor

@Douglashdaniel Douglashdaniel left a comment

Choose a reason for hiding this comment

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

++

@josheleonard josheleonard force-pushed the fix-normalize-displayed-unlimited-token-approval-amount branch from 97427b0 to 4c668f0 Compare March 14, 2023 16:01
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@josheleonard josheleonard force-pushed the fix-normalize-displayed-unlimited-token-approval-amount branch from 4c668f0 to 269284d Compare March 23, 2023 20:25
@josheleonard josheleonard force-pushed the fix-normalize-displayed-unlimited-token-approval-amount branch from 269284d to 1e39bf6 Compare March 23, 2023 20:32
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@josheleonard josheleonard merged commit 1bc7257 into master Mar 24, 2023
@josheleonard josheleonard deleted the fix-normalize-displayed-unlimited-token-approval-amount branch March 24, 2023 14:19
@github-actions github-actions bot added this to the 1.51.x - Nightly milestone Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/storybook-url Deploy storybook and provide a unique URL for each build feature/web3/wallet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Follow up #23562] Unlimited ERC20 allowance shows full value in panel and on activity tab
4 participants