diff --git a/package.json b/package.json index cb5c058..a7f8f3d 100644 --- a/package.json +++ b/package.json @@ -37,9 +37,9 @@ "@cosmjs/proto-signing": "^0.31.0", "@cosmjs/stargate": "^0.31.0", "@cosmjs/tendermint-rpc": "^0.31.0", - "@dydxprotocol/v4-abacus": "^0.6.3", + "@dydxprotocol/v4-abacus": "^0.6.4", "@dydxprotocol/v4-client-js": "^0.36.1", - "@dydxprotocol/v4-localization": "^0.1.23", + "@dydxprotocol/v4-localization": "^0.1.24", "@ethersproject/providers": "^5.7.2", "@js-joda/core": "^5.5.3", "@radix-ui/react-collapsible": "^1.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5c03d6b..00ec3b5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -27,14 +27,14 @@ dependencies: specifier: ^0.31.0 version: 0.31.0 '@dydxprotocol/v4-abacus': - specifier: ^0.6.3 - version: 0.6.3 + specifier: ^0.6.4 + version: 0.6.4 '@dydxprotocol/v4-client-js': specifier: ^0.36.1 version: 0.36.1 '@dydxprotocol/v4-localization': - specifier: ^0.1.23 - version: 0.1.23 + specifier: ^0.1.24 + version: 0.1.24 '@ethersproject/providers': specifier: ^5.7.2 version: 5.7.2 @@ -979,8 +979,8 @@ packages: resolution: {integrity: sha512-RpfLEtTlyIxeNPGKcokS+p3BZII/Q3bYxryFRglh5H3A3T8q9fsLYm72VYAMEOOIBLEa8o93kFLiBDUWKrwXZA==} dev: true - /@dydxprotocol/v4-abacus@0.6.3: - resolution: {integrity: sha512-oYMbII7o7fXjNpl2PZpG6mwKQ49e8Qky5vA8Ua9boNs7nRUx3PC6azfoPtjHKMdYY33eHoXcZBpTynhneLXCVg==} + /@dydxprotocol/v4-abacus@0.6.4: + resolution: {integrity: sha512-eH+/9Q/OnQtwzBwM1BJyXybFPdivGmFQWrxM71MFWGs6uIQGbZX775mpoa8deweSTyQ/QrRLRQ1mP2BPDgBQYg==} dev: false /@dydxprotocol/v4-client-js@0.36.1: @@ -1010,8 +1010,8 @@ packages: - utf-8-validate dev: false - /@dydxprotocol/v4-localization@0.1.23: - resolution: {integrity: sha512-TaEey7dINwxELlEyA8XsQ4GQLfJ7e1b434bafpnlG9ccW1sIW7TYTsfaSkck2egR4R736hA7k5WvVy0aI/0TFw==} + /@dydxprotocol/v4-localization@0.1.24: + resolution: {integrity: sha512-zSiu8+/6BWNWZXxe73zUp/UjuLG1Cp5UuhXKtbATqqkeZyVCs01QxbBCTs1MLfgsLh02IrfhXCPHvXnzZyReEw==} dev: false /@dydxprotocol/v4-proto@0.2.1: diff --git a/src/views/TransferStatus.tsx b/src/views/TransferStatus.tsx index 6f3bb06..cecce4e 100644 --- a/src/views/TransferStatus.tsx +++ b/src/views/TransferStatus.tsx @@ -53,6 +53,15 @@ export const TransferStatusToast = ({ if (!status) return ; + const statusString = + type === 'deposit' + ? status?.squidTransactionStatus === 'success' + ? STRING_KEYS.DEPOSIT_COMPLETE + : STRING_KEYS.DEPOSIT_STATUS + : status?.squidTransactionStatus === 'success' + ? STRING_KEYS.WITHDRAW_COMPLETE + : STRING_KEYS.WITHDRAW_STATUS; + return ( {stringGetter({ - key: type === 'deposit' ? STRING_KEYS.DEPOSIT_STATUS : STRING_KEYS.WITHDRAW_STATUS, + key: statusString, params: { AMOUNT_USD: , ESTIMATED_DURATION: ( 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 78b6854..32c5d66 100644 --- a/src/views/dialogs/OnboardingDialog/GenerateKeys.tsx +++ b/src/views/dialogs/OnboardingDialog/GenerateKeys.tsx @@ -166,8 +166,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..f24b628 100644 --- a/src/views/forms/AccountManagementForms/WithdrawForm.tsx +++ b/src/views/forms/AccountManagementForms/WithdrawForm.tsx @@ -4,6 +4,7 @@ import styled, { type AnyStyledComponent } from 'styled-components'; import type { NumberFormatValues } from 'react-number-format'; import { shallowEqual, useSelector } from 'react-redux'; import { TESTNET_CHAIN_ID } from '@dydxprotocol/v4-client-js'; +import { isAddress } from 'viem'; import { TransferInputField, TransferInputTokenResource, TransferType } from '@/constants/abacus'; import { AlertType } from '@/constants/alerts'; @@ -26,6 +27,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'; @@ -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;