Skip to content

Commit

Permalink
feat: paraswap feature updates (#1218)
Browse files Browse the repository at this point in the history
* fix: repay type select styling

* fix: remove repay with collateral warning

* feat: add slippage components

* feat: add slippage select to tx modal

* feat: update asset input styling

* feat: redesign repay with collateral modal

* run i18n

* removed psp warning

* fix: paraswap icon

* fix: input box alignment

* feat: add price impact tooltip

* fix: slippage select styling

* fix: update collateral repay modal styling

* fix: don't allow frozen assets to be used as collateral repay

* fix: match toggle button style from repay modal

* fix: match bridge and faucet button styles with emode button

* feat: update collateral swap modal up to design specs

* chore: run i18n

* fix: handle collateral balance being less than the debt amount when trying to repay

* Automated cache update [skip cypress]

* Automated cache update [skip cypress]

* Automated cache update [skip cypress]

* fix: remove weird stuff (#958)

* fix: switch default env from staging to prod (#961)

* fix: default env from staging to prod

* feat: update env setup in CONTIRUBTING.md

* fix: token click area (#963)

* fix: token click area

* fix: update some ui and build deps

* fix: update babel loader

* cleanup: remove caching service for stake (#937)

* cleanup: remove caching service for stake

* fix: remove unused var

* fix: Use selected slippage when getting swap parameters instead of hard coded 1%

* fix: handle repay collateral amount being less than the debt amount

* chore: i18n

* fix: reverting changes, matching latest design

* fix: remove exluded dexes for testing

* fix: remove console log

* fix: don't exclude any pools from paraswap

* chore: i18n

* fix: show correct asset name in collateral repay actions when approving

* feat: wip

* feat: wip

* feat: wip

* feat: separate component for tx details

* feat: continuing with design updates

* chore: run i18n

* feat: add supply balances after swap section

* feat: refactor collateral repay

* feat: update warning text

* fix: warning styling

* chore: i18n

* chore: i18n

* chore: i18n

* fix: reset state when no there is invalid swap data

* fix: remove console log

* fix: added change handler back in so we can reset the state on asset change

* fix: console logs

* fix: cleanup swap/repay

* feat: refactor swap and repay logic

feat: refactor swap logic

* chore: merge main (#1194)

* chore: automated cache update [skip cypress]

* feat: add maticx icons (#1106)

* e2e - refactor  (#1131)

* init commands

* test version with commands without timeouts

* move all methods to CY commands

* fix matic e-mode

* add documentation

* add cy.wait for max amount

Co-authored-by: Nikita Boakrev <nikitaboakrev@Nikitas-MacBook-Pro.local>

* chore: automated cache update [skip cypress]

* chore: add prettier commands (#1142)

* chore: add prettierignore

* chore: add prettier commands

* chore: add combined linting commands

* chore: run yarn lint:fix

* chore: update lint-staged

* chore: update contributors

* chore: typo

* chore: typos

* chore: add license field

* chore: automated cache update [skip cypress]

* fix: lint-staged (#1145)

* chore: automated cache update [skip cypress]

* feat: refactor frozen warnings (#1141)

* feat: improve frozen warning mappings

* fix: clean up logic and make warnings responsive to frozen status

* fix: trans tag wrapping

* fix: simplify MarketWarning component

* chore: run i18n

* remove fantom market from CI while it frozen

Co-authored-by: Nikita Boakrev <nikitaboakrev@Nikitas-MacBook-Pro.local>

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore(i18n): synchronize translations from crowdin [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* feat: removed warnings related to eth borrow being disabled (#1113)

* feat: removed warnings related to eth borrow being disabled

* chore: prettier

* chore: fix missing param

* turn on eth tests

Co-authored-by: Mark Hinschberger <foodaka@users.noreply.github.com>
Co-authored-by: Nikita Boakrev <nikitaboakrev@Nikitas-MacBook-Pro.local>

* feat: add custom error page templates (#1094)

* chore: stub out the minimal error pages

* feat: add custom 404 page

* chore: i18n

* chore: add 500 page

* chore: cleanup

* chore: remove img from 500

* chore: use native img tag

* chore: add light/dark mode graphics

* chore: more UI updates

* chore: 500 page ideas

* chore: 500 error updates

* chore: test error boundary component in prod

* chore: ignore for build (temp)

* chore: remove error boundary component

* chore: style updates

* chore: remove throw

* chore: merge branch 'main' into feat/error-pages

* chore: use lint-staged pre-commit

* fix: build fix

* chore: post-merge cleanup

* chore: post-merge cleanup

* chore(i18n): synchronize translations from crowdin [skip cypress]

* feat: warn about governance in borrow modal (#999)

* chore(i18n): synchronize translations from crowdin [skip cypress]

* chore(i18n): synchronize translations from crowdin [skip cypress]

* fix: btc.b symbol (#1152)

* fix-tests (#1159)

Co-authored-by: Nikita Boakrev <nikitaboakrev@Nikitas-MacBook-Pro.local>

* fix: use correct blocktime (#1147)

* fix: change item name (#1148)

* chore: automated cache update [skip cypress]

* chore: sort imports (#1127)

Co-authored-by: Drew Cook <drewcook29@gmail.com>

* chore: revise contributing doc and PR template (#1158)

* chore: update contributing doc

* chore: lint

* chore: add default PR template + labels

* chore: move to be used as default

* chore: lowercase labels

* fix: typo

* chore: add project, remove frontmatter from pr template

* chore: projects fix

* chore: remove projects from frontmatter

* chore: update fork link

* chore: use js code block

* feat: add in wallet fork config section

* feat: graph improvements (#1102)

* chore: refactor graph component hierarchy

* feat: initial component for graph time range selector

* refactor: moved global style for ToggleButton to a styled component

* fix: enforce a selection

* fix: styles

* fix: bad merge

* refactor: move data fetching to graph containers

* feat: handle selected time range in parent component

* feat: initial hookup of time range selector

* feat: removed 'Max' time selection from graphs

* feat: add in loading/error states

* feat: clean up graph styles

* feat: add supply rate

* chore: remove log

* chore: add circle over supply rate

* chore: supply APR logic

* chore: show time/legend when loading

* chore: test error state

* chore: shorter graphs

* fix: build

* chore: remove unused component

* chore: remove time selector from IRM graph

* chore: add style changes to graphs

* chore: i18n

* chore: bump material and add react-transition-group

* chore: more style updates

* chore: more styling

* feat: add interest rate strategy link (#1124)

* feat: add link to interest rate strategy

* fix: remove unnecessary typography tag

* chore: i18n

* chore: more styling

* chore: cleanup

* chore: removed TODO comment

* fix: handle formatting dates behind UTC time, and don't include time for 6m and 1y time range

* fix: remove console logs

* fix: remove supply APY from interest rate model graph (#1160)

* chore: log cleanup

* chore: show %

* fix: remove horizontal divider for util rate

* chore: update eslintignore

* fix: remove unused file

* fix: re-render issue with loading spinner

* chore: remove unused package

* chore: hide charts for v3 and comment about bug

* chore: remove log

* feat: temporarily disable charts for polygon v2

Co-authored-by: Mark Grothe <grothem@gmail.com>
Co-authored-by: Andrew Schmidt <andrew@aave.com>

* chore: add QA verification checklist item for reviews (#1175)

* fix: remove duplicate warning (#1173)

* chore(i18n): synchronize translations from crowdin [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* fix(swap-modal): open swap modal on mobile (#1181)

* chore: automated cache update [skip cypress]

* fix: correct bridge message (#1168)

* fix: you don't bridge ETH assets

* fix: update po file

* fix: split messages in two

* chore: add @lidofinance/web3-ledgerhq-frame-connector (#1157)

* fix: debt ceiling wording (#1171)

* fix: tooltip wording

* fix: use correct warning component and sort imports

* chore: run i18n

Co-authored-by: Drew Cook <drewcook29@gmail.com>

* feat: market search (#1174)

* feat: wip

* feat: wip

* feat: wip

* feat(search):  styled to match designs

* chore: i18n

* feat(search): filter list based on search term

* chore: lint

* feat(search): auto focus on mobile, hide clear button when inactive

* feat(search): search on underlying address

* feat(search): show no results message

* chore: i18n

* feat(search): give input focus on clearing

* refactor: asset list titles

* feat(search): renamed file, cleanup

* feat(search): cleanup

* refactor: moved files

* feat(search): set font size to 16px on mobile to prevent auto zooming

* chore: small cleanup

* feat(search): focus input on clear on mobile, make code consistent

* chore: i18n

* feat(search): adjust no results message for mobile

* feat: graph improvements (#1102)

* chore: refactor graph component hierarchy

* feat: initial component for graph time range selector

* refactor: moved global style for ToggleButton to a styled component

* fix: enforce a selection

* fix: styles

* fix: bad merge

* refactor: move data fetching to graph containers

* feat: handle selected time range in parent component

* feat: initial hookup of time range selector

* feat: removed 'Max' time selection from graphs

* feat: add in loading/error states

* feat: clean up graph styles

* feat: add supply rate

* chore: remove log

* chore: add circle over supply rate

* chore: supply APR logic

* chore: show time/legend when loading

* chore: test error state

* chore: shorter graphs

* fix: build

* chore: remove unused component

* chore: remove time selector from IRM graph

* chore: add style changes to graphs

* chore: i18n

* chore: bump material and add react-transition-group

* chore: more style updates

* chore: more styling

* feat: add interest rate strategy link (#1124)

* feat: add link to interest rate strategy

* fix: remove unnecessary typography tag

* chore: i18n

* chore: more styling

* chore: cleanup

* chore: removed TODO comment

* fix: handle formatting dates behind UTC time, and don't include time for 6m and 1y time range

* fix: remove console logs

* fix: remove supply APY from interest rate model graph (#1160)

* chore: log cleanup

* chore: show %

* fix: remove horizontal divider for util rate

* chore: update eslintignore

* fix: remove unused file

* fix: re-render issue with loading spinner

* chore: remove unused package

* chore: hide charts for v3 and comment about bug

* chore: remove log

* feat: temporarily disable charts for polygon v2

Co-authored-by: Mark Grothe <grothem@gmail.com>
Co-authored-by: Andrew Schmidt <andrew@aave.com>

* chore: add QA verification checklist item for reviews (#1175)

* fix: remove duplicate warning (#1173)

* chore: i18n

* chore: i18n

* refactor: renamed prop

* feat(search): added debounce to the input change handler

* chore(i18n): synchronize translations from crowdin [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* fix(swap-modal): open swap modal on mobile (#1181)

* chore: automated cache update [skip cypress]

* fix: correct bridge message (#1168)

* fix: you don't bridge ETH assets

* fix: update po file

* fix: split messages in two

* chore: i18n

* fix: duplicate imports

* chore: i18n

* chore: i18n

Co-authored-by: Drew Cook <drewcook29@gmail.com>
Co-authored-by: Andrew Schmidt <andrew@aave.com>
Co-authored-by: Crowdin bot <crowdin-bot@aave.com>
Co-authored-by: Cache bot <cache-bot@aave.com>
Co-authored-by: Lukas <lukasstrassel@googlemail.com>

* chore: automated cache update [skip cypress]

* chore: lint and pre-commit updates (#1169)

* chore: order imports

* chore: add files from i18n in pre-commit

Co-authored-by: Drew Cook <drewcook29@gmail.com>

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore(i18n): synchronize translations from crowdin [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: use a fallback IPFS gateway for dynamic proposals (#1182)

* chore: use a fallback IPFS gateway for dynamic proposals

* fix: typo

* fix: lint (#1185)

* chore: update 404 image (#1184)

* chore: update 404 image

* chore: remove-brackets

* fix tests

Co-authored-by: Nikita Boakrev <nikitaboakrev@Nikitas-MacBook-Pro.local>

* feat: add watch mode only wallet address (#1178)

* feat(WalletWidget): added Alert component

* feat(mockWalletAddressContext): added mockWalletAddressContext

* feat(WalletSelector): added input to wallet selector for mock address

* feat(WatchOnlyModeTooltip): added WatchOnlyMode tooltip

* feat(WalletSelector): use web3 context for set mock adddress

* chore(WalletWidget): removed console log

* feat(WalletWidget): added warning icon

* chore: updated message.js

* chore: updated message.js

* feat(Web3Provider): updated condition to render Wallet Modal

* feat(TxActionsWrapper): render warning text when using mockAddress

* chore: updated messages

* feat(WalletSelector): use utils to check if mock address is valid

* feat(TxActionsWrapper): disabled button if mockAddress is present

* chore: updated message.js

* feat: do not render ChangeNetworkWarning when mockAddress is present

* feat(WalletWidget): added buttons to switch network and disconnect

* feat(WalletWidget): adjusted margin

* chore(WalletWidget): removed Disconnect Wallet button

* chore: removed temp value for max amount to borrow

* chore: updated messages.po

* chore: updated markdown to trigger git delta

* chore: reverted changes to Code of Conduct md

* chore: updated message.js

* chore: unimport WatchOnlyModeToolTip to ensure message.js is updated

* chore(cypress.config): removed eslint-disable

* chore(WalletSelector): re-import WatchOnlyModeToolTip

* feat(WalletWidget): set wallet widget to close when clicking switch wallet

* feat(Web3Provider): when connect wallet, check and remove mock address

* feat: if mockAddress is present, do not render approval help text and button

* feat: on mobile, if mockAddress is present, render Close menu icon

* feat(WalletWidget): update styling for warning text in mobile

* feat(WalletWidget): on mobile, render CTAs at list buttom

* feat(WalletWidget): add color styling to CTAs

* feat(WalletWidget): styling for avatar icon on mobile

* chore: updated message.js

* feat(WalletWidget): update styling for warning icon background

* feat(WalletWidget): use hideWalletAccountText variable to determine mockAddress styling

* chore(WalletWidget): removed un-used improt

* feat(WalletWidget): fine-tune warning icon color

* feat(WalletWidget): updated styling to background and CTA buttons

* feat(WalletWidget): added Divider

* chore(WalletWidget): updated copy

* feat(WalletSelector): use fullWifth props for button

* feat(WalletSelector): use fullWidfth props for input

* feat(WatchOnlyModeTooltip): re-named component with correct casing

* feat(WalletSelector): added boolean state to check for valid address error

* feat(WalletWidget): added handle switch wallet method

* chore: updated messages.js

* chore: code style changes

* update tests

* fix: use proper app header color

* fix: prevent auto zoom on mobile on watch address input

* test: don't set a watch wallet in cypress tests

* feat: wrap in form to allow input by pressing enter

* feat: add support for watching ens names

* feat: add ENS to placeholder text

* feat: enable watch button for ens inputs

* chore: use proper submit button for form

* chore: sx styles

* fix tests

Co-authored-by: matthew.lau <lau.cy.matthew@gmail.com>
Co-authored-by: Mark Grothe <grothem@gmail.com>
Co-authored-by: Nikita Boakrev <nikitaboakrev@Nikitas-MacBook-Pro.local>
Co-authored-by: Andrew Schmidt <andrew@aave.com>

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore(i18n): synchronize translations from crowdin [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* chore: automated cache update [skip cypress]

* fix: use gateway retry logic anywhere we fetch ipfs data (#1186)

* fix: swap ipfs gateway

* fix: replace pinata gateway with ipfs one

* fix: use retry logic anywhere we try to get proposal from ipfs

* fix: remove unused param

* chore: add JSDoc comments

Co-authored-by: Drew Cook <drewcook29@gmail.com>

* fix: lint

Co-authored-by: Cache bot <cache-bot@aave.com>
Co-authored-by: Lukas <lukasstrassel@googlemail.com>
Co-authored-by: Nikita <right2maresko@gmail.com>
Co-authored-by: Nikita Boakrev <nikitaboakrev@Nikitas-MacBook-Pro.local>
Co-authored-by: Drew Cook <drewcook29@gmail.com>
Co-authored-by: Andrew Schmidt <andrew@aave.com>
Co-authored-by: Crowdin bot <crowdin-bot@aave.com>
Co-authored-by: Mark Hinschberger <foodaka@users.noreply.github.com>
Co-authored-by: Jonathan Reem <jonathan.reem@gmail.com>
Co-authored-by: derasd <buenascold@gmail.com>
Co-authored-by: slundy-ledger <96065469+slundy-ledger@users.noreply.github.com>
Co-authored-by: 0xGraham <grahamnelson@live.com>
Co-authored-by: matthew.lau <lau.cy.matthew@gmail.com>

* fix: ui polish for 'exactIn'  swap case

* refactor: swap and collateral repay hooks

* chore: added jsdoc comments

* fix: make sure input amount is valid, set correct slippage on swap

* fix: error handling

* fix: clean up merge files

* fix: clean up merge files

Co-authored-by: Mark Hinschberger <markhinschberger@gmail.com>
Co-authored-by: Mark Grothe <grothem@gmail.com>
Co-authored-by: Cache bot <cache-bot@aave.com>
Co-authored-by: Lukas <lukasstrassel@googlemail.com>
Co-authored-by: Nikita <right2maresko@gmail.com>
Co-authored-by: Nikita Boakrev <nikitaboakrev@Nikitas-MacBook-Pro.local>
Co-authored-by: Drew Cook <drewcook29@gmail.com>
Co-authored-by: Crowdin bot <crowdin-bot@aave.com>
Co-authored-by: Mark Hinschberger <foodaka@users.noreply.github.com>
Co-authored-by: Jonathan Reem <jonathan.reem@gmail.com>
Co-authored-by: derasd <buenascold@gmail.com>
Co-authored-by: slundy-ledger <96065469+slundy-ledger@users.noreply.github.com>
Co-authored-by: 0xGraham <grahamnelson@live.com>
Co-authored-by: matthew.lau <lau.cy.matthew@gmail.com>
  • Loading branch information
15 people authored Oct 11, 2022
1 parent 7a2ba3e commit 9a52770
Show file tree
Hide file tree
Showing 26 changed files with 1,373 additions and 591 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"test:ci": "jest --ci"
},
"dependencies": {
"@aave/contract-helpers": "1.5.1",
"@aave/math-utils": "1.5.1",
"@aave/contract-helpers": "1.6.0",
"@aave/math-utils": "1.6.0",
"@apollo/client": "^3.5.10",
"@emotion/cache": "11.10.3",
"@emotion/react": "11.10.4",
Expand Down
1 change: 1 addition & 0 deletions public/icons/other/paraswap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 16 additions & 11 deletions src/components/transactions/AssetInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export interface AssetInputProps<T extends Asset = Asset> {
maxValue?: string;
isMaxSelected?: boolean;
inputTitle?: ReactNode;
balanceText?: string;
}

export const AssetInput = <T extends Asset = Asset>({
Expand All @@ -89,6 +90,7 @@ export const AssetInput = <T extends Asset = Asset>({
maxValue,
inputTitle,
isMaxSelected,
balanceText,
}: AssetInputProps<T>) => {
const handleSelect = (event: SelectChangeEvent) => {
const newAsset = assets.find((asset) => asset.symbol === event.target.value) as T;
Expand Down Expand Up @@ -198,6 +200,7 @@ export const AssetInput = <T extends Asset = Asset>({
'&.AssetInput__select .MuiOutlinedInput-notchedOutline': { display: 'none' },
'&.AssetInput__select .MuiSelect-icon': {
color: 'text.primary',
right: '0%',
},
}}
renderValue={(symbol) => {
Expand Down Expand Up @@ -248,15 +251,15 @@ export const AssetInput = <T extends Asset = Asset>({
compact
symbol="USD"
variant="secondary12"
color="text.disabled"
symbolsColor="text.disabled"
color="text.muted"
symbolsColor="text.muted"
flexGrow={1}
/>

{asset.balance && onChange && (
<>
<Typography component="div" variant="secondary12" color="text.secondary">
<Trans>Balance</Trans>{' '}
<Trans>{balanceText || 'Balance'}</Trans>{' '}
<FormattedNumber
value={asset.balance}
compact
Expand All @@ -265,14 +268,16 @@ export const AssetInput = <T extends Asset = Asset>({
symbolsColor="text.disabled"
/>
</Typography>
<Button
size="small"
sx={{ minWidth: 0, ml: '7px', p: 0 }}
onClick={() => onChange('-1')}
disabled={disabled || isMaxSelected}
>
<Trans>Max</Trans>
</Button>
{!disableInput && (
<Button
size="small"
sx={{ minWidth: 0, ml: '7px', p: 0 }}
onClick={() => onChange('-1')}
disabled={disabled || isMaxSelected}
>
<Trans>Max</Trans>
</Button>
)}
</>
)}
</Box>
Expand Down
2 changes: 1 addition & 1 deletion src/components/transactions/Borrow/BorrowModalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const BorrowModeSwitch = ({
value={interestRateMode}
exclusive
onChange={(_, value) => setInterestRateMode(value)}
sx={{ width: '100%', mt: 0.5 }}
sx={{ width: '100%', height: '36px', p: '2px', mt: 0.5 }}
>
<StyledToggleButton
value={InterestRate.Variable}
Expand Down
36 changes: 24 additions & 12 deletions src/components/transactions/FlowCommons/TxModalDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ import { GasStation } from '../GasStation/GasStation';

export interface TxModalDetailsProps {
gasLimit?: string;
slippageSelector?: ReactNode;
}

export const TxModalDetails: React.FC<TxModalDetailsProps> = ({ gasLimit, children }) => {
export const TxModalDetails: React.FC<TxModalDetailsProps> = ({
gasLimit,
slippageSelector,
children,
}) => {
return (
<Box sx={{ pt: 5 }}>
<Typography sx={{ mb: 1 }} color="text.secondary">
Expand All @@ -37,8 +42,10 @@ export const TxModalDetails: React.FC<TxModalDetailsProps> = ({ gasLimit, childr
>
{children}
</Box>

<GasStation gasLimit={parseUnits(gasLimit || '0', 'wei')} />
<Box sx={{ display: 'flex', justifyContent: 'space-between' }}>
<GasStation gasLimit={parseUnits(gasLimit || '0', 'wei')} />
{slippageSelector}
</Box>
</Box>
);
};
Expand Down Expand Up @@ -87,6 +94,7 @@ interface DetailsNumberLineWithSubProps {
futureValueUSD: string;
hideSymbolSuffix?: boolean;
color?: string;
tokenIcon?: string;
}

export const DetailsNumberLineWithSub = ({
Expand All @@ -98,6 +106,7 @@ export const DetailsNumberLineWithSub = ({
futureValueUSD,
hideSymbolSuffix,
color,
tokenIcon,
}: DetailsNumberLineWithSubProps) => {
return (
<Row caption={description} captionVariant="description" mb={4} align="flex-start">
Expand All @@ -116,6 +125,7 @@ export const DetailsNumberLineWithSub = ({
</SvgIcon>
</>
)}
{tokenIcon && <TokenIcon symbol={tokenIcon} sx={{ mr: 1, fontSize: '14px' }} />}
<FormattedNumber value={futureValue} variant="secondary14" color={color} />
{!hideSymbolSuffix && (
<Typography ml={1} variant="secondary14">
Expand Down Expand Up @@ -209,15 +219,17 @@ export const DetailsIncentivesLine = ({
if (!incentives || incentives.filter((i) => i.incentiveAPR !== '0').length === 0) return null;
return (
<Row caption={<Trans>Rewards APR</Trans>} captionVariant="description" mb={4} minHeight={24}>
<IncentivesButton incentives={incentives} symbol={symbol} />
{futureSymbol && (
<>
<SvgIcon color="primary" sx={{ fontSize: '14px', mx: 1 }}>
<ArrowNarrowRightIcon />
</SvgIcon>
<IncentivesButton incentives={futureIncentives} symbol={futureSymbol} />
</>
)}
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<IncentivesButton incentives={incentives} symbol={symbol} />
{futureSymbol && (
<>
<SvgIcon color="primary" sx={{ fontSize: '14px', mx: 1 }}>
<ArrowNarrowRightIcon />
</SvgIcon>
<IncentivesButton incentives={futureIncentives} symbol={futureSymbol} />
</>
)}
</Box>
</Row>
);
};
Expand Down
28 changes: 6 additions & 22 deletions src/components/transactions/Repay/CollateralRepayActions.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { InterestRate } from '@aave/contract-helpers';
import { normalize } from '@aave/math-utils';
import { Trans } from '@lingui/macro';
import { BoxProps } from '@mui/material';
import { OptimalRate } from 'paraswap-core';
import { useTransactionHandler } from 'src/helpers/useTransactionHandler';
import { ComputedReserveData } from 'src/hooks/app-data-provider/useAppDataProvider';
import { useProtocolDataContext } from 'src/hooks/useProtocolDataContext';
import { getRepayCallData } from 'src/hooks/useSwap';
import { useTxBuilderContext } from 'src/hooks/useTxBuilder';
import { useWeb3Context } from 'src/libs/hooks/useWeb3Context';

Expand All @@ -21,11 +17,11 @@ export interface RepayActionProps extends BoxProps {
isWrongNetwork: boolean;
customGasPrice?: string;
symbol: string;
priceRoute: OptimalRate | null;
repayAllDebt: boolean;
useFlashLoan: boolean;
blocked: boolean;
maxSlippage: number;
swapCallData: string;
augustus: string;
}

export const CollateralRepayActions = ({
Expand All @@ -37,36 +33,25 @@ export const CollateralRepayActions = ({
sx,
symbol,
rateMode,
priceRoute,
repayAllDebt,
useFlashLoan,
blocked,
maxSlippage,
swapCallData,
augustus,
...props
}: RepayActionProps) => {
const { lendingPool } = useTxBuilderContext();
const { currentChainId: chainId, currentNetworkConfig } = useProtocolDataContext();
const { currentAccount } = useWeb3Context();

const { approval, action, requiresApproval, loadingTxns, approvalTxState, mainTxState } =
useTransactionHandler({
handleGetTxns: async () => {
const { swapCallData, augustus, srcAmountWithSlippage } = await getRepayCallData({
srcToken: fromAssetData.underlyingAsset,
srcDecimals: fromAssetData.decimals,
destToken: poolReserve.underlyingAsset,
destDecimals: poolReserve.decimals,
user: currentAccount,
route: priceRoute as OptimalRate,
chainId: currentNetworkConfig.underlyingChainId || chainId,
maxSlippage,
});
return lendingPool.paraswapRepayWithCollateral({
user: currentAccount,
fromAsset: fromAssetData.underlyingAsset,
fromAToken: fromAssetData.aTokenAddress,
assetToRepay: poolReserve.underlyingAsset,
repayWithAmount: normalize(srcAmountWithSlippage, fromAssetData.decimals),
repayWithAmount,
repayAmount,
repayAllDebt,
rateMode,
Expand All @@ -79,7 +64,6 @@ export const CollateralRepayActions = ({
deps: [
repayWithAmount,
repayAmount,
priceRoute,
poolReserve.underlyingAsset,
fromAssetData.underlyingAsset,
repayAllDebt,
Expand All @@ -91,7 +75,7 @@ export const CollateralRepayActions = ({
return (
<TxActionsWrapper
preparingTransactions={loadingTxns}
symbol={poolReserve.symbol}
symbol={fromAssetData.symbol}
mainTxState={mainTxState}
approvalTxState={approvalTxState}
requiresAmount
Expand Down
Loading

0 comments on commit 9a52770

Please sign in to comment.