From 54b3c782fe91b049856aa81f5df969de7a0de76a Mon Sep 17 00:00:00 2001 From: toniocodo Date: Tue, 3 Oct 2023 10:57:28 +0200 Subject: [PATCH] feat: add W/OETH balances, update CTA labels --- libs/oeth/redeem/src/views/RedeemView.tsx | 2 +- .../shared/src/components/AccountPopover.tsx | 2 ++ libs/oeth/swap/src/constants.ts | 16 ++++++++++++++-- libs/oeth/swap/src/views/SwapView.tsx | 4 ++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/libs/oeth/redeem/src/views/RedeemView.tsx b/libs/oeth/redeem/src/views/RedeemView.tsx index cc40b95f7..382796cac 100644 --- a/libs/oeth/redeem/src/views/RedeemView.tsx +++ b/libs/oeth/redeem/src/views/RedeemView.tsx @@ -78,7 +78,7 @@ function RedeemViewWrapped() { ? intl.formatMessage({ defaultMessage: 'Enter an amount' }) : amountIn > balOeth?.value ? intl.formatMessage({ defaultMessage: 'Insufficient funds' }) - : intl.formatMessage({ defaultMessage: 'Redeem for mix' }); + : intl.formatMessage({ defaultMessage: 'Redeem' }); const redeemButtonDisabled = isBalOethLoading || isEstimateLoading || diff --git a/libs/oeth/shared/src/components/AccountPopover.tsx b/libs/oeth/shared/src/components/AccountPopover.tsx index 3cac0c061..21c09a77d 100644 --- a/libs/oeth/shared/src/components/AccountPopover.tsx +++ b/libs/oeth/shared/src/components/AccountPopover.tsx @@ -20,6 +20,8 @@ import type { StackProps } from '@mui/material'; import type { Token } from '@origin/shared/contracts'; const balanceTokens = [ + tokens.mainnet.OETH, + tokens.mainnet.WOETH, tokens.mainnet.WETH, tokens.mainnet.rETH, tokens.mainnet.frxETH, diff --git a/libs/oeth/swap/src/constants.ts b/libs/oeth/swap/src/constants.ts index 5f630efdc..55623e682 100644 --- a/libs/oeth/swap/src/constants.ts +++ b/libs/oeth/swap/src/constants.ts @@ -19,14 +19,26 @@ export const routeActionLabel: Record = { 'mint-vault': defineMessage({ defaultMessage: 'Mint with Vault' }), 'swap-curve': defineMessage({ defaultMessage: 'Swap with Curve' }), 'swap-curve-eth': defineMessage({ defaultMessage: 'Swap with CurvePool' }), - 'swap-zapper-eth': defineMessage({ defaultMessage: 'Zap + Mint with Vault' }), + 'swap-zapper-eth': defineMessage({ defaultMessage: 'Mint with Vault' }), 'swap-zapper-sfrxeth': defineMessage({ - defaultMessage: 'Zap + Mint with Vault', + defaultMessage: 'Mint with Vault', }), 'unwrap-woeth': defineMessage({ defaultMessage: 'Unwrap with Origin' }), 'wrap-oeth': defineMessage({ defaultMessage: 'Wrap with Origin' }), }; +export const buttonActionLabel: Record = { + 'mint-vault': defineMessage({ defaultMessage: 'Mint' }), + 'swap-curve': defineMessage({ defaultMessage: 'Swap' }), + 'swap-curve-eth': defineMessage({ defaultMessage: 'Swap' }), + 'swap-zapper-eth': defineMessage({ defaultMessage: 'Mint' }), + 'swap-zapper-sfrxeth': defineMessage({ + defaultMessage: 'Mint', + }), + 'unwrap-woeth': defineMessage({ defaultMessage: 'Unwrap' }), + 'wrap-oeth': defineMessage({ defaultMessage: 'Wrap' }), +}; + export const swapRoutes = [ // Mint { diff --git a/libs/oeth/swap/src/views/SwapView.tsx b/libs/oeth/swap/src/views/SwapView.tsx index 5bdab87f2..285c7df93 100644 --- a/libs/oeth/swap/src/views/SwapView.tsx +++ b/libs/oeth/swap/src/views/SwapView.tsx @@ -27,7 +27,7 @@ import { mainnet, useAccount, useBalance, useNetwork } from 'wagmi'; import { ApyHeader } from '../components/ApyHeader'; import { SwapRoute } from '../components/SwapRoute'; import { TokenSelectModal } from '../components/TokenSelectModal'; -import { routeActionLabel } from '../constants'; +import { buttonActionLabel } from '../constants'; import { useHandleAmountInChange, useHandleApprove, @@ -135,7 +135,7 @@ function SwapViewWrapped() { : amountIn > balTokenIn?.value ? intl.formatMessage({ defaultMessage: 'Insufficient funds' }) : !isNilOrEmpty(selectedSwapRoute) - ? intl.formatMessage(routeActionLabel[selectedSwapRoute?.action]) + ? intl.formatMessage(buttonActionLabel[selectedSwapRoute?.action]) : ''; const amountInInputDisabled = isSwapLoading || isApprovalLoading; const approveButtonDisabled =