Skip to content

Commit

Permalink
fix: deposit flow adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov committed Dec 3, 2024
1 parent 0848773 commit c5d0ef0
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 12 deletions.
2 changes: 0 additions & 2 deletions examples/deposit-flow/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { contractTool } from './config'

// EXAMPLE CONTRACT, DON'T DEPOSIT
const depositAddress = '0x4bF3E32de155359D1D75e8B474b66848221142fc'
const depositAmount = 5000000n

const contractCalls: ContractCall[] = []

Expand Down Expand Up @@ -54,7 +53,6 @@ export function App() {
coinKey: CoinKey.USDC,
logoURI:
'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png',
amount: depositAmount,
}}
contractCalls={contractCalls}
/>
Expand Down
4 changes: 2 additions & 2 deletions packages/widget/src/components/RouteCard/RouteCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const RouteCard: React.FC<
...other
}) => {
const { t } = useTranslation()
const { subvariant } = useWidgetConfig()
const { subvariant, subvariantOptions } = useWidgetConfig()
const [cardExpanded, setCardExpanded] = useState(defaulExpanded)

const handleExpand: MouseEventHandler<HTMLButtonElement> = (e) => {
Expand All @@ -35,7 +35,7 @@ export const RouteCard: React.FC<
}

const token: TokenAmount =
subvariant === 'custom'
subvariant === 'custom' && subvariantOptions?.custom !== 'deposit'
? { ...route.fromToken, amount: BigInt(route.fromAmount) }
: { ...route.toToken, amount: BigInt(route.toAmount) }
const impactToken: TokenAmount | undefined =
Expand Down
2 changes: 1 addition & 1 deletion packages/widget/src/components/Routes/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const Routes: React.FC<CardProps> = (props) => {
const title =
subvariant === 'custom'
? subvariantOptions?.custom === 'deposit'
? t('header.deposit')
? t('header.receive')
: t('header.youPay')
: t('header.receive')

Expand Down
4 changes: 2 additions & 2 deletions packages/widget/src/components/Step/Step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export const Step: React.FC<{
default:
return subvariant === 'custom'
? subvariantOptions?.custom === 'deposit'
? t('main.stepSwapAndDeposit')
: t('main.stepSwapAndBuy')
? t('main.stepDeposit')
: t('main.stepBuy')
: t('main.stepSwap')
}
}
Expand Down
4 changes: 3 additions & 1 deletion packages/widget/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,15 @@
"stepBridge": "Bridge",
"stepBridgeAndBuy": "Bridge and buy",
"stepBridgeAndDeposit": "Bridge and deposit",
"stepBuy": "Buy",
"stepDeposit": "Deposit",
"stepDetails": "{{tool}} via LI.FI",
"stepSwap": "Swap",
"stepSwapAndBridge": "Swap and bridge",
"stepSwapAndBuy": "Swap and buy",
"stepSwapAndDeposit": "Swap and deposit",
"transferId": "Transfer ID",
"swapStepDetails": "Swap on {{chain}} via {{tool}}",
"transferId": "Transfer ID",
"tags": {
"cheapest": "Best Return",
"fastest": "Fastest"
Expand Down
5 changes: 1 addition & 4 deletions packages/widget/src/pages/MainPage/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ export const MainPage: React.FC = () => {
) : null}
<SelectChainAndToken mb={2} />
{!custom || subvariantOptions?.custom === 'deposit' ? (
<AmountInput
formType={subvariantOptions?.custom === 'deposit' ? 'to' : 'from'}
sx={marginSx}
/>
<AmountInput formType="from" sx={marginSx} />
) : null}
{!wideVariant ? <Routes sx={marginSx} /> : null}
<SendToWalletButton sx={marginSx} />
Expand Down

0 comments on commit c5d0ef0

Please sign in to comment.