-
Notifications
You must be signed in to change notification settings - Fork 445
chore: permit modifications #1325
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
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
3895517
feat: use updated permit function
defispartan 7ab4c8c
chore: bump package for proper export
defispartan b1c0012
chore: standardize permitConfig casing
defispartan 3830a05
chore: small styling changes to approval flow
defispartan e9346c6
chore: remove approval component which was replaced with tooltip
defispartan 83b731f
chore: remove retry with approval text placements
defispartan 7647937
chore: modify approval function for explicit parmeters and allow forc…
defispartan a5b60f6
fix: build errors on handleApproval
defispartan a504d1e
chore: run i18n
defispartan 978a5b8
chore: revert permit utility modification
defispartan cbe1951
chore rework approval fallback params
defispartan 9776302
chore: update actions components approval params
defispartan 8fd5cc9
chore: update text and link
defispartan c4b62b5
Merge branch 'main' into chore/permit-modifications
defispartan 45f70af
chore: cleanup unused state
defispartan dc0c453
feat: move tryPermit logic to zustand store
defispartan 7a3db44
feat: add approval tx to gas estimation
defispartan f822489
chore: remove unused import
defispartan be19f8a
Merge branch 'main' into chore/permit-modifications
bojanaave 040f90e
feat: design updates for new approve/permit flow
defispartan c9fc883
feat: add wallet approval preferences to walletSlice
defispartan 1d76a69
feat: add approval preference button
defispartan b1a83aa
feat: apply approval method toggle in TxActionsWrapper
defispartan 3b37cd6
chore: rework params for approval toggle
defispartan 27b8501
Merge branch 'main' into chore/permit-modifications
defispartan 48672d5
chore: bump utils package to include permit gas estimations
defispartan a2756f7
feat: use wallet approval preference in tx handler
defispartan a1897aa
chor: bump icon size
defispartan a3016c7
chore: handle edge case with already approved action
defispartan 570805b
chore: rename variable for consistency
defispartan 6ec34df
test(fix): fix e-mode for polygon
MareskoY 9fd8b38
chore: review
defispartan 2312958
chore: review
defispartan 47297be
fix: localStorage override with multiple wallets
defispartan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
src/components/infoModalContents/RetryWithApprovalInfoContent.tsx
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Trans } from '@lingui/macro'; | ||
|
||
import { Link } from '../primitives/Link'; | ||
import { TextWithTooltip, TextWithTooltipProps } from '../TextWithTooltip'; | ||
|
||
export const ApprovalTooltip = ({ ...rest }: TextWithTooltipProps) => { | ||
return ( | ||
<TextWithTooltip {...rest}> | ||
<Trans> | ||
To continue, you need to grant Aave smart contracts permission to move your funds from your | ||
wallet. Depending on the asset and wallet you use, it is done by signing the permission | ||
message (gas free), or by submitting an approval transaction (requires gas).{' '} | ||
<Link href="https://eips.ethereum.org/EIPS/eip-2612" underline="always"> | ||
Learn more | ||
</Link> | ||
</Trans> | ||
</TextWithTooltip> | ||
); | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
src/components/transactions/FlowCommons/ApprovalMethodToggleButton.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { CheckIcon } from '@heroicons/react/outline'; | ||
import { CogIcon } from '@heroicons/react/solid'; | ||
import { Trans } from '@lingui/macro'; | ||
import { | ||
Box, | ||
ListItemIcon, | ||
ListItemText, | ||
Menu, | ||
MenuItem, | ||
SvgIcon, | ||
Typography, | ||
} from '@mui/material'; | ||
import * as React from 'react'; | ||
import { ApprovalMethod } from 'src/store/walletSlice'; | ||
|
||
interface ApprovalMethodToggleButtonProps { | ||
currentMethod: ApprovalMethod; | ||
setMethod: (newMethod: ApprovalMethod) => void; | ||
} | ||
|
||
export const ApprovalMethodToggleButton = ({ | ||
currentMethod, | ||
setMethod, | ||
}: ApprovalMethodToggleButtonProps) => { | ||
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null); | ||
const open = Boolean(anchorEl); | ||
const handleClick = (event: React.MouseEvent<HTMLDivElement>) => { | ||
setAnchorEl(event.currentTarget); | ||
}; | ||
const handleClose = () => { | ||
setAnchorEl(null); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Box onClick={handleClick} sx={{ display: 'flex', alignItems: 'center', cursor: 'pointer' }}> | ||
<Typography variant="subheader2" color="info.main"> | ||
<Trans>{currentMethod}</Trans> | ||
</Typography> | ||
<SvgIcon sx={{ fontSize: 16, ml: 1, color: 'info.main' }}> | ||
<CogIcon /> | ||
</SvgIcon> | ||
</Box> | ||
|
||
<Menu | ||
anchorEl={anchorEl} | ||
open={open} | ||
onClose={handleClose} | ||
MenuListProps={{ | ||
'aria-labelledby': 'basic-button', | ||
}} | ||
keepMounted={true} | ||
data-cy={`approveMenu_${currentMethod}`} | ||
> | ||
<MenuItem | ||
selected={currentMethod === ApprovalMethod.PERMIT} | ||
value={ApprovalMethod.PERMIT} | ||
onClick={() => { | ||
if (currentMethod === ApprovalMethod.APPROVE) { | ||
setMethod(ApprovalMethod.PERMIT); | ||
} | ||
handleClose(); | ||
}} | ||
> | ||
<ListItemText primaryTypographyProps={{ variant: 'subheader1' }}> | ||
<Trans>{ApprovalMethod.PERMIT}</Trans> | ||
</ListItemText> | ||
<ListItemIcon> | ||
<SvgIcon>{currentMethod === ApprovalMethod.PERMIT && <CheckIcon />}</SvgIcon> | ||
</ListItemIcon> | ||
</MenuItem> | ||
|
||
<MenuItem | ||
selected={currentMethod === ApprovalMethod.APPROVE} | ||
value={ApprovalMethod.APPROVE} | ||
onClick={() => { | ||
if (currentMethod === ApprovalMethod.PERMIT) { | ||
setMethod(ApprovalMethod.APPROVE); | ||
} | ||
handleClose(); | ||
}} | ||
> | ||
<ListItemText primaryTypographyProps={{ variant: 'subheader1' }}> | ||
<Trans>{ApprovalMethod.APPROVE}</Trans> | ||
</ListItemText> | ||
<ListItemIcon> | ||
<SvgIcon>{currentMethod === ApprovalMethod.APPROVE && <CheckIcon />}</SvgIcon> | ||
</ListItemIcon> | ||
</MenuItem> | ||
</Menu> | ||
</> | ||
); | ||
}; |
69 changes: 0 additions & 69 deletions
69
src/components/transactions/FlowCommons/LeftHelperText.tsx
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Could these menu item components be simplified? They look identical other than the
ApprovalMethod.VALUE
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.
Would end up with more code to split to separate component and pass currentMethod, buttonMethod, setMethod, and handleClose as props so I think it's fine to leave as is