From 1e7568ab962a8451d37fe2fc47783dba87bb0f7d Mon Sep 17 00:00:00 2001 From: Bill He Date: Wed, 4 Oct 2023 17:12:58 -0400 Subject: [PATCH] Polishes for Onboarding --- src/views/TransferStatusSteps.tsx | 2 +- .../dialogs/OnboardingDialog/GenerateKeys.tsx | 4 +- .../DepositForm/DepositButtonAndReceipt.tsx | 13 ++++ .../AccountManagementForms/WithdrawForm.tsx | 20 ++++- .../WithdrawForm/WithdrawButtonAndReceipt.tsx | 78 +++++++++++-------- 5 files changed, 77 insertions(+), 40 deletions(-) diff --git a/src/views/TransferStatusSteps.tsx b/src/views/TransferStatusSteps.tsx index cf3d551..409badf 100644 --- a/src/views/TransferStatusSteps.tsx +++ b/src/views/TransferStatusSteps.tsx @@ -51,7 +51,7 @@ export const TransferStatusSteps = ({ status }: ElementProps) => { label: stringGetter({ key: type === 'deposit' ? STRING_KEYS.DEPOSIT_TO_CHAIN : STRING_KEYS.WITHDRAW_TO_CHAIN, params: { - CHAIN: status?.toChain?.chainData?.chainName, + CHAIN: type === 'deposit' ? 'dYdX' : status?.toChain?.chainData?.chainName, }, }), step: TransferStatusStep.ToChain, diff --git a/src/views/dialogs/OnboardingDialog/GenerateKeys.tsx b/src/views/dialogs/OnboardingDialog/GenerateKeys.tsx index 6669a4a..a8bd695 100644 --- a/src/views/dialogs/OnboardingDialog/GenerateKeys.tsx +++ b/src/views/dialogs/OnboardingDialog/GenerateKeys.tsx @@ -165,8 +165,8 @@ export const GenerateKeys = ({ {[ { status: EvmDerivedAccountStatus.Deriving, - title: stringGetter({ key: STRING_KEYS.GENERATE_COSMOS_WALLET }), - description: stringGetter({ key: STRING_KEYS.GENERATE_COSMOS_WALLET }), + title: stringGetter({ key: STRING_KEYS.GENERATE_DYDX_WALLET }), + description: stringGetter({ key: STRING_KEYS.VERIFY_WALLET_OWNERSHIP }), }, status === EvmDerivedAccountStatus.EnsuringDeterminism && { status: EvmDerivedAccountStatus.EnsuringDeterminism, diff --git a/src/views/forms/AccountManagementForms/DepositForm/DepositButtonAndReceipt.tsx b/src/views/forms/AccountManagementForms/DepositForm/DepositButtonAndReceipt.tsx index f63e649..07d0cb1 100644 --- a/src/views/forms/AccountManagementForms/DepositForm/DepositButtonAndReceipt.tsx +++ b/src/views/forms/AccountManagementForms/DepositForm/DepositButtonAndReceipt.tsx @@ -168,6 +168,19 @@ export const DepositButtonAndReceipt = ({ /> ), }, + { + key: 'estimatedRouteDuration', + label: {stringGetter({ key: STRING_KEYS.ESTIMATED_TIME })}, + value: typeof summary?.estimatedRouteDuration === 'number' && ( + + ), + }, ]; const isFormValid = !isDisabled && !isEditingSlippage; diff --git a/src/views/forms/AccountManagementForms/WithdrawForm.tsx b/src/views/forms/AccountManagementForms/WithdrawForm.tsx index 02ce647..898c0a1 100644 --- a/src/views/forms/AccountManagementForms/WithdrawForm.tsx +++ b/src/views/forms/AccountManagementForms/WithdrawForm.tsx @@ -26,6 +26,7 @@ import { Link } from '@/components/Link'; import { OutputType } from '@/components/Output'; import { Tag } from '@/components/Tag'; import { WithDetailsReceipt } from '@/components/WithDetailsReceipt'; +import { Icon, IconName } from '@/components/Icon'; import { ChainSelectMenu } from '@/views/forms/AccountManagementForms/ChainSelectMenu'; @@ -37,6 +38,7 @@ import { MustBigNumber } from '@/lib/numbers'; import { TokenSelectMenu } from './TokenSelectMenu'; import { WithdrawButtonAndReceipt } from './WithdrawForm/WithdrawButtonAndReceipt'; +import { isAddress } from 'viem'; export const WithdrawForm = () => { const stringGetter = useStringGetter(); @@ -59,6 +61,8 @@ export const WithdrawForm = () => { resources, } = useSelector(getTransferInputs, shallowEqual) || {}; + const isValidAddress = toAddress && isAddress(toAddress); + const toToken = useMemo( () => (token ? resources?.tokenResources?.get(token) : undefined), [token, resources] @@ -179,7 +183,6 @@ export const WithdrawForm = () => { const onSelectChain = useCallback((chain: string) => { if (chain) { - abacusStateManager.clearTransferInputValues(); abacusStateManager.setTransferValue({ field: TransferInputField.chain, value: chain, @@ -190,7 +193,6 @@ export const WithdrawForm = () => { const onSelectToken = useCallback((token: TransferInputTokenResource) => { if (token) { - abacusStateManager.clearTransferInputValues(); abacusStateManager.setTransferValue({ field: TransferInputField.token, value: token.address, @@ -265,7 +267,12 @@ export const WithdrawForm = () => { placeholder={stringGetter({ key: STRING_KEYS.ADDRESS })} onChange={onChangeAddress} value={toAddress || ''} - label={stringGetter({ key: STRING_KEYS.DESTINATION })} + label={ + + {stringGetter({ key: STRING_KEYS.DESTINATION })}{' '} + {isValidAddress ? : null} + + } /> + {stringGetter({ key: STRING_KEYS.AMOUNT_RECEIVED })}{' '} + {withdrawToken && {withdrawToken?.symbol}} + + ), + value: ( + + ), + }, { key: 'leverage', - label: {stringGetter({ key: STRING_KEYS.LEVERAGE })}, + label: {stringGetter({ key: STRING_KEYS.ACCOUNT_LEVERAGE })}, value: ( ), }, - // TODO: uncomment when we have a way to get token amount estimate from abacus - // { - // key: 'wallet', - // label: ( - // - // {stringGetter({ key: STRING_KEYS.WALLET })}{' '} - // {withdrawToken && {withdrawToken?.symbol}} - // - // ), - // value: ( - // - // ), - // }, + { + key: 'estimatedRouteDuration', + label: {stringGetter({ key: STRING_KEYS.ESTIMATED_TIME })}, + value: typeof summary?.estimatedRouteDuration === 'number' && ( + + ), + }, ]; const isFormValid = !isDisabled && !isEditingSlippage;