diff --git a/src/App.tsx b/src/App.tsx index 7a8401d..d9f6df7 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -62,15 +62,13 @@ const Content = () => { items={[ { value: MigrateTabs.Migrate, - label: stringGetter({ key: STRING_KEYS.MIGRATE }), + label: "Migrate", forceMount: true, content: , }, { value: MigrateTabs.PendingMigrations, - label: stringGetter({ - key: STRING_KEYS.PENDING_MIGRATIONS, - }), + label: 'Pending Migrations', forceMount: true, content: , }, diff --git a/src/components/CopyButton.tsx b/src/components/CopyButton.tsx index 1194f79..8f26c4f 100644 --- a/src/components/CopyButton.tsx +++ b/src/components/CopyButton.tsx @@ -54,7 +54,7 @@ export const CopyButton = ({ onClick={onCopy} > - {children ?? stringGetter({ key: copied ? STRING_KEYS.COPIED : STRING_KEYS.COPY })} + {children ?? (copied ? 'Copied' : 'Copy')} ); }; diff --git a/src/components/TimeoutButton.tsx b/src/components/TimeoutButton.tsx index 01879c8..b1db08e 100644 --- a/src/components/TimeoutButton.tsx +++ b/src/components/TimeoutButton.tsx @@ -23,6 +23,14 @@ export const TimeoutButton = ({ const secondsLeft = Math.max(0, (timeoutDeadline - now) / 1000); + const getWaitSecondsMessage = (secondsLeft: number) => { + const seconds = Math.ceil(secondsLeft); + return seconds === 1 + ? `Wait for ${seconds} second` + : `Wait for ${seconds} seconds`; + }; + const waitSecondsMessage = secondsLeft ? getWaitSecondsMessage(secondsLeft) : children; + return ( ); }; diff --git a/src/constants/localization.ts b/src/constants/localization.ts index 1798282..d725eb7 100644 --- a/src/constants/localization.ts +++ b/src/constants/localization.ts @@ -27,7 +27,8 @@ export enum SupportedLocales { export const DORA_KEYS = { "DORA_CHAIN_SETTLEMENT": 'Dora vota-ash Chain settlement', "DORA_EXPLORER" : 'Dora vota explorer', - + "VOTA_CHAIN" : 'vota-ash Chain', + "ETHEREUM": 'Ethereum' } export const DORA_LONG_SENTENCE = { @@ -36,6 +37,21 @@ export const DORA_LONG_SENTENCE = { "PENDING_MIGRATIONS_DESCRIPTION_I": 'This table lists all ongoing DORA token migrations from Ethereum to the Dora vota-ash Chain. It refreshes periodically or upon a manual page reload.', "PENDING_MIGRATIONS_DESCRIPTION_II": 'Once a pending migration is listed, the migration will be completed within ~48 hours. Once the migration has been settled, it will be removed from this table during the next automatic update or when the page is manually refreshed.', "PENDING_MIGRATIONS_DESCRIPTION_III": 'However, you can see all your migration records (including those that are pending or have been settled) in the "Mine" option. Please note that if the migration is pending, the Transaction Hash will display as 0x0000...00000. If your migration is settled, it will display the link of transaction hash of the successful migration on the Dora vota-ash network.', + "MIGRATION_FAQ_DYDX_CHAIN_PORTAL": "What is the dYdX Chain Portal?", + "MIGRATION_FAQ_DYDX_CHAIN_PORTAL_ANSWER": "The dYdX Community elected to migrate Ethereum-based DYDX to dYdX Chain (vote {HERE}). This portal assists Ethereum-based DYDX holders to engage with the Ethereum smart contract to migrate their DYDX tokens from Ethereum to dYdX Chain.", + "MIGRATION_FAQ_GAS_FEES_ANSWER": "Yes, holders who engage with the portal will have to pay gas costs on Ethereum. Users will not have to pay gas costs on dYdX Chain.", + "MIGRATION_FAQ_GAS_FEES": "Do I have to pay gas fees?", + "MIGRATION_FAQ_HOW_LONG_ANSWER": "Once Ethereum-based DYDX is successfully sent to the Ethereum smart contract, a holder will receive wethDYDX immediately. dYdX Chain validators will acknowledge the Ethereum tx after it is finalized (which takes roughly 20 minutes). After dYdX Chain validators acknowledge the Ethereum tx, dYdX Chain DYDX settlement will be delayed for 86400 blocks, which translates into roughly 38.5 hours. After the 86400 block delay, dYdX Chain validators will send the dYdX Chain address the specified amount of DYDX.", + "MIGRATION_FAQ_HOW_LONG": "How long should the migration take?", + "MIGRATION_FAQ_HOW_TO_TRACK_ANSWER": "Once your Ethereum tx has been finalized (which takes roughly 20 minutes), you can track your pending dYdX Chain migration in Pending Migrations tab. You can filter the table by pasting a dYdX Chain address to see all of its pending migrations. Once the pending migration has settled to the dYdX Chain Address, the pending migration will no longer be shown in the table.", + "MIGRATION_FAQ_HOW_TO_TRACK": "How can I track the status of my migration?", + "MIGRATION_FAQ_WHAT_ADDRESS_ANSWER": "Users who interact with the portal can send dYdX Chain DYDX tokens to any dYdX Chain address. User’s can send tokens directly to their dYdX Chain address that is automatically created from their Ethereum address’s signature.", + "MIGRATION_FAQ_WHAT_ADDRESS": "What address can I send dYdX Chain DYDX to?", + "MIGRATION_FAQ_WHAT_TOKENS_ANSWER": "Holders who successfully engage with the portal will receive wethDYDX on Ethereum and DYDX on dYdX Chain.", + "MIGRATION_FAQ_WHAT_TOKENS": "What tokens will I receive?", + "MIGRATION_FAQ_WRAPPED_TOKENS_ANSWER": "wethDYDX are minted 1:1 to any users who successfully send Ethereum-based DYDX to the smart contract. wethDYDX have the same v3 governance rights as Ethereum-based DYDX, and are transferable. wethDYDX cannot be bridged to v4.", + "MIGRATION_FAQ_WRAPPED_TOKENS": "What are wrapped Ethereum DYDX tokens (“wethDYDX”)?", + "MIGRATION_BLOCKED_MESSAGE_DESTINATION": "Because the destination address appears to be a resident of, or using this user interface from, a jurisdiction that violates our terms of use, or has engaged in activity that violates our terms of use, the destination address has been blocked and this transaction cannot be completed.", } export const EN_LOCALE_DATA = { diff --git a/src/constants/wallets.ts b/src/constants/wallets.ts index 5b4c6f2..251f663 100644 --- a/src/constants/wallets.ts +++ b/src/constants/wallets.ts @@ -92,7 +92,7 @@ export const WALLET_CONNECT_EXPLORER_RECOMMENDED_IDS = Object.values( export const wallets: Record = { [WalletType.OtherWallet]: { type: WalletType.OtherWallet, - stringKey: STRING_KEYS.OTHER_WALLET, + stringKey: "Other", icon: GenericWalletIcon, connectionTypes: [WalletConnectionType.InjectedEip1193, WalletConnectionType.WalletConnect2], matchesInjectedEip1193: (provider) => @@ -105,14 +105,14 @@ export const wallets: Record = { }, [WalletType.CoinbaseWallet]: { type: WalletType.CoinbaseWallet, - stringKey: STRING_KEYS.COINBASE_WALLET, + stringKey: "Coinbase Wallet", icon: CoinbaseIcon, connectionTypes: [WalletConnectionType.CoinbaseWalletSdk, WalletConnectionType.InjectedEip1193], matchesInjectedEip1193: (provider) => provider.isCoinbaseWallet, }, [WalletType.MetaMask]: { type: WalletType.MetaMask, - stringKey: STRING_KEYS.METAMASK, + stringKey: "MetaMask", icon: MetaMaskIcon, connectionTypes: [WalletConnectionType.InjectedEip1193, WalletConnectionType.WalletConnect2], matchesInjectedEip1193: isMetaMask, @@ -120,7 +120,7 @@ export const wallets: Record = { }, [WalletType.WalletConnect2]: { type: WalletType.WalletConnect2, - stringKey: STRING_KEYS.WALLET_CONNECT_2, + stringKey: "WalletConnect", icon: WalletConnectIcon, connectionTypes: [WalletConnectionType.WalletConnect2], }, diff --git a/src/hooks/useDydxClient.tsx b/src/hooks/useDydxClient.tsx index 50d773c..a5b23e5 100644 --- a/src/hooks/useDydxClient.tsx +++ b/src/hooks/useDydxClient.tsx @@ -24,7 +24,7 @@ const useDydxClientContext = () => { // ------ Client Initialization ------ // const [compositeClient, setCompositeClient] = useState(); - useEffect(() => { +/* useEffect(() => { (async () => { try { const initializedClient = await CompositeClient.connect( @@ -54,7 +54,7 @@ const useDydxClientContext = () => { console.error(error); } })(); - }, []); + }, []); */ // ------ Wallet Methods ------ // const getWalletFromEvmSignature = async ({ signature }: { signature: string }) => { diff --git a/src/hooks/useMigrateToken.tsx b/src/hooks/useMigrateToken.tsx index 9cf198f..2e7c804 100644 --- a/src/hooks/useMigrateToken.tsx +++ b/src/hooks/useMigrateToken.tsx @@ -2,7 +2,7 @@ import { useContext, createContext, useEffect, useState } from 'react'; import { useSelector } from 'react-redux'; import BigNumber from 'bignumber.js'; -import { STRING_KEYS } from '@/constants/localization'; +import { STRING_KEYS, DORA_LONG_SENTENCE } from '@/constants/localization'; import { MigrateFormSteps, @@ -145,9 +145,7 @@ const useMigrateTokenContext = () => { return; } else if (screenResults?.[destinationAddress!]) { setErrorMsg( - stringGetter({ - key: STRING_KEYS.MIGRATION_BLOCKED_MESSAGE_DESTINATION, - }) + DORA_LONG_SENTENCE.MIGRATION_BLOCKED_MESSAGE_DESTINATION ); return; } diff --git a/src/hooks/usePendingMigrationsData.tsx b/src/hooks/usePendingMigrationsData.tsx index 08cc6b8..d66a372 100644 --- a/src/hooks/usePendingMigrationsData.tsx +++ b/src/hooks/usePendingMigrationsData.tsx @@ -35,7 +35,7 @@ export const usePendingMigrationsData = ({ ); const [addressSearchFilter, setAddressSearchFilter] = useState(''); - const [PendingMigrations, setPendingMigrations] = useState([]); + // const [PendingMigrations, setPendingMigrations] = useState([]); const [filteredPendingMigrations, setFilteredPendingMigrations] = useState< PendingMigrationData[] >([]); @@ -76,11 +76,16 @@ export const usePendingMigrationsData = ({ enabled: unprocessedCount > 0, queryKey: ['pollPendingMigrations', unprocessedCount], queryFn: async () => { + // 直接返回 unprocessedRecordsData + console.log(`查询未处理的数据。。。。。。。。`) return unprocessedRecordsData; }, select: (data) => { - if (!data) return []; - // let [size, records] = data + if (!data) { + console.log('Data is undefined or null'); + return []; + } + console.log(`data is ${data}`); if (Array.isArray(data) && data.length === 2) { const [size, records] = data; return records.map((record, idx) => ({ @@ -89,16 +94,17 @@ export const usePendingMigrationsData = ({ 'dora', fromHex(record.vota.startsWith('0x') ? record.vota.slice(2) : record.vota) ), - amount: BigNumber(record.amount).shiftedBy(-18)?.toFixed() ?? '0', + amount: BigNumber(record.amount).shiftedBy(-18).toFixed(), txHash: ethers.hexlify(record.txHash), })) as PendingMigrationData[]; } - console.log(`data is ${data}`); + console.log(`data is not in expected format: ${data}`); + return []; }, refetchInterval: interval, staleTime: interval, }); - + console.log(pendingMigrations); console.log(`fetch error is ${fetchPendingMigrationsError}`) diff --git a/src/lib/timeUtils.ts b/src/lib/timeUtils.ts index 5a33aac..8ebb3c4 100644 --- a/src/lib/timeUtils.ts +++ b/src/lib/timeUtils.ts @@ -36,19 +36,19 @@ export const getStringsForTimeInterval = (timeInterval: Duration) => { if (months > 0) { timeString = Math.round(months).toString(); - unitStringKey = STRING_KEYS.MONTHS_ABBREVIATED; + unitStringKey = "M"; } else if (weeks > 0) { timeString = Math.round(weeks + days / 7).toString(); - unitStringKey = STRING_KEYS.WEEKS_ABBREVIATED; + unitStringKey = "w"; } else if (days > 0) { timeString = Math.round(days + hours / 24).toString(); - unitStringKey = STRING_KEYS.DAYS_ABBREVIATED; + unitStringKey = "d"; } else if (hours > 0) { timeString = Math.round(hours + minutes / 60).toString(); - unitStringKey = STRING_KEYS.HOURS_ABBREVIATED; + unitStringKey = "h"; } else { timeString = Math.ceil(minutes).toString(); - unitStringKey = STRING_KEYS.MINUTES_ABBREVIATED; + unitStringKey = "m"; } return { diff --git a/src/lib/wallet/index.ts b/src/lib/wallet/index.ts index e728214..dfd398d 100644 --- a/src/lib/wallet/index.ts +++ b/src/lib/wallet/index.ts @@ -122,12 +122,7 @@ export const parseWalletError = ({ break; } default: { - message = stringGetter({ - key: STRING_KEYS.SOMETHING_WENT_WRONG_WITH_MESSAGE, - params: { - ERROR_MESSAGE: error.message || stringGetter({ key: STRING_KEYS.UNKNOWN_ERROR }), - }, - }); + message = `Something went wrong: ${error.message || 'Unknown error'}`; } } diff --git a/src/views/Header.tsx b/src/views/Header.tsx index 5527666..eb40a63 100644 --- a/src/views/Header.tsx +++ b/src/views/Header.tsx @@ -38,13 +38,13 @@ export const Header = () => { items: [ { value: 'MIGRATE', - label: stringGetter({ key: STRING_KEYS.MIGRATE }), + label: 'Migrate', active: true, href: '/', }, { value: 'MORE', - label: stringGetter({ key: STRING_KEYS.MORE }), + label: 'More', subitems: RELEVANT_LINKS.map((linkItem) => ({ value: linkItem.value, slotBefore: linkItem.iconName ? : undefined, diff --git a/src/views/HelpPanel.tsx b/src/views/HelpPanel.tsx index 8071431..5d62992 100644 --- a/src/views/HelpPanel.tsx +++ b/src/views/HelpPanel.tsx @@ -1,6 +1,6 @@ import styled, { AnyStyledComponent } from 'styled-components'; -import { STRING_KEYS } from '@/constants/localization'; +import { STRING_KEYS, DORA_LONG_SENTENCE } from '@/constants/localization'; import { AppRoute } from '@/constants/routes'; import breakpoints from '@/styles/breakpoints'; @@ -19,9 +19,9 @@ export const HelpPanel = () => { -

{stringGetter({ key: STRING_KEYS.MIGRATION_HELP })}

- - {stringGetter({ key: STRING_KEYS.LEARN_MORE })} +

Migration help

+ + Learn More } @@ -29,70 +29,41 @@ export const HelpPanel = () => { - {stringGetter({ key: STRING_KEYS.HERE })} - - ), - }, - }), + header: DORA_LONG_SENTENCE.MIGRATION_FAQ_DYDX_CHAIN_PORTAL, + content: DORA_LONG_SENTENCE.MIGRATION_FAQ_DYDX_CHAIN_PORTAL_ANSWER, }, { - header: stringGetter({ - key: STRING_KEYS.MIGRATION_FAQ_WHAT_TOKENS, - }), + header: DORA_LONG_SENTENCE.MIGRATION_FAQ_WHAT_TOKENS, content: stringGetter({ - key: STRING_KEYS.MIGRATION_FAQ_WHAT_TOKENS_ANSWER, + key: DORA_LONG_SENTENCE.MIGRATION_FAQ_WHAT_TOKENS_ANSWER, }), }, { - header: stringGetter({ key: STRING_KEYS.MIGRATION_FAQ_HOW_LONG }), - content: stringGetter({ - key: STRING_KEYS.MIGRATION_FAQ_HOW_LONG_ANSWER, - }), + header: DORA_LONG_SENTENCE.MIGRATION_FAQ_HOW_LONG, + content: DORA_LONG_SENTENCE.MIGRATION_FAQ_HOW_LONG_ANSWER, }, { - header: stringGetter({ - key: STRING_KEYS.MIGRATION_FAQ_HOW_TO_TRACK, - }), - content: stringGetter({ - key: STRING_KEYS.MIGRATION_FAQ_HOW_TO_TRACK_ANSWER, - }), + header: DORA_LONG_SENTENCE.MIGRATION_FAQ_HOW_TO_TRACK, + content: DORA_LONG_SENTENCE.MIGRATION_FAQ_HOW_TO_TRACK_ANSWER, }, { - header: stringGetter({ key: STRING_KEYS.MIGRATION_FAQ_GAS_FEES }), - content: stringGetter({ - key: STRING_KEYS.MIGRATION_FAQ_GAS_FEES_ANSWER, - }), + header: DORA_LONG_SENTENCE.MIGRATION_FAQ_GAS_FEES, + content: DORA_LONG_SENTENCE.MIGRATION_FAQ_GAS_FEES_ANSWER, }, { - header: stringGetter({ - key: STRING_KEYS.MIGRATION_FAQ_WHAT_ADDRESS, - }), - content: stringGetter({ - key: STRING_KEYS.MIGRATION_FAQ_WHAT_ADDRESS_ANSWER, - }), + header: DORA_LONG_SENTENCE.MIGRATION_FAQ_WHAT_ADDRESS, + content: DORA_LONG_SENTENCE.MIGRATION_FAQ_WHAT_ADDRESS_ANSWER, }, { - header: stringGetter({ - key: STRING_KEYS.MIGRATION_FAQ_WRAPPED_TOKENS, - }), - content: stringGetter({ - key: STRING_KEYS.MIGRATION_FAQ_WRAPPED_TOKENS_ANSWER, - }), + header: DORA_LONG_SENTENCE.MIGRATION_FAQ_WRAPPED_TOKENS, + content: DORA_LONG_SENTENCE.MIGRATION_FAQ_WRAPPED_TOKENS_ANSWER, }, ]} />
- {stringGetter({ key: STRING_KEYS.TERMS_OF_USE })} + Terms of Use ); @@ -102,7 +73,7 @@ const Styled: Record = {}; Styled.Container = styled.div` text-align: center; - + @media ${breakpoints.notTablet} { width: max-content; } diff --git a/src/views/MigrateForm/ConfirmedStep/FinalizingCountdownTimer.tsx b/src/views/MigrateForm/ConfirmedStep/FinalizingCountdownTimer.tsx index e49159b..b956609 100644 --- a/src/views/MigrateForm/ConfirmedStep/FinalizingCountdownTimer.tsx +++ b/src/views/MigrateForm/ConfirmedStep/FinalizingCountdownTimer.tsx @@ -40,7 +40,7 @@ export const FinalizingCountdownTimer = ({ return ( - {stringGetter({ key: STRING_KEYS.FINALIZING })} + Finalizing {secondsRemaining > 0 ? ` ${minutes}:${seconds}` : '...'} ); diff --git a/src/views/MigrateForm/ConfirmedStep/MigrateFormConfirmedStep.tsx b/src/views/MigrateForm/ConfirmedStep/MigrateFormConfirmedStep.tsx index 024a548..dadc52b 100644 --- a/src/views/MigrateForm/ConfirmedStep/MigrateFormConfirmedStep.tsx +++ b/src/views/MigrateForm/ConfirmedStep/MigrateFormConfirmedStep.tsx @@ -39,18 +39,12 @@ export const MigrateFormConfirmedStep = () => { const { evmAddress } = useAccounts(); - const getAssetOnChainLabel = ({ asset, chain }: { asset: string; chain: string }) => ( - - {asset} {stringGetter({ key: STRING_KEYS.ON_CHAIN, params: { CHAIN: chain } })} - - ); - return ( <> } detailItems={[ { @@ -60,11 +54,11 @@ export const MigrateFormConfirmedStep = () => { {transactionStatus > TransactionStatus.NotStarted && transactionStatus < TransactionStatus.Finalized && !bridgeTxError && } - {stringGetter({ key: STRING_KEYS.TRANSACTION })} + Transaction {transactionStatus >= TransactionStatus.Finalized ? ( - {stringGetter({ key: STRING_KEYS.FINALIZED })} + Finalized ) : bridgeTxError ? ( - {stringGetter({ key: STRING_KEYS.FAILED })} + Failed ) : ( transactionStatus === TransactionStatus.Unfinalized && ( @@ -80,7 +74,7 @@ export const MigrateFormConfirmedStep = () => { }, { key: 'address', - label: stringGetter({ key: STRING_KEYS.ADDRESS }), + label: "Address", value: ( {truncateAddress(evmAddress, '0x')} @@ -114,27 +108,21 @@ export const MigrateFormConfirmedStep = () => { {transactionStatus === TransactionStatus.Finalized && ( )} - {stringGetter({ key: STRING_KEYS.TRANSACTION })} + Transaction - {stringGetter({ - key: - transactionStatus < TransactionStatus.Acknowledged - ? STRING_KEYS.NOT_STARTED - : STRING_KEYS.STARTED, - })} + {transactionStatus < TransactionStatus.Acknowledged + ? "Not Started" + : "Started"} ), - value: stringGetter({ - key: STRING_KEYS.X_HOURS_LOWERCASED, - params: { X: '~40' }, - }), + value: "~40 hours", }, { key: 'address', - label: stringGetter({ key: STRING_KEYS.ADDRESS }), + label: "Address", value: ( {truncateAddress(destinationAddress)} @@ -159,13 +147,13 @@ export const MigrateFormConfirmedStep = () => { {bridgeTxError ? ( - {stringGetter({ key: STRING_KEYS.RETRY_MIGRATION })} + Retry migration ) : transactionStatus < TransactionStatus.Acknowledged ? ( {transactionStatus < TransactionStatus.Finalized ? ( - stringGetter({ key: STRING_KEYS.PROGRESS_TRACKING_WARNING }) + "Leave this open to track your progress while the transaction is being finalized." ) : ( )} @@ -173,10 +161,10 @@ export const MigrateFormConfirmedStep = () => { ) : ( resetForm(true)}> - {stringGetter({ key: STRING_KEYS.NEW_MIGRATION })} + New migration - {stringGetter({ key: STRING_KEYS.CHECK_STATUS })} + Check status )} diff --git a/src/views/MigrateForm/EditingStep/MigrateFormEditingStep.tsx b/src/views/MigrateForm/EditingStep/MigrateFormEditingStep.tsx index 13e31eb..ce6ccf1 100644 --- a/src/views/MigrateForm/EditingStep/MigrateFormEditingStep.tsx +++ b/src/views/MigrateForm/EditingStep/MigrateFormEditingStep.tsx @@ -81,12 +81,7 @@ export const MigrateFormEditingStep = () => { key: 'amount', label: ( - {stringGetter({ - key: STRING_KEYS.AVAILABLE_ON_CHAIN, - params: { - CHAIN: 'Ethereum', - }, - })} + Available on Ethereum ethDORA ), @@ -130,7 +125,7 @@ export const MigrateFormEditingStep = () => { setAmountBN(MustBigNumber(floatValue))} value={amountBN?.toFixed( @@ -138,7 +133,7 @@ export const MigrateFormEditingStep = () => { BigNumber.ROUND_DOWN )} slotRight={renderFormInputButton({ - label: stringGetter({ key: STRING_KEYS.MAX }), + label: 'Max', isInputEmpty: !amountBN, onClear: () => setAmountBN(undefined), onClick: () => ethDYDXBalance && setAmountBN(ethDYDXBalanceBN), @@ -146,67 +141,36 @@ export const MigrateFormEditingStep = () => { /> - {/* - {/* {stringGetter({ - key: STRING_KEYS.SEND_TO_ANOTHER_ADDRESS, - params: { - ADDRESS: ( - {stringGetter({ key: STRING_KEYS.DYDX_CHAIN_ADDRESS })} - ), - }, - })} */} - Send to your vota-ash chain Address - - {/* ), */} - {/* slotContent: ( */} - - setDestinationAddress(e.target?.value)} - label={ - - {/* {stringGetter({ key: STRING_KEYS.DYDX_CHAIN_ADDRESS })} */} - vota-ash chain Address - {isDestinationAddressValid && } - - } - type={InputType.Text} - value={destinationAddress} - // placeholder={stringGetter({ key: STRING_KEYS.ENTER_ADDRESS })} - placeholder={"Enter vota-ash chain address"} - slotRight={renderFormInputButton({ - label: stringGetter({ key: STRING_KEYS.PASTE }), - isInputEmpty: !destinationAddress, - onClear: () => setDestinationAddress(''), - onClick: onPasteAddress, - })} - validationConfig={ - destinationAddress && - !isDestinationAddressValid && { - attached: true, - type: AlertType.Error, - // message: stringGetter({ - // key: isAddressSanctioned(destinationAddress) - // ? STRING_KEYS.MIGRATION_BLOCKED_MESSAGE_DESTINATION - // : STRING_KEYS.INVALID_ADDRESS_BODY, - // }), - message: "Please enter a valid DORA vota-ash chain address.", - } - } - /> - - {/* ), - }, - ]} - value={destinationAddressOption} - onValueChange={onOptionChange} - /> */} - + Send to your vota-ash chain Address + + setDestinationAddress(e.target?.value)} + label={ + + vota-ash chain Address + {isDestinationAddressValid && } + + } + type={InputType.Text} + value={destinationAddress} + placeholder={'Enter vota-ash chain address'} + slotRight={renderFormInputButton({ + label: "Paste", + isInputEmpty: !destinationAddress, + onClear: () => setDestinationAddress(''), + onClick: onPasteAddress, + })} + validationConfig={ + destinationAddress && + !isDestinationAddressValid && { + attached: true, + type: AlertType.Error, + message: 'Please enter a valid DORA vota-ash chain address.', + } + } + /> + diff --git a/src/views/MigrateForm/EditingStep/PreviewMigrateButtonAndReceipt.tsx b/src/views/MigrateForm/EditingStep/PreviewMigrateButtonAndReceipt.tsx index 53a9866..b8102ca 100644 --- a/src/views/MigrateForm/EditingStep/PreviewMigrateButtonAndReceipt.tsx +++ b/src/views/MigrateForm/EditingStep/PreviewMigrateButtonAndReceipt.tsx @@ -37,10 +37,7 @@ export const PreviewMigrateButtonAndReceipt = ({ isDisabled, isLoading }: Elemen const getLabel = ({ chain, asset }: { chain: string; asset: string }) => ( - {stringGetter({ - key: STRING_KEYS.BALANCE_ON_CHAIN, - params: { CHAIN: chain }, - })} + Balance on Ethereum {asset} ); @@ -103,7 +100,7 @@ export const PreviewMigrateButtonAndReceipt = ({ isDisabled, isLoading }: Elemen type={ButtonType.Submit} state={{ isLoading, isDisabled }} > - {stringGetter({ key: STRING_KEYS.PREVIEW_MIGRATION })} + Preview Migration )} diff --git a/src/views/MigrateForm/PreviewStep/MigrateFormPreviewStep.tsx b/src/views/MigrateForm/PreviewStep/MigrateFormPreviewStep.tsx index 3895a27..75a9693 100644 --- a/src/views/MigrateForm/PreviewStep/MigrateFormPreviewStep.tsx +++ b/src/views/MigrateForm/PreviewStep/MigrateFormPreviewStep.tsx @@ -40,7 +40,7 @@ export const MigrateFormPreviewStep = () => { } detailItems={[ { @@ -48,10 +48,7 @@ export const MigrateFormPreviewStep = () => { label: 'Ethereum settlement', value: ( - {stringGetter({ - key: STRING_KEYS.X_SECONDS_LOWERCASED, - params: { X: '0-12' }, - })} + 0-12 seconds ), }, @@ -60,10 +57,7 @@ export const MigrateFormPreviewStep = () => { label: 'Ethereum finalization', value: ( - {stringGetter({ - key: STRING_KEYS.X_MINUTES_LOWERCASED, - params: { X: '~20' }, - })} + ~20 minutes ), }, @@ -73,10 +67,7 @@ export const MigrateFormPreviewStep = () => { tooltip: 'dydx-chain-settlement', value: ( - {stringGetter({ - key: STRING_KEYS.X_HOURS_LOWERCASED, - params: { X: '~40' }, - })} + ~40 hours ), }, @@ -107,9 +98,7 @@ export const MigrateFormPreviewStep = () => { )} - resetForm(false)}> - {stringGetter({ key: STRING_KEYS.EDIT })} - + resetForm(false)}>Edit { !isAmountValid, }} > - {stringGetter({ - key: needTokenAllowance ? STRING_KEYS.APPROVE_ALLOWANCE : STRING_KEYS.CONFIRM_MIGRATION, - })} + {needTokenAllowance ? 'Approve Allowance' : 'Confirm Migration'} diff --git a/src/views/MigrateForm/TokensBeforeAfterDiagram.tsx b/src/views/MigrateForm/TokensBeforeAfterDiagram.tsx index 6783be5..dfaaa45 100644 --- a/src/views/MigrateForm/TokensBeforeAfterDiagram.tsx +++ b/src/views/MigrateForm/TokensBeforeAfterDiagram.tsx @@ -19,7 +19,7 @@ export const TokensBeforeAfterDiagram = () => { const detailItems = [ { key: 'before', - label: stringGetter({ key: STRING_KEYS.BEFORE }), + label: "Before", value: ( @@ -34,12 +34,7 @@ export const TokensBeforeAfterDiagram = () => { /> ethDORA - {stringGetter({ - key: STRING_KEYS.ON_CHAIN, - params: { - CHAIN: 'Ethereum', - }, - })} + on Ethereum @@ -47,7 +42,7 @@ export const TokensBeforeAfterDiagram = () => { }, { key: 'after', - label: stringGetter({ key: STRING_KEYS.AFTER }), + label: "After", value: ( @@ -64,12 +59,7 @@ export const TokensBeforeAfterDiagram = () => { /> ethDORA - {stringGetter({ - key: STRING_KEYS.ON_CHAIN, - params: { - CHAIN: 'Ethereum', - }, - })} + on Ethereum @@ -86,12 +76,7 @@ export const TokensBeforeAfterDiagram = () => { /> DORA - {stringGetter({ - key: STRING_KEYS.ON_CHAIN, - params: { - CHAIN: 'vota-ash Chain', - }, - })} + on vota-ash Chain diff --git a/src/views/MigratePanel.tsx b/src/views/MigratePanel.tsx index 0632321..452a5ac 100644 --- a/src/views/MigratePanel.tsx +++ b/src/views/MigratePanel.tsx @@ -5,7 +5,7 @@ import breakpoints from '@/styles/breakpoints'; import { formMixins } from '@/styles/formMixins'; import { layoutMixins } from '@/styles/layoutMixins'; -import { STRING_KEYS } from '@/constants/localization'; +import { STRING_KEYS, DORA_KEYS } from '@/constants/localization'; import { MigrateFormSteps, TransactionStatus } from '@/constants/migrate'; import { useStringGetter, useMigrateToken } from '@/hooks'; @@ -24,27 +24,30 @@ export const MigratePanel = () => { const { currentStep, onFormSubmit, transactionStatus, bridgeTxError } = useMigrateToken(); + const getTransactionStatusMessage = () => { + if (transactionStatus >= TransactionStatus.Finalized) { + return "Sending Successful"; + } + if (bridgeTxError) { + return "Migration Failed"; + } + return "Sending In Progress"; + }; + const { slotIcon, title, subtitle, content } = { [MigrateFormSteps.Edit]: { slotIcon: , - title: stringGetter({ key: STRING_KEYS.MIGRATE }), - subtitle: stringGetter({ - key: STRING_KEYS.FROM_TO, - params: { - FROM: Ethereum, - TO: vota-ash Chain, - }, - }), + title: 'Migrate', + subtitle: `From ${DORA_KEYS.ETHEREUM} to ${DORA_KEYS.VOTA_CHAIN}`, content: , }, [MigrateFormSteps.Preview]: { - title: stringGetter({ key: STRING_KEYS.CONFIRM_MIGRATION }), - subtitle: stringGetter({ - key: STRING_KEYS.TO, - params: { - TO: DORA vota-ash Chain, - }, - }), + title: "Confirm migration", + subtitle: ( + <> + To DORA vota-ash Chain + + ), content: , }, [MigrateFormSteps.Confirmed]: { @@ -56,14 +59,7 @@ export const MigratePanel = () => { ) : ( ), - title: stringGetter({ - key: - transactionStatus >= TransactionStatus.Finalized - ? STRING_KEYS.SENDING_SUCCESSFUL - : bridgeTxError - ? STRING_KEYS.MIGRATION_FAILED - : STRING_KEYS.SENDING_IN_PROGRESS, - }), + title: getTransactionStatusMessage(), content: , }, }[currentStep]; diff --git a/src/views/PendingMigrationsPage.tsx b/src/views/PendingMigrationsPage.tsx index 073ae9f..dbb046a 100644 --- a/src/views/PendingMigrationsPage.tsx +++ b/src/views/PendingMigrationsPage.tsx @@ -37,9 +37,7 @@ export const PendingMigrationsPage = () => { onPressedChange={setShowFullDescription} slotRight={} > - {stringGetter({ - key: showFullDescription ? STRING_KEYS.VIEW_LESS : STRING_KEYS.VIEW_MORE, - })} + {showFullDescription ? "View Less" : "View More"} diff --git a/src/views/PendingMigrationsTable.tsx b/src/views/PendingMigrationsTable.tsx index acbbd5e..285eb2b 100644 --- a/src/views/PendingMigrationsTable.tsx +++ b/src/views/PendingMigrationsTable.tsx @@ -115,7 +115,7 @@ export const PendingMigrationsTable = ({ {showTitle && ( -

{stringGetter({ key: STRING_KEYS.PENDING_MIGRATIONS })}

+

Pending Migrations

)} diff --git a/src/views/dialogs/AcknowledgeTermsDialog.tsx b/src/views/dialogs/AcknowledgeTermsDialog.tsx index 6c07ae9..acc4cc8 100644 --- a/src/views/dialogs/AcknowledgeTermsDialog.tsx +++ b/src/views/dialogs/AcknowledgeTermsDialog.tsx @@ -38,7 +38,7 @@ export const AcknowledgeTermsDialog = ({ setIsOpen }: ElementProps) => { isOpen preventClose setIsOpen={setIsOpen} - title={stringGetter({ key: STRING_KEYS.ACKNOWLEDGE_TERMS })} + title="Acknowledge terms" > { onClick={onContinue} state={{ isDisabled: !hasAcknowledged }} > - {stringGetter({ key: STRING_KEYS.CONTINUE })} + Continue diff --git a/src/views/dialogs/DisconnectDialog.tsx b/src/views/dialogs/DisconnectDialog.tsx index acf0279..5008c6e 100644 --- a/src/views/dialogs/DisconnectDialog.tsx +++ b/src/views/dialogs/DisconnectDialog.tsx @@ -29,17 +29,17 @@ export const DisconnectDialog = ({ setIsOpen }: ElementProps) => { }; return ( - + -

{stringGetter({ key: STRING_KEYS.DISCONNECT_CONFIRMATION })}

+

Are you sure you want to disconnect your account?

- +
diff --git a/src/views/dialogs/MnemonicExportDialog.tsx b/src/views/dialogs/MnemonicExportDialog.tsx index e6d2efc..a4e966a 100644 --- a/src/views/dialogs/MnemonicExportDialog.tsx +++ b/src/views/dialogs/MnemonicExportDialog.tsx @@ -109,7 +109,7 @@ export const MnemonicExportDialog = ({ setIsOpen }: DialogProps) => { ))} - {stringGetter({ key: STRING_KEYS.CLICK_TO_SHOW })} + Click to show } > @@ -124,9 +124,7 @@ export const MnemonicExportDialog = ({ setIsOpen }: DialogProps) => { isOpen setIsOpen={setIsOpen} title={title} - description={stringGetter({ - key: STRING_KEYS.REVEAL_SECRET_PHRASE_DESCRIPTION, - })} + description="Your secret phrase is a set of 24 words used to backup and access your account." > {content} diff --git a/src/views/dialogs/MoreLinksDialog.tsx b/src/views/dialogs/MoreLinksDialog.tsx index e8145e3..c736f48 100644 --- a/src/views/dialogs/MoreLinksDialog.tsx +++ b/src/views/dialogs/MoreLinksDialog.tsx @@ -36,7 +36,7 @@ export const MoreLinksDialog = ({ setIsOpen }: DialogProps) => { ]; return ( - + ); diff --git a/src/views/dialogs/OnboardingDialog.tsx b/src/views/dialogs/OnboardingDialog.tsx index c35af54..c9da049 100644 --- a/src/views/dialogs/OnboardingDialog.tsx +++ b/src/views/dialogs/OnboardingDialog.tsx @@ -42,8 +42,8 @@ export const OnboardingDialog = ({ setIsOpen }: DialogProps) => { {...(currentOnboardingStep && { [OnboardingSteps.ChooseWallet]: { - title: stringGetter({ key: STRING_KEYS.CONNECT_YOUR_WALLET }), - description: stringGetter({ key: STRING_KEYS.CONNECT_YOUR_WALLET_SUBTITLE }), + title: "Connect your wallet", + description: "Select your wallet from these supported options.", children: ( @@ -61,10 +61,8 @@ export const OnboardingDialog = ({ setIsOpen }: DialogProps) => { ), [EvmDerivedAccountStatus.Derived]: , }[derivationStatus], - title: stringGetter({ key: STRING_KEYS.SIGN_MESSAGE }), - description: stringGetter({ - key: STRING_KEYS.SIGNATURE_CREATES_COSMOS_WALLET, - }), + title: "Sign message", + description: "Signatures are used to verify your ownership and to confirm wallet compatibility", children: ( diff --git a/src/views/dialogs/OnboardingDialog/ChooseWallet.tsx b/src/views/dialogs/OnboardingDialog/ChooseWallet.tsx index 98ada81..1767186 100644 --- a/src/views/dialogs/OnboardingDialog/ChooseWallet.tsx +++ b/src/views/dialogs/OnboardingDialog/ChooseWallet.tsx @@ -28,14 +28,7 @@ export const ChooseWallet = () => { {

- {stringGetter({ - key: STRING_KEYS.COULD_NOT_CONNECT, - params: { - WALLET: stringGetter({ - key: wallets[selectedWalletType].stringKey, - }), - }, - })} + Couldn't connect to {wallets[selectedWalletType].stringKey},

} {selectedWalletError} @@ -51,14 +44,14 @@ export const ChooseWallet = () => { slotLeft={} size={ButtonSize.Small} > -
{stringGetter({ key: wallets[walletType].stringKey })}
+
{wallets[walletType].stringKey}
))} - {stringGetter({ key: STRING_KEYS.ABOUT_WALLETS })} + About wallets diff --git a/src/views/dialogs/OnboardingDialog/GenerateKeys.tsx b/src/views/dialogs/OnboardingDialog/GenerateKeys.tsx index 715797e..fe67503 100644 --- a/src/views/dialogs/OnboardingDialog/GenerateKeys.tsx +++ b/src/views/dialogs/OnboardingDialog/GenerateKeys.tsx @@ -92,37 +92,6 @@ export const GenerateKeys = ({ setStatus(EvmDerivedAccountStatus.Deriving); const signature = await signTypedDataAsync(); - // const { wallet: dydxWallet } = await getWalletFromEvmSignature({ - // signature, - // }); - - // // 2. Ensure signature is deterministic - // // Check if subaccounts exist - // const dydxAddress = dydxWallet.address as DydxAddress; - - // try { - // // const subaccounts = await getSubaccounts({ dydxAddress }); - - // // if (!subaccounts.length) { - // setStatus(EvmDerivedAccountStatus.EnsuringDeterminism); - // const additionalSignature = await signTypedDataAsync(); - // if (signature !== additionalSignature) { - // setStatus(EvmDerivedAccountStatus.NotDerived); - // setError( - // stringGetter({ - // key: STRING_KEYS.INDETERMINISTIC_SIGNING, - // }) as string - // ); - // return; - // // } - // } - // } catch (error) { - // setStatus(EvmDerivedAccountStatus.NotDerived); - // const { message } = parseWalletError({ error, stringGetter }); - // if (message) setError(message); - // return; - // } - await setWalletFromEvmSignature(signature); // 3: Remember me (encrypt and store signature) @@ -132,7 +101,7 @@ export const GenerateKeys = ({ saveEvmSignature(encryptedSignature); } - // 4. Done + // 2. Done setStatus(EvmDerivedAccountStatus.Derived); } catch (error) { setStatus(EvmDerivedAccountStatus.NotDerived); @@ -140,7 +109,7 @@ export const GenerateKeys = ({ error, stringGetter, }); - console.log(`find error, error is ${error}`) + console.log(`find error, error is ${error}`); if (message) setError(message); } }; @@ -149,21 +118,10 @@ export const GenerateKeys = ({ <> {[ -/* { - status: EvmDerivedAccountStatus.Deriving, - title: stringGetter({ key: STRING_KEYS.GENERATE_DYDX_WALLET }), - description: stringGetter({ - key: STRING_KEYS.VERIFY_WALLET_OWNERSHIP, - }), - }, */ { status: EvmDerivedAccountStatus.EnsuringDeterminism, - title: stringGetter({ - key: STRING_KEYS.VERIFY_WALLET_COMPATIBILITY, - }), - description: stringGetter({ - key: STRING_KEYS.ENSURES_WALLET_SUPPORT, - }), + title: 'Verify wallet compatibility', + description: 'Ensures your wallet is supported.', }, ] .filter(isTruthy) @@ -188,7 +146,7 @@ export const GenerateKeys = ({ {staticEncryptionKey && ( - {stringGetter({ key: STRING_KEYS.REMEMBER_ME })} + Remember me - {stringGetter({ - key: STRING_KEYS.FREE_SIGNING, - params: { - FREE: ( - - {stringGetter({ - key: STRING_KEYS.FREE_TRADING_TITLE_ASTERISK_FREE, - })} - - ), - }, - })} + Signing is {''} + free + {''} and will not send a transaction. } @@ -225,7 +174,7 @@ export const GenerateKeys = ({ onClick={() => switchNetwork().then(deriveKeys).then(onKeysDerived)} state={{ isLoading: isSwitchingNetwork }} > - {stringGetter({ key: STRING_KEYS.SWITCH_NETWORK })} + Switch network ) : ( )} - - {stringGetter({ key: STRING_KEYS.CHECK_WALLET_FOR_REQUEST })} - + Check your wallet for a request! ); diff --git a/src/views/dialogs/OnboardingTriggerButton.tsx b/src/views/dialogs/OnboardingTriggerButton.tsx index 4863d5b..0d14801 100644 --- a/src/views/dialogs/OnboardingTriggerButton.tsx +++ b/src/views/dialogs/OnboardingTriggerButton.tsx @@ -30,8 +30,8 @@ export const OnboardingTriggerButton = ({ size = ButtonSize.Small }: StyleProps) > { { - [OnboardingState.Disconnected]: stringGetter({ key: STRING_KEYS.CONNECT_WALLET }), - // [OnboardingState.WalletConnected]: stringGetter({ key: STRING_KEYS.RECOVER_KEYS }), + [OnboardingState.Disconnected]: 'Connect Wallet', + [OnboardingState.WalletConnected]: 'Reconnect Wallet' }[onboardingState as string] } diff --git a/src/views/dialogs/RestrictedGeoDialog.tsx b/src/views/dialogs/RestrictedGeoDialog.tsx index e3ae7be..328f3e2 100644 --- a/src/views/dialogs/RestrictedGeoDialog.tsx +++ b/src/views/dialogs/RestrictedGeoDialog.tsx @@ -1,17 +1,14 @@ -import styled, { AnyStyledComponent } from "styled-components"; +import styled, { AnyStyledComponent } from 'styled-components'; -import { PreventCloseDialogProps } from "@/constants/dialogs"; -import { STRING_KEYS } from "@/constants/localization"; -import { useStringGetter } from "@/hooks"; -import { layoutMixins } from "@/styles/layoutMixins"; +import { PreventCloseDialogProps } from '@/constants/dialogs'; +import { STRING_KEYS } from '@/constants/localization'; +import { useStringGetter } from '@/hooks'; +import { layoutMixins } from '@/styles/layoutMixins'; -import { Dialog } from "@/components/Dialog"; -import { Icon, IconName } from "@/components/Icon"; +import { Dialog } from '@/components/Dialog'; +import { Icon, IconName } from '@/components/Icon'; -export const RestrictedGeoDialog = ({ - preventClose, - setIsOpen, -}: PreventCloseDialogProps) => { +export const RestrictedGeoDialog = ({ preventClose, setIsOpen }: PreventCloseDialogProps) => { const stringGetter = useStringGetter(); return ( @@ -19,11 +16,13 @@ export const RestrictedGeoDialog = ({ isOpen preventClose={preventClose} setIsOpen={setIsOpen} - title={stringGetter({ key: STRING_KEYS.REGION_NOT_PERMITTED_TITLE })} + title="Restricted" slotIcon={} > - {stringGetter({ key: STRING_KEYS.MIGRATION_BLOCKED_MESSAGE })} + Because you appear to be a resident of, or using this user interface from, a jurisdiction + that violates our terms of use, or have engaged in activity that violates our terms of use, + you have been blocked and this transaction cannot be completed.
); diff --git a/src/views/dialogs/WalletRestrictedDialog.tsx b/src/views/dialogs/WalletRestrictedDialog.tsx index 4a9fe5e..217c8d6 100644 --- a/src/views/dialogs/WalletRestrictedDialog.tsx +++ b/src/views/dialogs/WalletRestrictedDialog.tsx @@ -19,11 +19,11 @@ export const WalletRestrictedDialog = ({ isOpen preventClose={preventClose} setIsOpen={setIsOpen} - title={stringGetter({ key: STRING_KEYS.WALLET_RESTRICTED_ERROR_TITLE })} + title="Wallet Restricted" slotIcon={} > - {stringGetter({ key: STRING_KEYS.MIGRATION_BLOCKED_MESSAGE })} + Because you appear to be a resident of, or using this user interface from, a jurisdiction that violates our terms of use, or have engaged in activity that violates our terms of use, you have been blocked and this transaction cannot be completed.
); diff --git a/src/views/menus/AccountMenu.tsx b/src/views/menus/AccountMenu.tsx index d303a1c..bd9eacd 100644 --- a/src/views/menus/AccountMenu.tsx +++ b/src/views/menus/AccountMenu.tsx @@ -72,42 +72,14 @@ export const AccountMenu = () => { type={ButtonType.Link} /> - {/* - - {stringGetter({ - key: STRING_KEYS.ASSET_BALANCE, - params: { ASSET: 'DYDX' }, - })} - - - */} ) } items={[ - // onboardingState === OnboardingState.WalletConnected && { - // value: 'ConnectToChain', - // label: ( - // - //

{stringGetter({ key: STRING_KEYS.MISSING_KEYS_DESCRIPTION })}

- // - //
- // ), - // onSelect: onRecoverKeys, - // separator: true, - // }, - // onboardingState === OnboardingState.AccountConnected && - // hdKey && { - // value: 'MnemonicExport', - // icon: , - // label: stringGetter({ key: STRING_KEYS.EXPORT_SECRET_PHRASE }), - // highlightColor: 'negative', - // onSelect: () => dispatch(openDialog({ type: DialogTypes.MnemonicExport })), - // }, { value: 'Disconnect', icon: , - label: stringGetter({ key: STRING_KEYS.DISCONNECT }), + label: "Disconnect", highlightColor: 'negative', onSelect: () => dispatch(openDialog({ type: DialogTypes.DisconnectWallet })), },