diff --git a/.changelog/2069.bugfix.md b/.changelog/2069.bugfix.md new file mode 100644 index 0000000000..0685906b72 --- /dev/null +++ b/.changelog/2069.bugfix.md @@ -0,0 +1 @@ +Guide users who paste Eth private key into Consensus private key input diff --git a/playwright/tests/extension.spec.ts b/playwright/tests/extension.spec.ts index 8d13cdc4de..6bd438f69f 100644 --- a/playwright/tests/extension.spec.ts +++ b/playwright/tests/extension.spec.ts @@ -75,6 +75,10 @@ test.describe('The extension popup should load', () => { ) .click() await expect(page.frameLocator('iframe')!.getByAltText('Powered by Transak')).toBeVisible() + // Wait for conversion to be loaded otherwise clicking "Buy now" early reloads the iframe + await expect(page.frameLocator('iframe')!.locator('#transak-calculator-source:disabled')).toHaveValue( + /\d/, + ) await page.frameLocator('iframe')!.getByText('Buy now').click() await expect(page.frameLocator('iframe')!.getByText(/email/i).first()).toBeVisible() }) diff --git a/playwright/tests/fiat.spec.ts b/playwright/tests/fiat.spec.ts index 25a431fb70..54dd29cc15 100644 --- a/playwright/tests/fiat.spec.ts +++ b/playwright/tests/fiat.spec.ts @@ -39,6 +39,10 @@ test.describe('Fiat on-ramp', () => { ) .click() await expect(page.frameLocator('iframe')!.getByAltText('Powered by Transak')).toBeVisible() + // Wait for conversion to be loaded otherwise clicking "Buy now" early reloads the iframe + await expect(page.frameLocator('iframe')!.locator('#transak-calculator-source:disabled')).toHaveValue( + /\d/, + ) await page.frameLocator('iframe')!.getByText('Buy now').click() await expect(page.frameLocator('iframe')!.getByText(/email/i).first()).toBeVisible() }) diff --git a/src/app/pages/OpenWalletPage/Features/FromPrivateKey/index.tsx b/src/app/pages/OpenWalletPage/Features/FromPrivateKey/index.tsx index 31e7334695..e895906524 100644 --- a/src/app/pages/OpenWalletPage/Features/FromPrivateKey/index.tsx +++ b/src/app/pages/OpenWalletPage/Features/FromPrivateKey/index.tsx @@ -13,6 +13,7 @@ import { Header } from 'app/components/Header' import { ChoosePasswordFields } from 'app/components/Persist/ChoosePasswordFields' import { FormValue as ChoosePasswordFieldsFormValue } from 'app/components/Persist/ChoosePasswordInputFields' import { preventSavingInputsToUserData } from 'app/lib/preventSavingInputsToUserData' +import { isValidEthPrivateKey, stripHexPrefix } from 'app/lib/eth-helpers' interface Props {} @@ -65,7 +66,18 @@ export function FromPrivateKey(props: Props) { placeholder={t('openWallet.privateKey.enterPrivateKeyHere', 'Enter your private key here')} autoFocus validate={privateKey => - isValidKey(privateKey) ? undefined : t('openWallet.privateKey.error', 'Invalid private key') + isValidKey(privateKey) + ? undefined + : isValidEthPrivateKey(stripHexPrefix(privateKey)) + ? t( + 'openWallet.privateKey.errorKeyIsInEthFormat', + 'This input is intended for Oasis Consensus private keys. The private key you entered looks like an Ethereum-compatible private key (e.g. from MetaMask for Sapphire). If you want to use your Ethereum-compatible private key to move ROSE from Sapphire to Consensus, click "{{paratimesMenu}}", then "{{withdrawButton}}", and paste it there.', + { + paratimesMenu: t('menu.paraTimes', 'ParaTimes'), + withdrawButton: t('paraTimes.transfers.withdraw', 'Withdraw from ParaTime'), + }, + ) + : t('openWallet.privateKey.error', 'Invalid private key') } showTip={t('openWallet.privateKey.showPrivateKey', 'Show private key')} hideTip={t('openWallet.privateKey.hidePrivateKey', 'Hide private key')} diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index b1bd4b3473..5170f2207c 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -336,6 +336,7 @@ "privateKey": { "enterPrivateKeyHere": "Enter your private key here", "error": "Invalid private key", + "errorKeyIsInEthFormat": "This input is intended for Oasis Consensus private keys. The private key you entered looks like an Ethereum-compatible private key (e.g. from MetaMask for Sapphire). If you want to use your Ethereum-compatible private key to move ROSE from Sapphire to Consensus, click \"{{paratimesMenu}}\", then \"{{withdrawButton}}\", and paste it there.", "header": "Enter your private key", "hidePrivateKey": "Hide private key", "instruction": "Enter your private key in Base64 format.",