From d4b6cbe9bd726e97ce7f3675a0c75fd274b70e7b Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 27 Apr 2023 21:29:27 +0300 Subject: [PATCH 01/80] added method clickByScript --- packages/yoroi-extension/features/support/webdriver.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/yoroi-extension/features/support/webdriver.js b/packages/yoroi-extension/features/support/webdriver.js index b18e32cd80..9030c8f050 100644 --- a/packages/yoroi-extension/features/support/webdriver.js +++ b/packages/yoroi-extension/features/support/webdriver.js @@ -367,8 +367,10 @@ function CustomWorld(cmdInput: WorldInput) { }, index); }; - this.clickElementByQuery = async query => { - await this.driver.executeScript(`document.querySelector('${query}').click()`); + this.clickByScript = async (locator: LocatorObject) => { + this.webDriverLogger.info(`Webdriver: Clicking with executeScript on "${JSON.stringify(locator)}"`); + const element = await this.getElementBy(locator); + await this.driver.executeScript(`arguments[0].click()`, element); }; this.checkIfExists = async (locator: LocatorObject) => { From 4f794c70680e999bff5e54beeafbd08409883473 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 27 Apr 2023 21:30:11 +0300 Subject: [PATCH 02/80] removed unnecessary and fail action --- packages/yoroi-extension/features/pages/settingsPage.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/yoroi-extension/features/pages/settingsPage.js b/packages/yoroi-extension/features/pages/settingsPage.js index 50dc4d160a..29627b69e8 100644 --- a/packages/yoroi-extension/features/pages/settingsPage.js +++ b/packages/yoroi-extension/features/pages/settingsPage.js @@ -9,10 +9,6 @@ export async function selectSubmenuSettings(customWorld: Object, buttonName: str const formattedButtonName = camelCase(buttonName); const buttonSelector = `.SubMenuItem_component.${formattedButtonName}`; await customWorld.click({ locator: buttonSelector, method: 'css' }); - await customWorld.waitForElement({ - locator: `.SubMenuItem_component.SubMenuItem_active.${formattedButtonName}`, - method: 'css', - }); } export async function goToSettings(customWorld: Object) { From bcc7530255f1dd1931cddf0594994e62f63fa9c8 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 27 Apr 2023 21:39:30 +0300 Subject: [PATCH 03/80] actual fix --- .../features/step_definitions/trezor-steps.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/yoroi-extension/features/step_definitions/trezor-steps.js b/packages/yoroi-extension/features/step_definitions/trezor-steps.js index ec687af851..bac13255c9 100644 --- a/packages/yoroi-extension/features/step_definitions/trezor-steps.js +++ b/packages/yoroi-extension/features/step_definitions/trezor-steps.js @@ -14,14 +14,17 @@ import { testWallets } from '../mock-chain/TestWallets'; import { errorBlockComponent } from '../pages/commonDialogPage'; export async function switchToTrezorAndAllow(customWorld: any) { - // wait for a new tab + // wait for a new Trezor tab and switch to it await customWorld.windowManager.findNewWindowAndSwitchTo(trezorConnectTabName); - // tick the checkbox on the Trezor page and press Allow button await customWorld.driver.sleep(1000); + // tick the checkbox Don't ask again await customWorld.waitForElement(dontAskAgainCheckbox); await customWorld.click(dontAskAgainCheckbox); + // press the Allow button await customWorld.waitForElement(confirmUsingTrezorButton); - await customWorld.click(confirmUsingTrezorButton); + // this dirty trick is necessary because the button Allow is covered by the pop-up + // which is I can't find and close from the UI side + await customWorld.clickByScript(confirmUsingTrezorButton); } export async function switchToTrezorAndExport(customWorld: any) { @@ -30,12 +33,17 @@ export async function switchToTrezorAndExport(customWorld: any) { // tick the checkbox on the Trezor page and press Allow button await customWorld.driver.sleep(1000); await customWorld.waitForElement(confirmUsingTrezorButton); - await customWorld.click(confirmUsingTrezorButton); + // this dirty trick is necessary because the button Allow is covered by the pop-up + // which is I can't find and close from the UI side + await customWorld.clickByScript(confirmUsingTrezorButton); } export async function allowPubKeysAndSwitchToYoroi(customWorld: any) { // press the Export button - await customWorld.click(exportTrezorButton); + await customWorld.waitForElement(exportTrezorButton); + // this dirty trick is necessary because the button Export is covered by the pop-up + // which is I can't find and close from the UI side + await customWorld.clickByScript(exportTrezorButton); // wait for closing the new tab await customWorld.windowManager.waitForClosingAndSwitchTo(trezorConnectTabName, extensionTabName); } From 6daeb941c04784dd0d6d745c3ec83ea92c10e238 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 27 Apr 2023 21:48:48 +0300 Subject: [PATCH 04/80] little addition for debugging --- .../yoroi-extension/features/step_definitions/common-steps.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/yoroi-extension/features/step_definitions/common-steps.js b/packages/yoroi-extension/features/step_definitions/common-steps.js index 3607108ab7..069e0a7a3f 100644 --- a/packages/yoroi-extension/features/step_definitions/common-steps.js +++ b/packages/yoroi-extension/features/step_definitions/common-steps.js @@ -560,6 +560,10 @@ Given(/^I have opened the extension$/, async function () { if (browserName === 'firefox') { await this.driver.manage().window().maximize(); } + // this string is for local debug only. It sets the same resolution as on Github virtual display + if (process.env.LIKE_GITHUB_DISPLAY != null && process.env.LIKE_GITHUB_DISPLAY === '1') { + this.driver.manage().window().setRect({ x: 0, y: 0, width: 989, height: 1113 }); + } }); Given(/^I refresh the page$/, async function () { From afd4ede2f7f36ad97b51c0479a51a938a37acac1 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 27 Apr 2023 21:49:14 +0300 Subject: [PATCH 05/80] minor change on CI --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5c2f4ee6ae..7a7b9e347b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -181,9 +181,9 @@ jobs: working-directory: ../trezor-user-env run: cp -rf src/binaries/firmware/bin/trezor-emu-core-v2-master ./ - - name: Copy the trezord-go-v2.0.31 to the root of the project + - name: Copy the trezord-go-v2.0.32 to the root of the project working-directory: ../trezor-user-env - run: cp -rf src/binaries/trezord-go/bin/trezord-go-v2.0.31 ./ + run: cp -rf src/binaries/trezord-go/bin/trezord-go-v2.0.32 ./ - name: Create the logs folder in the root of the trezor-user-env working-directory: ../trezor-user-env @@ -191,7 +191,7 @@ jobs: - name: Run the trezor user environment working-directory: ../trezor-user-env - run: sudo docker run -p 9001:9001 -p 9002:9002 -p 21326:21326 -p 127.0.0.1:21325:21326 -p 21324:21324 -v logs:/trezor-user-env/logs/screens -v trezor-emu-core-v2-master:/trezor-user-env/src/binaries/firmware/bin/user_downloaded -v trezord-go-v2.0.31:/trezor-user-env/src/binaries/trezord-go/bin -d emurgornd/trezor-user-env:latest + run: sudo docker run -p 9001:9001 -p 9002:9002 -p 21326:21326 -p 127.0.0.1:21325:21326 -p 21324:21324 -v logs:/trezor-user-env/logs/screens -v trezor-emu-core-v2-master:/trezor-user-env/src/binaries/firmware/bin/user_downloaded -v trezord-go-v2.0.32:/trezor-user-env/src/binaries/trezord-go/bin -d emurgornd/trezor-user-env:latest - uses: actions/checkout@v3 From 29044004a4dfd7b79f9680c9db924a2845316653 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 4 May 2023 09:23:27 +0300 Subject: [PATCH 06/80] await top window will not be presented --- .../yoroi-extension/features/step_definitions/common-steps.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/yoroi-extension/features/step_definitions/common-steps.js b/packages/yoroi-extension/features/step_definitions/common-steps.js index 069e0a7a3f..07011b5cbe 100644 --- a/packages/yoroi-extension/features/step_definitions/common-steps.js +++ b/packages/yoroi-extension/features/step_definitions/common-steps.js @@ -640,6 +640,7 @@ Given(/^I connected Trezor device ([^"]*)$/, async function (deviceId) { Given(/^I connected Trezor emulator device$/, async function () { // select connecting a HW wallet + this.webDriverLogger.info(`Step: I connected Trezor device`); await this.click(connectHwButton); // pick up currency await this.waitForElement(pickUpCurrencyDialog); @@ -661,6 +662,9 @@ Given(/^I connected Trezor emulator device$/, async function () { const name = await this.getValue(walletNameInput); expect(name).to.be.equal('Emulator'); await this.click(saveButton); + this.webDriverLogger.info(`Step: Wallet is connected and saved`); + await this.waitForElementNotPresent(walletSyncingOverlayComponent); + this.webDriverLogger.info(`Step: Wallet is fully synchronized`); }); async function restoreWalletsFromStorage(client) { From 5bac4115aad9c01b113e998b49fa108d5fe97743 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 4 May 2023 10:42:51 +0300 Subject: [PATCH 07/80] added waiting for window --- .../yoroi-extension/features/step_definitions/common-steps.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/yoroi-extension/features/step_definitions/common-steps.js b/packages/yoroi-extension/features/step_definitions/common-steps.js index 07011b5cbe..b987de9469 100644 --- a/packages/yoroi-extension/features/step_definitions/common-steps.js +++ b/packages/yoroi-extension/features/step_definitions/common-steps.js @@ -663,6 +663,7 @@ Given(/^I connected Trezor emulator device$/, async function () { expect(name).to.be.equal('Emulator'); await this.click(saveButton); this.webDriverLogger.info(`Step: Wallet is connected and saved`); + await this.waitForElement(walletSyncingOverlayComponent); await this.waitForElementNotPresent(walletSyncingOverlayComponent); this.webDriverLogger.info(`Step: Wallet is fully synchronized`); }); From 46fad0b80a1dde88563876385ea1303fdbca04a1 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Wed, 10 May 2023 22:04:00 +0300 Subject: [PATCH 08/80] feat: add back to current wallet button --- .../app/components/topbar/SidebarRevamp.js | 6 +- .../add-wallet-revamp/AddWalletPageHeader.js | 60 ++++++++++++------- .../app/containers/wallet/AddWalletPage.js | 1 + .../containers/wallet/AddWalletPageRevamp.js | 7 ++- .../app/i18n/locales/en-US.json | 3 +- 5 files changed, 50 insertions(+), 27 deletions(-) diff --git a/packages/yoroi-extension/app/components/topbar/SidebarRevamp.js b/packages/yoroi-extension/app/components/topbar/SidebarRevamp.js index cd0ce766c9..96da650d37 100644 --- a/packages/yoroi-extension/app/components/topbar/SidebarRevamp.js +++ b/packages/yoroi-extension/app/components/topbar/SidebarRevamp.js @@ -7,7 +7,7 @@ import styles from './SidebarRevamp.scss'; import type { SidebarCategoryRevamp } from '../../stores/stateless/sidebarCategories'; import { intlShape } from 'react-intl'; import type { $npm$ReactIntl$IntlFormat } from 'react-intl'; -import { ReactComponent as yoroiLogo } from '../../assets/images/sidebar/yoroi_logo.inline.svg'; +import { ReactComponent as yoroiLogo } from '../../assets/images/sidebar/yoroi_logo.inline.svg'; import globalMessages from '../../i18n/global-messages'; type Props = {| @@ -68,8 +68,8 @@ export default class SidebarRevamp extends Component { {intl.formatMessage(globalMessages.sidebarFaq)} diff --git a/packages/yoroi-extension/app/components/wallet/add-wallet-revamp/AddWalletPageHeader.js b/packages/yoroi-extension/app/components/wallet/add-wallet-revamp/AddWalletPageHeader.js index 178274e812..9964c50c55 100644 --- a/packages/yoroi-extension/app/components/wallet/add-wallet-revamp/AddWalletPageHeader.js +++ b/packages/yoroi-extension/app/components/wallet/add-wallet-revamp/AddWalletPageHeader.js @@ -6,49 +6,69 @@ import YoroiLogo from '../../../assets/images/yoroi-logo-shape-blue.inline.svg'; import { defineMessages, intlShape } from 'react-intl'; import { observer } from 'mobx-react'; import type { $npm$ReactIntl$IntlFormat } from 'react-intl'; -import { Typography, Box } from '@mui/material'; +import { Typography, Box, Button } from '@mui/material'; import globalMessages from '../../../i18n/global-messages'; +import { ReactComponent as BackIcon } from '../../../assets/images/assets-page/backarrow.inline.svg'; const messages: * = defineMessages({ subtitle: { id: 'wallet.add.page.revamp.subtitle', defaultMessage: '!!!Light wallet for Cardano assets', }, + backButtonLabel: { + id: 'wallet.add.page.revamp.backButtonLabel', + defaultMessage: '!!!Back to current wallet', + }, }); +type Props = {| + +goToCurrentWallet: void => void, +|}; + @observer -export default class AddWalletPageHeader extends Component<{||}> { +export default class AddWalletPageHeader extends Component { static contextTypes: {| intl: $npm$ReactIntl$IntlFormat |} = { intl: intlShape.isRequired, }; render(): Node { const { intl } = this.context; + const { goToCurrentWallet } = this.props; return ( - + + - Yoroi + + Yoroi + + + {intl.formatMessage(globalMessages.yoroi)} + + + {intl.formatMessage(messages.subtitle)} + - - {intl.formatMessage(globalMessages.yoroi)} - - - {intl.formatMessage(messages.subtitle)} - ); } diff --git a/packages/yoroi-extension/app/containers/wallet/AddWalletPage.js b/packages/yoroi-extension/app/containers/wallet/AddWalletPage.js index 6af1392b55..f7012332e2 100644 --- a/packages/yoroi-extension/app/containers/wallet/AddWalletPage.js +++ b/packages/yoroi-extension/app/containers/wallet/AddWalletPage.js @@ -386,6 +386,7 @@ class AddWalletPage extends Component { onHardwareConnect={() => this.openDialogWrapper(WalletConnectHWOptionDialog)} onCreate={() => goToRoute.trigger({ route: ROUTES.WALLETS.CREATE_NEW_WALLET })} onRestore={() => goToRoute.trigger({ route: ROUTES.WALLETS.RESTORE_WALLET })} + goToCurrentWallet={() => goToRoute.trigger({ route: ROUTES.WALLETS.TRANSACTIONS })} /> {activeDialog} diff --git a/packages/yoroi-extension/app/containers/wallet/AddWalletPageRevamp.js b/packages/yoroi-extension/app/containers/wallet/AddWalletPageRevamp.js index 611e0c02eb..86885ce5f6 100644 --- a/packages/yoroi-extension/app/containers/wallet/AddWalletPageRevamp.js +++ b/packages/yoroi-extension/app/containers/wallet/AddWalletPageRevamp.js @@ -8,17 +8,18 @@ type Props = {| +onCreate: void => void, +onRestore: void => void, +onHardwareConnect: void => void, + +goToCurrentWallet: void => void, |}; export default function AddWalletPageRevamp(props: Props): Node { return ( - + - ) -} \ No newline at end of file + ); +} diff --git a/packages/yoroi-extension/app/i18n/locales/en-US.json b/packages/yoroi-extension/app/i18n/locales/en-US.json index 30125fa15c..f51bf71ad9 100644 --- a/packages/yoroi-extension/app/i18n/locales/en-US.json +++ b/packages/yoroi-extension/app/i18n/locales/en-US.json @@ -464,6 +464,7 @@ "wallet.add.page.revamp.createWallet": "Create new wallet", "wallet.add.page.revamp.restoreWallet": "Restore existing wallet", "wallet.add.page.revamp.subtitle": "Light wallet for Cardano assets", + "wallet.add.page.revamp.backButtonLabel": "Back to current wallet", "wallet.add.page.subtitle.label": "Yoroi light wallet for Cardano", "wallet.add.page.title": "Your gateway
to the
financial world", "wallet.address.category.addressBook": "Addresses that do not belong to you, but are relevant to your wallet", @@ -1056,4 +1057,4 @@ "yoroiTransfer.waiting.progressInfo.checkingAddresses": "Checking addresses funds", "yoroiTransfer.waiting.progressInfo.restoringAddresses": "Fetching addresses", "yoroiTransfer.waiting.title.label": "Wallet is being restored" -} \ No newline at end of file +} From c7d60703d0ec7a1289a57956cc7893dcf78dcfc8 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Wed, 10 May 2023 22:22:05 +0300 Subject: [PATCH 09/80] feat: Make Yoroi logo in the blue side navigation clickable and lead to the main 'Creation / restoration' screen --- .../app/components/topbar/SidebarRevamp.js | 15 +++++++++++---- .../app/containers/SidebarContainer.js | 9 +++++---- .../wallet/CreateWalletPageContainer.js | 8 +++++++- .../wallet/restore/RestoreWalletPage.js | 8 +++++++- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/packages/yoroi-extension/app/components/topbar/SidebarRevamp.js b/packages/yoroi-extension/app/components/topbar/SidebarRevamp.js index 96da650d37..2a690786e2 100644 --- a/packages/yoroi-extension/app/components/topbar/SidebarRevamp.js +++ b/packages/yoroi-extension/app/components/topbar/SidebarRevamp.js @@ -7,7 +7,7 @@ import styles from './SidebarRevamp.scss'; import type { SidebarCategoryRevamp } from '../../stores/stateless/sidebarCategories'; import { intlShape } from 'react-intl'; import type { $npm$ReactIntl$IntlFormat } from 'react-intl'; -import { ReactComponent as yoroiLogo } from '../../assets/images/sidebar/yoroi_logo.inline.svg'; +import { ReactComponent as YoroiLogo } from '../../assets/images/sidebar/yoroi_logo.inline.svg'; import globalMessages from '../../i18n/global-messages'; type Props = {| @@ -15,6 +15,7 @@ type Props = {| +categories?: Array, +isActiveCategory?: SidebarCategoryRevamp => boolean, +onCategoryClicked?: SidebarCategoryRevamp => void, + +onLogoClick?: void => void, |}; @observer @@ -33,18 +34,24 @@ export default class SidebarRevamp extends Component { categories: undefined, isActiveCategory: undefined, onCategoryClicked: undefined, + onLogoClick: undefined, }; render(): Node { const { intl } = this.context; - const { categories, isActiveCategory, onCategoryClicked } = this.props; - const YoroiLogo = yoroiLogo; + const { categories, isActiveCategory, onCategoryClicked, onLogoClick } = this.props; return (
{this.props.children}
- + {onLogoClick ? ( + + ) : ( + + )}
{categories diff --git a/packages/yoroi-extension/app/containers/SidebarContainer.js b/packages/yoroi-extension/app/containers/SidebarContainer.js index eeaa2475bc..ca7ea17094 100644 --- a/packages/yoroi-extension/app/containers/SidebarContainer.js +++ b/packages/yoroi-extension/app/containers/SidebarContainer.js @@ -16,6 +16,7 @@ export type GeneratedData = typeof SidebarContainer.prototype.generated; type Props = {| ...InjectedOrGenerated, + +onLogoClick?: void => void, |}; type InjectedProps = {| +selectedLayout: string, @@ -32,6 +33,7 @@ class SidebarContainer extends Component { render(): Node { const { stores, actions } = this.generated; const { profile } = stores; + const { onLogoClick } = this.props; const SidebarComponent = ( { route: category.route, }); }} - isActiveCategory={category => - stores.app.currentRoute.startsWith(category.route) - } + isActiveCategory={category => stores.app.currentRoute.startsWith(category.route)} categories={allCategories.filter(category => category.isVisible({ hasAnyWallets: stores.wallets.hasAnyWallets, @@ -57,6 +57,7 @@ class SidebarContainer extends Component { const SidebarRevampComponent = ( { actions.router.goToRoute.trigger({ route: category.route, @@ -130,7 +131,7 @@ class SidebarContainer extends Component { hasAnyWallets: stores.wallets.hasAnyWallets, }, delegation: { - getDelegationRequests: stores.delegation.getDelegationRequests + getDelegationRequests: stores.delegation.getDelegationRequests, }, }, actions: { diff --git a/packages/yoroi-extension/app/containers/wallet/CreateWalletPageContainer.js b/packages/yoroi-extension/app/containers/wallet/CreateWalletPageContainer.js index b0cf2a1971..f0cf188720 100644 --- a/packages/yoroi-extension/app/containers/wallet/CreateWalletPageContainer.js +++ b/packages/yoroi-extension/app/containers/wallet/CreateWalletPageContainer.js @@ -11,6 +11,7 @@ import type { GeneratedData as SidebarContainerData } from '../SidebarContainer' import type { InjectedOrGenerated } from '../../types/injectedPropsType'; import type { NetworkRow } from '../../api/ada/lib/storage/database/primitives/tables'; import { PublicDeriver } from '../../api/ada/lib/storage/models/PublicDeriver'; +import { ROUTES } from '../../routes-config'; export const CreateWalletPagePromise: void => Promise = () => import('../../components/wallet/create-wallet/CreateWalletPage'); @@ -27,7 +28,12 @@ export default class CreateWalletPageContainer extends Component { return ( } - sidebar={} + sidebar={ + actions.router.goToRoute.trigger({ route: ROUTES.WALLETS.ADD })} + /> + } bgcolor="common.white" > diff --git a/packages/yoroi-extension/app/containers/wallet/restore/RestoreWalletPage.js b/packages/yoroi-extension/app/containers/wallet/restore/RestoreWalletPage.js index c57cbc4805..b07bcf8130 100644 --- a/packages/yoroi-extension/app/containers/wallet/restore/RestoreWalletPage.js +++ b/packages/yoroi-extension/app/containers/wallet/restore/RestoreWalletPage.js @@ -24,6 +24,7 @@ import TopBarLayout from '../../../components/layout/TopBarLayout'; import BannerContainer from '../../banners/BannerContainer'; import SidebarContainer from '../../SidebarContainer'; import LocalizableError from '../../../i18n/LocalizableError'; +import { ROUTES } from '../../../routes-config'; export const RestoreWalletPagePromise: void => Promise = () => import('../../../components/wallet/restore/RestoreWalletPage'); @@ -40,7 +41,12 @@ export default class RestoreWalletPage extends Component { return ( } - sidebar={} + sidebar={ + actions.router.goToRoute.trigger({ route: ROUTES.WALLETS.ADD })} + /> + } bgcolor="common.white" > Date: Wed, 10 May 2023 22:25:02 +0300 Subject: [PATCH 10/80] fix: add default value for onLogoClick prop --- .../yoroi-extension/app/components/topbar/SidebarRevamp.js | 1 + packages/yoroi-extension/app/containers/SidebarContainer.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/packages/yoroi-extension/app/components/topbar/SidebarRevamp.js b/packages/yoroi-extension/app/components/topbar/SidebarRevamp.js index 2a690786e2..674013d98c 100644 --- a/packages/yoroi-extension/app/components/topbar/SidebarRevamp.js +++ b/packages/yoroi-extension/app/components/topbar/SidebarRevamp.js @@ -29,6 +29,7 @@ export default class SidebarRevamp extends Component { children: void, isActiveCategory: void, onCategoryClicked: void, + onLogoClick: void, |} = { children: undefined, categories: undefined, diff --git a/packages/yoroi-extension/app/containers/SidebarContainer.js b/packages/yoroi-extension/app/containers/SidebarContainer.js index ca7ea17094..ef8411e678 100644 --- a/packages/yoroi-extension/app/containers/SidebarContainer.js +++ b/packages/yoroi-extension/app/containers/SidebarContainer.js @@ -30,6 +30,12 @@ class SidebarContainer extends Component { await this.generated.actions.profile.toggleSidebar.trigger(); }; + static defaultProps: {| + onLogoClick: void, + |} = { + onLogoClick: undefined, + }; + render(): Node { const { stores, actions } = this.generated; const { profile } = stores; From 82523b14a8defafd1499f05099e886dfab24277a Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Fri, 12 May 2023 11:59:42 -0400 Subject: [PATCH 11/80] New translations en-US.json (Hungarian) --- .../yoroi-extension/app/i18n/locales/hu-HU.json | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/packages/yoroi-extension/app/i18n/locales/hu-HU.json b/packages/yoroi-extension/app/i18n/locales/hu-HU.json index 7c0f4f349f..ecf739d297 100644 --- a/packages/yoroi-extension/app/i18n/locales/hu-HU.json +++ b/packages/yoroi-extension/app/i18n/locales/hu-HU.json @@ -667,6 +667,7 @@ "wallet.hw.incorrectDevice": "Incorrect device detected. Expected device {expectedDeviceId}, but got device {responseDeviceId}. Please plug in the correct device", "wallet.hw.incorrectVersion": "Incorrect device version detected. We support version {supportedVersions} but you have version {responseVersion}.", "wallet.hw.ledger.app.not.running": "The Cardano App is not running on your Ledger", + "wallet.hw.ledger.catalyst.cip36.unsupported": "Catalyst registration requires Ledger app version 6.", "wallet.hw.ledger.catalyst.unsupported.106": "Please upgrade your Ledger firmware version to at least 2.0.0 and Caradano app version to 2.3.2 or above.", "wallet.hw.ledger.common.error.101": "Operation cancelled on Ledger device.", "wallet.hw.ledger.common.error.102": "Operation cancelled by user.", @@ -1007,25 +1008,14 @@ "wallet.voting.dialog.completeLabel": "Complete", "wallet.voting.dialog.confirmPin": "Confirm PIN", "wallet.voting.dialog.registerLabel": "Register", - "wallet.voting.dialog.step.confirm.line1": "Please enter the PIN as you will need it every time you want to access the Catalyst Voting app.", - "wallet.voting.dialog.step.pin.actionButton": "Confirm that I wrote down the PIN", - "wallet.voting.dialog.step.pin.line1": "Please write down this PIN as you will need it every time you want to access the Catalyst Voting app.", - "wallet.voting.dialog.step.qr.actionButton": "Confirm that I saved the QR code", - "wallet.voting.dialog.step.qr.downloadQrCode": "Download QR code", - "wallet.voting.dialog.step.qr.line2": "The following QR code is the generated certificate required by the Catalyst App to be able to participate in the voting process of Cardano.", - "wallet.voting.dialog.step.qr.line3": "Also we suggest to take a screenshot of it as a backup — you won’t be able to access this QR code after clicking Complete.", - "wallet.voting.dialog.step.qr.lineTitle": "Use the Catalyst Voting App to scan the QR code", - "wallet.voting.dialog.step.register.line1": "Enter your spending password to be able to generate the required certificate for voting.", + "wallet.voting.dialog.step.done.lineTitle": "Voting key registered.", "wallet.voting.dialog.step.trx.ledger.info.line.1": "After connecting your Ledger device to your computer’s USB port, press the Register button.", "wallet.voting.dialog.step.trx.line1": "Confirm your spending password to register in the blockchain the certificate previously generated for voting.", "wallet.voting.dialog.step.trx.trezor.info.line.1": "After connecting your Trezor device to your computer, press the Register button.", - "wallet.voting.dialog.stepConfirm": "Confirm", - "wallet.voting.dialog.stepPin": "PIN", - "wallet.voting.dialog.stepQrCode": "QR Code", "wallet.voting.dialog.title": "Register for Voting", "wallet.voting.dialog.transactionLabel": "Transaction", "wallet.voting.keepDelegated": "Your voting power is how much you delegate and the voting rewards will be distributed to your delegation reward address. Please keep delegated until the voting ends.", - "wallet.voting.ledgerNanoRequirement": "Updatethe Cardano app on your Ledger to version 2.3.2 or above with Ledger Live.", + "wallet.voting.ledgerNanoRequirement": "Updatethe Cardano app on your Ledger to version 6 or above with Ledger Live.", "wallet.voting.line2": "Before you begin, make sure to complete steps below", "wallet.voting.line3": "Download the Catalyst Voting App.", "wallet.voting.line4": "Open the Catalyst Voting App and click on the Complete registration button.", From a2bca1ef57b59edcda02fc99a373ff34646c330e Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Fri, 12 May 2023 11:59:43 -0400 Subject: [PATCH 12/80] New translations en-US.json (Vietnamese) --- .../yoroi-extension/app/i18n/locales/vi-VN.json | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/packages/yoroi-extension/app/i18n/locales/vi-VN.json b/packages/yoroi-extension/app/i18n/locales/vi-VN.json index 506b907ea2..18a6db1a98 100644 --- a/packages/yoroi-extension/app/i18n/locales/vi-VN.json +++ b/packages/yoroi-extension/app/i18n/locales/vi-VN.json @@ -667,6 +667,7 @@ "wallet.hw.incorrectDevice": "Đã phát hiện thiết bị không chính xác. Cần có thiết bị {expectedDeviceId}, nhưng có thiết bị {responseDeviceId}. Vui lòng cắm đúng thiết bị", "wallet.hw.incorrectVersion": "Đã phát hiện phiên bản thiết bị không chính xác. Chúng tôi hỗ trợ phiên bản {supportedVersions} nhưng bạn có phiên bản {responseVersion}.", "wallet.hw.ledger.app.not.running": "Ứng dụng Cardano không chạy trên Sổ cái của bạn", + "wallet.hw.ledger.catalyst.cip36.unsupported": "Catalyst registration requires Ledger app version 6.", "wallet.hw.ledger.catalyst.unsupported.106": "Vui lòng nâng cấp phiên bản chương trình cơ sở Ledger của bạn lên ít nhất 2.0.0 và phiên bản ứng dụng Caradano lên 2.3.2 trở lên.", "wallet.hw.ledger.common.error.101": "Thao tác bị hủy trên thiết bị Ledger.", "wallet.hw.ledger.common.error.102": "Hoạt động bị hủy bỏ bởi người dùng.", @@ -1007,25 +1008,14 @@ "wallet.voting.dialog.completeLabel": "Hoàn thành", "wallet.voting.dialog.confirmPin": "Xác minh mã PIN", "wallet.voting.dialog.registerLabel": "Đăng ký", - "wallet.voting.dialog.step.confirm.line1": "Vui lòng nhập mã PIN vì bạn sẽ cần nó mỗi khi bạn muốn truy cập ứng dụng Catalyst Voting.", - "wallet.voting.dialog.step.pin.actionButton": "Xác nhận rằng tôi đã viết mã PIN", - "wallet.voting.dialog.step.pin.line1": "Vui lòng ghi lại mã PIN này vì bạn sẽ cần nó mỗi lần bạn muốn truy cập ứng dụng Catalyst Voting.", - "wallet.voting.dialog.step.qr.actionButton": "Xác nhận rằng tôi đã lưu mã QR", - "wallet.voting.dialog.step.qr.downloadQrCode": "Tải xuống mã QR", - "wallet.voting.dialog.step.qr.line2": "Mã QR sau đây là chứng chỉ được tạo bởi Ứng dụng Catalyst để có thể tham gia vào quá trình bỏ phiếu của Cardano.", - "wallet.voting.dialog.step.qr.line3": "Ngoài ra, chúng tôi khuyên bạn nên chụp ảnh màn hình của nó để sao lưu — bạn sẽ không thể truy cập mã QR này sau khi nhấp vào Hoàn thành.", - "wallet.voting.dialog.step.qr.lineTitle": "Sử dụng Ứng dụng bỏ phiếu Catalyst để quét mã QR", - "wallet.voting.dialog.step.register.line1": "Nhập mật khẩu chi tiêu của bạn để có thể tạo chứng chỉ cần thiết cho việc bỏ phiếu.", + "wallet.voting.dialog.step.done.lineTitle": "Voting key registered.", "wallet.voting.dialog.step.trx.ledger.info.line.1": "Sau khi kết nối thiết bị Ledger của bạn với cổng USB của máy tính, hãy nhấn nút Đăng ký.", "wallet.voting.dialog.step.trx.line1": "Xác nhận mật khẩu chi tiêu của bạn để đăng ký trong chuỗi khối chứng chỉ được tạo trước đó để bỏ phiếu.", "wallet.voting.dialog.step.trx.trezor.info.line.1": "Sau khi kết nối thiết bị Trezor với máy tính, hãy nhấn nút Đăng ký.", - "wallet.voting.dialog.stepConfirm": "Xác nhận", - "wallet.voting.dialog.stepPin": "PIN", - "wallet.voting.dialog.stepQrCode": "Mã QR", "wallet.voting.dialog.title": "Đăng ký bỏ phiếu", "wallet.voting.dialog.transactionLabel": "Giao dịch", "wallet.voting.keepDelegated": "Quyền biểu quyết của bạn là số tiền bạn ủy quyền và phần thưởng biểu quyết sẽ được phân phối tới địa chỉ phần thưởng ủy quyền của bạn. Vui lòng tiếp tục được ủy quyền cho đến khi cuộc biểu quyết kết thúc.", - "wallet.voting.ledgerNanoRequirement": "Cập nhậtứng dụng Cardano trên ví Ledger lên phiên bản 2.3.2 hoặc cao hơn Ledger Live.", + "wallet.voting.ledgerNanoRequirement": "Updatethe Cardano app on your Ledger to version 6 or above with Ledger Live.", "wallet.voting.line2": "Trước khi bạn bắt đầu, hãy đảm bảo hoàn thành các bước bên dưới", "wallet.voting.line3": "Tải xuống ứng dụng bỏ phiếu Catalyst.", "wallet.voting.line4": "Mở Ứng dụng bỏ phiếu của Catalyst và nhấp vào nút Hoàn thành đăng ký.", From af9ab778bd208bcf99384db58b52f9fd44812daf Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Fri, 12 May 2023 20:42:41 -0400 Subject: [PATCH 13/80] New translations en-US.json (Vietnamese) --- packages/yoroi-extension/app/i18n/locales/vi-VN.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/yoroi-extension/app/i18n/locales/vi-VN.json b/packages/yoroi-extension/app/i18n/locales/vi-VN.json index 18a6db1a98..fb595e5c43 100644 --- a/packages/yoroi-extension/app/i18n/locales/vi-VN.json +++ b/packages/yoroi-extension/app/i18n/locales/vi-VN.json @@ -667,7 +667,7 @@ "wallet.hw.incorrectDevice": "Đã phát hiện thiết bị không chính xác. Cần có thiết bị {expectedDeviceId}, nhưng có thiết bị {responseDeviceId}. Vui lòng cắm đúng thiết bị", "wallet.hw.incorrectVersion": "Đã phát hiện phiên bản thiết bị không chính xác. Chúng tôi hỗ trợ phiên bản {supportedVersions} nhưng bạn có phiên bản {responseVersion}.", "wallet.hw.ledger.app.not.running": "Ứng dụng Cardano không chạy trên Sổ cái của bạn", - "wallet.hw.ledger.catalyst.cip36.unsupported": "Catalyst registration requires Ledger app version 6.", + "wallet.hw.ledger.catalyst.cip36.unsupported": "Đăng ký Catalyst yêu cầu ứng dụng Ledger phiên bản 6.", "wallet.hw.ledger.catalyst.unsupported.106": "Vui lòng nâng cấp phiên bản chương trình cơ sở Ledger của bạn lên ít nhất 2.0.0 và phiên bản ứng dụng Caradano lên 2.3.2 trở lên.", "wallet.hw.ledger.common.error.101": "Thao tác bị hủy trên thiết bị Ledger.", "wallet.hw.ledger.common.error.102": "Hoạt động bị hủy bỏ bởi người dùng.", @@ -1008,7 +1008,7 @@ "wallet.voting.dialog.completeLabel": "Hoàn thành", "wallet.voting.dialog.confirmPin": "Xác minh mã PIN", "wallet.voting.dialog.registerLabel": "Đăng ký", - "wallet.voting.dialog.step.done.lineTitle": "Voting key registered.", + "wallet.voting.dialog.step.done.lineTitle": "Đăng ký khóa bỏ phiếu.", "wallet.voting.dialog.step.trx.ledger.info.line.1": "Sau khi kết nối thiết bị Ledger của bạn với cổng USB của máy tính, hãy nhấn nút Đăng ký.", "wallet.voting.dialog.step.trx.line1": "Xác nhận mật khẩu chi tiêu của bạn để đăng ký trong chuỗi khối chứng chỉ được tạo trước đó để bỏ phiếu.", "wallet.voting.dialog.step.trx.trezor.info.line.1": "Sau khi kết nối thiết bị Trezor với máy tính, hãy nhấn nút Đăng ký.", From 0c5d5c84208167e68a3cdf51b44eab402b1b63a3 Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Fri, 12 May 2023 21:47:00 -0400 Subject: [PATCH 14/80] New translations en-US.json (Vietnamese) --- packages/yoroi-extension/app/i18n/locales/vi-VN.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/i18n/locales/vi-VN.json b/packages/yoroi-extension/app/i18n/locales/vi-VN.json index fb595e5c43..5ec79ad4ce 100644 --- a/packages/yoroi-extension/app/i18n/locales/vi-VN.json +++ b/packages/yoroi-extension/app/i18n/locales/vi-VN.json @@ -1015,7 +1015,7 @@ "wallet.voting.dialog.title": "Đăng ký bỏ phiếu", "wallet.voting.dialog.transactionLabel": "Giao dịch", "wallet.voting.keepDelegated": "Quyền biểu quyết của bạn là số tiền bạn ủy quyền và phần thưởng biểu quyết sẽ được phân phối tới địa chỉ phần thưởng ủy quyền của bạn. Vui lòng tiếp tục được ủy quyền cho đến khi cuộc biểu quyết kết thúc.", - "wallet.voting.ledgerNanoRequirement": "Updatethe Cardano app on your Ledger to version 6 or above with Ledger Live.", + "wallet.voting.ledgerNanoRequirement": "Cập nhậtứng dụng Cardano trên ví Ledger lên phiên bản 6 hoặc cao hơn Ledger Live.", "wallet.voting.line2": "Trước khi bạn bắt đầu, hãy đảm bảo hoàn thành các bước bên dưới", "wallet.voting.line3": "Tải xuống ứng dụng bỏ phiếu Catalyst.", "wallet.voting.line4": "Mở Ứng dụng bỏ phiếu của Catalyst và nhấp vào nút Hoàn thành đăng ký.", From 1a4241582fc220089bb34e180fc67f8170e54349 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Mon, 15 May 2023 16:22:13 +0300 Subject: [PATCH 15/80] fix: hide the back button if there are no wallets --- .../add-wallet-revamp/AddWalletPageHeader.js | 21 +++++++++++-------- .../app/containers/wallet/AddWalletPage.js | 1 + .../containers/wallet/AddWalletPageRevamp.js | 6 +++++- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/add-wallet-revamp/AddWalletPageHeader.js b/packages/yoroi-extension/app/components/wallet/add-wallet-revamp/AddWalletPageHeader.js index 9964c50c55..e67ddd0939 100644 --- a/packages/yoroi-extension/app/components/wallet/add-wallet-revamp/AddWalletPageHeader.js +++ b/packages/yoroi-extension/app/components/wallet/add-wallet-revamp/AddWalletPageHeader.js @@ -23,6 +23,7 @@ const messages: * = defineMessages({ type Props = {| +goToCurrentWallet: void => void, + +hasAnyWallets: boolean, |}; @observer @@ -33,18 +34,20 @@ export default class AddWalletPageHeader extends Component { render(): Node { const { intl } = this.context; - const { goToCurrentWallet } = this.props; + const { goToCurrentWallet, hasAnyWallets } = this.props; return ( - + {hasAnyWallets && ( + + )} { onCreate={() => goToRoute.trigger({ route: ROUTES.WALLETS.CREATE_NEW_WALLET })} onRestore={() => goToRoute.trigger({ route: ROUTES.WALLETS.RESTORE_WALLET })} goToCurrentWallet={() => goToRoute.trigger({ route: ROUTES.WALLETS.TRANSACTIONS })} + hasAnyWallets={hasAnyWallets} /> {activeDialog} diff --git a/packages/yoroi-extension/app/containers/wallet/AddWalletPageRevamp.js b/packages/yoroi-extension/app/containers/wallet/AddWalletPageRevamp.js index 86885ce5f6..15a826176d 100644 --- a/packages/yoroi-extension/app/containers/wallet/AddWalletPageRevamp.js +++ b/packages/yoroi-extension/app/containers/wallet/AddWalletPageRevamp.js @@ -9,12 +9,16 @@ type Props = {| +onRestore: void => void, +onHardwareConnect: void => void, +goToCurrentWallet: void => void, + +hasAnyWallets: boolean, |}; export default function AddWalletPageRevamp(props: Props): Node { return ( - + Date: Thu, 18 May 2023 10:47:24 +0300 Subject: [PATCH 16/80] added ids on ConnectPage --- .../app/connector/components/connect/ConnectPage.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/yoroi-extension/app/connector/components/connect/ConnectPage.js b/packages/yoroi-extension/app/connector/components/connect/ConnectPage.js index f1d456d514..84fde706b3 100644 --- a/packages/yoroi-extension/app/connector/components/connect/ConnectPage.js +++ b/packages/yoroi-extension/app/connector/components/connect/ConnectPage.js @@ -244,6 +244,7 @@ class ConnectPage extends Component { type="password" {...walletPasswordField.bind()} error={walletPasswordField.error} + id="passwordField" /> )}
@@ -253,6 +254,7 @@ class ConnectPage extends Component { variant={isRevampLayout ? 'outlined' : 'secondary'} onClick={this.hidePasswordForm} sx={{ minWidth: 'auto' }} + id="backButton" > {intl.formatMessage(globalMessages.backButtonLabel)} @@ -263,6 +265,7 @@ class ConnectPage extends Component { fullWidth disabled={!walletPasswordField.isValid} onClick={this.submit} + id="confirmButton" > {intl.formatMessage(globalMessages.confirm)} From a4c3652d99417866772fba256d7f30b5610f7e1d Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 18 May 2023 10:48:06 +0300 Subject: [PATCH 17/80] added ids on CardanoSignTxPage --- .../app/connector/components/signin/CardanoSignTxPage.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/yoroi-extension/app/connector/components/signin/CardanoSignTxPage.js b/packages/yoroi-extension/app/connector/components/signin/CardanoSignTxPage.js index c601692cf8..b2d1395e1e 100644 --- a/packages/yoroi-extension/app/connector/components/signin/CardanoSignTxPage.js +++ b/packages/yoroi-extension/app/connector/components/signin/CardanoSignTxPage.js @@ -390,6 +390,7 @@ class SignTxPage extends Component { passwordFormField={ @@ -486,6 +487,7 @@ class SignTxPage extends Component { color="primary" onClick={onCancel} disabled={isSubmitting} + id="cancelButton" > {intl.formatMessage(globalMessages.cancel)} @@ -499,6 +501,7 @@ class SignTxPage extends Component { } onClick={this.submit.bind(this)} sx={{ minWidth: 0 }} + id="confirmButton" > {intl.formatMessage(confirmButtonLabel)} From 2365f40c4cbff648bc179c01d139c7b3b600df0d Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 18 May 2023 10:49:17 +0300 Subject: [PATCH 18/80] added ids on SignTx --- .../app/connector/components/signin/cardano/SignTx.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/yoroi-extension/app/connector/components/signin/cardano/SignTx.js b/packages/yoroi-extension/app/connector/components/signin/cardano/SignTx.js index 67340343d2..d612cb6081 100644 --- a/packages/yoroi-extension/app/connector/components/signin/cardano/SignTx.js +++ b/packages/yoroi-extension/app/connector/components/signin/cardano/SignTx.js @@ -57,12 +57,12 @@ function CardanoSignTx({ renderExplorerHashLink={renderExplorerHashLink} txAssetsData={txAssetsData} /> - - + + {intl.formatMessage(signTxMessages.transactionFee)} - + {total.fee} {total.ticker} @@ -168,7 +168,7 @@ const ExpandableAssetsPanel = ({ }; const AsseetValueDisplay = ({ children }): Node => ( - + {children} From 0d1101277c7bf315208718903e9f727544daedf6 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 18 May 2023 10:49:53 +0300 Subject: [PATCH 19/80] added ids on SignTxSummary --- .../app/connector/components/signin/cardano/SignTxSummary.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/yoroi-extension/app/connector/components/signin/cardano/SignTxSummary.js b/packages/yoroi-extension/app/connector/components/signin/cardano/SignTxSummary.js index 8a4d8098df..4710b5a5f3 100644 --- a/packages/yoroi-extension/app/connector/components/signin/cardano/SignTxSummary.js +++ b/packages/yoroi-extension/app/connector/components/signin/cardano/SignTxSummary.js @@ -81,11 +81,11 @@ function CardanoSignTxSummary({ color="var(--yoroi-palette-common-white)" sx={{ background: 'linear-gradient(30.09deg, #244ABF 0%, #4760FF 176.73%)' }} > - + {intl.formatMessage(signTxMessages.summary)} - + {showOnlyTxFee ? total.fee : total.total} {total.ticker} From a2a7286cbffa510d087f5a84330071170a4d7b82 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 18 May 2023 10:51:32 +0300 Subject: [PATCH 20/80] updated test locators --- .../pages/connector-connectWalletPage.js | 22 ++++++++----- .../features/pages/connector-signingTxPage.js | 31 +++++++++++++------ 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/packages/yoroi-extension/features/pages/connector-connectWalletPage.js b/packages/yoroi-extension/features/pages/connector-connectWalletPage.js index 6247e226d6..fd5afd015a 100644 --- a/packages/yoroi-extension/features/pages/connector-connectWalletPage.js +++ b/packages/yoroi-extension/features/pages/connector-connectWalletPage.js @@ -14,31 +14,39 @@ export const createWalletBtn: LocatorObject = { method: 'css', }; export const walletListElement: LocatorObject = { locator: '.ConnectPage_list', method: 'css' }; -export const walletNameField: LocatorObject = { locator: 'div.WalletCard_name', method: 'css' }; +export const walletNameField: LocatorObject = { + locator: 'div.ConnectedWallet_nameWrapper', + method: 'css', +}; export const walletItemButton: LocatorObject = { locator: './button', method: 'xpath' }; export const walletBalanceField: LocatorObject = { locator: '.WalletCard_balance', method: 'css' }; export const spendingPasswordInput: LocatorObject = { - locator: '//input[@name="walletPassword"]', - method: 'xpath', + locator: 'passwordField', + method: 'id', }; export const spendingPasswordErrorField: LocatorObject = { locator: '//p[starts-with(@id, "walletPassword--") and contains(@id, "-helper-text")]', method: 'xpath', }; export const eyeButton: LocatorObject = { locator: '.MuiIconButton-edgeEnd', method: 'css' }; -export const confirmButton: LocatorObject = { locator: '.MuiButton-primary', method: 'css' }; -export const backButton: LocatorObject = { locator: '.MuiButton-secondary', method: 'css' }; +export const confirmButton: LocatorObject = { locator: 'confirmButton', method: 'id' }; +export const backButton: LocatorObject = { locator: 'backButton', method: 'id' }; export const getWallets = async (customWorld: Object): Promise> => { const walletList = await customWorld.waitForElement(walletListElement); return await walletList.findElements(By.css('li')); }; -export const getWalletName = async (wallets: Array, index: number): Promise => { +export const getWalletNameAndPlate = async ( + wallets: Array, + index: number +): Promise<{| walletName: string, walletPlate: string |}> => { const walletNameFieldElem = await wallets[index].findElement( getMethod(walletNameField.method)(walletNameField.locator) ); - return await walletNameFieldElem.getText(); + const fullText = await walletNameFieldElem.getText(); + const [name, walletPlate] = fullText.split('\n') + return { walletName: name, walletPlate }; }; export const getWalletBalance = async ( diff --git a/packages/yoroi-extension/features/pages/connector-signingTxPage.js b/packages/yoroi-extension/features/pages/connector-signingTxPage.js index f5c293eeb7..7607c7e084 100644 --- a/packages/yoroi-extension/features/pages/connector-signingTxPage.js +++ b/packages/yoroi-extension/features/pages/connector-signingTxPage.js @@ -18,14 +18,19 @@ const utxoAddresses = 'UTXO addresses'; const getTabButton = (tabName: string) => `//div[@role="tablist"]/button[contains(text(), "${tabName}")]`; -export const transactionFeeTitle: LocatorObject = { - locator: '//p[contains(text(), "Transaction Fee")]', - method: 'xpath', -}; +export const transactionFeeText: LocatorObject = { + locator: 'signTxAdditionalInfoPanelBox-fee', + method: 'id', +} + +export const summaryBox: LocatorObject = { + locator: 'signTxMessagesSummaryBox', + method: 'id', +} export const transactionTotalAmountField: LocatorObject = { - locator: '//p[contains(text(), "Total Amount")]', - method: 'xpath', + locator: 'signTxMessagesSummaryBox-total', + method: 'id', }; const addressesPanel: LocatorObject = { @@ -33,6 +38,11 @@ const addressesPanel: LocatorObject = { method: 'xpath', }; +const amountTextField: LocatorObject = { + locator: 'asseetValueDisplayBox', + method: 'id', +}; + const getToAddressesPanel = async (customWorld: Object): Promise => { return (await customWorld.findElements(addressesPanel))[1]; }; @@ -96,12 +106,15 @@ export const utxoAddressesTabButton: LocatorObject = { export const walletBalanceField: LocatorObject = { locator: '.WalletCard_balance', method: 'css' }; export const getTransactionFee = async (customWorld: Object): Promise => { - const titleElement = await customWorld.findElement(transactionFeeTitle); - const parentElement = await titleElement.findElement(By.xpath('./..')); - const amountFieldElement = (await parentElement.findElements(By.xpath('./p')))[1]; + const amountFieldElement = await customWorld.findElement(transactionFeeText); return (await amountFieldElement.getText()).split(' ')[0]; }; +export const getTransactionSentAmount = async (customWorld: Object): Promise => { + const allAmountBlocks = await customWorld.findElements(amountTextField) + return (await allAmountBlocks[0].getText()).split(' ')[0]; +} + export const getTransactionAmount = async (customWorld: Object): Promise => { const titleElement = await customWorld.findElement(transactionTotalAmountField); const parentElement = await titleElement.findElement(By.xpath('./..')); From 2efaf73f35466e8a3f96ba4deb0047ee33acda6a Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 18 May 2023 10:51:47 +0300 Subject: [PATCH 21/80] wip connector-steps --- .../step_definitions/connector-steps.js | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/packages/yoroi-extension/features/step_definitions/connector-steps.js b/packages/yoroi-extension/features/step_definitions/connector-steps.js index a97f101ca0..d9093029f8 100644 --- a/packages/yoroi-extension/features/step_definitions/connector-steps.js +++ b/packages/yoroi-extension/features/step_definitions/connector-steps.js @@ -7,7 +7,7 @@ import { confirmButton, createWalletBtn, getWalletBalance, - getWalletName, + getWalletNameAndPlate, getWallets, logoElement, noWalletsImg, @@ -19,10 +19,9 @@ import { disconnectWallet, getWalletsWithConnectedWebsites } from '../pages/conn import { getTransactionFee, overviewTabButton, - getTransactionAmount, + getTransactionSentAmount, utxoAddressesTabButton, getUTXOAddresses, - transactionFeeTitle, cancelButton, transactionTotalAmountField, } from '../pages/connector-signingTxPage'; @@ -107,26 +106,27 @@ Then(/^There is no the connector popup$/, async function () { Then( /^I select the only wallet named (.+) with ([0-9.]+) balance$/, - async function (walletName, expectedBalance) { + async function (expectedWalletName, expectedBalance) { this.webDriverLogger.info( - `Step: I select the only wallet named ${walletName} with ${expectedBalance} balance` + `Step: I select the only wallet named ${expectedWalletName} with ${expectedBalance} balance` ); const wallets = await getWallets(this); expect(wallets.length).to.equal(1, `expect 1 wallet but get ${wallets.length}`); - const name = await getWalletName(wallets, 0); - expect(name).to.equal( - walletName, - `expect wallet name ${walletName} but get wallet name ${name}` - ); - const balance = await getWalletBalance(wallets, 0); - const match = balance.match(/^[0-9.]+/); - expect(match, 'Can not get wallet balance').to.not.be.null; - // $FlowFixMe[incompatible-use] - const balanceMatch = match[0]; - expect(balanceMatch).to.equal( - expectedBalance, - `expect wallet balance ${expectedBalance} but get ${balanceMatch}` + const { walletName } = await getWalletNameAndPlate(wallets, 0); + expect(walletName).to.equal( + expectedWalletName, + `expect wallet name ${expectedWalletName} but get wallet name ${walletName}` ); + // TODO uncomment when the balance will be displayed + // const balance = await getWalletBalance(wallets, 0); + // const match = balance.match(/^[0-9.]+/); + // expect(match, 'Can not get wallet balance').to.not.be.null; + // // $FlowFixMe[incompatible-use] + // const balanceMatch = match[0]; + // expect(balanceMatch).to.equal( + // expectedBalance, + // `expect wallet balance ${expectedBalance} but get ${balanceMatch}` + // ); await selectWallet(wallets, 0); await this.driver.sleep(1000); } @@ -191,13 +191,12 @@ Then(/^I should see the transaction amount data:$/, async function (table) { await this.waitForElement(overviewTabButton); const fields = table.hashes()[0]; const realFee = await getTransactionFee(this); - const expectedFee = `-${fields.fee}`; - const realFullAmount = await getTransactionAmount(this); + const realFullAmount = await getTransactionSentAmount(this); const expectedTotalAmount = `-${parseFloat(fields.amount) + parseFloat(fields.fee)}`; this.webDriverLogger.info( - `Step: I should see the transaction amount data: amount: ${expectedTotalAmount}, fee: ${expectedFee} ` + `Step: I should see the transaction amount data: amount: ${expectedTotalAmount}, fee: ${fields.fee} ` ); - expect(realFee, 'Fee is different').to.equal(expectedFee); + expect(realFee, 'Fee is different').to.equal(fields.fee); expect(realFullAmount, 'Total amount is different').to.equal(expectedTotalAmount); }); @@ -242,7 +241,7 @@ Then(/^I should see the transaction addresses info:$/, async function (table) { Received:\n${JSON.stringify(realFromAddresses)}` ).to.equal(1); await this.click(overviewTabButton); - await this.waitForElement(transactionFeeTitle); + // await this.waitForElement(transactionFeeTitle); }); Then(/^The signing transaction API should return (.+)$/, async function (txHex) { From 58c9269d3037a42cc79b30ee0368408fb5260f1c Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 18 May 2023 19:21:46 +0300 Subject: [PATCH 22/80] fixed checkIfExists --- .../features/support/webdriver.js | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/packages/yoroi-extension/features/support/webdriver.js b/packages/yoroi-extension/features/support/webdriver.js index 9030c8f050..0404785566 100644 --- a/packages/yoroi-extension/features/support/webdriver.js +++ b/packages/yoroi-extension/features/support/webdriver.js @@ -375,15 +375,32 @@ function CustomWorld(cmdInput: WorldInput) { this.checkIfExists = async (locator: LocatorObject) => { this.webDriverLogger.info(`Webdriver: Checking if element exists "${JSON.stringify(locator)}"`); - return await this.driver.findElement(getMethod(locator.method)(locator.locator)).then( - () => true, - err => { - if (err instanceof error.NoSuchElementError) { - return false; + const state = this.driver + .findElement(getMethod(locator.method)(locator.locator)) + .then( + (response) => { + this.webDriverLogger.info(`Webdriver:checkIfExists: Response is received: ${response}`); + this.webDriverLogger.info(`Webdriver:checkIfExists: The element "${JSON.stringify(locator)}" exists`); + return true; + }, + (err) => { + if (err instanceof error.NoSuchElementError) { + this.webDriverLogger.info(`Webdriver:checkIfExists: The element "${JSON.stringify(locator)}" does not exists`); + return false; + } + promise.rejected(err); // some other error } - promise.rejected(err); // some other error - } - ); + ).catch( + (err) => { + if (err instanceof error.NoSuchElementError){ + this.webDriverLogger.info(`Webdriver:checkIfExists: The element "${JSON.stringify(locator)}" does not exists`); + return false; + } + throw(err) + } + ) + + return state; }; this.customWaiter = async ( From f5012349e74ffcae2b1037cacf903c490aca0755 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 18 May 2023 19:51:06 +0300 Subject: [PATCH 23/80] updated connector-signingTxPage.js --- .../features/pages/connector-signingTxPage.js | 125 +++++++++++++----- 1 file changed, 92 insertions(+), 33 deletions(-) diff --git a/packages/yoroi-extension/features/pages/connector-signingTxPage.js b/packages/yoroi-extension/features/pages/connector-signingTxPage.js index 7607c7e084..b83072a87a 100644 --- a/packages/yoroi-extension/features/pages/connector-signingTxPage.js +++ b/packages/yoroi-extension/features/pages/connector-signingTxPage.js @@ -2,6 +2,7 @@ import { By, WebElement } from 'selenium-webdriver'; import type { LocatorObject } from '../support/webdriver'; +import { getMethod } from '../support/helpers/helpers'; type AddressWithAmount = {| address: string, @@ -13,67 +14,94 @@ type AddressesWithAmount = {| toAddresses: Array, |}; -const overview = 'Overview'; -const utxoAddresses = 'UTXO addresses'; -const getTabButton = (tabName: string) => - `//div[@role="tablist"]/button[contains(text(), "${tabName}")]`; +const detailsTabName = 'Details'; +const utxosTabName = 'UTxOs'; +const connectionTabName = 'Connection'; + +const getTabButton = (tabName: string) => `//div[@role="tablist"]/button/p[text()="${tabName}"]`; export const transactionFeeText: LocatorObject = { locator: 'signTxAdditionalInfoPanelBox-fee', method: 'id', -} +}; export const summaryBox: LocatorObject = { locator: 'signTxMessagesSummaryBox', method: 'id', -} +}; export const transactionTotalAmountField: LocatorObject = { locator: 'signTxMessagesSummaryBox-total', method: 'id', }; -const addressesPanel: LocatorObject = { - locator: '//div[@role="tabpanel"][2]/div/div/div', - method: 'xpath', -}; - const amountTextField: LocatorObject = { locator: 'asseetValueDisplayBox', method: 'id', }; -const getToAddressesPanel = async (customWorld: Object): Promise => { - return (await customWorld.findElements(addressesPanel))[1]; +const fromAddressYourInputs: LocatorObject = { + locator: 'fromAddressesBox-yourInputs', + method: 'id', +}; + +const fromAddressForeignInputs: LocatorObject = { + locator: 'fromAddressesBox-foreignInputs', + method: 'id', +}; + +const toAddressYourInputs: LocatorObject = { + locator: 'toAddressesBox-yourOutputs', + method: 'id', +}; + +const toAddressForeignInputs: LocatorObject = { + locator: 'toAddressesBox-foreignOutputs', + method: 'id', +}; + +const addressRowLocator: LocatorObject = { + locator: 'addressRow', + method: 'id', }; -const getFromAddressesPanel = async (customWorld: Object): Promise => { - return (await customWorld.findElements(addressesPanel))[0]; +const addressRowAddressInfo: LocatorObject = { + locator: './div[@class="CopyableAddress_component"]', + method: 'xpath', +} + +const addressRowAmount: LocatorObject = { + locator: 'addressRow-amount', + method: 'id', }; const getAddressesRows = async (addressPart: WebElement): Promise> => { - return await addressPart.findElements(By.xpath('./div[2]/div')); + return await addressPart.findElements( + getMethod(addressRowLocator.method)(addressRowLocator.locator) + ); }; const getAddressFromRow = async (addressRow: WebElement): Promise => { const addressElement = await addressRow.findElement( - By.xpath('./div[@class="CopyableAddress_component"]') + getMethod(addressRowAddressInfo.method)(addressRowAddressInfo.locator) ); return await addressElement.getText(); }; // should be improved in case of several outputs const getAmountFromRow = async (addressRow: WebElement): Promise => { - const amountElement = await addressRow.findElement(By.xpath('./div[2]')); + const amountElement = await addressRow.findElement( + getMethod(addressRowAmount.method)(addressRowAmount.locator) + ); return (await amountElement.getText()).split(' ')[0]; }; const getAddresses = async (addressesPart: WebElement): Promise> => { const result = []; - const fromAddressesRows = await getAddressesRows(addressesPart); - for (const fromAddressesRow of fromAddressesRows) { - const address = await getAddressFromRow(fromAddressesRow); - const amountString = await getAmountFromRow(fromAddressesRow); + const addressesRows = await getAddressesRows(addressesPart); + for (const addressesRow of addressesRows) { + const address = await getAddressFromRow(addressesRow); + const amountString = await getAmountFromRow(addressesRow); const amount = parseFloat(amountString); result.push({ address, @@ -84,22 +112,53 @@ const getAddresses = async (addressesPart: WebElement): Promise> => { - const fromAddressesPart = await getFromAddressesPanel(customWorld); - return await getAddresses(fromAddressesPart); + const result = []; + if (await customWorld.checkIfExists(fromAddressYourInputs)) { + const fromAddressesYourInputsBoxElem = await customWorld.findElement(fromAddressYourInputs); + const fromAddressesYourArr = await getAddresses(fromAddressesYourInputsBoxElem); + result.push(...fromAddressesYourArr); + } + if (await customWorld.checkIfExists(fromAddressForeignInputs)) { + const fromAddressesForeignInputsBoxElem = await customWorld.findElement( + fromAddressForeignInputs + ); + const fromAddressesForeignArr = await getAddresses(fromAddressesForeignInputsBoxElem); + result.push(...fromAddressesForeignArr); + } + + return result; }; -const getToAddresses = async (customWorld: Object): Promise> => { - const toAddressesPart = await getToAddressesPanel(customWorld); - return await getAddresses(toAddressesPart); +const getToAddresses = async (customWorld): Promise> => { + const result = []; + if (await customWorld.checkIfExists(toAddressYourInputs)) { + const toAddressesYourInputsBoxElem = await customWorld.findElement(toAddressYourInputs); + const toAddressesYourArr = await getAddresses(toAddressesYourInputsBoxElem); + result.push(...toAddressesYourArr); + } + if (await customWorld.checkIfExists(toAddressForeignInputs)) { + const toAddressesForeignInputsBoxElem = await customWorld.findElement( + toAddressForeignInputs + ); + const toAddressesForeignArr = await getAddresses(toAddressesForeignInputsBoxElem); + result.push(...toAddressesForeignArr); + } + + return result; }; -export const overviewTabButton: LocatorObject = { - locator: getTabButton(overview), +export const detailsTabButton: LocatorObject = { + locator: getTabButton(detailsTabName), method: 'xpath', }; -export const utxoAddressesTabButton: LocatorObject = { - locator: getTabButton(utxoAddresses), +export const utxosTabButton: LocatorObject = { + locator: getTabButton(utxosTabName), + method: 'xpath', +}; + +export const connectionTabButton: LocatorObject = { + locator: getTabButton(connectionTabName), method: 'xpath', }; @@ -111,9 +170,9 @@ export const getTransactionFee = async (customWorld: Object): Promise => }; export const getTransactionSentAmount = async (customWorld: Object): Promise => { - const allAmountBlocks = await customWorld.findElements(amountTextField) + const allAmountBlocks = await customWorld.findElements(amountTextField); return (await allAmountBlocks[0].getText()).split(' ')[0]; -} +}; export const getTransactionAmount = async (customWorld: Object): Promise => { const titleElement = await customWorld.findElement(transactionTotalAmountField); From fe42c0b9514c5729ae6d207a2898c7faaf9bd4ad Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 18 May 2023 19:52:13 +0300 Subject: [PATCH 24/80] added ids to UtxoDetails --- .../components/signin/cardano/UtxoDetails.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/yoroi-extension/app/connector/components/signin/cardano/UtxoDetails.js b/packages/yoroi-extension/app/connector/components/signin/cardano/UtxoDetails.js index d1f586a5de..4da56b7b8a 100644 --- a/packages/yoroi-extension/app/connector/components/signin/cardano/UtxoDetails.js +++ b/packages/yoroi-extension/app/connector/components/signin/cardano/UtxoDetails.js @@ -117,7 +117,7 @@ class CardanoUtxoDetails extends Component { `${request.kind}-${request.address.address}-${request.addressIndex}-${identifier}`; const renderAmount = entry => { return ( -
+
{this.renderAmountDisplay({ entry: { ...entry, @@ -141,6 +141,7 @@ class CardanoUtxoDetails extends Component { justifyContent="space-between" py="16px" borderRadius="8px" + id="addressRow" > { {intl.formatMessage(connectorMessages.yourAddresses)} - + {txData.inputs.map((address, addressIndex) => { return this.renderRow({ kind: 'in', @@ -223,7 +224,7 @@ class CardanoUtxoDetails extends Component { {intl.formatMessage(connectorMessages.foreignAddresses)} - + {txData.foreignInputs.map((address, addressIndex) => { return this.renderRow({ kind: 'in-foreign', @@ -249,7 +250,7 @@ class CardanoUtxoDetails extends Component { {intl.formatMessage(connectorMessages.yourAddresses)} - + {txData.outputs .filter(o => !o.isForeign) .map((address, addressIndex) => { @@ -265,7 +266,7 @@ class CardanoUtxoDetails extends Component { {foreignOutputs.length > 0 && ( <> - + {intl.formatMessage(connectorMessages.foreignAddresses)} From 1a7096f3703422221194b90fbe005bb4b871ab89 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 18 May 2023 20:15:38 +0300 Subject: [PATCH 25/80] updated ids --- .../app/connector/components/connect/ConnectPage.js | 2 +- .../app/connector/components/signin/CardanoSignTxPage.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/yoroi-extension/app/connector/components/connect/ConnectPage.js b/packages/yoroi-extension/app/connector/components/connect/ConnectPage.js index 84fde706b3..e32b39f4d8 100644 --- a/packages/yoroi-extension/app/connector/components/connect/ConnectPage.js +++ b/packages/yoroi-extension/app/connector/components/connect/ConnectPage.js @@ -244,7 +244,7 @@ class ConnectPage extends Component { type="password" {...walletPasswordField.bind()} error={walletPasswordField.error} - id="passwordField" + id="walletPassword" /> )}
diff --git a/packages/yoroi-extension/app/connector/components/signin/CardanoSignTxPage.js b/packages/yoroi-extension/app/connector/components/signin/CardanoSignTxPage.js index b2d1395e1e..3ff7710612 100644 --- a/packages/yoroi-extension/app/connector/components/signin/CardanoSignTxPage.js +++ b/packages/yoroi-extension/app/connector/components/signin/CardanoSignTxPage.js @@ -390,9 +390,9 @@ class SignTxPage extends Component { passwordFormField={ } /> From 188ee24346e3167f005db26e0086e2d005cb2034 Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 19 May 2023 13:45:36 +0300 Subject: [PATCH 26/80] added ids on AddCollateralPage --- .../app/connector/components/signin/AddCollateralPage.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/yoroi-extension/app/connector/components/signin/AddCollateralPage.js b/packages/yoroi-extension/app/connector/components/signin/AddCollateralPage.js index 8f6a110af7..674dfa52d5 100644 --- a/packages/yoroi-extension/app/connector/components/signin/AddCollateralPage.js +++ b/packages/yoroi-extension/app/connector/components/signin/AddCollateralPage.js @@ -263,6 +263,7 @@ class AddCollateralPage extends Component { fontWeight={500} marginBottom="8px" fontSize="20px" + id="addCollateralTitle" > {intl.formatMessage(messages.reorgTitle)} @@ -291,7 +292,7 @@ class AddCollateralPage extends Component { > {intl.formatMessage(globalMessages.amount)} - + {this.renderAmountDisplay({ entry: { identifier: txData.fee.tokenId, @@ -303,7 +304,7 @@ class AddCollateralPage extends Component { {intl.formatMessage(signTxMessages.transactionFee)} - + {this.renderAmountDisplay({ entry: { identifier: txData.fee.tokenId, @@ -321,6 +322,7 @@ class AddCollateralPage extends Component { type="password" {...walletPasswordField.bind()} error={walletPasswordField.error} + id="walletPassword" /> {submissionError === 'SEND_TX_ERROR' && ( {intl.formatMessage(messages.sendError)} @@ -355,6 +357,7 @@ class AddCollateralPage extends Component { variant="outlined" color="primary" onClick={onCancel} + id="cancelButton" > {intl.formatMessage(globalMessages.backButtonLabel)} @@ -365,6 +368,7 @@ class AddCollateralPage extends Component { disabled={walletType === 'web' && !walletPasswordField.isValid} onClick={this.submit.bind(this)} loading={isSubmitting} + id="confirmButton" > {intl.formatMessage(confirmButtonLabel)} From d37de7f5960496ecc3294366a78d78f24f76b960 Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 19 May 2023 13:46:26 +0300 Subject: [PATCH 27/80] added ids on CardanoSignTxPage --- .../app/connector/components/signin/CardanoSignTxPage.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/connector/components/signin/CardanoSignTxPage.js b/packages/yoroi-extension/app/connector/components/signin/CardanoSignTxPage.js index 3ff7710612..001599e025 100644 --- a/packages/yoroi-extension/app/connector/components/signin/CardanoSignTxPage.js +++ b/packages/yoroi-extension/app/connector/components/signin/CardanoSignTxPage.js @@ -423,7 +423,7 @@ class SignTxPage extends Component { // signing data content = ( - + {intl.formatMessage(signTxMessages.signMessage)} { p="16px" border="1px solid var(--yoroi-palette-gray-100)" borderRadius="6px" + id="signMessageBox-payload" >
{this.renderPayload(signData.payload)}
@@ -440,6 +441,7 @@ class SignTxPage extends Component { type="password" {...walletPasswordField.bind()} error={walletPasswordField.error} + id="walletPassword" />
From 918656a16c2e467f189507f148d395cc07456c82 Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 19 May 2023 13:47:22 +0300 Subject: [PATCH 28/80] updated locators on connector-connectWalletPage.js --- .../features/pages/connector-connectWalletPage.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/yoroi-extension/features/pages/connector-connectWalletPage.js b/packages/yoroi-extension/features/pages/connector-connectWalletPage.js index fd5afd015a..199dc85d12 100644 --- a/packages/yoroi-extension/features/pages/connector-connectWalletPage.js +++ b/packages/yoroi-extension/features/pages/connector-connectWalletPage.js @@ -21,12 +21,12 @@ export const walletNameField: LocatorObject = { export const walletItemButton: LocatorObject = { locator: './button', method: 'xpath' }; export const walletBalanceField: LocatorObject = { locator: '.WalletCard_balance', method: 'css' }; export const spendingPasswordInput: LocatorObject = { - locator: 'passwordField', + locator: 'walletPassword', method: 'id', }; export const spendingPasswordErrorField: LocatorObject = { - locator: '//p[starts-with(@id, "walletPassword--") and contains(@id, "-helper-text")]', - method: 'xpath', + locator: 'walletPassword-helper-text', + method: 'id', }; export const eyeButton: LocatorObject = { locator: '.MuiIconButton-edgeEnd', method: 'css' }; export const confirmButton: LocatorObject = { locator: 'confirmButton', method: 'id' }; From c835d8b807bb8247f2af263b28419bb3076e92b9 Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 19 May 2023 13:47:57 +0300 Subject: [PATCH 29/80] updated locators on connector-getCollateralPage.js --- .../pages/connector-getCollateralPage.js | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/yoroi-extension/features/pages/connector-getCollateralPage.js b/packages/yoroi-extension/features/pages/connector-getCollateralPage.js index 5ecc55ae16..e452fdb1b5 100644 --- a/packages/yoroi-extension/features/pages/connector-getCollateralPage.js +++ b/packages/yoroi-extension/features/pages/connector-getCollateralPage.js @@ -3,16 +3,26 @@ import type { LocatorObject } from '../support/webdriver'; export const addCollateralTitle: LocatorObject = { - locator: '//h5[contains(text(), "Add Collateral")]', - method: 'xpath', + locator: 'addCollateralTitle', + method: 'id', }; export const transactionFeeTitle: LocatorObject = { - locator: '//p[contains(text(), "Transaction Fee")]', - method: 'xpath', + locator: 'addCollateralFeeTitle', + method: 'id', }; export const totalAmountTitle: LocatorObject = { - locator: '//p[contains(text(), "Total Amount")]', - method: 'xpath', + locator: 'addCollateralAmountTitle', + method: 'id', +}; + +export const getCollateralTransactionFee = async (customWorld: Object): Promise => { + const feeFieldElement = await customWorld.findElement(transactionFeeTitle); + return (await feeFieldElement.getText()).split(' ')[0]; +}; + +export const getCollateralTransactionAmount = async (customWorld: Object): Promise => { + const allAmountBlocks = await customWorld.findElement(totalAmountTitle); + return (await allAmountBlocks.getText()).split(' ')[0]; }; From fff5662250d24ad9c07d12e4974d39f3ec803556 Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 19 May 2023 13:48:53 +0300 Subject: [PATCH 30/80] updated locators on connector-signingDataPage.js --- .../features/pages/connector-signingDataPage.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/yoroi-extension/features/pages/connector-signingDataPage.js b/packages/yoroi-extension/features/pages/connector-signingDataPage.js index b84d0d44b5..14fee94f30 100644 --- a/packages/yoroi-extension/features/pages/connector-signingDataPage.js +++ b/packages/yoroi-extension/features/pages/connector-signingDataPage.js @@ -3,13 +3,13 @@ import type { LocatorObject } from '../support/webdriver'; export const signMessageTitle: LocatorObject = { - locator: '//h5[contains(text(), "Sign Message")]', - method: 'xpath', + locator: 'signMessageTitle', + method: 'id', }; export const dataText: LocatorObject = { - locator: '//pre', - method: 'xpath', + locator: 'signMessageBox-payload', + method: 'id', }; export const getSigningData = async (customWorld: Object): Promise => { From e61ad7fbe6a353c0cbc6ffe089cb346f23e09563 Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 19 May 2023 13:49:24 +0300 Subject: [PATCH 31/80] updated locators on connector-signingTxPage.js --- .../yoroi-extension/features/pages/connector-signingTxPage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/yoroi-extension/features/pages/connector-signingTxPage.js b/packages/yoroi-extension/features/pages/connector-signingTxPage.js index b83072a87a..fbcb3e06bb 100644 --- a/packages/yoroi-extension/features/pages/connector-signingTxPage.js +++ b/packages/yoroi-extension/features/pages/connector-signingTxPage.js @@ -181,8 +181,8 @@ export const getTransactionAmount = async (customWorld: Object): Promise return (await amountFieldElement.getText()).split(' ')[0]; }; -export const confirmButton: LocatorObject = { locator: '.MuiButton-primary', method: 'css' }; -export const cancelButton: LocatorObject = { locator: '.MuiButton-secondary', method: 'css' }; +export const confirmButton: LocatorObject = { locator: 'confirmButton', method: 'id' }; +export const cancelButton: LocatorObject = { locator: 'cancelButton', method: 'id' }; export const getUTXOAddresses = async (customWorld: Object): Promise => { const fromAddresses = await getFromAddresses(customWorld); From 47636109c0935bd2ce752463ba2fe97450a41421 Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 19 May 2023 13:50:42 +0300 Subject: [PATCH 32/80] updated returning error on mocked dapp --- packages/yoroi-extension/features/mock-dApp-webpage/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/yoroi-extension/features/mock-dApp-webpage/index.js b/packages/yoroi-extension/features/mock-dApp-webpage/index.js index 6d6f5fb9ce..97939b8757 100644 --- a/packages/yoroi-extension/features/mock-dApp-webpage/index.js +++ b/packages/yoroi-extension/features/mock-dApp-webpage/index.js @@ -229,11 +229,11 @@ export class MockDAppWebpage { callback({ success: true, error: null, retValue: null }); }, error => { - callback({ success: false, error: error.message, retValue: null }); + callback({ success: false, error, retValue: null }); } ) .catch(error => { - callback({ success: false, error: error.message, retValue: null }); + callback({ success: false, error, retValue: null }); }); }): DAppConnectorResponse); this.logger.info(`MockDApp: -> The access response: ${JSON.stringify(accessResponse)}`); From 82363dd9c560d8f5c25b325341df7e9260379b74 Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 19 May 2023 13:52:48 +0300 Subject: [PATCH 33/80] updated connector steps --- .../step_definitions/connector-steps.js | 105 +++++------------- 1 file changed, 27 insertions(+), 78 deletions(-) diff --git a/packages/yoroi-extension/features/step_definitions/connector-steps.js b/packages/yoroi-extension/features/step_definitions/connector-steps.js index d9093029f8..1840a26fe7 100644 --- a/packages/yoroi-extension/features/step_definitions/connector-steps.js +++ b/packages/yoroi-extension/features/step_definitions/connector-steps.js @@ -18,15 +18,19 @@ import { import { disconnectWallet, getWalletsWithConnectedWebsites } from '../pages/connectedWebsitesPage'; import { getTransactionFee, - overviewTabButton, + detailsTabButton, getTransactionSentAmount, - utxoAddressesTabButton, + utxosTabButton, getUTXOAddresses, cancelButton, transactionTotalAmountField, + transactionFeeText, } from '../pages/connector-signingTxPage'; import { getSigningData, signMessageTitle } from '../pages/connector-signingDataPage'; -import { addCollateralTitle } from '../pages/connector-getCollateralPage'; +import { + addCollateralTitle, + getCollateralTransactionFee, +} from '../pages/connector-getCollateralPage'; import { mockDAppName, extensionTabName, popupConnectorName } from '../support/windowManager'; import { connectorButton } from '../pages/sidebarPage'; import { @@ -179,6 +183,7 @@ Then(/^The dApp should see balance (\d+)$/, async function (expectedBalance) { }); When(/^I request signing the transaction:$/, async function (table) { + this.webDriverLogger.info(`Step: I request signing the transaction`); const fields = table.hashes()[0]; const normalizedAmount = `${parseFloat(fields.amount) * parseFloat('1000000')}`; this.webDriverLogger.info( @@ -188,34 +193,30 @@ When(/^I request signing the transaction:$/, async function (table) { }); Then(/^I should see the transaction amount data:$/, async function (table) { - await this.waitForElement(overviewTabButton); const fields = table.hashes()[0]; - const realFee = await getTransactionFee(this); - const realFullAmount = await getTransactionSentAmount(this); - const expectedTotalAmount = `-${parseFloat(fields.amount) + parseFloat(fields.fee)}`; + this.webDriverLogger.info( - `Step: I should see the transaction amount data: amount: ${expectedTotalAmount}, fee: ${fields.fee} ` + `Step: I should see the transaction amount data: amount: ${fields.amount}, fee: ${fields.fee} ` ); + await this.waitForElement(detailsTabButton); + const realFee = await getTransactionFee(this); + const realSentAmount = await getTransactionSentAmount(this); expect(realFee, 'Fee is different').to.equal(fields.fee); - expect(realFullAmount, 'Total amount is different').to.equal(expectedTotalAmount); + expect(realSentAmount, 'Sent amount is different').to.equal(fields.amount); }); Then(/^I should see the transaction addresses info:$/, async function (table) { - await this.waitForElement(overviewTabButton); - const tableHashes = table.hashes(); - const fields = tableHashes[0]; + const fields = table.hashes()[0]; this.webDriverLogger.info( `Step: I should see the transaction addresses info: from: ${fields.fromAddress}, to: ${fields.toAddress} ` ); - - await this.click(utxoAddressesTabButton); - + await this.waitForElement(detailsTabButton); + await this.click(utxosTabButton); const expectedFromAddress = fields.fromAddress; const expectedFromAddressAmount = fields.fromAddressAmount; const expectedToAddress = fields.toAddress; const expectedToAddressAmount = fields.toAddressAmount; - const realAddresses = await getUTXOAddresses(this); const realFromAddresses = realAddresses.fromAddresses; const foundFromAddresses = realFromAddresses.filter( @@ -240,8 +241,8 @@ Then(/^I should see the transaction addresses info:$/, async function (table) { address: ${expectedFromAddress}, amount: ${expectedFromAddressAmount} Received:\n${JSON.stringify(realFromAddresses)}` ).to.equal(1); - await this.click(overviewTabButton); - // await this.waitForElement(transactionFeeTitle); + await this.click(detailsTabButton); + await this.waitForElement(transactionFeeText); }); Then(/^The signing transaction API should return (.+)$/, async function (txHex) { @@ -357,19 +358,17 @@ Then(/^I cancel signing the transaction$/, async function () { }); When(/^I request signing the data:$/, async function (table) { - const tableHashes = table.hashes(); - const fields = tableHashes[0]; + const fields = table.hashes()[0]; const payload = fields.payload; this.webDriverLogger.info(`Step: I request signing the data: ${payload}`); await this.mockDAppPage.requestSigningData(payload); }); Then(/^I should see the data to sign:$/, async function (table) { - const tableHashes = table.hashes(); - const fields = tableHashes[0]; + const fields = table.hashes()[0]; const payload = fields.payload; - const actualSigningData = await getSigningData(this); this.webDriverLogger.info(`Step: I should see the data to sign: ${payload}`); + const actualSigningData = await getSigningData(this); expect(actualSigningData, 'Signing Data is different').to.equal(payload); }); @@ -416,6 +415,9 @@ Then( Then(/^The dApp should receive collateral$/, async function (table) { const fields = table.hashes()[0]; + this.webDriverLogger.info( + `Step: The dApp should receive collateral:\namount - ${fields.amount}, receiver - ${fields.receiver}` + ); const collateralResponse = (await this.mockDAppPage.getCollateralResult(): DAppConnectorResponse); expect(collateralResponse.success).to.equal(true); const collateralUtxuJson = collateralResponse.retValue[0]; @@ -430,63 +432,10 @@ Then(/^I should see the connector popup to Add Collateral with fee info$/, async await connectorPopUpIsDisplayed(this); await this.waitForElement(addCollateralTitle); const fields = table.hashes()[0]; - const realFee = await getTransactionFee(this); + const realFee = await getCollateralTransactionFee(this); expect(realFee, 'Fee is different').to.equal(fields.fee); }); -Then(/^I should see the collateral fee data:$/, async function (table) { - await this.waitForElement(overviewTabButton); - const fields = table.hashes()[0]; - const realFee = await getTransactionFee(this); - const expectedFee = `-${fields.fee}`; - const realFullAmount = await getTransactionAmount(this); - this.webDriverLogger.info(`Step: I should see the collateral fee data: ${expectedFee}`); - expect(realFee, 'Fee is different').to.equal(expectedFee); - expect(realFullAmount, 'Total amount is different').to.equal(expectedFee); -}); - -Then(/^I should see the collateral from address info:$/, async function (table) { - await this.waitForElement(overviewTabButton); - const tableHashes = table.hashes(); - const fields = tableHashes[0]; - await this.click(utxoAddressesTabButton); - - const expectedFromAddress = fields.fromAddress; - const expectedFromAddressAmount = fields.fromAddressAmount; - - const actualAddresses = await getUTXOAddresses(this); - const actualFromAddresses = actualAddresses.fromAddresses; - const foundFromAddresses = actualFromAddresses.filter( - addr => - addr.address === expectedFromAddress && addr.amount === parseFloat(expectedFromAddressAmount) - ); - this.webDriverLogger.info( - `Step: I should see the collateral from address info: address: ${expectedFromAddress}, amount: ${expectedFromAddressAmount}` - ); - expect( - foundFromAddresses.length, - `Expected fromAddress: - address:${expectedFromAddress}, amount: ${expectedFromAddressAmount} - Received:\n${JSON.stringify(actualFromAddresses)}` - ).to.equal(1); -}); - -Then(/^I should see the collateral to addresses info:$/, async function (table) { - this.webDriverLogger.info(`Step: I should see the collateral to addresses info`); - await this.waitForElement(overviewTabButton); - const tableHashes = table.hashes(); - await this.click(utxoAddressesTabButton); - - const actualAddresses = await getUTXOAddresses(this); - const actualToAddresses = actualAddresses.toAddresses; - actualToAddresses.forEach((addr, index) => { - expect(addr.address).to.equal(tableHashes[index].toAddresses); - expect(addr.amount).to.equal(parseFloat(tableHashes[index].toAddressesAmount)); - }); - await this.click(overviewTabButton); - await this.waitForElement(transactionFeeTitle); -}); - When(/^I request unused addresses$/, async function () { this.webDriverLogger.info(`Step: I request unused addresses`); await this.mockDAppPage.requestUnusedAddresses(); @@ -498,7 +447,7 @@ When(/^I request used addresses$/, async function () { }); When(/^The collateral received the error:$/, async function (table) { - this.webDriverLogger.info(`Step: I should see the collateral to addresses info`); + this.webDriverLogger.info(`Step: The collateral received the error`); const tableHashes = table.hashes(); const fields = tableHashes[0]; From 658e5831f1cecab0baeb0cbc0d188ea64f51eb05 Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 19 May 2023 13:54:18 +0300 Subject: [PATCH 34/80] updated test features --- .../yoroi-extension/features/01-connector-cardano.feature | 6 ++++-- .../02-connector-anonymous-wallet-errors-checking.feature | 5 +++++ .../03-connector-authorized-wallet-errors-checking.feature | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/yoroi-extension/features/01-connector-cardano.feature b/packages/yoroi-extension/features/01-connector-cardano.feature index 7b9cb9e7d3..d50f7f1ef2 100644 --- a/packages/yoroi-extension/features/01-connector-cardano.feature +++ b/packages/yoroi-extension/features/01-connector-cardano.feature @@ -32,9 +32,10 @@ Feature: dApp connector data signing | amount | toAddress | | 3 | addr1q97xu8uvdgjpqum6sjv9vptzulkc53x7tk69vj2lynywxppq3e92djqml4tjxz2avcgem3u8z7r54yvysm20qasxx5gqyx8evw | Then I should see the connector popup for signing + # remove minus sign after the fix https://emurgo.atlassian.net/browse/YOEXT-577 And I should see the transaction amount data: | amount | fee | - | 3 | 0.168317 | + | -3 | 0.168317 | And I should see the transaction addresses info: | fromAddress | fromAddressAmount | toAddress | toAddressAmount | | addr1...ajfkn | -5.5 | addr1...x8evw | 3 | @@ -56,9 +57,10 @@ Feature: dApp connector data signing | amount | toAddress | | 3 | addr1q97xu8uvdgjpqum6sjv9vptzulkc53x7tk69vj2lynywxppq3e92djqml4tjxz2avcgem3u8z7r54yvysm20qasxx5gqyx8evw | Then I should see the connector popup for signing + # remove minus sign after the fix https://emurgo.atlassian.net/browse/YOEXT-577 And I should see the transaction amount data: | amount | fee | - | 3 | 0.168317 | + | -3 | 0.168317 | And I should see the transaction addresses info: | fromAddress | fromAddressAmount | toAddress | toAddressAmount | | addr1...ajfkn | -5.5 | addr1...x8evw | 3 | diff --git a/packages/yoroi-extension/features/02-connector-anonymous-wallet-errors-checking.feature b/packages/yoroi-extension/features/02-connector-anonymous-wallet-errors-checking.feature index e0da07c331..760e59d433 100644 --- a/packages/yoroi-extension/features/02-connector-anonymous-wallet-errors-checking.feature +++ b/packages/yoroi-extension/features/02-connector-anonymous-wallet-errors-checking.feature @@ -23,6 +23,8 @@ Feature: dApp connector anonymous wallet errors checking And I select the only wallet named shelley-simple-15 with 5.5 balance Then The popup window should be closed And The access request should succeed + And The wallet shelley-simple-15 is connected to the website localhost + And The dApp should see balance 5500000 Then I request signing the transaction: | amount | toAddress | | 3 | addr1q97xu8uvdgjpqum6sjv9vptzulkc53x7tk69vj2lynywxppq3e92djqml4tjxz2avcgem3u8z7r54yvysm20qasxx5gqyx8evw | @@ -47,6 +49,8 @@ Feature: dApp connector anonymous wallet errors checking And I select the only wallet named shelley-simple-15 with 5.5 balance Then The popup window should be closed And The access request should succeed + And The wallet shelley-simple-15 is connected to the website localhost + And The dApp should see balance 5500000 Then I request signing the transaction: | amount | toAddress | | 3 | addr1q97xu8uvdgjpqum6sjv9vptzulkc53x7tk69vj2lynywxppq3e92djqml4tjxz2avcgem3u8z7r54yvysm20qasxx5gqyx8evw | @@ -62,6 +66,7 @@ Feature: dApp connector anonymous wallet errors checking Then The popup window should be closed And The access request should succeed And The wallet shelley-simple-15 is connected to the website localhost + And The dApp should see balance 5500000 Then I request unused addresses And I request signing the data: | payload | diff --git a/packages/yoroi-extension/features/03-connector-authorized-wallet-errors-checking.feature b/packages/yoroi-extension/features/03-connector-authorized-wallet-errors-checking.feature index e2150f28e9..ba1d14e554 100644 --- a/packages/yoroi-extension/features/03-connector-authorized-wallet-errors-checking.feature +++ b/packages/yoroi-extension/features/03-connector-authorized-wallet-errors-checking.feature @@ -40,6 +40,8 @@ Feature: dApp connector errors checking Then I enter the spending password asdfasdfasdf and click confirm Then The popup window should be closed And The access request should succeed + And The wallet shelley-simple-15 is connected to the website localhost + And The dApp should see balance 5500000 Then I request signing the transaction: | amount | toAddress | | 3 | addr1q97xu8uvdgjpqum6sjv9vptzulkc53x7tk69vj2lynywxppq3e92djqml4tjxz2avcgem3u8z7r54yvysm20qasxx5gqyx8evw | @@ -66,6 +68,8 @@ Feature: dApp connector errors checking Then I enter the spending password asdfasdfasdf and click confirm Then The popup window should be closed And The access request should succeed + And The wallet shelley-simple-15 is connected to the website localhost + And The dApp should see balance 5500000 Then I request signing the transaction: | amount | toAddress | | 3 | addr1q97xu8uvdgjpqum6sjv9vptzulkc53x7tk69vj2lynywxppq3e92djqml4tjxz2avcgem3u8z7r54yvysm20qasxx5gqyx8evw | From 5fc627357fb1e2d6e313ca5ac2459773183aa0c1 Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Fri, 19 May 2023 08:54:16 -0400 Subject: [PATCH 35/80] New translations en-US.json (Hungarian) --- packages/yoroi-extension/app/i18n/locales/hu-HU.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/yoroi-extension/app/i18n/locales/hu-HU.json b/packages/yoroi-extension/app/i18n/locales/hu-HU.json index ecf739d297..81ea33cf4b 100644 --- a/packages/yoroi-extension/app/i18n/locales/hu-HU.json +++ b/packages/yoroi-extension/app/i18n/locales/hu-HU.json @@ -65,6 +65,10 @@ "connector.connect.info": "Your connection preferences will be saved to your Yoroi dApp list.", "connector.connect.noWalletsFound": "Ooops, no {network} wallets found.", "connector.connect.noWebsitesConnected": "You don't have any websites connected yet", + "connector.connected-dapps.cardanoLabel": "Cardano, ADA", + "connector.connected-dapps.dappsLabel": "Dapps", + "connector.connected-dapps.ergoLabel": "Ergo, ERG", + "connector.connected-dapps.walletsLabel": "Wallets", "connector.foreignAddresses": "Foreign Addresses", "connector.from": "From (Inputs): {qty}", "connector.fromWallet": "From wallet", From 19f04e43b935c6809e66cfab3cb11ecf57bcaf01 Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Fri, 19 May 2023 08:54:18 -0400 Subject: [PATCH 36/80] New translations en-US.json (Vietnamese) --- packages/yoroi-extension/app/i18n/locales/vi-VN.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/yoroi-extension/app/i18n/locales/vi-VN.json b/packages/yoroi-extension/app/i18n/locales/vi-VN.json index 5ec79ad4ce..a63e502aee 100644 --- a/packages/yoroi-extension/app/i18n/locales/vi-VN.json +++ b/packages/yoroi-extension/app/i18n/locales/vi-VN.json @@ -65,6 +65,10 @@ "connector.connect.info": "Tùy chọn kết nối của bạn sẽ được lưu vào danh sách dApp Yoroi.", "connector.connect.noWalletsFound": "Không có {network}.", "connector.connect.noWebsitesConnected": "Bạn chưa có bất kỳ trang web nào được kết nối", + "connector.connected-dapps.cardanoLabel": "Cardano, ADA", + "connector.connected-dapps.dappsLabel": "Dapps", + "connector.connected-dapps.ergoLabel": "Ergo, ERG", + "connector.connected-dapps.walletsLabel": "Wallets", "connector.foreignAddresses": "Các địa chỉ bên ngoài", "connector.from": "Từ (đầu vào): {qty}", "connector.fromWallet": "Từ Ví", From 31c6eb778d98f888bc8db9eb0f37ec3867a52d41 Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 19 May 2023 15:56:49 +0300 Subject: [PATCH 37/80] updated locator for the amount field --- .../pages/connector-connectWalletPage.js | 2 +- .../step_definitions/connector-steps.js | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/yoroi-extension/features/pages/connector-connectWalletPage.js b/packages/yoroi-extension/features/pages/connector-connectWalletPage.js index 199dc85d12..8cefb0e8e3 100644 --- a/packages/yoroi-extension/features/pages/connector-connectWalletPage.js +++ b/packages/yoroi-extension/features/pages/connector-connectWalletPage.js @@ -19,7 +19,7 @@ export const walletNameField: LocatorObject = { method: 'css', }; export const walletItemButton: LocatorObject = { locator: './button', method: 'xpath' }; -export const walletBalanceField: LocatorObject = { locator: '.WalletCard_balance', method: 'css' }; +export const walletBalanceField: LocatorObject = { locator: '.AmountDisplay_amount', method: 'css' }; export const spendingPasswordInput: LocatorObject = { locator: 'walletPassword', method: 'id', diff --git a/packages/yoroi-extension/features/step_definitions/connector-steps.js b/packages/yoroi-extension/features/step_definitions/connector-steps.js index 1840a26fe7..dd0040f9bc 100644 --- a/packages/yoroi-extension/features/step_definitions/connector-steps.js +++ b/packages/yoroi-extension/features/step_definitions/connector-steps.js @@ -121,16 +121,15 @@ Then( expectedWalletName, `expect wallet name ${expectedWalletName} but get wallet name ${walletName}` ); - // TODO uncomment when the balance will be displayed - // const balance = await getWalletBalance(wallets, 0); - // const match = balance.match(/^[0-9.]+/); - // expect(match, 'Can not get wallet balance').to.not.be.null; - // // $FlowFixMe[incompatible-use] - // const balanceMatch = match[0]; - // expect(balanceMatch).to.equal( - // expectedBalance, - // `expect wallet balance ${expectedBalance} but get ${balanceMatch}` - // ); + const balance = await getWalletBalance(wallets, 0); + const match = balance.match(/^[0-9.]+/); + expect(match, 'Can not get wallet balance').to.not.be.null; + // $FlowFixMe[incompatible-use] + const balanceMatch = match[0]; + expect(balanceMatch).to.equal( + expectedBalance, + `expect wallet balance ${expectedBalance} but get ${balanceMatch}` + ); await selectWallet(wallets, 0); await this.driver.sleep(1000); } From 69f3f77ef667bcbd00a73e2b7d316a296e999bcd Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 19 May 2023 16:14:07 +0300 Subject: [PATCH 38/80] little fix --- .../features/step_definitions/connector-steps.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/yoroi-extension/features/step_definitions/connector-steps.js b/packages/yoroi-extension/features/step_definitions/connector-steps.js index dd0040f9bc..f6c52c3c28 100644 --- a/packages/yoroi-extension/features/step_definitions/connector-steps.js +++ b/packages/yoroi-extension/features/step_definitions/connector-steps.js @@ -122,13 +122,11 @@ Then( `expect wallet name ${expectedWalletName} but get wallet name ${walletName}` ); const balance = await getWalletBalance(wallets, 0); - const match = balance.match(/^[0-9.]+/); - expect(match, 'Can not get wallet balance').to.not.be.null; - // $FlowFixMe[incompatible-use] - const balanceMatch = match[0]; - expect(balanceMatch).to.equal( + expect(balance, 'Can not get wallet balance').to.not.be.null; + const realBalanceDigitsOnly = balance.split(' ')[0]; + expect(realBalanceDigitsOnly).to.equal( expectedBalance, - `expect wallet balance ${expectedBalance} but get ${balanceMatch}` + `expect wallet balance ${expectedBalance} but get ${realBalanceDigitsOnly}` ); await selectWallet(wallets, 0); await this.driver.sleep(1000); From 12a4a9d49bab6b8a077b678078351ce8f207a7ce Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Mon, 22 May 2023 07:27:56 +0300 Subject: [PATCH 39/80] fix: add epoch number to rewards list --- .../staking/dashboard-revamp/RewardHistoryDialog.js | 12 +++++++++--- packages/yoroi-extension/app/i18n/locales/en-US.json | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/RewardHistoryDialog.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/RewardHistoryDialog.js index ab3fcde47c..9dbda7a569 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/RewardHistoryDialog.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/RewardHistoryDialog.js @@ -7,7 +7,7 @@ import globalMessages from '../../../../i18n/global-messages'; import DialogCloseButton from '../../../widgets/DialogCloseButton'; import { Typography } from '@mui/material'; import Dialog from '../../../widgets/Dialog'; -import { injectIntl } from 'react-intl'; +import { injectIntl, defineMessages } from 'react-intl'; import type { $npm$ReactIntl$IntlShape } from 'react-intl'; import { Box } from '@mui/system'; import { RewardHistoryItem } from './RewardHistoryTab'; @@ -19,6 +19,13 @@ import LocalizableError from '../../../../i18n/LocalizableError'; import { groupByPoolName } from '../utils'; import styles from './RewardHistoryDialog.scss'; +const messages = defineMessages({ + epoch: { + id: 'wallet.staking.rewards.rewardHistory.epochNum', + defaultMessage: '!!!Epoch {number}', + }, +}); + export type GraphRewardData = {| error: ?LocalizableError, items: Array<{| @@ -42,7 +49,6 @@ type Intl = {| function RewardHistoryDialog({ graphData, onClose, intl }: Props & Intl): Node { const rewardItems = graphData.rewardsGraphData.items; const rewardList = rewardItems?.totalRewards.filter(p => Boolean(p.primary)) ?? []; - const rewardsByPoolName = useMemo(() => groupByPoolName(rewardList), []); return ( @@ -82,7 +88,7 @@ function RewardHistoryDialog({ graphData, onClose, intl }: Props & Intl): Node { // $FlowFixMe[incompatible-use]: Object entries flow type historyList={data.map(item => ({ // TODO: Make sure it's "received" in all use cases - type: 'Received', + type: intl.formatMessage(messages.epoch, { number: item.name }), date: item.date, balance: item.primary, currency: item.currency, diff --git a/packages/yoroi-extension/app/i18n/locales/en-US.json b/packages/yoroi-extension/app/i18n/locales/en-US.json index 91f31c5d40..622e321ef4 100644 --- a/packages/yoroi-extension/app/i18n/locales/en-US.json +++ b/packages/yoroi-extension/app/i18n/locales/en-US.json @@ -909,6 +909,7 @@ "wallet.staking.pool.unknownLabel": "Unknown pool", "wallet.staking.rewards.openRewardHistory": "Open Reward History", "wallet.staking.rewards.rewardHistory": "Reward History", + "wallet.staking.rewards.rewardHistory.epochNum": "Epoch {number}", "wallet.staking.summary": "Summary", "wallet.staking.warning.pendingTx": "You cannot change your delegation preference while a transaction is pending", "wallet.summary.no.transaction": "No transaction history.", @@ -1050,4 +1051,4 @@ "yoroiTransfer.waiting.progressInfo.checkingAddresses": "Checking addresses funds", "yoroiTransfer.waiting.progressInfo.restoringAddresses": "Fetching addresses", "yoroiTransfer.waiting.title.label": "Wallet is being restored" -} \ No newline at end of file +} From 0bfd654b6cfbd8d6e7d271c167d8440e026c229f Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Mon, 22 May 2023 07:34:03 +0300 Subject: [PATCH 40/80] feat: align 'reward history' button with the design --- .../dashboard-revamp/RewardHistoryGraph.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/RewardHistoryGraph.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/RewardHistoryGraph.js index 4766771bb5..7d41363dfc 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/RewardHistoryGraph.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/RewardHistoryGraph.js @@ -1,7 +1,7 @@ // @flow import type { ComponentType, Node } from 'react'; import { Box, styled } from '@mui/system'; -import { Stack, Typography } from '@mui/material'; +import { Button, Stack, Typography } from '@mui/material'; import { defineMessages, injectIntl } from 'react-intl'; import globalMessages from '../../../../i18n/global-messages'; import type { $npm$ReactIntl$IntlShape } from 'react-intl'; @@ -188,19 +188,14 @@ function RewardHistoryGraph({ return ( - - {title} - + + + {rewardsGraphData.error && (
From 7c41b167a06e72622438dee979fb8d77320167d8 Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Mon, 22 May 2023 21:56:36 -0400 Subject: [PATCH 41/80] New translations en-US.json (Vietnamese) --- packages/yoroi-extension/app/i18n/locales/vi-VN.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/i18n/locales/vi-VN.json b/packages/yoroi-extension/app/i18n/locales/vi-VN.json index a63e502aee..435882c0a1 100644 --- a/packages/yoroi-extension/app/i18n/locales/vi-VN.json +++ b/packages/yoroi-extension/app/i18n/locales/vi-VN.json @@ -68,7 +68,7 @@ "connector.connected-dapps.cardanoLabel": "Cardano, ADA", "connector.connected-dapps.dappsLabel": "Dapps", "connector.connected-dapps.ergoLabel": "Ergo, ERG", - "connector.connected-dapps.walletsLabel": "Wallets", + "connector.connected-dapps.walletsLabel": "Các Ví", "connector.foreignAddresses": "Các địa chỉ bên ngoài", "connector.from": "Từ (đầu vào): {qty}", "connector.fromWallet": "Từ Ví", From c708d12d694e0e41c8520e3b53b95018cf6d7536 Mon Sep 17 00:00:00 2001 From: yushi Date: Tue, 23 May 2023 16:50:18 +0800 Subject: [PATCH 42/80] apply metadata display fix to revamped transaction --- .../wallet/transactions/TransactionRevamp.js | 41 +++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/transactions/TransactionRevamp.js b/packages/yoroi-extension/app/components/wallet/transactions/TransactionRevamp.js index c52fa19451..e8fb8ff994 100644 --- a/packages/yoroi-extension/app/components/wallet/transactions/TransactionRevamp.js +++ b/packages/yoroi-extension/app/components/wallet/transactions/TransactionRevamp.js @@ -896,29 +896,38 @@ export default class TransactionRevamp extends Component { const { intl } = this.context; if (data instanceof CardanoShelleyTransaction && data.metadata !== null) { - let jsonData = null; - - try { - jsonData = parseMetadata(data.metadata); - } catch (error) { - // try to parse schema using detailed conversion if advanced user - if (this.props.complexityLevel === ComplexityLevels.Advanced) { - try { - jsonData = parseMetadataDetailed(data.metadata); - } catch (errDetailed) { - // discard error - // can not parse metadata as json - // show the metadata hex as is + let metadata; + if (typeof data.metadata === 'string') { + let jsonData = null; + + try { + jsonData = parseMetadata(data.metadata); + } catch (error) { + // try to parse schema using detailed conversion if advanced user + if (this.props.complexityLevel === ComplexityLevels.Advanced) { + try { + jsonData = parseMetadataDetailed(data.metadata); + } catch (errDetailed) { + // discard error + // can not parse metadata as json + // show the metadata hex as is + } } + // do nothing for simple user } - // do nothing for simple user + if (jsonData !== null) { + metadata = (); + } else { + metadata = (0x{data.metadata}); + } + } else { + metadata = (); } - return (

{intl.formatMessage(messages.transactionMetadata)}

- {jsonData !== null ? : 0x{data.metadata}} + {metadata}
); From 32d0d6296feaeee83b7348cc068b4db7920e61cf Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Tue, 23 May 2023 09:20:01 -0400 Subject: [PATCH 43/80] New translations en-US.json (Hungarian) --- .../yoroi-extension/app/i18n/locales/hu-HU.json | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/i18n/locales/hu-HU.json b/packages/yoroi-extension/app/i18n/locales/hu-HU.json index 81ea33cf4b..89c9c46b68 100644 --- a/packages/yoroi-extension/app/i18n/locales/hu-HU.json +++ b/packages/yoroi-extension/app/i18n/locales/hu-HU.json @@ -1012,10 +1012,21 @@ "wallet.voting.dialog.completeLabel": "Complete", "wallet.voting.dialog.confirmPin": "Confirm PIN", "wallet.voting.dialog.registerLabel": "Register", - "wallet.voting.dialog.step.done.lineTitle": "Voting key registered.", + "wallet.voting.dialog.step.confirm.line1": "Please enter the PIN as you will need it every time you want to access the Catalyst Voting app.", + "wallet.voting.dialog.step.pin.actionButton": "Confirm that I wrote down the PIN", + "wallet.voting.dialog.step.pin.line1": "Please write down this PIN as you will need it every time you want to access the Catalyst Voting app.", + "wallet.voting.dialog.step.qr.actionButton": "Confirm that I saved the QR code", + "wallet.voting.dialog.step.qr.downloadQrCode": "Download QR code", + "wallet.voting.dialog.step.qr.line2": "The following QR code is the generated certificate required by the Catalyst App to be able to participate in the voting process of Cardano.", + "wallet.voting.dialog.step.qr.line3": "Also we suggest to take a screenshot of it as a backup — you won’t be able to access this QR code after clicking Complete.", + "wallet.voting.dialog.step.qr.lineTitle": "Use the Catalyst Voting App to scan the QR code", + "wallet.voting.dialog.step.register.line1": "Enter your spending password to be able to generate the required certificate for voting.", "wallet.voting.dialog.step.trx.ledger.info.line.1": "After connecting your Ledger device to your computer’s USB port, press the Register button.", "wallet.voting.dialog.step.trx.line1": "Confirm your spending password to register in the blockchain the certificate previously generated for voting.", "wallet.voting.dialog.step.trx.trezor.info.line.1": "After connecting your Trezor device to your computer, press the Register button.", + "wallet.voting.dialog.stepConfirm": "Confirm", + "wallet.voting.dialog.stepPin": "PIN", + "wallet.voting.dialog.stepQrCode": "QR Code", "wallet.voting.dialog.title": "Register for Voting", "wallet.voting.dialog.transactionLabel": "Transaction", "wallet.voting.keepDelegated": "Your voting power is how much you delegate and the voting rewards will be distributed to your delegation reward address. Please keep delegated until the voting ends.", From 69ae8cc71faf598423514fd6a1cb8d80191f0f3c Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Tue, 23 May 2023 09:20:03 -0400 Subject: [PATCH 44/80] New translations en-US.json (Vietnamese) --- .../yoroi-extension/app/i18n/locales/vi-VN.json | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/i18n/locales/vi-VN.json b/packages/yoroi-extension/app/i18n/locales/vi-VN.json index 435882c0a1..677760931b 100644 --- a/packages/yoroi-extension/app/i18n/locales/vi-VN.json +++ b/packages/yoroi-extension/app/i18n/locales/vi-VN.json @@ -1012,10 +1012,21 @@ "wallet.voting.dialog.completeLabel": "Hoàn thành", "wallet.voting.dialog.confirmPin": "Xác minh mã PIN", "wallet.voting.dialog.registerLabel": "Đăng ký", - "wallet.voting.dialog.step.done.lineTitle": "Đăng ký khóa bỏ phiếu.", + "wallet.voting.dialog.step.confirm.line1": "Please enter the PIN as you will need it every time you want to access the Catalyst Voting app.", + "wallet.voting.dialog.step.pin.actionButton": "Confirm that I wrote down the PIN", + "wallet.voting.dialog.step.pin.line1": "Please write down this PIN as you will need it every time you want to access the Catalyst Voting app.", + "wallet.voting.dialog.step.qr.actionButton": "Confirm that I saved the QR code", + "wallet.voting.dialog.step.qr.downloadQrCode": "Download QR code", + "wallet.voting.dialog.step.qr.line2": "The following QR code is the generated certificate required by the Catalyst App to be able to participate in the voting process of Cardano.", + "wallet.voting.dialog.step.qr.line3": "Also we suggest to take a screenshot of it as a backup — you won’t be able to access this QR code after clicking Complete.", + "wallet.voting.dialog.step.qr.lineTitle": "Use the Catalyst Voting App to scan the QR code", + "wallet.voting.dialog.step.register.line1": "Enter your spending password to be able to generate the required certificate for voting.", "wallet.voting.dialog.step.trx.ledger.info.line.1": "Sau khi kết nối thiết bị Ledger của bạn với cổng USB của máy tính, hãy nhấn nút Đăng ký.", "wallet.voting.dialog.step.trx.line1": "Xác nhận mật khẩu chi tiêu của bạn để đăng ký trong chuỗi khối chứng chỉ được tạo trước đó để bỏ phiếu.", "wallet.voting.dialog.step.trx.trezor.info.line.1": "Sau khi kết nối thiết bị Trezor với máy tính, hãy nhấn nút Đăng ký.", + "wallet.voting.dialog.stepConfirm": "Confirm", + "wallet.voting.dialog.stepPin": "PIN", + "wallet.voting.dialog.stepQrCode": "QR Code", "wallet.voting.dialog.title": "Đăng ký bỏ phiếu", "wallet.voting.dialog.transactionLabel": "Giao dịch", "wallet.voting.keepDelegated": "Quyền biểu quyết của bạn là số tiền bạn ủy quyền và phần thưởng biểu quyết sẽ được phân phối tới địa chỉ phần thưởng ủy quyền của bạn. Vui lòng tiếp tục được ủy quyền cho đến khi cuộc biểu quyết kết thúc.", From cbcbcc32e1e3ee03441455c13258e4e5ab504b61 Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Wed, 24 May 2023 13:24:02 -0400 Subject: [PATCH 45/80] New translations en-US.json (Hungarian) --- packages/yoroi-extension/app/i18n/locales/hu-HU.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/yoroi-extension/app/i18n/locales/hu-HU.json b/packages/yoroi-extension/app/i18n/locales/hu-HU.json index 89c9c46b68..b02feda60a 100644 --- a/packages/yoroi-extension/app/i18n/locales/hu-HU.json +++ b/packages/yoroi-extension/app/i18n/locales/hu-HU.json @@ -444,8 +444,6 @@ "wallet.add.optionDialog.connect.hw.ledger.title": "Ledger Hardware Wallet", "wallet.add.optionDialog.connect.hw.trezor.learnMoreText": "A Trezor hardware wallet is a small USB device that adds an extra level of security to your wallet. It is more secure because your private key never leaves the hardware wallet. This protects your funds even if your computer is compromised due to malware, phishing attempts, etc.", "wallet.add.optionDialog.connect.hw.trezor.title": "Trezor Hardware Wallet", - "wallet.add.optionDialog.create.normalWallet.description": "A standard wallet backed by a recovery phrase.", - "wallet.add.optionDialog.create.paperWallet.description": "Paper wallets can be created even on devices not connected to the internet which makes them well-suited for single-use cold storage.", "wallet.add.optionDialog.restore.dialogTitle": "Tárca helyreállítása", "wallet.add.optionDialog.restore.normalWallet.description": "If you have a recovery phrase consisting of {length} words, choose this option to restore your wallet.", "wallet.add.optionDialog.restore.normalWallet.title": "Enter a {length}-word recovery phrase", From f431442b09420684a6694a5a39ad8ef89d95ecf4 Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Wed, 24 May 2023 13:24:04 -0400 Subject: [PATCH 46/80] New translations en-US.json (Vietnamese) --- packages/yoroi-extension/app/i18n/locales/vi-VN.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/yoroi-extension/app/i18n/locales/vi-VN.json b/packages/yoroi-extension/app/i18n/locales/vi-VN.json index 677760931b..b42f857eef 100644 --- a/packages/yoroi-extension/app/i18n/locales/vi-VN.json +++ b/packages/yoroi-extension/app/i18n/locales/vi-VN.json @@ -444,8 +444,6 @@ "wallet.add.optionDialog.connect.hw.ledger.title": "Ví cứng Ledger", "wallet.add.optionDialog.connect.hw.trezor.learnMoreText": "Ví cứng Trezor là một thiết bị USB nhỏ bổ sung thêm mức độ bảo mật cho ví của bạn. Nó an toàn hơn vì khóa riêng của bạn không bao giờ rời khỏi ví phần cứng. Điều này bảo vệ tiền của bạn ngay cả khi máy tính của bạn bị xâm phạm do phần mềm độc hại, nỗ lực lừa đảo, v. v.", "wallet.add.optionDialog.connect.hw.trezor.title": "Ví cứng Trezor", - "wallet.add.optionDialog.create.normalWallet.description": "Một ví tiêu chuẩn được hỗ trợ bởi một cụm từ khôi phục.", - "wallet.add.optionDialog.create.paperWallet.description": "Ví giấy có thể được tạo ngay cả trên các thiết bị không được kết nối với internet, điều này khiến chúng rất phù hợp để lưu trữ lạnh sử dụng một lần.", "wallet.add.optionDialog.restore.dialogTitle": "Khôi phục Ví", "wallet.add.optionDialog.restore.normalWallet.description": "Nếu bạn có một cụm từ khôi phục bao gồm {length} từ, hãy chọn tùy chọn này để khôi phục ví của bạn.", "wallet.add.optionDialog.restore.normalWallet.title": "Nhập {length}-từ trong cụm từ khôi phục", From 38c5ec1286a84c96657b3c4547e02669e2515ac9 Mon Sep 17 00:00:00 2001 From: Denis Nebytov Date: Fri, 26 May 2023 17:24:32 +0300 Subject: [PATCH 47/80] removed outdated files --- .../step_definitions/wallet-paper-steps.js | 62 ------------------- .../features/wallet-paper-creation.feature | 26 -------- 2 files changed, 88 deletions(-) delete mode 100644 packages/yoroi-extension/features/step_definitions/wallet-paper-steps.js delete mode 100644 packages/yoroi-extension/features/wallet-paper-creation.feature diff --git a/packages/yoroi-extension/features/step_definitions/wallet-paper-steps.js b/packages/yoroi-extension/features/step_definitions/wallet-paper-steps.js deleted file mode 100644 index 3399f6bcb6..0000000000 --- a/packages/yoroi-extension/features/step_definitions/wallet-paper-steps.js +++ /dev/null @@ -1,62 +0,0 @@ -// @flow - -import { Given, Then } from 'cucumber'; -import { expect } from 'chai'; -import { truncateAddress } from '../../app/utils/formatters'; -import { enterRecoveryPhrase } from '../pages/restoreWalletPage'; -import { primaryButton } from '../pages/commonDialogPage'; -import { - addressElement, - getAddressesAmountButton, - paperWalletDialogSelect, -} from '../pages/newWalletPages'; -import { fakeAddresses, halfSecond } from '../support/helpers/common-constants'; - -// ========== Paper wallet ========== - -Then(/^I open Number of Addresses selection dropdown$/, async function () { - await this.click(paperWalletDialogSelect); -}); - -Then(/^I select 2 addresses$/, async function () { - await this.click(getAddressesAmountButton('2')); - await this.driver.sleep(halfSecond); -}); - -Then(/^I click the create paper wallet button$/, async function () { - await this.click(primaryButton); -}); - -Then(/^I enter the paper recovery phrase$/, async function () { - /** - * Mnemomic is printed on the paper wallet and not present in the UI - * So we instead fetch the paper wallet from app memory - */ - const recoveryPhrase = await this.driver.executeScript(() => ( - window.yoroi.stores.substores.ada.paperWallets.paper.scrambledWords - )); - - await enterRecoveryPhrase(this, recoveryPhrase.join(' ')); -}); - -Given(/^I swap the paper wallet addresses$/, async function () { - // make sure 2 addresses we generated as expected - const addresses = await this.driver.executeScript(() => ( - window.yoroi.stores.substores.ada.paperWallets.paper.addresses - )); - expect(addresses.length).to.be.equal(2); - - // we swap out the generated addresses with fake ones to get a consistent UI for screenshots - await this.driver.executeScript((fakes) => { - window.yoroi.stores.substores.ada.paperWallets.paper.addresses = fakes; - }, fakeAddresses); -}); - -Then(/^I should see two addresses displayed$/, async function () { - const addressesElem = await this.findElements(addressElement); - expect(addressesElem.length).to.be.equal(fakeAddresses.length); - for (let i = 0; i < fakeAddresses.length; i++) { - const address = await addressesElem[i].getText(); - expect(address).to.be.equal(truncateAddress(fakeAddresses[i])); - } -}); diff --git a/packages/yoroi-extension/features/wallet-paper-creation.feature b/packages/yoroi-extension/features/wallet-paper-creation.feature deleted file mode 100644 index 964f985806..0000000000 --- a/packages/yoroi-extension/features/wallet-paper-creation.feature +++ /dev/null @@ -1,26 +0,0 @@ -Feature: Wallet Paper creation - - Background: - Given I have opened the extension - And I have completed the basic setup - - @it-77 - Scenario: Paper wallet creation (IT-77) - When I click the create button - Then I select the currency cardano - Then I select Paper Wallet - Then I open Number of Addresses selection dropdown - And I select 2 addresses - Then I click the create paper wallet button - Then I enter the paper wallet password "cool password" - And I repeat the wallet password "cool password" - Then I click the next button - # wait for paper wallet generation then go to next - Then I click the next button - And I enter the paper recovery phrase - And I enter the paper wallet password "cool password" - # swap addresses for UI testing - Given I swap the paper wallet addresses - Then I click then button labeled "Verify wallet" - Then I should see two addresses displayed - Then I click the next button \ No newline at end of file From 8c65dacf22415bf38616fff6093b4d71c8483d94 Mon Sep 17 00:00:00 2001 From: Denis Nebytov Date: Fri, 26 May 2023 17:25:34 +0300 Subject: [PATCH 48/80] updated path to firefox binary --- packages/yoroi-extension/features/support/webdriver.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/yoroi-extension/features/support/webdriver.js b/packages/yoroi-extension/features/support/webdriver.js index b18e32cd80..59cb2f6139 100644 --- a/packages/yoroi-extension/features/support/webdriver.js +++ b/packages/yoroi-extension/features/support/webdriver.js @@ -19,6 +19,10 @@ import { const fs = require('fs'); +const firefoxBin = process.env.FIREFOX_BIN + ? process.env.FIREFOX_BIN + : '/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox-bin'; + function encode(file) { return fs.readFileSync(file, { encoding: 'base64' }); } @@ -85,7 +89,7 @@ function getFirefoxBuilder() { * For Firefox it is needed to use "Firefox for Developers" to load the unsigned extensions * Set the FIREFOX_DEV env variable to the "Firefix for Developers" executable */ - .setBinary(process.env.FIREFOX_DEV) + .setBinary(firefoxBin) .addExtensions(path.resolve(__dirname, '../../Yoroi.xpi')) /** * Firefox disallows unsigned extensions by default. We solve this through a config change From 22914b80988966a222198d646edca7577c13e18e Mon Sep 17 00:00:00 2001 From: Denis Nebytov Date: Fri, 26 May 2023 17:32:55 +0300 Subject: [PATCH 49/80] removed outdated information --- .../features/mock-chain/TestWallets.js | 60 ++++++++-- .../features/pages/newWalletPages.js | 34 +----- .../features/pages/restoreWalletPage.js | 1 - .../features/step_definitions/common-steps.js | 29 +---- .../step_definitions/wallet-creation-steps.js | 12 -- .../wallet-restoration-steps.js | 19 ---- .../features/transactions.feature | 107 ------------------ .../features/wallet-creation.feature | 23 +--- .../features/wallet-restoration.feature | 41 ------- 9 files changed, 56 insertions(+), 270 deletions(-) diff --git a/packages/yoroi-extension/features/mock-chain/TestWallets.js b/packages/yoroi-extension/features/mock-chain/TestWallets.js index 87aef41daf..8abbc5f345 100644 --- a/packages/yoroi-extension/features/mock-chain/TestWallets.js +++ b/packages/yoroi-extension/features/mock-chain/TestWallets.js @@ -7,8 +7,8 @@ export type RestorationInput = {| password: string, mnemonic: string, plate: string, - plateByron?: string, - deviceId?: ?string, + plateByron: string, + deviceId: string, |}; function getMnemonicFromEnv(walletName): string { @@ -19,16 +19,17 @@ function createWallet(payload: {| name: string, mnemonic: string, plate: string, - plateByron?: ?string, - deviceId?: ?string, + plateByron: string, + deviceId: string, |}) { - const { name, mnemonic, plate } = payload; + const { name, mnemonic, plate, plateByron, deviceId } = payload; return { [name]: { name, mnemonic, plate, + plateByron, password: commonWalletPassword, - deviceId: payload.deviceId, + deviceId, } }; } @@ -67,33 +68,44 @@ export const testWallets: { [key: WalletNames]: RestorationInput, ... } = Object createWallet({ name: ('small-single-tx': WalletNames), mnemonic: 'eight country switch draw meat scout mystery blade tip drift useless good keep usage title', - plate: 'EAJD-7036', + plate: '', + plateByron: 'EAJD-7036', + deviceId: '', }), createWallet({ name: ('failed-single-tx': WalletNames), mnemonic: 'broken common spring toilet work safe decrease equal velvet cluster myth old toy hold rain', plate: 'JSLX-5059', + plateByron: '', + deviceId: '', }), createWallet({ name: ('many-tx-wallet': WalletNames), mnemonic: 'final autumn bacon fold horse scissors act pole country focus task blush basket move view', plate: 'ZKTZ-4614', + plateByron: '', + deviceId: '', }), createWallet({ name: ('empty-wallet': WalletNames), mnemonic: 'burst hood dance captain city crane over olive notice sugar what bubble butter wealth grace', plate: 'PZEB-5741', plateByron: 'ZPOX-6942', + deviceId: '', }), createWallet({ name: ('simple-pending-wallet': WalletNames), mnemonic: 'ritual horn upon plastic foster enemy expect hand control coil jeans wolf arch isolate farm', plate: 'DPAH-1099', + plateByron: '', + deviceId: '', }), createWallet({ name: ('tx-big-input-wallet': WalletNames), mnemonic: 'dragon mango general very inmate idea rabbit pencil element bleak term cart critic kite pill', plate: 'EDAO-9229', + plateByron: '', + deviceId: '', }), createWallet({ // a wallet to send stuff to when you need a tx output @@ -101,11 +113,15 @@ export const testWallets: { [key: WalletNames]: RestorationInput, ... } = Object name: ('dump-wallet': WalletNames), mnemonic: 'proud nuclear patch arm digital theory peasant winner person knock mirror across immune certain power', plate: 'XXXX-1111', + plateByron: '', + deviceId: '', }), createWallet({ name: ('jormungandr-test': WalletNames), mnemonic: '', plate: 'XXXX-1111', + plateByron: '', + deviceId: '', }), createWallet({ name: ('ledger-wallet': WalletNames), @@ -125,72 +141,98 @@ export const testWallets: { [key: WalletNames]: RestorationInput, ... } = Object name: ('shelley-simple-24': WalletNames), mnemonic: 'reunion walnut update express purse defense slice barrel estate olympic february flock give team alert coast luggage exhaust notable bag december split furnace sponsor', plate: 'DSKC-9213', + plateByron: '', + deviceId: '', }), createWallet({ name: ('shelley-collateral': WalletNames), mnemonic: 'deal calm cloth world refuse pledge grant tuna inner body fat afford absorb off barely', plate: 'HLBZ-9462', + plateByron: '', + deviceId: '', }), createWallet({ name: ('shelley-simple-15': WalletNames), mnemonic: 'eight country switch draw meat scout mystery blade tip drift useless good keep usage title', plate: 'ZDDC-9858', + plateByron: '', + deviceId: '', }), createWallet({ name: ('shelley-delegated': WalletNames), mnemonic: 'parrot offer switch thank film high drop salute task train squirrel coral consider coyote evolve', plate: 'PALP-0076', + plateByron: '', deviceId: '6495958994A4025BB5EE1DB1', }), createWallet({ name: ('shelley-ledger-delegated': WalletNames), mnemonic: 'parrot offer switch thank film high drop salute task train squirrel coral consider coyote evolve', plate: 'PALP-0076', + plateByron: '', deviceId: '707fa118bf6b84', }), createWallet({ name: ('shelley-only-registered': WalletNames), mnemonic: 'pig organ result afraid abstract arrest brass kangaroo hub cube crunch return vibrant core make', plate: 'TDDO-4310', + plateByron: '', + deviceId: '', }), createWallet({ name: ('shelley-enterprise': WalletNames), mnemonic: 'much million increase spot visa domain grow brother chief mechanic innocent envelope vacant bundle coyote', plate: 'HBDZ-9545', + plateByron: '', + deviceId: '', }), createWallet({ name: ('shelley-mangled': WalletNames), mnemonic: 'weekend december choose maid rack helmet canoe bridge strike section lift autumn route practice seat', plate: 'JCEH-5025', + plateByron: '', + deviceId: '', }), createWallet({ name: ('ergo-simple-wallet': WalletNames), mnemonic: 'eight country switch draw meat scout mystery blade tip drift useless good keep usage title', plate: 'CXTP-1821', + plateByron: '', + deviceId: '', }), createWallet({ name: ('ergo-token-wallet': WalletNames), mnemonic: 'rent sword help dynamic enhance collect biology drama agent raven grape bike march length leisure', plate: 'AZTH-1588', + plateByron: '', + deviceId: '', }), createWallet({ name: ('cardano-token-wallet': WalletNames), mnemonic: 'rent sword help dynamic enhance collect biology drama agent raven grape bike march length leisure', plate: 'HZPX-1482', + plateByron: '', + deviceId: '', }), createWallet({ name: ('First-Smoke-Test-Wallet': WalletNames), mnemonic: getMnemonicFromEnv('FIRST_SMOKE_TEST_WALLET'), - plate: 'XONT-4910' + plate: 'XONT-4910', + plateByron: '', + deviceId: '', }), createWallet({ name: ('Second-Smoke-Test-Wallet': WalletNames), mnemonic: getMnemonicFromEnv('SECOND_SMOKE_TEST_WALLET'), plate: 'XZHD-1651', + plateByron: '', + deviceId: '', }), createWallet({ name: ('Second-Smoke-Test-Wallet-FF': WalletNames), mnemonic: getMnemonicFromEnv('SECOND_SMOKE_TEST_WALLET_FF'), - plate: 'CJBE-8896' + plate: 'CJBE-8896', + plateByron: '', + deviceId: '', }), ); diff --git a/packages/yoroi-extension/features/pages/newWalletPages.js b/packages/yoroi-extension/features/pages/newWalletPages.js index e18b42ed76..88c65b1d1a 100644 --- a/packages/yoroi-extension/features/pages/newWalletPages.js +++ b/packages/yoroi-extension/features/pages/newWalletPages.js @@ -17,10 +17,6 @@ export const pickUpCurrencyDialog: LocatorObject = { locator: '.PickCurrencyOptionDialog', method: 'css', }; -export const pickUpCurrencyDialogErgo: LocatorObject = { - locator: '.PickCurrencyOptionDialog_ergo', - method: 'css', -}; export const pickUpCurrencyDialogCardano: LocatorObject = { locator: '.PickCurrencyOptionDialog_cardano', method: 'css', @@ -75,18 +71,6 @@ export const trezorWalletName: LocatorObject = { }; export const trezorConfirmButton: LocatorObject = { locator: '.MuiButton-primary', method: 'css' }; // Create wallet dialog -export const createOptionDialog: LocatorObject = { - locator: '.WalletCreateOptionDialog', - method: 'css', -}; -export const createNormalWalletButton: LocatorObject = { - locator: '.WalletCreateOptionDialog_createWallet', - method: 'css' -}; -export const createPaperWalletButton: LocatorObject = { - locator: '.WalletCreateOptionDialog_restorePaperWallet', - method: 'css', -}; export const createWalletPasswordInput: LocatorObject = { locator: '.WalletCreateDialog .walletPassword input', method: 'css', @@ -140,34 +124,20 @@ export const getRecoveryPhraseWord = (indexNumber: number): LocatorObject => { }; }; -// Paper Wallet dialog -export const paperWalletDialogSelect: LocatorObject = { - locator: '.WalletPaperDialog_component .MuiSelect-select', - method: 'css', -}; -export const restorePaperWalletButton: LocatorObject = { - locator: '.WalletRestoreOptionDialog_restorePaperWallet', - method: 'css', -}; export const restoreDialogButton: LocatorObject = { locator: '.WalletRestoreDialog .primary', method: 'css', }; -export const getAddressesAmountButton = (addressesAmount: string): LocatorObject => { - return { locator: `//li[contains(text(), "${addressesAmount}")]`, method: 'xpath' }; -}; + export const recoveryPhraseDeleteIcon = { locator: `(//span[contains(text(), '×')])[1]`, method: 'xpath', }; + export const recoveryPhraseError: LocatorObject = { locator: '//p[starts-with(@id, "recoveryPhrase--")]', method: 'xpath', }; -export const addressElement : LocatorObject = { - locator: '//span[contains(@class, "RawHash_hash")]', - method: 'xpath', -}; // Common elements export const walletNameInput: LocatorObject = { diff --git a/packages/yoroi-extension/features/pages/restoreWalletPage.js b/packages/yoroi-extension/features/pages/restoreWalletPage.js index 53f5e7c93c..ce33de8ad0 100644 --- a/packages/yoroi-extension/features/pages/restoreWalletPage.js +++ b/packages/yoroi-extension/features/pages/restoreWalletPage.js @@ -49,7 +49,6 @@ export const walletNameInput: LocatorObject = { locator: "input[name='walletName export const confirmRestoreWalletButton: LocatorObject = { locator: '.WalletRestoreDialog .primary', method: 'css' }; export const walletPasswordInput: LocatorObject = { locator: "input[name='walletPassword']", method: 'css' }; export const repeatPasswordInput: LocatorObject = { locator: "input[name='repeatPassword']", method: 'css' }; -export const paperPasswordInput: LocatorObject = { locator: "input[name='paperPassword']", method: 'css' }; export const confirmButton: LocatorObject = { locator: '.confirmButton', method: 'css' }; export const confirmConfirmationButton: LocatorObject = { locator: '.WalletRestoreDialog .primary', method: 'css' }; export const verifyRestoredInfoDialog: LocatorObject = { locator: '.WalletRestoreVerifyDialog_dialog', method: 'css' }; diff --git a/packages/yoroi-extension/features/step_definitions/common-steps.js b/packages/yoroi-extension/features/step_definitions/common-steps.js index 3607108ab7..3c915d6d07 100644 --- a/packages/yoroi-extension/features/step_definitions/common-steps.js +++ b/packages/yoroi-extension/features/step_definitions/common-steps.js @@ -50,16 +50,12 @@ import { trezorConfirmButton, walletNameInput, saveDialog, - pickUpCurrencyDialogErgo, walletRestoreOptionDialog, restoreNormalWallet, - walletRestoreDialog, restoreWalletButton, saveButton, byronEraButton, createWalletButton, - createOptionDialog, - createNormalWalletButton, } from '../pages/newWalletPages'; import { allowPubKeysAndSwitchToYoroi, switchToTrezorAndAllow } from './trezor-steps'; import { @@ -276,8 +272,9 @@ export async function getIndexedDBTablesInfo(customWorld: any, postfix: string = } }; -export async function getPlates(customWorld: any): Promise { +export async function getPlates(customWorld: any): Promise> { // check plate in confirmation dialog + await customWorld.waitForElement(restoringDialogPlate); let plateElements = await customWorld.findElements(restoringDialogPlate); // this makes this function also work for wallets that already exist @@ -437,25 +434,6 @@ Then(/^I pause the test to debug$/, async function () { await this.waitForElement({ locator: '.element_that_does_not_exist', method: 'css' }); }); -Given(/^There is an Ergo wallet stored named ([^"]*)$/, async function (walletName) { - this.webDriverLogger.info(`Step: There is an Ergo wallet stored named ${walletName}`); - const restoreInfo = testWallets[walletName]; - expect(restoreInfo).to.not.equal(undefined); - - await this.click(restoreWalletButton); - - await this.waitForElement(pickUpCurrencyDialog); - await this.click(pickUpCurrencyDialogErgo); - - await this.waitForElement(walletRestoreOptionDialog); - - await this.click(restoreNormalWallet); - await this.waitForElement(walletRestoreDialog); - - await inputMnemonicForWallet(this, restoreInfo); - await checkWalletPlate(this, walletName, restoreInfo); -}); - Given(/^There is a Shelley wallet stored named ([^"]*)$/, async function (walletName: WalletNames) { this.webDriverLogger.info(`Step: There is a Shelley wallet stored named ${walletName}`); const browserName = await this.getBrowser(); @@ -477,9 +455,6 @@ Given(/^I create a new Shelley wallet with the name ([^"]*)$/, async function (w await this.waitForElement(pickUpCurrencyDialog); await this.click(getCurrencyButton('cardano')); - await this.waitForElement(createOptionDialog); - await this.click(createNormalWalletButton); - await this.waitForElement(walletInfoDialog); await this.input(walletNameInput, walletName); await this.input(walletPasswordInput, commonWalletPassword); diff --git a/packages/yoroi-extension/features/step_definitions/wallet-creation-steps.js b/packages/yoroi-extension/features/step_definitions/wallet-creation-steps.js index 61e2395723..6c18d0e264 100644 --- a/packages/yoroi-extension/features/step_definitions/wallet-creation-steps.js +++ b/packages/yoroi-extension/features/step_definitions/wallet-creation-steps.js @@ -7,9 +7,6 @@ import { expect } from 'chai'; import { checkErrorByTranslationId } from './common-steps'; import { clearButton, - createNormalWalletButton, - createOptionDialog, - createPaperWalletButton, createPersonalWalletButton, createWalletButton, createWalletNameError, @@ -39,15 +36,6 @@ When(/^I select the currency ([^"]*)$/, async function (currency) { await this.click(getCurrencyButton(currency)); }); -When(/^I select Create Wallet$/, async function () { - await this.waitForElement(createOptionDialog); - await this.click(createNormalWalletButton); -}); -When(/^I select Paper Wallet$/, async function () { - await this.waitForElement(createOptionDialog); - await this.click(createPaperWalletButton); -}); - When(/^I enter the created wallet password:$/, async function (table) { const fields = table.hashes()[0]; await this.input(createWalletPasswordInput, fields.password); diff --git a/packages/yoroi-extension/features/step_definitions/wallet-restoration-steps.js b/packages/yoroi-extension/features/step_definitions/wallet-restoration-steps.js index c353fb19db..1f77259812 100644 --- a/packages/yoroi-extension/features/step_definitions/wallet-restoration-steps.js +++ b/packages/yoroi-extension/features/step_definitions/wallet-restoration-steps.js @@ -11,7 +11,6 @@ import { confirmButton, errorInvalidRecoveryPhrase, getWords, - paperPasswordInput, recoveryPhraseField, repeatPasswordInput, walletPasswordInput, @@ -20,14 +19,12 @@ import { masterKeyInput } from '../pages/walletClaimTransferPage'; import { byronEraButton, pickUpCurrencyDialog, - pickUpCurrencyDialogCardano, recoveryPhraseDeleteIcon, recoveryPhraseError, restoreWalletButton, restore24WordWallet, restoreDialogButton, restoreNormalWallet, - restorePaperWalletButton, shelleyEraButton, walletAlreadyExistsComponent, walletRestoreDialog, @@ -64,18 +61,6 @@ Then(/^I select bip44 15-word wallet$/, async function () { await this.waitForElement(walletRestoreDialog); }); -When(/^I click the restore paper wallet button$/, async function () { - await this.click(restoreWalletButton); - - await this.waitForElement(pickUpCurrencyDialog); - await this.click(pickUpCurrencyDialogCardano); - - await this.waitForElement(walletRestoreOptionDialog); - - await this.click(restorePaperWalletButton); - await this.waitForElement(walletRestoreDialog); -}); - When(/^I enter the recovery phrase:$/, async function (table) { const fields = table.hashes()[0]; await enterRecoveryPhrase(this, fields.recoveryPhrase); @@ -129,10 +114,6 @@ Then(/^I repeat the wallet password "([^"]*)"$/, async function (password) { await this.input(repeatPasswordInput, password); }); -When(/^I enter the paper wallet password "([^"]*)"$/, async function (password) { - await this.input(paperPasswordInput, password); -}); - When(/^I clear the restored wallet password ([^"]*)$/, async function (password) { await this.clearInputUpdatingForm(walletPasswordInput, password.length); }); diff --git a/packages/yoroi-extension/features/transactions.feature b/packages/yoroi-extension/features/transactions.feature index c2b6b3d667..0c31266cb9 100644 --- a/packages/yoroi-extension/features/transactions.feature +++ b/packages/yoroi-extension/features/transactions.feature @@ -277,63 +277,6 @@ Feature: Send transaction Then I submit the wallet send form Then I should see an delegation incorrect wallet password error message - @it-162 - Scenario Outline: Send from an ergo wallet (IT-162) - Given There is an Ergo wallet stored named ergo-simple-wallet - And I have an ERGO wallet with funds - When I go to the send transaction screen - And I fill the form: - | address | amount | - |
| | - And The transaction fees are "" - And I click on the next button in the wallet send form - And I see send money confirmation dialog - And I see CONFIRM TRANSACTION Pop up: - | address | amount |fee | isErgo | - |
| | | 1 | - And I enter the wallet password: - | password | - | asdfasdfasdf | - And I submit the wallet send form - Then I should see the successfully sent page - And I click the transaction page button - Then I should see the summary screen - - Examples: - | address | amount |fee | - | 9guxMsa2S1Z4xzr5JHUHZesznThjZ4BMM9Ra5Lfx2E9duAnxEmv | 5.000000000 |0.001100000 | - - @it-163 - Scenario: Send all from an ergo wallet (IT-163) - When I click the restore button for ergo - Then I select bip44 15-word wallet - And I enter the name "Restored Wallet" - And I enter the recovery phrase: - | recoveryPhrase | - | eight country switch draw meat scout mystery blade tip drift useless good keep usage title | - And I enter the restored wallet password: - | password | repeatedPassword | - | asdfasdfasdf | asdfasdfasdf | - And I click the "Restore Wallet" button - Then I should see a plate CXTP-1821 - Then I click the next button - Then I should see the opened wallet with name "Restored Wallet" - When I go to the send transaction screen - And I fill the address of the form: - | address | - | 9guxMsa2S1Z4xzr5JHUHZesznThjZ4BMM9Ra5Lfx2E9duAnxEmv | - And I open the amount dropdown and select send all - And The transaction fees are "0.001100000" - And I click on the next button in the wallet send form - And I see send money confirmation dialog - And I enter the wallet password: - | password | - | asdfasdfasdf | - And I submit the wallet send form - Then I should see the successfully sent page - And I click the transaction page button - Then I should see the summary screen - @it-164 Scenario Outline: Can receive & send funds from enterprise address (IT-164) Given There is a Shelley wallet stored named shelley-enterprise @@ -386,56 +329,6 @@ Feature: Send transaction Then I should see the summary screen And I should see 1 pending transactions - @it-170 - Scenario Outline: Can send some of a custom token (IT-170) - Given There is an Ergo wallet stored named ergo-token-wallet - And I have an ERGO wallet with funds - When I go to the send transaction screen - And I open the token selection dropdown - And I select token "USD" - And I fill the form: - | address | amount | - |
| | - And The transaction fees are "" - And I click on the next button in the wallet send form - And I see send money confirmation dialog - And I see CONFIRM TRANSACTION Pop up: - | address | amount |fee | isErgo | - |
| 0.010000000 | | 1 | - And I enter the wallet password: - | password | - | asdfasdfasdf | - And I submit the wallet send form - Then I should see the successfully sent page - And I click the transaction page button - Then I should see the summary screen - - Examples: - | address | amount | fee | - | 9guxMsa2S1Z4xzr5JHUHZesznThjZ4BMM9Ra5Lfx2E9duAnxEmv | 123 |0.001100000 | - - @it-171 - Scenario: Can send all of a custom token (IT-171) - Given There is an Ergo wallet stored named ergo-token-wallet - And I have an ERGO wallet with funds - When I go to the send transaction screen - And I open the token selection dropdown - And I select token "USD" - And I fill the address of the form: - | address | - | 9guxMsa2S1Z4xzr5JHUHZesznThjZ4BMM9Ra5Lfx2E9duAnxEmv | - And I open the amount dropdown and select send all - And The transaction fees are "0.001100000" - And I click on the next button in the wallet send form - And I see send money confirmation dialog - And I enter the wallet password: - | password | - | asdfasdfasdf | - And I submit the wallet send form - Then I should see the successfully sent page - And I click the transaction page button - Then I should see the summary screen - @it-178 Scenario Outline: Can send some of a custom Cardano token (IT-178) Given There is a Shelley wallet stored named cardano-token-wallet diff --git a/packages/yoroi-extension/features/wallet-creation.feature b/packages/yoroi-extension/features/wallet-creation.feature index dff1d6b4e8..0972a8f349 100644 --- a/packages/yoroi-extension/features/wallet-creation.feature +++ b/packages/yoroi-extension/features/wallet-creation.feature @@ -9,7 +9,6 @@ Feature: Wallet creation Scenario: Wallet creation (IT-5) When I click the create button Then I select the currency cardano - Then I select Create Wallet And I enter the name "Created Wallet" And I enter the created wallet password: | password | repeatedPassword | @@ -23,7 +22,6 @@ Feature: Wallet creation Scenario Outline: Wallet can't be created if its password doesn't meet complexity requirements (IT-7) When I click the create button Then I select the currency cardano - Then I select Create Wallet And I enter the name "Created Wallet" And I enter the created wallet password: | password | repeatedPassword | @@ -41,7 +39,6 @@ Feature: Wallet creation Scenario: Wallet access after browser restart (IT-9) When I click the create button Then I select the currency cardano - Then I select Create Wallet And I enter the name "Created Wallet" And I enter the created wallet password: | password | repeatedPassword | @@ -57,7 +54,6 @@ Feature: Wallet creation Scenario Outline: Wallet can't be created if wallet name doesn't meet requirements (IT-16) When I click the create button Then I select the currency cardano - Then I select Create Wallet And I enter the name "Created Wallet" And I enter the created wallet password: | password | repeatedPassword | @@ -79,7 +75,6 @@ Feature: Wallet creation Scenario: Mnemonic words can be cleared by clicking "Clear button" on wallet creation screen (IT-18) When I click the create button Then I select the currency cardano - Then I select Create Wallet And I enter the name "Created Wallet" And I enter the created wallet password: | password | repeatedPassword | @@ -94,7 +89,6 @@ Feature: Wallet creation Scenario: Wallet can't be created without entering password (IT-24) When I click the create button Then I select the currency cardano - Then I select Create Wallet And I enter the name "Created Wallet" And I enter the created wallet password: | password | repeatedPassword | @@ -109,7 +103,6 @@ Feature: Wallet creation Scenario: Users will be presented with a security warning prior to seed creation (IT-27) When I click the create button Then I select the currency cardano - Then I select Create Wallet And I enter the name "Created Wallet" And I enter the created wallet password: | password | repeatedPassword | @@ -117,18 +110,4 @@ Feature: Wallet creation And I click the "Create personal wallet" button Then I see the security warning prior: | message | - | wallet.backup.privacy.warning.dialog.checkbox.label.nobodyWatching | - - @it-131 - Scenario: Wallet creation. Ergo (IT-131) - When I click the create button - Then I select the currency ergo - Then I select Create Wallet - And I enter the name "Created Wallet" - And I enter the created wallet password: - | password | repeatedPassword | - | asdfasdfasdf | asdfasdfasdf | - And I click the "Create personal wallet" button - And I accept the creation terms - And I copy and enter the displayed mnemonic phrase - Then I should see the opened wallet with name "Created Wallet" + | wallet.backup.privacy.warning.dialog.checkbox.label.nobodyWatching | \ No newline at end of file diff --git a/packages/yoroi-extension/features/wallet-restoration.feature b/packages/yoroi-extension/features/wallet-restoration.feature index 4cdf961fb7..2fac78e138 100644 --- a/packages/yoroi-extension/features/wallet-restoration.feature +++ b/packages/yoroi-extension/features/wallet-restoration.feature @@ -104,27 +104,6 @@ Feature: Restore Wallet | recoveryPhrase | | | remind style lunch result accuse upgrade atom eight limit glance frequent eternal fashion borrow monster galaxy | 16-words phrase | - @it-72 - Scenario: Restoring a paper wallet (IT-72) - When I click the restore paper wallet button - And I enter the name "Restored Wallet" - And I enter the recovery phrase: - | recoveryPhrase | - | mushroom expose slogan wagon uphold train absurd fix snake unable rescue curious escape member resource garbage enemy champion airport matrix year | - And I enter the paper wallet password "cool password" - And I enter the restored wallet password: - | password | repeatedPassword | - | asdfasdfasdf | asdfasdfasdf | - And I click the "Restore Wallet" button - Then I should see a plate KOTZ-1730 - Then I click the next button - Then I should see the opened wallet with name "Restored Wallet" - And I go to the receive screen - And I should see the addresses exactly list them - | address | - | Ae2tdPwUPEZF4q7tzeXnofsXLF3yCW7mwbFVxucwoXBrfUCGXJ9yHWzwVm8 | - | Ae2tdPwUPEZ7TQpzbJZCbA5BjW4zWYFn47jKo43ouvfe4EABoCfvEjwYvJr | - @it-73 Scenario Outline: Wallet restoration Recovery Phrase with less than 15 words (IT-73) And I click the restore button for cardano @@ -234,26 +213,6 @@ Feature: Restore Wallet Then I switch to "many-tx-wallet" from the dropdown Then I should see the opened wallet with name "many-tx-wallet" - @it-130 - Scenario: Restoring an ergo wallet (IT-130) - When I click the restore button for ergo - Then I select bip44 15-word wallet - And I enter the name "Restored Wallet" - And I enter the recovery phrase: - | recoveryPhrase | - | eight country switch draw meat scout mystery blade tip drift useless good keep usage title | - And I enter the restored wallet password: - | password | repeatedPassword | - | asdfasdfasdf | asdfasdfasdf | - And I click the "Restore Wallet" button - Then I should see a plate CXTP-1821 - Then I click the next button - Then I should see the opened wallet with name "Restored Wallet" - And I go to the receive screen - And I should see the addresses exactly list them - | address | - | 9erND2FjDWVTgT2TWRZ9dCLueKAWjoskx6KqRmZbtvtRXEgCrja | - @it-132 Scenario: Restoring a shelley 15-word wallet (IT-132) When I click the restore button for cardano From 7ed24e7ed74474d17980322a2ff5440c557862e8 Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Mon, 29 May 2023 09:14:12 -0400 Subject: [PATCH 50/80] New translations en-US.json (Hungarian) --- packages/yoroi-extension/app/i18n/locales/hu-HU.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/i18n/locales/hu-HU.json b/packages/yoroi-extension/app/i18n/locales/hu-HU.json index b02feda60a..4358e38d00 100644 --- a/packages/yoroi-extension/app/i18n/locales/hu-HU.json +++ b/packages/yoroi-extension/app/i18n/locales/hu-HU.json @@ -466,6 +466,7 @@ "wallet.add.page.revamp.createWallet": "Create new wallet", "wallet.add.page.revamp.restoreWallet": "Restore existing wallet", "wallet.add.page.revamp.subtitle": "Light wallet for Cardano assets", + "wallet.add.page.revamp.backButtonLabel": "Back to current wallet", "wallet.add.page.subtitle.label": "Yoroi light wallet for Cardano", "wallet.add.page.title": "Your gateway
to the
financial world", "wallet.address.category.addressBook": "Addresses that do not belong to you, but are relevant to your wallet", @@ -1059,4 +1060,4 @@ "yoroiTransfer.waiting.progressInfo.checkingAddresses": "Checking addresses funds", "yoroiTransfer.waiting.progressInfo.restoringAddresses": "Fetching addresses", "yoroiTransfer.waiting.title.label": "Wallet is being restored" -} \ No newline at end of file +} From 02942943a6cdbf6b4540c974f35b3981288f8f91 Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Mon, 29 May 2023 09:14:14 -0400 Subject: [PATCH 51/80] New translations en-US.json (Vietnamese) --- packages/yoroi-extension/app/i18n/locales/vi-VN.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/i18n/locales/vi-VN.json b/packages/yoroi-extension/app/i18n/locales/vi-VN.json index b42f857eef..1eb18ff972 100644 --- a/packages/yoroi-extension/app/i18n/locales/vi-VN.json +++ b/packages/yoroi-extension/app/i18n/locales/vi-VN.json @@ -466,6 +466,7 @@ "wallet.add.page.revamp.createWallet": "Tạo ví mới", "wallet.add.page.revamp.restoreWallet": "Khôi phục ví đã tồn tại", "wallet.add.page.revamp.subtitle": "Ví nhẹ cho tài sản Cardano", + "wallet.add.page.revamp.backButtonLabel": "Back to current wallet", "wallet.add.page.subtitle.label": "Ví nhẹ Yoroi cho Cardano", "wallet.add.page.title": "Cửa ngõ
của bạn đến với thế giới tài chính
", "wallet.address.category.addressBook": "Địa chỉ không thuộc về bạn nhưng có liên quan đến ví của bạn", @@ -1059,4 +1060,4 @@ "yoroiTransfer.waiting.progressInfo.checkingAddresses": "Kiểm tra địa chỉ quỹ", "yoroiTransfer.waiting.progressInfo.restoringAddresses": "Đang tìm nạp địa chỉ", "yoroiTransfer.waiting.title.label": "Ví đang được khôi phục" -} \ No newline at end of file +} From 450d2f47209d2189e7fe5818dc89c258f3a67293 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Wed, 31 May 2023 13:49:50 +0300 Subject: [PATCH 52/80] fix(tx): add default token decimals to be zero --- .../app/components/wallet/transactions/TransactionRevamp.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/components/wallet/transactions/TransactionRevamp.js b/packages/yoroi-extension/app/components/wallet/transactions/TransactionRevamp.js index c52fa19451..58ccef415e 100644 --- a/packages/yoroi-extension/app/components/wallet/transactions/TransactionRevamp.js +++ b/packages/yoroi-extension/app/components/wallet/transactions/TransactionRevamp.js @@ -198,7 +198,8 @@ export default class TransactionRevamp extends Component { return {hiddenAmount}; } const tokenInfo = this.props.getTokenInfo(request.entry); - const shiftedAmount = request.entry.amount.shiftedBy(-tokenInfo.Metadata.numberOfDecimals); + const numberOfDecimals = tokenInfo?.Metadata.numberOfDecimals ?? 0; + const shiftedAmount = request.entry.amount.shiftedBy(numberOfDecimals); const [beforeDecimalRewards, afterDecimalRewards] = splitAmount( shiftedAmount, From c63a6f82084b01f1a9585dce874522e6ebfecd09 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Thu, 1 Jun 2023 12:25:17 +0300 Subject: [PATCH 53/80] fix(send-tx): update transaction success dialog layout --- .../app/components/transfer/SuccessPage.js | 22 ++++++++++++++----- .../app/components/transfer/SuccessPage.scss | 20 +---------------- .../app/containers/wallet/WalletSendPage.js | 2 +- 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/packages/yoroi-extension/app/components/transfer/SuccessPage.js b/packages/yoroi-extension/app/components/transfer/SuccessPage.js index 0ee2a8a23e..1423400e51 100644 --- a/packages/yoroi-extension/app/components/transfer/SuccessPage.js +++ b/packages/yoroi-extension/app/components/transfer/SuccessPage.js @@ -8,6 +8,7 @@ import Dialog from '../widgets/Dialog'; import DialogCloseButton from '../widgets/DialogCloseButton'; import LoadingSpinner from '../widgets/LoadingSpinner'; import type { $npm$ReactIntl$IntlFormat } from 'react-intl'; +import { Typography } from '@mui/material'; type Props = {| +title: string, @@ -48,17 +49,28 @@ export default class SuccessPage extends Component { closeOnOverlayClick={false} onClose={this.props.closeInfo ? this.props.closeInfo.onClose : undefined} className={styles.dialog} - closeButton={this.props.closeInfo ? () : undefined} + closeButton={this.props.closeInfo ? : undefined} >
-
+ {title} -
-
+ + {text} -
+ {this.props.closeInfo == null && (
diff --git a/packages/yoroi-extension/app/components/transfer/SuccessPage.scss b/packages/yoroi-extension/app/components/transfer/SuccessPage.scss index 0c0a365baf..116c10b84a 100644 --- a/packages/yoroi-extension/app/components/transfer/SuccessPage.scss +++ b/packages/yoroi-extension/app/components/transfer/SuccessPage.scss @@ -4,25 +4,6 @@ align-items: center; justify-content: center; - .title { - color: var(--yoroi-palette-secondary-300); - text-transform: uppercase; - height: 19px; - font-weight: 500; - font-size: 16px; - font-weight: 500; - line-height: 19px; - text-align: center; - } - - .text { - color: var(--yoroi-palette-gray-800); - font-weight: 400; - font-size: 14px; - line-height: 22px; - text-align: center; - } - .spinnerSection { margin-top: 12px; margin-bottom: 5px; @@ -37,6 +18,7 @@ width: 252px; height: 194px; margin: auto; + margin-top: 30px; } } :global(.YoroiModern):global(.YoroiShelley) .component, :global(.YoroiRevamp):global(.YoroiShelley) .component { diff --git a/packages/yoroi-extension/app/containers/wallet/WalletSendPage.js b/packages/yoroi-extension/app/containers/wallet/WalletSendPage.js index 4c6c33e8bc..e57ae010cc 100644 --- a/packages/yoroi-extension/app/containers/wallet/WalletSendPage.js +++ b/packages/yoroi-extension/app/containers/wallet/WalletSendPage.js @@ -277,7 +277,7 @@ class WalletSendPage extends Component { if (uiDialogs.isOpen(MemoNoExternalStorageDialog)) { return this.noCloudWarningDialog(); } - if(uiDialogs.isOpen(TransactionSuccessDialog)){ + if(uiDialogs.isOpen(TransactionSuccessDialog) || true){ return ( Date: Thu, 1 Jun 2023 12:28:19 +0300 Subject: [PATCH 54/80] fix(tx-send): change title color based on the selected theme --- .../app/components/transfer/SuccessPage.js | 11 +++++++---- .../app/containers/wallet/WalletSendPage.js | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/yoroi-extension/app/components/transfer/SuccessPage.js b/packages/yoroi-extension/app/components/transfer/SuccessPage.js index 1423400e51..1607ac95fd 100644 --- a/packages/yoroi-extension/app/components/transfer/SuccessPage.js +++ b/packages/yoroi-extension/app/components/transfer/SuccessPage.js @@ -9,6 +9,8 @@ import DialogCloseButton from '../widgets/DialogCloseButton'; import LoadingSpinner from '../widgets/LoadingSpinner'; import type { $npm$ReactIntl$IntlFormat } from 'react-intl'; import { Typography } from '@mui/material'; +import { withLayout } from '../../styles/context/layout'; +import type { InjectedLayoutProps } from '../../styles/context/layout'; type Props = {| +title: string, @@ -21,8 +23,7 @@ type Props = {| |}; @observer -export default class SuccessPage extends Component { - +class SuccessPage extends Component { static contextTypes: {|intl: $npm$ReactIntl$IntlFormat|} = { intl: intlShape.isRequired }; @@ -32,7 +33,7 @@ export default class SuccessPage extends Component { }; render(): Node { - const { title, text } = this.props; + const { title, text, isRevampLayout } = this.props; const actions = this.props.closeInfo == null ? undefined @@ -56,7 +57,7 @@ export default class SuccessPage extends Component {
{ ); } } + +export default (withLayout(SuccessPage): ComponentType); \ No newline at end of file diff --git a/packages/yoroi-extension/app/containers/wallet/WalletSendPage.js b/packages/yoroi-extension/app/containers/wallet/WalletSendPage.js index e57ae010cc..4c6c33e8bc 100644 --- a/packages/yoroi-extension/app/containers/wallet/WalletSendPage.js +++ b/packages/yoroi-extension/app/containers/wallet/WalletSendPage.js @@ -277,7 +277,7 @@ class WalletSendPage extends Component { if (uiDialogs.isOpen(MemoNoExternalStorageDialog)) { return this.noCloudWarningDialog(); } - if(uiDialogs.isOpen(TransactionSuccessDialog) || true){ + if(uiDialogs.isOpen(TransactionSuccessDialog)){ return ( Date: Fri, 2 Jun 2023 14:50:24 +0300 Subject: [PATCH 55/80] fix: render json data & watch for null token info --- .../wallet/transactions/TransactionRevamp.js | 51 +++++++++++-------- .../app/components/widgets/CodeBlock.js | 2 +- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/transactions/TransactionRevamp.js b/packages/yoroi-extension/app/components/wallet/transactions/TransactionRevamp.js index 58ccef415e..4068a8f28f 100644 --- a/packages/yoroi-extension/app/components/wallet/transactions/TransactionRevamp.js +++ b/packages/yoroi-extension/app/components/wallet/transactions/TransactionRevamp.js @@ -47,7 +47,7 @@ import CopyableAddress from '../../widgets/CopyableAddress'; import { genAddressLookup } from '../../../stores/stateless/addressStores'; import { MultiToken } from '../../../api/common/lib/MultiToken'; import { hiddenAmount } from '../../../utils/strings'; -import { getTokenName, getTokenIdentifierIfExists } from '../../../stores/stateless/tokenHelpers'; +import { getTokenName, getTokenIdentifierIfExists, assetNameFromIdentifier } from '../../../stores/stateless/tokenHelpers'; import { parseMetadata, parseMetadataDetailed, @@ -199,11 +199,11 @@ export default class TransactionRevamp extends Component { } const tokenInfo = this.props.getTokenInfo(request.entry); const numberOfDecimals = tokenInfo?.Metadata.numberOfDecimals ?? 0; - const shiftedAmount = request.entry.amount.shiftedBy(numberOfDecimals); + const shiftedAmount = request.entry.amount.shiftedBy(-numberOfDecimals); const [beforeDecimalRewards, afterDecimalRewards] = splitAmount( shiftedAmount, - tokenInfo.Metadata.numberOfDecimals + numberOfDecimals, ); // we may need to explicitly add + for positive values @@ -354,7 +354,9 @@ export default class TransactionRevamp extends Component { getTicker: TokenEntry => string = tokenEntry => { const tokenInfo = this.props.getTokenInfo(tokenEntry); - return truncateToken(getTokenName(tokenInfo)); + return tokenInfo != null + ? truncateToken(getTokenName(tokenInfo)) + : assetNameFromIdentifier(tokenEntry.identifier); }; getFingerprint: TokenEntry => string | void = tokenEntry => { @@ -897,29 +899,38 @@ export default class TransactionRevamp extends Component { const { intl } = this.context; if (data instanceof CardanoShelleyTransaction && data.metadata !== null) { - let jsonData = null; - - try { - jsonData = parseMetadata(data.metadata); - } catch (error) { - // try to parse schema using detailed conversion if advanced user - if (this.props.complexityLevel === ComplexityLevels.Advanced) { - try { - jsonData = parseMetadataDetailed(data.metadata); - } catch (errDetailed) { - // discard error - // can not parse metadata as json - // show the metadata hex as is + let metadata; + if (typeof data.metadata === 'string') { + let jsonData = null; + + try { + jsonData = parseMetadata(data.metadata); + } catch (error) { + // try to parse schema using detailed conversion if advanced user + if (this.props.complexityLevel === ComplexityLevels.Advanced) { + try { + jsonData = parseMetadataDetailed(data.metadata); + } catch (errDetailed) { + // discard error + // can not parse metadata as json + // show the metadata hex as is + } } + // do nothing for simple user + } + if (jsonData !== null) { + metadata = (); + } else { + metadata = (0x{data.metadata}); } - // do nothing for simple user + } else { + metadata = ({JSON.stringify(data.metadata, null, 2)} } />); } - return (

{intl.formatMessage(messages.transactionMetadata)}

- {jsonData !== null ? : 0x{data.metadata}} + {metadata}
); diff --git a/packages/yoroi-extension/app/components/widgets/CodeBlock.js b/packages/yoroi-extension/app/components/widgets/CodeBlock.js index 6f974dc3d4..1a7246f7a4 100644 --- a/packages/yoroi-extension/app/components/widgets/CodeBlock.js +++ b/packages/yoroi-extension/app/components/widgets/CodeBlock.js @@ -5,7 +5,7 @@ import { observer } from 'mobx-react'; import styles from './CodeBlock.scss'; type Props = {| - +code: string, + +code: string | Node, |}; @observer From cdfa6820831d96315e078ddde427e2246f4bac2d Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Fri, 2 Jun 2023 15:53:14 +0300 Subject: [PATCH 56/80] fix(txs): return undefine when token info is not defined --- .../app/components/wallet/transactions/TransactionRevamp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/components/wallet/transactions/TransactionRevamp.js b/packages/yoroi-extension/app/components/wallet/transactions/TransactionRevamp.js index 4068a8f28f..fb207d2929 100644 --- a/packages/yoroi-extension/app/components/wallet/transactions/TransactionRevamp.js +++ b/packages/yoroi-extension/app/components/wallet/transactions/TransactionRevamp.js @@ -361,7 +361,7 @@ export default class TransactionRevamp extends Component { getFingerprint: TokenEntry => string | void = tokenEntry => { const tokenInfo = this.props.getTokenInfo(tokenEntry); - if (tokenInfo.Metadata.type === 'Cardano') { + if (tokenInfo?.Metadata.type === 'Cardano') { return getTokenIdentifierIfExists(tokenInfo); } return undefined; From fcb944c1c0b93fb595314d56679d21c881fe26da Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Mon, 5 Jun 2023 15:23:52 +0300 Subject: [PATCH 57/80] fix: format token amounts fro the tokens list (revamp) --- .../app/components/wallet/assets/TokenList.js | 2 +- .../app/containers/wallet/TokensPageRevamp.js | 22 +++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/assets/TokenList.js b/packages/yoroi-extension/app/components/wallet/assets/TokenList.js index accf777f27..5f57f2bafb 100644 --- a/packages/yoroi-extension/app/components/wallet/assets/TokenList.js +++ b/packages/yoroi-extension/app/components/wallet/assets/TokenList.js @@ -263,7 +263,7 @@ function TokenItemRow({ avatar, name, id, amount, isTotalAmount }: TokenItemRowP color="primary.600" to={id !== '-' && ROUTES.ASSETS.DETAILS.replace(':tokenId', id)} > - {name} + {name}
} diff --git a/packages/yoroi-extension/app/containers/wallet/TokensPageRevamp.js b/packages/yoroi-extension/app/containers/wallet/TokensPageRevamp.js index 9d2d7e3866..dce3735c75 100644 --- a/packages/yoroi-extension/app/containers/wallet/TokensPageRevamp.js +++ b/packages/yoroi-extension/app/containers/wallet/TokensPageRevamp.js @@ -4,12 +4,11 @@ import { Component } from 'react'; import type { InjectedOrGenerated } from '../../types/injectedPropsType'; import type { Node } from 'react'; import { - genFormatTokenAmount, genLookupOrFail, getTokenIdentifierIfExists, getTokenStrictName, } from '../../stores/stateless/tokenHelpers'; -import { truncateToken } from '../../utils/formatters'; +import { splitAmount, truncateToken } from '../../utils/formatters'; import { computed } from 'mobx'; import type { TokenInfoMap } from '../../stores/toplevel/TokenInfoStore'; import type { TokenRow } from '../../api/ada/lib/storage/database/primitives/tables'; @@ -40,11 +39,20 @@ export default class TokensPageRevamp extends Component item.info.IsNFT === false) - .map(token => ({ - name: truncateToken(getTokenStrictName(token.info) ?? '-'), - id: getTokenIdentifierIfExists(token.info) ?? '-', - amount: genFormatTokenAmount(getTokenInfo)(token.entry), - })); + .map(token => { + const numberOfDecimals = token.info?.Metadata.numberOfDecimals ?? 0; + const shiftedAmount = token.entry.amount.shiftedBy(-numberOfDecimals); + const [beforeDecimal, afterDecimal] = splitAmount( + shiftedAmount, + numberOfDecimals + ); + + return { + name: truncateToken(getTokenStrictName(token.info) ?? '-'), + id: getTokenIdentifierIfExists(token.info) ?? '-', + amount: [beforeDecimal, afterDecimal].join(''), + } + }); })(); const txRequests = this.generated.stores.transactions.getTxRequests(publicDeriver); From d5755465ca08ceab500235abbefd8471f63198d2 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Mon, 5 Jun 2023 16:26:58 +0300 Subject: [PATCH 58/80] fix: format token amounts fro the tokens list (modern) --- .../components/wallet/assets/AssetsPage.js | 8 +++---- .../app/components/wallet/assets/TokenList.js | 2 +- .../app/containers/wallet/WalletAssetsPage.js | 22 +++++++++++++------ 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/assets/AssetsPage.js b/packages/yoroi-extension/app/components/wallet/assets/AssetsPage.js index 635deb33f7..4a552b1f1c 100644 --- a/packages/yoroi-extension/app/components/wallet/assets/AssetsPage.js +++ b/packages/yoroi-extension/app/components/wallet/assets/AssetsPage.js @@ -24,14 +24,14 @@ type Props = {| export default class AssetsPage extends Component { render(): Node { - const { assetDeposit, network } = this.props + const { assetDeposit, network, assetsList, getTokenInfo, shouldHideBalance } = this.props; return (
diff --git a/packages/yoroi-extension/app/components/wallet/assets/TokenList.js b/packages/yoroi-extension/app/components/wallet/assets/TokenList.js index 5f57f2bafb..accf777f27 100644 --- a/packages/yoroi-extension/app/components/wallet/assets/TokenList.js +++ b/packages/yoroi-extension/app/components/wallet/assets/TokenList.js @@ -263,7 +263,7 @@ function TokenItemRow({ avatar, name, id, amount, isTotalAmount }: TokenItemRowP color="primary.600" to={id !== '-' && ROUTES.ASSETS.DETAILS.replace(':tokenId', id)} > - {name} + {name} } diff --git a/packages/yoroi-extension/app/containers/wallet/WalletAssetsPage.js b/packages/yoroi-extension/app/containers/wallet/WalletAssetsPage.js index 2219070727..3f74f52453 100644 --- a/packages/yoroi-extension/app/containers/wallet/WalletAssetsPage.js +++ b/packages/yoroi-extension/app/containers/wallet/WalletAssetsPage.js @@ -10,8 +10,8 @@ import { } from '../../api/common/lib/MultiToken'; import type { TokenInfoMap } from '../../stores/toplevel/TokenInfoStore'; import type { TokenRow } from '../../api/ada/lib/storage/database/primitives/tables'; -import { genFormatTokenAmount, genLookupOrFail, getTokenIdentifierIfExists, getTokenStrictName } from '../../stores/stateless/tokenHelpers'; -import { truncateToken } from '../../utils/formatters'; +import { genLookupOrFail, getTokenIdentifierIfExists, getTokenStrictName } from '../../stores/stateless/tokenHelpers'; +import { splitAmount, truncateToken } from '../../utils/formatters'; import AssetsPage from '../../components/wallet/assets/AssetsPage'; import type { TxRequests } from '../../stores/toplevel/TransactionsStore'; @@ -36,11 +36,19 @@ export default class WalletAssetsPage extends Component ({ entry, info: getTokenInfo(entry), - })).map(token => ({ - name: truncateToken(getTokenStrictName(token.info) ?? '-'), - id: (getTokenIdentifierIfExists(token.info) ?? '-'), - amount: genFormatTokenAmount(getTokenInfo)(token.entry), - })); + })).map(token => { + const numberOfDecimals = token.info?.Metadata.numberOfDecimals ?? 0; + const shiftedAmount = token.entry.amount.shiftedBy(-numberOfDecimals); + const [beforeDecimal, afterDecimal] = splitAmount( + shiftedAmount, + numberOfDecimals + ); + return { + name: truncateToken(getTokenStrictName(token.info) ?? '-'), + id: (getTokenIdentifierIfExists(token.info) ?? '-'), + amount: [beforeDecimal, afterDecimal].join(''), + } + }); })(); const txRequests = this.generated.stores.transactions.getTxRequests(publicDeriver); From d66d175ed9476162d8f496b90518847f85c1d6bb Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Tue, 6 Jun 2023 11:10:56 +0300 Subject: [PATCH 59/80] fix: render per epoch rewards instead of total rewards --- .../wallet/staking/dashboard-revamp/RewardHistoryDialog.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/RewardHistoryDialog.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/RewardHistoryDialog.js index 9dbda7a569..a232cf47d0 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/RewardHistoryDialog.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/RewardHistoryDialog.js @@ -48,7 +48,7 @@ type Intl = {| function RewardHistoryDialog({ graphData, onClose, intl }: Props & Intl): Node { const rewardItems = graphData.rewardsGraphData.items; - const rewardList = rewardItems?.totalRewards.filter(p => Boolean(p.primary)) ?? []; + const rewardList = rewardItems?.perEpochRewards.filter(p => Boolean(p.primary)) ?? []; const rewardsByPoolName = useMemo(() => groupByPoolName(rewardList), []); return ( @@ -82,7 +82,7 @@ function RewardHistoryDialog({ graphData, onClose, intl }: Props & Intl): Node { key={poolName} // $FlowFixMe[incompatible-use]: Object entries flow type poolId={data.poolId} - poolName={poolName} + poolName={poolName || '-'} // $FlowFixMe[incompatible-use]: Object entries flow type poolAvatar={data.poolAvatar} // $FlowFixMe[incompatible-use]: Object entries flow type From 24d8341d40dc5b3821c98f773f2405c5b1e1392c Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Mon, 12 Jun 2023 18:44:30 +0300 Subject: [PATCH 60/80] feat: add transaction success revamp dialog --- .../wallet/send/TransactionSuccessDialog.js | 50 ++- .../app/containers/wallet/WalletSendPage.js | 413 ++++++++++-------- .../app/i18n/locales/en-US.json | 6 +- .../app/i18n/locales/hu-HU.json | 5 +- .../app/i18n/locales/vi-VN.json | 5 +- 5 files changed, 258 insertions(+), 221 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/send/TransactionSuccessDialog.js b/packages/yoroi-extension/app/components/wallet/send/TransactionSuccessDialog.js index 7276c45bd1..fc592a6347 100644 --- a/packages/yoroi-extension/app/components/wallet/send/TransactionSuccessDialog.js +++ b/packages/yoroi-extension/app/components/wallet/send/TransactionSuccessDialog.js @@ -4,33 +4,35 @@ import type { Node } from 'react'; import { Component } from 'react'; import { observer } from 'mobx-react'; import { defineMessages, intlShape } from 'react-intl'; -import SuccessPage from '../../transfer/SuccessPage'; import type { $npm$ReactIntl$IntlFormat } from 'react-intl'; +import Dialog from '../../widgets/Dialog'; +import { Stack, Typography } from '@mui/material'; +import DialogCloseButton from '../../widgets/DialogCloseButton'; +import { ReactComponent as SuccessImg } from '../../../assets/images/transfer-success.inline.svg'; const messages = defineMessages({ title: { id: 'wallet.transaction.success.title', - defaultMessage: '!!!Successfully sent', + defaultMessage: '!!!Transaction submitted', }, buttonLabel: { id: 'wallet.transaction.success.button.label', - defaultMessage: '!!!Transaction page', + defaultMessage: '!!!Go To Transactions', }, explanation: { id: 'wallet.transaction.success.explanation', - defaultMessage: '!!!Track the status of the transaction from the Transactions page', - } + defaultMessage: '!!!Check this transaction in the list of wallet transactions', + }, }); type Props = {| - +onClose: void => PossiblyAsync; + +onClose: void => PossiblyAsync, +classicTheme: boolean, |}; @observer export default class TransactionSuccessDialog extends Component { - - static contextTypes: {|intl: $npm$ReactIntl$IntlFormat|} = { + static contextTypes: {| intl: $npm$ReactIntl$IntlFormat |} = { intl: intlShape.isRequired, }; @@ -38,15 +40,31 @@ export default class TransactionSuccessDialog extends Component { const { intl } = this.context; return ( - + actions={[ + { + label: intl.formatMessage(messages.buttonLabel), + onClick: this.props.onClose, + primary: true, + }, + ]} + onClose={this.props.onClose} + closeButton={} + > + + + + {intl.formatMessage(messages.explanation)} + + + ); } } diff --git a/packages/yoroi-extension/app/containers/wallet/WalletSendPage.js b/packages/yoroi-extension/app/containers/wallet/WalletSendPage.js index 4c6c33e8bc..678ca53f68 100644 --- a/packages/yoroi-extension/app/containers/wallet/WalletSendPage.js +++ b/packages/yoroi-extension/app/containers/wallet/WalletSendPage.js @@ -12,13 +12,14 @@ import WalletSendFormRevamp from '../../components/wallet/send/WalletSendFormRev // Web Wallet Confirmation import WalletSendConfirmationDialogContainer from './dialogs/WalletSendConfirmationDialogContainer'; -import type { - GeneratedData as WalletSendConfirmationDialogContainerData -} from './dialogs/WalletSendConfirmationDialogContainer'; +import type { GeneratedData as WalletSendConfirmationDialogContainerData } from './dialogs/WalletSendConfirmationDialogContainer'; import WalletSendConfirmationDialog from '../../components/wallet/send/WalletSendConfirmationDialog'; import MemoNoExternalStorageDialog from '../../components/wallet/memos/MemoNoExternalStorageDialog'; import { WalletTypeOption } from '../../api/ada/lib/storage/models/ConceptualWallet/interfaces'; -import { isLedgerNanoWallet, isTrezorTWallet } from '../../api/ada/lib/storage/models/ConceptualWallet/index'; +import { + isLedgerNanoWallet, + isTrezorTWallet, +} from '../../api/ada/lib/storage/models/ConceptualWallet/index'; import { HaskellShelleyTxSignRequest } from '../../api/ada/transactions/shelley/HaskellShelleyTxSignRequest'; import type { $npm$ReactIntl$IntlFormat } from 'react-intl'; import type { SendUsingLedgerParams } from '../../actions/ada/ledger-send-actions'; @@ -29,12 +30,10 @@ import { SelectedExplorer } from '../../domain/SelectedExplorer'; import type { UnitOfAccountSettingType } from '../../types/unitOfAccountType'; import LocalizableError from '../../i18n/LocalizableError'; import type { ISignRequest } from '../../api/common/lib/transactions/ISignRequest'; -import { ApiOptions, getApiForNetwork, } from '../../api/common/utils'; +import { ApiOptions, getApiForNetwork } from '../../api/common/utils'; import { validateAmount, getMinimumValue } from '../../utils/validations'; import { addressToDisplayString } from '../../api/ada/lib/storage/bridge/utils'; -import { - MultiToken, -} from '../../api/common/lib/MultiToken'; +import { MultiToken } from '../../api/common/lib/MultiToken'; import type { TokenInfoMap } from '../../stores/toplevel/TokenInfoStore'; import type { TokenRow } from '../../api/ada/lib/storage/database/primitives/tables'; import { genLookupOrFail } from '../../stores/stateless/tokenHelpers'; @@ -54,7 +53,8 @@ import { trackSend } from '../../api/analytics'; const messages = defineMessages({ txConfirmationLedgerNanoLine1: { id: 'wallet.send.ledger.confirmationDialog.info.line.1', - defaultMessage: '!!!After connecting your Ledger device to your computer’s USB port, press the Send using Ledger button.', + defaultMessage: + '!!!After connecting your Ledger device to your computer’s USB port, press the Send using Ledger button.', }, sendUsingLedgerNano: { id: 'wallet.send.ledger.confirmationDialog.submit', @@ -62,7 +62,8 @@ const messages = defineMessages({ }, txConfirmationTrezorTLine1: { id: 'wallet.send.trezor.confirmationDialog.info.line.1', - defaultMessage: '!!!After connecting your Trezor device to your computer, press the Send using Trezor button.', + defaultMessage: + '!!!After connecting your Trezor device to your computer, press the Send using Trezor button.', }, sendUsingTrezorT: { id: 'wallet.send.trezor.confirmationDialog.submit', @@ -83,24 +84,22 @@ type AllProps = {| ...Props, ...InjectedProps |}; @observer class WalletSendPage extends Component { - - static contextTypes: {|intl: $npm$ReactIntl$IntlFormat|} = { + static contextTypes: {| intl: $npm$ReactIntl$IntlFormat |} = { intl: intlShape.isRequired, }; @observable showMemo: boolean = false; - closeTransactionSuccessDialog: void => void = () => { this.generated.actions.dialogs.closeActiveDialog.trigger(); this.generated.actions.router.goToRoute.trigger({ route: ROUTES.WALLETS.TRANSACTIONS }); - } + }; openTransactionSuccessDialog: void => void = () => { this.generated.actions.dialogs.push.trigger({ - dialog: TransactionSuccessDialog + dialog: TransactionSuccessDialog, }); - } + }; componentDidMount(): void { runInAction(() => { @@ -114,12 +113,12 @@ class WalletSendPage extends Component { this.generated.actions.memos.closeMemoDialog.trigger(); }; - openDialog: any => void = (dialog) => { - this.generated.actions.dialogs.closeActiveDialog.trigger() + openDialog: any => void = dialog => { + this.generated.actions.dialogs.closeActiveDialog.trigger(); this.generated.actions.dialogs.push.trigger({ dialog, }); - } + }; _getNumDecimals(): number { const publicDeriver = this.generated.stores.wallets.selected; @@ -127,7 +126,7 @@ class WalletSendPage extends Component { const defaultToken = this.generated.stores.tokenInfoStore.getDefaultTokenInfo( publicDeriver.getParent().getNetworkInfo().NetworkId ); - const getTokenInfo = genLookupOrFail(this.generated.stores.tokenInfoStore.tokenInfo) + const getTokenInfo = genLookupOrFail(this.generated.stores.tokenInfoStore.tokenInfo); const info = getTokenInfo({ identifier: defaultToken.Identifier, networkId: defaultToken.NetworkId, @@ -142,29 +141,29 @@ class WalletSendPage extends Component { const { transactionBuilderStore } = this.generated.stores; - const { uiDialogs, profile, } = this.generated.stores; + const { uiDialogs, profile } = this.generated.stores; const { actions } = this.generated; const { hasAnyPending } = this.generated.stores.transactions; const { txBuilderActions } = this.generated.actions; // disallow sending when pending tx exists if ( - ( - uiDialogs.isOpen(HWSendConfirmationDialog) || - uiDialogs.isOpen(WalletSendConfirmationDialog) - ) && hasAnyPending + (uiDialogs.isOpen(HWSendConfirmationDialog) || + uiDialogs.isOpen(WalletSendConfirmationDialog)) && + hasAnyPending ) { actions.dialogs.closeActiveDialog.trigger(); } const walletType = publicDeriver.getParent().getWalletType(); - const targetDialog = walletType === WalletTypeOption.HARDWARE_WALLET ? - HWSendConfirmationDialog : - WalletSendConfirmationDialog; + const targetDialog = + walletType === WalletTypeOption.HARDWARE_WALLET + ? HWSendConfirmationDialog + : WalletSendConfirmationDialog; const onSubmit = () => { actions.dialogs.push.trigger({ - dialog: targetDialog + dialog: targetDialog, }); txBuilderActions.updateTentativeTx.trigger(); }; @@ -198,10 +197,12 @@ class WalletSendPage extends Component { uriParams={this.generated.stores.loading.uriParams} resetUriParams={this.generated.stores.loading.resetUriParams} showMemo={this.showMemo} - onAddMemo={() => this.showMemoDialog({ - dialog: MemoNoExternalStorageDialog, - continuation: this.toggleShowMemo, - })} + onAddMemo={() => + this.showMemoDialog({ + dialog: MemoNoExternalStorageDialog, + continuation: this.toggleShowMemo, + }) + } spendableBalance={this.generated.stores.transactions.getBalanceRequest.result} onAddToken={txBuilderActions.addToken.trigger} onRemoveTokens={txBuilderActions.removeTokens.trigger} @@ -225,15 +226,17 @@ class WalletSendPage extends Component { <> validateAmount( - amount, - transactionBuilderStore.selectedToken ?? defaultToken, - getMinimumValue( - publicDeriver.getParent().getNetworkInfo(), - transactionBuilderStore.selectedToken?.IsDefault ?? true - ), - this.context.intl, - )} + validateAmount={amount => + validateAmount( + amount, + transactionBuilderStore.selectedToken ?? defaultToken, + getMinimumValue( + publicDeriver.getParent().getNetworkInfo(), + transactionBuilderStore.selectedToken?.IsDefault ?? true + ), + this.context.intl + ) + } defaultToken={defaultToken} getTokenInfo={genLookupOrFail(this.generated.stores.tokenInfoStore.tokenInfo)} onSubmit={onSubmit} @@ -252,10 +255,12 @@ class WalletSendPage extends Component { uriParams={this.generated.stores.loading.uriParams} resetUriParams={this.generated.stores.loading.resetUriParams} showMemo={this.showMemo} - onAddMemo={() => this.showMemoDialog({ - dialog: MemoNoExternalStorageDialog, - continuation: this.toggleShowMemo, - })} + onAddMemo={() => + this.showMemoDialog({ + dialog: MemoNoExternalStorageDialog, + continuation: this.toggleShowMemo, + }) + } spendableBalance={this.generated.stores.transactions.getBalanceRequest.result} onAddToken={txBuilderActions.addToken.trigger} selectedToken={transactionBuilderStore.selectedToken} @@ -265,7 +270,7 @@ class WalletSendPage extends Component { ); } - renderDialog: (() => Node) = () => { + renderDialog: () => Node = () => { const { uiDialogs } = this.generated.stores; if (uiDialogs.isOpen(WalletSendConfirmationDialog)) { @@ -277,29 +282,32 @@ class WalletSendPage extends Component { if (uiDialogs.isOpen(MemoNoExternalStorageDialog)) { return this.noCloudWarningDialog(); } - if(uiDialogs.isOpen(TransactionSuccessDialog)){ - return () + if (uiDialogs.isOpen(TransactionSuccessDialog)) { + return ( + + ); } if (uiDialogs.isOpen(AddNFTDialog)) { - return this.renderNFTDialog() + return this.renderNFTDialog(); } if (uiDialogs.isOpen(AddTokenDialog)) { - return this.renderAddTokenDialog() + return this.renderAddTokenDialog(); } return ''; - } + }; /** Web Wallet Send Confirmation dialog - * Callback that creates a container to avoid the component knowing about actions/stores */ - webWalletDoConfirmation: (() => Node) = () => { + * Callback that creates a container to avoid the component knowing about actions/stores */ + webWalletDoConfirmation: () => Node = () => { const publicDeriver = this.generated.stores.wallets.selected; - if (!publicDeriver) throw new Error(`Active wallet required for ${nameof(this.webWalletDoConfirmation)}.`); + if (!publicDeriver) + throw new Error(`Active wallet required for ${nameof(this.webWalletDoConfirmation)}.`); const { transactionBuilderStore } = this.generated.stores; if (!transactionBuilderStore.tentativeTx) { @@ -307,18 +315,21 @@ class WalletSendPage extends Component { } const signRequest = transactionBuilderStore.tentativeTx; - return (); + return ( + + ); }; - renderTxPreviewStep: (() => Node) = () => { + renderTxPreviewStep: () => Node = () => { const publicDeriver = this.generated.stores.wallets.selected; - if (!publicDeriver) throw new Error(`Active wallet required for ${nameof(this.webWalletDoConfirmation)}.`); + if (!publicDeriver) + throw new Error(`Active wallet required for ${nameof(this.webWalletDoConfirmation)}.`); const { transactionBuilderStore } = this.generated.stores; if (!transactionBuilderStore.tentativeTx) { @@ -326,25 +337,27 @@ class WalletSendPage extends Component { } const signRequest = transactionBuilderStore.tentativeTx; - return (); + return ( + + ); }; - /** Hardware Wallet (Trezor or Ledger) Confirmation dialog - * Callback that creates a component to avoid the component knowing about actions/stores - * separate container is not needed, this container acts as container for Confirmation dialog */ - hardwareWalletDoConfirmation: (() => Node) = () => { + * Callback that creates a component to avoid the component knowing about actions/stores + * separate container is not needed, this container acts as container for Confirmation dialog */ + hardwareWalletDoConfirmation: () => Node = () => { const publicDeriver = this.generated.stores.wallets.selected; - if (!publicDeriver) throw new Error(`Active wallet required for ${nameof(this.webWalletDoConfirmation)}.`); + if (!publicDeriver) + throw new Error(`Active wallet required for ${nameof(this.webWalletDoConfirmation)}.`); const selectedApiType = getApiForNetwork(publicDeriver.getParent().getNetworkInfo()); if (selectedApiType !== ApiOptions.ada) { @@ -369,11 +382,17 @@ class WalletSendPage extends Component { let hwSendConfirmationDialog: Node = null; if (!(signRequest instanceof HaskellShelleyTxSignRequest)) { - throw new Error(`${nameof(this.hardwareWalletDoConfirmation)} hw wallets only supported for Byron`); + throw new Error( + `${nameof(this.hardwareWalletDoConfirmation)} hw wallets only supported for Byron` + ); } - const selectedExplorerForNetwork = this.generated.stores.explorers.selectedExplorer - .get(publicDeriver.getParent().getNetworkInfo().NetworkId) - ?? (() => { throw new Error('No explorer for wallet network'); })(); + const selectedExplorerForNetwork = + this.generated.stores.explorers.selectedExplorer.get( + publicDeriver.getParent().getNetworkInfo().NetworkId + ) ?? + (() => { + throw new Error('No explorer for wallet network'); + })(); if (isLedgerNanoWallet(conceptualWallet)) { const messagesLedgerNano = { @@ -397,22 +416,21 @@ class WalletSendPage extends Component { messages={messagesLedgerNano} isSubmitting={ledgerSendStore.isActionProcessing} error={ledgerSendStore.error} - onSubmit={ - () => { - ledgerSendAction.sendUsingLedgerWallet.trigger({ - params: { signRequest }, - publicDeriver, - onSuccess: this.openTransactionSuccessDialog, - }); - trackSend(); - } - } + onSubmit={() => { + ledgerSendAction.sendUsingLedgerWallet.trigger({ + params: { signRequest }, + publicDeriver, + onSuccess: this.openTransactionSuccessDialog, + }); + trackSend(); + }} onCancel={ledgerSendAction.cancel.trigger} unitOfAccountSetting={this.generated.stores.profile.unitOfAccount} - addressToDisplayString={ - addr => addressToDisplayString(addr, publicDeriver.getParent().getNetworkInfo()) + addressToDisplayString={addr => + addressToDisplayString(addr, publicDeriver.getParent().getNetworkInfo()) } - />); + /> + ); } else if (isTrezorTWallet(conceptualWallet)) { const messagesTrezor = { infoLine1: messages.txConfirmationTrezorTLine1, @@ -434,22 +452,21 @@ class WalletSendPage extends Component { messages={messagesTrezor} isSubmitting={trezorSendStore.isActionProcessing} error={trezorSendStore.error} - onSubmit={ - () => { - trezorSendAction.sendUsingTrezor.trigger({ - params: { signRequest }, - publicDeriver, - onSuccess: this.openTransactionSuccessDialog, - }) - trackSend(); - } - } + onSubmit={() => { + trezorSendAction.sendUsingTrezor.trigger({ + params: { signRequest }, + publicDeriver, + onSuccess: this.openTransactionSuccessDialog, + }); + trackSend(); + }} onCancel={trezorSendAction.cancel.trigger} unitOfAccountSetting={this.generated.stores.profile.unitOfAccount} - addressToDisplayString={ - addr => addressToDisplayString(addr, publicDeriver.getParent().getNetworkInfo()) + addressToDisplayString={addr => + addressToDisplayString(addr, publicDeriver.getParent().getNetworkInfo()) } - />); + /> + ); } else { throw new Error('Unsupported hardware wallet found at hardwareWalletDoConfirmation.'); } @@ -457,10 +474,10 @@ class WalletSendPage extends Component { return hwSendConfirmationDialog; }; - showMemoDialog: {| + showMemoDialog: ({| continuation: void => void, dialog: any, - |} => void = (request) => { + |}) => void = request => { if (this.generated.stores.memos.hasSetSelectedExternalStorageProvider) { return request.continuation(); } @@ -471,35 +488,43 @@ class WalletSendPage extends Component { continuation: request.continuation, }, }); - } + }; noCloudWarningDialog: void => Node = () => { - const { actions, } = this.generated; - return ( { - actions.memos.closeMemoDialog.trigger(); - actions.router.goToRoute.trigger({ route: ROUTES.SETTINGS.EXTERNAL_STORAGE }); - }} - onAcknowledge={() => { - this.generated.stores.uiDialogs.getParam void>('continuation')(); - }} - />); - } + const { actions } = this.generated; + return ( + { + actions.memos.closeMemoDialog.trigger(); + actions.router.goToRoute.trigger({ route: ROUTES.SETTINGS.EXTERNAL_STORAGE }); + }} + onAcknowledge={() => { + this.generated.stores.uiDialogs.getParam<(void) => void>('continuation')(); + }} + /> + ); + }; - calculateMinAda: Array<{| - token: $ReadOnly, included: boolean - |}> => string = (selectedTokens) => { + calculateMinAda: ( + Array<{| + token: $ReadOnly, + included: boolean, + |}> + ) => string = selectedTokens => { const { transactionBuilderStore } = this.generated.stores; - const { calculateMinAda } = transactionBuilderStore; + const { calculateMinAda } = transactionBuilderStore; const tokens = this._mergeTokens(selectedTokens); const minAdaAmount = calculateMinAda(tokens.map(token => ({ token }))); - return (new BigNumber(minAdaAmount)).shiftedBy(-this._getNumDecimals()).toString() - } + return new BigNumber(minAdaAmount).shiftedBy(-this._getNumDecimals()).toString(); + }; - _mergeTokens: Array<{| - token: $ReadOnly, included: boolean - |}> => Array<$ReadOnly> = (selectedTokens) => { + _mergeTokens: ( + Array<{| + token: $ReadOnly, + included: boolean, + |}> + ) => Array<$ReadOnly> = selectedTokens => { const { transactionBuilderStore } = this.generated.stores; const { plannedTxInfoMap } = transactionBuilderStore; const tokens = new Map>(); @@ -515,22 +540,21 @@ class WalletSendPage extends Component { }); plannedTxInfoMap.forEach(entry => { const id = entry.token.Identifier; - if (!shouldNotInclude.has(id)) - tokens.set(id, entry.token); + if (!shouldNotInclude.has(id)) tokens.set(id, entry.token); }); - return [...tokens.values()] - } + return [...tokens.values()]; + }; - shouldAddMoreTokens: Array<{| token: $ReadOnly, included: boolean |}> => boolean = ( - tokens - ) => { + shouldAddMoreTokens: ( + Array<{| token: $ReadOnly, included: boolean |}> + ) => boolean = tokens => { const { maxAssetsAllowed } = this.generated.stores.transactionBuilderStore; const allTokens = this._mergeTokens(tokens); return allTokens.length <= maxAssetsAllowed; - } + }; renderNFTDialog: void => Node = () => { const publicDeriver = this.generated.stores.wallets.selected; @@ -553,8 +577,8 @@ class WalletSendPage extends Component { plannedTxInfoMap={transactionBuilderStore.plannedTxInfoMap} shouldAddMoreTokens={this.shouldAddMoreTokens} /> - ) - } + ); + }; renderAddTokenDialog: void => Node = () => { const publicDeriver = this.generated.stores.wallets.selected; @@ -579,12 +603,11 @@ class WalletSendPage extends Component { plannedTxInfoMap={transactionBuilderStore.plannedTxInfoMap} selectedNetwork={publicDeriver.getParent().getNetworkInfo()} /> - ) - } + ); + }; @computed get generated(): {| - WalletSendConfirmationDialogContainerProps: - InjectedOrGenerated, + WalletSendConfirmationDialogContainerProps: InjectedOrGenerated, actions: {| ada: {| ledgerSend: {| @@ -595,8 +618,8 @@ class WalletSendPage extends Component { params: SendUsingLedgerParams, publicDeriver: PublicDeriver<>, onSuccess?: void => void, - |}) => Promise - |} + |}) => Promise, + |}, |}, trezorSend: {| cancel: {| trigger: (params: void) => void |}, @@ -605,8 +628,8 @@ class WalletSendPage extends Component { params: SendUsingTrezorParams, publicDeriver: PublicDeriver<>, onSuccess?: void => void, - |}) => Promise - |} + |}) => Promise, + |}, |}, |}, txBuilderActions: {| @@ -614,71 +637,71 @@ class WalletSendPage extends Component { trigger: (params: void) => Promise, |}, reset: {| - trigger: (params: void) => void + trigger: (params: void) => void, |}, updateSendAllStatus: {| - trigger: (params: boolean | void) => void + trigger: (params: boolean | void) => void, |}, updateAmount: {| - trigger: (params: ?BigNumber) => void + trigger: (params: ?BigNumber) => void, |}, addToken: {| trigger: (params: {| token?: $ReadOnly, shouldReset?: boolean, - |}) => void + |}) => void, |}, deselectToken: {| - trigger: void => void + trigger: void => void, |}, removeTokens: {| trigger: (params: Array<$ReadOnly>) => void, |}, updateMemo: {| - trigger: (params: void | string) => void + trigger: (params: void | string) => void, |}, updateReceiver: {| - trigger: (params: void | string) => void + trigger: (params: void | string) => void, |}, updateTentativeTx: {| - trigger: (params: void) => void - |} + trigger: (params: void) => void, + |}, |}, dialogs: {| closeActiveDialog: {| - trigger: (params: void) => void + trigger: (params: void) => void, |}, push: {| trigger: (params: {| dialog: any, - params?: any - |}) => void + params?: any, + |}) => void, |}, |}, memos: {| - closeMemoDialog: {| trigger: (params: void) => void |} + closeMemoDialog: {| trigger: (params: void) => void |}, |}, router: {| goToRoute: {| trigger: (params: {| publicDeriver?: null | PublicDeriver<>, params?: ?any, - route: string - |}) => void - |} - |} + route: string, + |}) => void, + |}, + |}, |}, initialShowMemoState: boolean, stores: {| coinPriceStore: {| - getCurrentPrice: (from: string, to: string) => ?string + getCurrentPrice: (from: string, to: string) => ?string, |}, loading: {| resetUriParams: void => void, - uriParams: ?UriParams + uriParams: ?UriParams, |}, memos: {| - hasSetSelectedExternalStorageProvider: boolean + hasSetSelectedExternalStorageProvider: boolean, |}, explorers: {| selectedExplorer: Map, @@ -689,12 +712,12 @@ class WalletSendPage extends Component { |}, profile: {| isClassicTheme: boolean, - unitOfAccount: UnitOfAccountSettingType + unitOfAccount: UnitOfAccountSettingType, |}, transactionBuilderStore: {| createUnsignedTx: {| error: ?LocalizableError, - isExecuting: boolean + isExecuting: boolean, |}, fee: ?MultiToken, shouldSendAll: boolean, @@ -710,7 +733,7 @@ class WalletSendPage extends Component { shouldSendAll?: boolean, |}>, minAda: ?MultiToken, - calculateMinAda: Array<{| token: $ReadOnly |}> => string, + calculateMinAda: (Array<{| token: $ReadOnly |}>) => string, maxSendableAmount: {| error: ?LocalizableError, isExecuting: boolean, @@ -721,13 +744,13 @@ class WalletSendPage extends Component { ada: {| ledgerSend: {| error: ?LocalizableError, - isActionProcessing: boolean + isActionProcessing: boolean, |}, trezorSend: {| error: ?LocalizableError, - isActionProcessing: boolean - |} - |} + isActionProcessing: boolean, + |}, + |}, |}, transactions: {| hasAnyPending: boolean, @@ -737,11 +760,11 @@ class WalletSendPage extends Component { |}, uiDialogs: {| getParam: (number | string) => T, - isOpen: any => boolean + isOpen: any => boolean, |}, - wallets: {| selected: null | PublicDeriver<> |} - |} - |} { + wallets: {| selected: null | PublicDeriver<> |}, + |}, + |} { if (this.props.generated !== undefined) { return this.props.generated; } @@ -783,9 +806,10 @@ class WalletSendPage extends Component { transactions: { hasAnyPending: stores.transactions.hasAnyPending, getBalanceRequest: (() => { - if (stores.wallets.selected == null) return { - result: undefined, - }; + if (stores.wallets.selected == null) + return { + result: undefined, + }; const { requests } = stores.transactions.getTxRequests(stores.wallets.selected); return { @@ -840,7 +864,7 @@ class WalletSendPage extends Component { }, memos: { closeMemoDialog: { - trigger: actions.memos.closeMemoDialog.trigger + trigger: actions.memos.closeMemoDialog.trigger, }, }, txBuilderActions: { @@ -854,7 +878,7 @@ class WalletSendPage extends Component { reset: { trigger: actions.txBuilderActions.reset.trigger }, updateMemo: { trigger: actions.txBuilderActions.updateMemo.trigger }, calculateMaxAmount: { - trigger: actions.txBuilderActions.calculateMaxAmount.trigger + trigger: actions.txBuilderActions.calculateMaxAmount.trigger, }, }, ada: { @@ -862,7 +886,7 @@ class WalletSendPage extends Component { init: { trigger: actions.ada.ledgerSend.init.trigger }, cancel: { trigger: actions.ada.ledgerSend.cancel.trigger }, sendUsingLedgerWallet: { - trigger: actions.ada.ledgerSend.sendUsingLedgerWallet.trigger + trigger: actions.ada.ledgerSend.sendUsingLedgerWallet.trigger, }, }, trezorSend: { @@ -872,9 +896,10 @@ class WalletSendPage extends Component { }, }, initialShowMemoState: (false: boolean), - WalletSendConfirmationDialogContainerProps: ( - { actions, stores, }: InjectedOrGenerated - ), + WalletSendConfirmationDialogContainerProps: ({ + actions, + stores, + }: InjectedOrGenerated), }); } } diff --git a/packages/yoroi-extension/app/i18n/locales/en-US.json b/packages/yoroi-extension/app/i18n/locales/en-US.json index c381061331..032d663577 100644 --- a/packages/yoroi-extension/app/i18n/locales/en-US.json +++ b/packages/yoroi-extension/app/i18n/locales/en-US.json @@ -973,9 +973,9 @@ "wallet.transaction.state.failed": "failed", "wallet.transaction.state.pending": "pending", "wallet.transaction.state.submitted": "submitted", - "wallet.transaction.success.button.label": "Transaction page", - "wallet.transaction.success.explanation": "Track the status of the transaction from the Transactions page", - "wallet.transaction.success.title": "Successfully sent", + "wallet.transaction.success.button.label": "Go To Transactions", + "wallet.transaction.success.explanation": "Check this transaction in the list of wallet transactions", + "wallet.transaction.success.title": "Transaction submitted", "wallet.transaction.transactionAmount": "Transaction amount", "wallet.transaction.transactionId": "Transaction ID", "wallet.transaction.transactionMetadata": "Transaction Metadata", diff --git a/packages/yoroi-extension/app/i18n/locales/hu-HU.json b/packages/yoroi-extension/app/i18n/locales/hu-HU.json index 7c0f4f349f..24817cfd7a 100644 --- a/packages/yoroi-extension/app/i18n/locales/hu-HU.json +++ b/packages/yoroi-extension/app/i18n/locales/hu-HU.json @@ -969,9 +969,6 @@ "wallet.transaction.state.failed": "failed", "wallet.transaction.state.pending": "pending", "wallet.transaction.state.submitted": "submitted", - "wallet.transaction.success.button.label": "Transaction page", - "wallet.transaction.success.explanation": "Track the status of the transaction from the Transactions page", - "wallet.transaction.success.title": "Successfully sent", "wallet.transaction.transactionAmount": "Transaction amount", "wallet.transaction.transactionId": "Transaction ID", "wallet.transaction.transactionMetadata": "Transaction Metadata", @@ -1056,4 +1053,4 @@ "yoroiTransfer.waiting.progressInfo.checkingAddresses": "Checking addresses funds", "yoroiTransfer.waiting.progressInfo.restoringAddresses": "Fetching addresses", "yoroiTransfer.waiting.title.label": "Wallet is being restored" -} \ No newline at end of file +} diff --git a/packages/yoroi-extension/app/i18n/locales/vi-VN.json b/packages/yoroi-extension/app/i18n/locales/vi-VN.json index 506b907ea2..61077bf15f 100644 --- a/packages/yoroi-extension/app/i18n/locales/vi-VN.json +++ b/packages/yoroi-extension/app/i18n/locales/vi-VN.json @@ -969,9 +969,6 @@ "wallet.transaction.state.failed": "lỗi", "wallet.transaction.state.pending": "đang giải quyết", "wallet.transaction.state.submitted": "đã gửi", - "wallet.transaction.success.button.label": "Loại giao dịch", - "wallet.transaction.success.explanation": "Kiểm tra trạng thái giao dịch từ trang giao dịch", - "wallet.transaction.success.title": "Đã gửi thành công", "wallet.transaction.transactionAmount": "Số tiền giao dịch", "wallet.transaction.transactionId": "ID giao dịch", "wallet.transaction.transactionMetadata": "Siêu dữ liệu giao dịch", @@ -1056,4 +1053,4 @@ "yoroiTransfer.waiting.progressInfo.checkingAddresses": "Kiểm tra địa chỉ quỹ", "yoroiTransfer.waiting.progressInfo.restoringAddresses": "Đang tìm nạp địa chỉ", "yoroiTransfer.waiting.title.label": "Ví đang được khôi phục" -} \ No newline at end of file +} From e4baeb55c2d887c7c4e6dfa94ffdc69a5b8c7f94 Mon Sep 17 00:00:00 2001 From: vantuz-subhuman Date: Thu, 15 Jun 2023 20:48:38 +0300 Subject: [PATCH 61/80] Downgraded chromedriver to 113, cuz latest 114 is not compativle with our node version --- install-all.sh | 3 +-- packages/yoroi-extension/package-lock.json | 12 ++++++------ packages/yoroi-extension/package.json | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/install-all.sh b/install-all.sh index 2efa699cb1..616d01bf85 100644 --- a/install-all.sh +++ b/install-all.sh @@ -1,5 +1,4 @@ -npm i \ +nvm i && npm i \ && npm i --prefix packages/yoroi-extension \ && npm i --prefix packages/yoroi-connector \ -&& npm i --prefix packages/yoroi-connector/example-ergo \ && npm i --prefix packages/yoroi-connector/example-cardano \ No newline at end of file diff --git a/packages/yoroi-extension/package-lock.json b/packages/yoroi-extension/package-lock.json index 2f3368e6aa..7f9e1d395b 100644 --- a/packages/yoroi-extension/package-lock.json +++ b/packages/yoroi-extension/package-lock.json @@ -11268,9 +11268,9 @@ "dev": true }, "chromedriver": { - "version": "112.0.0", - "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-112.0.0.tgz", - "integrity": "sha512-fEw1tI05dmK1KK8MGh99LAppP7zCOPEXUxxbYX5wpIBCCmKasyrwZhk/qsdnxJYKd/h0TfiHvGEj7ReDQXW1AA==", + "version": "113.0.0", + "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-113.0.0.tgz", + "integrity": "sha512-UnQlt2kPicYXVNHPzy9HfcWvEbKJjjKAEaatdcnP/lCIRwuSoZFVLH0HVDAGdbraXp3dNVhfE2Qx7gw8TnHnPw==", "dev": true, "requires": { "@testim/chrome-version": "^1.1.3", @@ -11283,9 +11283,9 @@ }, "dependencies": { "axios": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.3.5.tgz", - "integrity": "sha512-glL/PvG/E+xCWwV8S6nCHcrfg1exGx7vxyUIivIA1iL7BIh6bePylCfVHwp6k13ao7SATxB6imau2kqY+I67kw==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz", + "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==", "dev": true, "requires": { "follow-redirects": "^1.15.0", diff --git a/packages/yoroi-extension/package.json b/packages/yoroi-extension/package.json index 1533eaa35e..4f06b6a86e 100644 --- a/packages/yoroi-extension/package.json +++ b/packages/yoroi-extension/package.json @@ -116,7 +116,7 @@ "cardano-wallet": "1.2.2", "chai": "4.3.0", "chai-as-promised": "7.1.1", - "chromedriver": "latest", + "chromedriver": "113.0.0", "config": "1.31.0", "config-webpack": "1.0.4", "crx": "5.0.1", From a718867e5ac10d3711a1f9c7d10b806b66f8ba23 Mon Sep 17 00:00:00 2001 From: vantuz-subhuman Date: Thu, 15 Jun 2023 21:01:00 +0300 Subject: [PATCH 62/80] removed usage of nvm --- install-all.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-all.sh b/install-all.sh index 616d01bf85..8143b1250c 100644 --- a/install-all.sh +++ b/install-all.sh @@ -1,4 +1,4 @@ -nvm i && npm i \ +npm i \ && npm i --prefix packages/yoroi-extension \ && npm i --prefix packages/yoroi-connector \ && npm i --prefix packages/yoroi-connector/example-cardano \ No newline at end of file From 7ba1460b597d49abd86eb42685508939fce242a7 Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Fri, 16 Jun 2023 10:41:33 +0100 Subject: [PATCH 63/80] New translations en-US.json (Hungarian) --- packages/yoroi-extension/app/i18n/locales/hu-HU.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/yoroi-extension/app/i18n/locales/hu-HU.json b/packages/yoroi-extension/app/i18n/locales/hu-HU.json index 4358e38d00..11091c07ba 100644 --- a/packages/yoroi-extension/app/i18n/locales/hu-HU.json +++ b/packages/yoroi-extension/app/i18n/locales/hu-HU.json @@ -908,6 +908,7 @@ "wallet.staking.pool.unknownLabel": "Unknown pool", "wallet.staking.rewards.openRewardHistory": "Open Reward History", "wallet.staking.rewards.rewardHistory": "Reward History", + "wallet.staking.rewards.rewardHistory.epochNum": "Epoch {number}", "wallet.staking.summary": "Summary", "wallet.staking.warning.pendingTx": "You cannot change your delegation preference while a transaction is pending", "wallet.summary.no.transaction": "No transaction history.", From a2fd3d574a6ad18e16492a3101ac0d8fa063f3d6 Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Fri, 16 Jun 2023 10:41:34 +0100 Subject: [PATCH 64/80] New translations en-US.json (Vietnamese) --- packages/yoroi-extension/app/i18n/locales/vi-VN.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/yoroi-extension/app/i18n/locales/vi-VN.json b/packages/yoroi-extension/app/i18n/locales/vi-VN.json index 1eb18ff972..6b0f0e3f10 100644 --- a/packages/yoroi-extension/app/i18n/locales/vi-VN.json +++ b/packages/yoroi-extension/app/i18n/locales/vi-VN.json @@ -908,6 +908,7 @@ "wallet.staking.pool.unknownLabel": "Nhóm không xác định", "wallet.staking.rewards.openRewardHistory": "Mở lịch sử phần thưởng", "wallet.staking.rewards.rewardHistory": "Lịch sử phần thưởng", + "wallet.staking.rewards.rewardHistory.epochNum": "Epoch {number}", "wallet.staking.summary": "Tóm tắt", "wallet.staking.warning.pendingTx": "Bạn không thể thay đổi tùy chọn ủy quyền của mình trong khi giao dịch đang chờ xử lý", "wallet.summary.no.transaction": "Không có lịch sử giao dịch.", From 034fdb8dbf56ae00e7fa78b1e043ba61a1b668bb Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Mon, 22 May 2023 10:23:39 +0300 Subject: [PATCH 65/80] fix: trigger onDisconnect when removing a wallet --- .../app/stores/toplevel/WalletSettingsStore.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/yoroi-extension/app/stores/toplevel/WalletSettingsStore.js b/packages/yoroi-extension/app/stores/toplevel/WalletSettingsStore.js index b6e4fdc01b..8dcea58f6f 100644 --- a/packages/yoroi-extension/app/stores/toplevel/WalletSettingsStore.js +++ b/packages/yoroi-extension/app/stores/toplevel/WalletSettingsStore.js @@ -276,7 +276,7 @@ export default class WalletSettingsStore extends Store { } await removeWalletFromLS(request.publicDeriver) - // remove this wallet from wallet sort list + // Remove this wallet from wallet sort list const walletType = getWalletType(request.publicDeriver) const walletsNavigation = this.stores.profile.walletsNavigation const newWalletsNavigation = { @@ -285,9 +285,22 @@ export default class WalletSettingsStore extends Store { [walletType]: walletsNavigation[walletType].filter( walletId => walletId !== request.publicDeriver.publicDeriverId) } - await this.actions.profile.updateSortedWalletList.trigger(newWalletsNavigation); + // ==================== Disconnect related dApps ==================== + await this.actions.connector.getConnectorWhitelist.trigger(); + const connectorWhitelist = this.stores.connector.currentConnectorWhitelist; + const connectedDapps = connectorWhitelist.filter( + dapp => dapp.publicDeriverId === request.publicDeriver.publicDeriverId + ); + + for (const dapp of connectedDapps) { + await this.actions.connector.removeWalletFromWhitelist.trigger({ + protocol: dapp.protocol, + url: dapp.url, + }); + }; + await this.removeWalletRequest.execute({ publicDeriver: request.publicDeriver, conceptualWallet: group.publicDerivers.length === 1 From 6f4256a4f90129b9643526c3db0072e56885a177 Mon Sep 17 00:00:00 2001 From: Ruslan Dudin Date: Fri, 16 Jun 2023 14:32:36 +0300 Subject: [PATCH 66/80] Update packages/yoroi-extension/app/stores/toplevel/WalletSettingsStore.js --- .../yoroi-extension/app/stores/toplevel/WalletSettingsStore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/stores/toplevel/WalletSettingsStore.js b/packages/yoroi-extension/app/stores/toplevel/WalletSettingsStore.js index 8dcea58f6f..aa0b467c4e 100644 --- a/packages/yoroi-extension/app/stores/toplevel/WalletSettingsStore.js +++ b/packages/yoroi-extension/app/stores/toplevel/WalletSettingsStore.js @@ -299,7 +299,7 @@ export default class WalletSettingsStore extends Store { protocol: dapp.protocol, url: dapp.url, }); - }; + } await this.removeWalletRequest.execute({ publicDeriver: request.publicDeriver, From e4abbfc92db9ed0ce107c29b1a4d3423dc2e0a9e Mon Sep 17 00:00:00 2001 From: vantuz-subhuman Date: Tue, 20 Jun 2023 13:13:38 +0300 Subject: [PATCH 67/80] flow fixes --- packages/yoroi-extension/app/components/transfer/SuccessPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/components/transfer/SuccessPage.js b/packages/yoroi-extension/app/components/transfer/SuccessPage.js index 1607ac95fd..24940df95c 100644 --- a/packages/yoroi-extension/app/components/transfer/SuccessPage.js +++ b/packages/yoroi-extension/app/components/transfer/SuccessPage.js @@ -1,5 +1,5 @@ // @flow -import type { Node } from 'react'; +import type { ComponentType, Node } from 'react'; import { Component } from 'react'; import { observer } from 'mobx-react'; import { intlShape } from 'react-intl'; From 890869a992eadea3f2680d63b1c2bc18c2d550e7 Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Tue, 20 Jun 2023 12:25:22 +0100 Subject: [PATCH 68/80] New translations en-US.json (Hungarian) --- packages/yoroi-extension/app/i18n/locales/hu-HU.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/yoroi-extension/app/i18n/locales/hu-HU.json b/packages/yoroi-extension/app/i18n/locales/hu-HU.json index 11091c07ba..df622b5c49 100644 --- a/packages/yoroi-extension/app/i18n/locales/hu-HU.json +++ b/packages/yoroi-extension/app/i18n/locales/hu-HU.json @@ -974,9 +974,9 @@ "wallet.transaction.state.failed": "failed", "wallet.transaction.state.pending": "pending", "wallet.transaction.state.submitted": "submitted", - "wallet.transaction.success.button.label": "Transaction page", - "wallet.transaction.success.explanation": "Track the status of the transaction from the Transactions page", - "wallet.transaction.success.title": "Successfully sent", + "wallet.transaction.success.button.label": "Go To Transactions", + "wallet.transaction.success.explanation": "Check this transaction in the list of wallet transactions", + "wallet.transaction.success.title": "Transaction submitted", "wallet.transaction.transactionAmount": "Transaction amount", "wallet.transaction.transactionId": "Transaction ID", "wallet.transaction.transactionMetadata": "Transaction Metadata", From d9a04ffa4e8df1126de95cd9d96688b1d9db5338 Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Tue, 20 Jun 2023 12:25:23 +0100 Subject: [PATCH 69/80] New translations en-US.json (Vietnamese) --- packages/yoroi-extension/app/i18n/locales/vi-VN.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/yoroi-extension/app/i18n/locales/vi-VN.json b/packages/yoroi-extension/app/i18n/locales/vi-VN.json index 6b0f0e3f10..20595176d6 100644 --- a/packages/yoroi-extension/app/i18n/locales/vi-VN.json +++ b/packages/yoroi-extension/app/i18n/locales/vi-VN.json @@ -974,9 +974,9 @@ "wallet.transaction.state.failed": "lỗi", "wallet.transaction.state.pending": "đang giải quyết", "wallet.transaction.state.submitted": "đã gửi", - "wallet.transaction.success.button.label": "Loại giao dịch", - "wallet.transaction.success.explanation": "Kiểm tra trạng thái giao dịch từ trang giao dịch", - "wallet.transaction.success.title": "Đã gửi thành công", + "wallet.transaction.success.button.label": "Go To Transactions", + "wallet.transaction.success.explanation": "Check this transaction in the list of wallet transactions", + "wallet.transaction.success.title": "Transaction submitted", "wallet.transaction.transactionAmount": "Số tiền giao dịch", "wallet.transaction.transactionId": "ID giao dịch", "wallet.transaction.transactionMetadata": "Siêu dữ liệu giao dịch", From c01458ae3643ab916710b728b0e6dfeb0b98d064 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Thu, 22 Jun 2023 17:00:47 +0300 Subject: [PATCH 70/80] feat: add content hash for webpack output file names --- packages/yoroi-extension/webpack/prodConfig.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/yoroi-extension/webpack/prodConfig.js b/packages/yoroi-extension/webpack/prodConfig.js index f6b1fb62bf..9dbb0ecdce 100644 --- a/packages/yoroi-extension/webpack/prodConfig.js +++ b/packages/yoroi-extension/webpack/prodConfig.js @@ -42,8 +42,8 @@ const baseProdConfig = (env /*: EnvParams */) /*: * */ => ({ }, output: { path: path.join(__dirname, '../build/js'), - filename: '[name].bundle.js', - chunkFilename: '[name].chunk.js', + filename: '[name].[contenthash].bundle.js', + chunkFilename: '[name].[contenthash].chunk.js', publicPath: env.publicPath == null ? defaultPublicPath : env.publicPath, }, plugins: [ From 0cc950e294ba4839504b57af6d1100566d2da58b Mon Sep 17 00:00:00 2001 From: vantuz-subhuman Date: Fri, 23 Jun 2023 21:32:01 +0300 Subject: [PATCH 71/80] Updated Ergo banner to display when any Ergo wallet is present at all and updated the message. --- .../topbar/banners/TestnetWarningBanner.js | 26 ++++++++++++------- .../app/containers/banners/BannerContainer.js | 14 +++++----- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/packages/yoroi-extension/app/components/topbar/banners/TestnetWarningBanner.js b/packages/yoroi-extension/app/components/topbar/banners/TestnetWarningBanner.js index cb735ea070..5a0e8a1e39 100644 --- a/packages/yoroi-extension/app/components/topbar/banners/TestnetWarningBanner.js +++ b/packages/yoroi-extension/app/components/topbar/banners/TestnetWarningBanner.js @@ -21,7 +21,7 @@ const messages = defineMessages({ type Props = {| isTestnet: boolean, - isErgo: boolean, + isAnyErgo: boolean, |}; @observer @@ -58,16 +58,24 @@ export default class TestnetWarningBanner extends Component {
); } - if (this.props.isErgo) { + if (this.props.isAnyErgo) { return ( -
- -
- NOTE: Unfortunately the Ergo network support will be dropped from Yoroi in the near future. -
- Please make sure to migrate your Ergo funds and wallets to another application. + <> +
+ +
+ NOTE: Due to the planned gradual termination of the Ergo wallets support in Yoroi extension, +
+ Starting with the next version the Ergo wallets in the list will be visible, but not operational. +
-
+
+ +
+ Please make sure to migrate your Ergo funds and wallets to another application. +
+
+ ); } return null; diff --git a/packages/yoroi-extension/app/containers/banners/BannerContainer.js b/packages/yoroi-extension/app/containers/banners/BannerContainer.js index 3d9bac311e..04b66ff15d 100644 --- a/packages/yoroi-extension/app/containers/banners/BannerContainer.js +++ b/packages/yoroi-extension/app/containers/banners/BannerContainer.js @@ -27,13 +27,11 @@ export default class BannerContainer extends Component isErgo(w.getParent().getNetworkInfo())); const deprecationBanner = this.getDeprecationBanner(); return ( @@ -47,7 +45,7 @@ export default class BannerContainer extends Component )} - + {!environment.isProduction() && } {deprecationBanner} @@ -88,7 +86,10 @@ export default class BannerContainer extends Component |}, + wallets: {| + publicDerivers: Array>, + selected: null | PublicDeriver<>, + |}, |}, actions: {||}, |} { @@ -109,6 +110,7 @@ export default class BannerContainer extends Component Date: Fri, 23 Jun 2023 21:37:18 +0300 Subject: [PATCH 72/80] Fixed banner style and text --- .../topbar/banners/TestnetWarningBanner.js | 24 +++++++------------ .../topbar/banners/TestnetWarningBanner.scss | 2 +- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/packages/yoroi-extension/app/components/topbar/banners/TestnetWarningBanner.js b/packages/yoroi-extension/app/components/topbar/banners/TestnetWarningBanner.js index 5a0e8a1e39..1e469f210e 100644 --- a/packages/yoroi-extension/app/components/topbar/banners/TestnetWarningBanner.js +++ b/packages/yoroi-extension/app/components/topbar/banners/TestnetWarningBanner.js @@ -60,22 +60,16 @@ export default class TestnetWarningBanner extends Component { } if (this.props.isAnyErgo) { return ( - <> -
- -
- NOTE: Due to the planned gradual termination of the Ergo wallets support in Yoroi extension, -
- Starting with the next version the Ergo wallets in the list will be visible, but not operational. -
-
-
- -
- Please make sure to migrate your Ergo funds and wallets to another application. -
+
+ +
+ NOTE: Due to the planned gradual termination of the Ergo wallets support in Yoroi extension, +
+ Starting with the next version any Ergo wallets in the list will be visible, but not operational! +
+ Please make sure to migrate your Ergo funds and wallets to another application.
- +
); } return null; diff --git a/packages/yoroi-extension/app/components/topbar/banners/TestnetWarningBanner.scss b/packages/yoroi-extension/app/components/topbar/banners/TestnetWarningBanner.scss index 8b31396cab..7bd2c43f07 100644 --- a/packages/yoroi-extension/app/components/topbar/banners/TestnetWarningBanner.scss +++ b/packages/yoroi-extension/app/components/topbar/banners/TestnetWarningBanner.scss @@ -46,7 +46,7 @@ } .ergoWarning { - height: 60px; + height: 90px; display: flex; justify-content: center; align-items: center; From fe6e5354583c69d82309adf2f9c232a3332d2332 Mon Sep 17 00:00:00 2001 From: vantuz-subhuman Date: Tue, 27 Jun 2023 20:29:24 +0300 Subject: [PATCH 73/80] flow fixes --- .../app/components/topbar/banners/TestnetWarningBanner.js | 4 ++-- .../app/containers/banners/BannerContainer.js | 6 +++--- .../app/containers/notice-board/NoticeBoardPage.js | 7 ++++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/yoroi-extension/app/components/topbar/banners/TestnetWarningBanner.js b/packages/yoroi-extension/app/components/topbar/banners/TestnetWarningBanner.js index 1e469f210e..67d80efdba 100644 --- a/packages/yoroi-extension/app/components/topbar/banners/TestnetWarningBanner.js +++ b/packages/yoroi-extension/app/components/topbar/banners/TestnetWarningBanner.js @@ -21,7 +21,7 @@ const messages = defineMessages({ type Props = {| isTestnet: boolean, - isAnyErgo: boolean, + isErgo: boolean, |}; @observer @@ -58,7 +58,7 @@ export default class TestnetWarningBanner extends Component {
); } - if (this.props.isAnyErgo) { + if (this.props.isErgo) { return (
diff --git a/packages/yoroi-extension/app/containers/banners/BannerContainer.js b/packages/yoroi-extension/app/containers/banners/BannerContainer.js index 04b66ff15d..0cbc521722 100644 --- a/packages/yoroi-extension/app/containers/banners/BannerContainer.js +++ b/packages/yoroi-extension/app/containers/banners/BannerContainer.js @@ -31,7 +31,7 @@ export default class BannerContainer extends Component isErgo(w.getParent().getNetworkInfo())); + const isAnyWalletErgo = publicDerivers?.some(w => isErgo(w.getParent().getNetworkInfo())) ?? false; const deprecationBanner = this.getDeprecationBanner(); return ( @@ -45,7 +45,7 @@ export default class BannerContainer extends Component )} - + {!environment.isProduction() && } {deprecationBanner} @@ -87,7 +87,7 @@ export default class BannerContainer extends Component>, + publicDerivers?: Array>, selected: null | PublicDeriver<>, |}, |}, diff --git a/packages/yoroi-extension/app/containers/notice-board/NoticeBoardPage.js b/packages/yoroi-extension/app/containers/notice-board/NoticeBoardPage.js index bfb815d93b..a04cba6e3f 100644 --- a/packages/yoroi-extension/app/containers/notice-board/NoticeBoardPage.js +++ b/packages/yoroi-extension/app/containers/notice-board/NoticeBoardPage.js @@ -105,9 +105,10 @@ export default class NoticeBoardPage extends Component - |}, + wallets: { + selected: null | PublicDeriver<>, + ... + }, tokenInfoStore: {| tokenInfo: TokenInfoMap, |}, From 491eab4fd897b1e041518054cce26d0837df2acb Mon Sep 17 00:00:00 2001 From: vantuz-subhuman Date: Wed, 28 Jun 2023 15:20:20 +0300 Subject: [PATCH 74/80] fixing quantity sorting --- .../app/components/wallet/assets/AssetsList.js | 5 +++++ .../app/components/wallet/assets/TokenList.js | 4 ++++ .../app/containers/wallet/TokensPageRevamp.js | 1 + .../app/containers/wallet/WalletAssetsPage.js | 1 + 4 files changed, 11 insertions(+) diff --git a/packages/yoroi-extension/app/components/wallet/assets/AssetsList.js b/packages/yoroi-extension/app/components/wallet/assets/AssetsList.js index 70b4f15482..7fec4aa836 100644 --- a/packages/yoroi-extension/app/components/wallet/assets/AssetsList.js +++ b/packages/yoroi-extension/app/components/wallet/assets/AssetsList.js @@ -37,6 +37,7 @@ const SORTING_COLUMNS = { name: string, id: string, amount: string, + amountForSorting?: BigNumber, |} type Props = {| +assetsList: Asset[], @@ -136,6 +137,10 @@ export default class AssetsList extends Component { this.setState({ sortingDirection: newSortDirection }) if (field === 'amount') { + const dedicatedField = 'amountForSorting'; + if (a[dedicatedField] != null && b[dedicatedField] != null) { + return compareNumbers(a[dedicatedField], b[dedicatedField], newSortDirection) + } return compareNumbers(a[field], b[field], newSortDirection) } // Other fields diff --git a/packages/yoroi-extension/app/components/wallet/assets/TokenList.js b/packages/yoroi-extension/app/components/wallet/assets/TokenList.js index accf777f27..ff212dc0c6 100644 --- a/packages/yoroi-extension/app/components/wallet/assets/TokenList.js +++ b/packages/yoroi-extension/app/components/wallet/assets/TokenList.js @@ -90,6 +90,10 @@ function TokenList({ assetsList: list, shouldHideBalance, intl }: Props & Intl): setState({ ...state, sortingDirection: newSortDirection }); if (field === SORTING_COLUMNS.AMOUNT) { + const dedicatedField = 'amountForSorting'; + if (a[dedicatedField] != null && b[dedicatedField] != null) { + return compareNumbers(a[dedicatedField], b[dedicatedField], newSortDirection); + } return compareNumbers(a[field], b[field], newSortDirection); } // Other fields diff --git a/packages/yoroi-extension/app/containers/wallet/TokensPageRevamp.js b/packages/yoroi-extension/app/containers/wallet/TokensPageRevamp.js index dce3735c75..20d264148a 100644 --- a/packages/yoroi-extension/app/containers/wallet/TokensPageRevamp.js +++ b/packages/yoroi-extension/app/containers/wallet/TokensPageRevamp.js @@ -51,6 +51,7 @@ export default class TokensPageRevamp extends Component Date: Wed, 28 Jun 2023 19:41:30 +0300 Subject: [PATCH 75/80] flow fixes --- .../yoroi-extension/app/components/wallet/assets/TokenList.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/yoroi-extension/app/components/wallet/assets/TokenList.js b/packages/yoroi-extension/app/components/wallet/assets/TokenList.js index ff212dc0c6..61fc2b36fb 100644 --- a/packages/yoroi-extension/app/components/wallet/assets/TokenList.js +++ b/packages/yoroi-extension/app/components/wallet/assets/TokenList.js @@ -33,6 +33,7 @@ import { Link } from 'react-router-dom'; import { ROUTES } from '../../../routes-config'; import CopyToClipboardText from '../../widgets/CopyToClipboardLabel'; import { ListEmpty } from './ListEmpty'; +import BigNumber from 'bignumber.js'; const SORTING_DIRECTIONS = { UP: 'UP', @@ -48,6 +49,7 @@ export type Asset = {| name: string, id: string, amount: string, + amountForSorting?: BigNumber, |}; type Props = {| +assetsList: Asset[], From f6c498731ad64064d790ee2453d164b10be089fc Mon Sep 17 00:00:00 2001 From: vantuz-subhuman Date: Thu, 29 Jun 2023 22:13:13 +0300 Subject: [PATCH 76/80] added vietnamese translation to the UI --- packages/yoroi-extension/app/components/widgets/FlagLabel.js | 2 +- packages/yoroi-extension/app/i18n/global-messages.js | 4 ++++ packages/yoroi-extension/app/i18n/locales/en-US.json | 5 +++-- packages/yoroi-extension/app/i18n/translations.js | 5 +++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/yoroi-extension/app/components/widgets/FlagLabel.js b/packages/yoroi-extension/app/components/widgets/FlagLabel.js index dd9aa19f35..29b519ac28 100644 --- a/packages/yoroi-extension/app/components/widgets/FlagLabel.js +++ b/packages/yoroi-extension/app/components/widgets/FlagLabel.js @@ -18,7 +18,7 @@ export default class FlagLabel extends Component { return (
- + { typeof svg === 'string' ? svg : ()} {label}
); diff --git a/packages/yoroi-extension/app/i18n/global-messages.js b/packages/yoroi-extension/app/i18n/global-messages.js index cb38148bbb..4c4de0a4b0 100644 --- a/packages/yoroi-extension/app/i18n/global-messages.js +++ b/packages/yoroi-extension/app/i18n/global-messages.js @@ -264,6 +264,10 @@ const globalMessages: * = defineMessages({ id: 'global.language.slovak', defaultMessage: '!!!Slovak', }, + languageVietnamese: { + id: 'global.language.vietnamese', + defaultMessage: '!!!Vietnamese', + }, addressLabel: { id: 'wallet.receive.confirmationDialog.addressLabel', defaultMessage: '!!!Address', diff --git a/packages/yoroi-extension/app/i18n/locales/en-US.json b/packages/yoroi-extension/app/i18n/locales/en-US.json index d72fc3ac76..c764e2c32a 100644 --- a/packages/yoroi-extension/app/i18n/locales/en-US.json +++ b/packages/yoroi-extension/app/i18n/locales/en-US.json @@ -203,6 +203,7 @@ "global.language.slovak": "Slovak", "global.language.spanish": "Español", "global.language.turkish": "Turkish", + "global.language.vietnamese": "Vietnamese", "global.passwordInstructionsPaperWallet": "Note: Paper Wallet password needs to be at least 10 characters long.", "global.publicKey.explanation": "Public keys allow seeing the wallet history for the wallet, but does not allow to spend or move the funds in any way (private key is not included)", "global.receive": "Receive", @@ -462,11 +463,11 @@ "wallet.add.page.hw.tooltip": "Create or restore a Yoroi wallet
using a Ledger or Trezor hardware wallet.", "wallet.add.page.restore.title": "Restore wallet", "wallet.add.page.restore.tooltip": "Enter a 15-word recovery phrase
to restore an already-existing Yoroi wallet,
or import an existing Yoroi paper wallet.", + "wallet.add.page.revamp.backButtonLabel": "Back to current wallet", "wallet.add.page.revamp.connectHardwareWallet": "Connect hardware wallet", "wallet.add.page.revamp.createWallet": "Create new wallet", "wallet.add.page.revamp.restoreWallet": "Restore existing wallet", "wallet.add.page.revamp.subtitle": "Light wallet for Cardano assets", - "wallet.add.page.revamp.backButtonLabel": "Back to current wallet", "wallet.add.page.subtitle.label": "Yoroi light wallet for Cardano", "wallet.add.page.title": "Your gateway
to the
financial world", "wallet.address.category.addressBook": "Addresses that do not belong to you, but are relevant to your wallet", @@ -1061,4 +1062,4 @@ "yoroiTransfer.waiting.progressInfo.checkingAddresses": "Checking addresses funds", "yoroiTransfer.waiting.progressInfo.restoringAddresses": "Fetching addresses", "yoroiTransfer.waiting.title.label": "Wallet is being restored" -} +} \ No newline at end of file diff --git a/packages/yoroi-extension/app/i18n/translations.js b/packages/yoroi-extension/app/i18n/translations.js index 44622b605f..7aed8fda06 100644 --- a/packages/yoroi-extension/app/i18n/translations.js +++ b/packages/yoroi-extension/app/i18n/translations.js @@ -116,5 +116,10 @@ export const LANGUAGES: Array = [ value: 'sk-SK', label: globalMessages.languageSlovak, svg: SlovakFlag + }, + { + value: 'vi-VN', + label: globalMessages.languageVietnamese, + svg: '🇻🇳' } ]; From b5ed22c40eafc6146d6f13e90ba031b5398a87b8 Mon Sep 17 00:00:00 2001 From: vantuz-subhuman Date: Fri, 30 Jun 2023 12:57:08 +0300 Subject: [PATCH 77/80] added vietnamese flag to the language selector --- .../assets/images/flags/vietnamese.inline.svg | 46 +++++++++++++++++++ .../yoroi-extension/app/i18n/translations.js | 3 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 packages/yoroi-extension/app/assets/images/flags/vietnamese.inline.svg diff --git a/packages/yoroi-extension/app/assets/images/flags/vietnamese.inline.svg b/packages/yoroi-extension/app/assets/images/flags/vietnamese.inline.svg new file mode 100644 index 0000000000..868caa51ba --- /dev/null +++ b/packages/yoroi-extension/app/assets/images/flags/vietnamese.inline.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/yoroi-extension/app/i18n/translations.js b/packages/yoroi-extension/app/i18n/translations.js index 7aed8fda06..42275bb670 100644 --- a/packages/yoroi-extension/app/i18n/translations.js +++ b/packages/yoroi-extension/app/i18n/translations.js @@ -16,6 +16,7 @@ import { ReactComponent as IndonesianFlag } from '../assets/images/flags/indone import { ReactComponent as TurkishFlag } from '../assets/images/flags/turkish.inline.svg'; import { ReactComponent as CzechFlag } from '../assets/images/flags/czech.inline.svg'; import { ReactComponent as SlovakFlag } from '../assets/images/flags/slovak.inline.svg'; +import { ReactComponent as VietnameseFlag } from '../assets/images/flags/vietnamese.inline.svg'; // This is essentially bulk require @@ -120,6 +121,6 @@ export const LANGUAGES: Array = [ { value: 'vi-VN', label: globalMessages.languageVietnamese, - svg: '🇻🇳' + svg: VietnameseFlag } ]; From 70ede971c69d65facfb2f217c48e95c63f2ff47b Mon Sep 17 00:00:00 2001 From: vantuz-subhuman Date: Fri, 30 Jun 2023 14:30:16 +0300 Subject: [PATCH 78/80] Adding missing vietnamese locale. Moving locales definition to the translations module. --- crowdin.yml | 2 ++ packages/yoroi-extension/app/App.js | 35 ++---------------- .../yoroi-extension/app/i18n/translations.js | 36 ++++++++++++++++++- 3 files changed, 39 insertions(+), 34 deletions(-) diff --git a/crowdin.yml b/crowdin.yml index 99323cd8bc..ebaf0309bc 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -17,6 +17,7 @@ files: it: it-IT sk: sk-SK cs: cs-CZ + vi: vi-VN - source: /packages/yoroi-extension/app/i18n/locales/**/en-US.md translation: /packages/yoroi-extension/app/i18n/locales/**/%locale%.md languages_mapping: @@ -34,4 +35,5 @@ files: it: it-IT sk: sk-SK cs: cs-CZ + vi: vi-VN content_segmentation: 0 diff --git a/packages/yoroi-extension/app/App.js b/packages/yoroi-extension/app/App.js index 1708953bc2..19b9294b34 100644 --- a/packages/yoroi-extension/app/App.js +++ b/packages/yoroi-extension/app/App.js @@ -5,24 +5,9 @@ import { observer } from 'mobx-react'; import { Router } from 'react-router-dom'; import type { RouterHistory } from 'react-router-dom'; import { addLocaleData, IntlProvider } from 'react-intl'; -import en from 'react-intl/locale-data/en'; -import ko from 'react-intl/locale-data/ko'; -import ja from 'react-intl/locale-data/ja'; -import zh from 'react-intl/locale-data/zh'; -import ru from 'react-intl/locale-data/ru'; -import de from 'react-intl/locale-data/de'; -import fr from 'react-intl/locale-data/fr'; -import nl from 'react-intl/locale-data/nl'; -import pt from 'react-intl/locale-data/pt'; -import id from 'react-intl/locale-data/id'; -import es from 'react-intl/locale-data/es'; -import it from 'react-intl/locale-data/it'; -import tr from 'react-intl/locale-data/tr'; -import cs from 'react-intl/locale-data/cs'; -import sk from 'react-intl/locale-data/sk'; import { observable, autorun, runInAction } from 'mobx'; import { Routes } from './Routes'; -import { translations } from './i18n/translations'; +import { locales, translations } from './i18n/translations'; import type { StoresMap } from './stores'; import type { ActionsMap } from './actions'; import { changeToplevelTheme, MuiThemes } from './styles/utils'; @@ -39,23 +24,7 @@ import Support from './components/widgets/Support'; import { trackNavigation } from './api/analytics'; // https://github.com/yahoo/react-intl/wiki#loading-locale-data -addLocaleData([ - ...en, - ...ko, - ...ja, - ...zh, - ...ru, - ...de, - ...fr, - ...nl, - ...pt, - ...id, - ...es, - ...it, - ...tr, - ...cs, - ...sk, -]); +addLocaleData(locales); type Props = {| +stores: StoresMap, diff --git a/packages/yoroi-extension/app/i18n/translations.js b/packages/yoroi-extension/app/i18n/translations.js index 42275bb670..5e89b1966d 100644 --- a/packages/yoroi-extension/app/i18n/translations.js +++ b/packages/yoroi-extension/app/i18n/translations.js @@ -1,4 +1,20 @@ // @flow +import en from 'react-intl/locale-data/en'; +import ko from 'react-intl/locale-data/ko'; +import ja from 'react-intl/locale-data/ja'; +import zh from 'react-intl/locale-data/zh'; +import ru from 'react-intl/locale-data/ru'; +import de from 'react-intl/locale-data/de'; +import fr from 'react-intl/locale-data/fr'; +import nl from 'react-intl/locale-data/nl'; +import pt from 'react-intl/locale-data/pt'; +import id from 'react-intl/locale-data/id'; +import es from 'react-intl/locale-data/es'; +import it from 'react-intl/locale-data/it'; +import tr from 'react-intl/locale-data/tr'; +import cs from 'react-intl/locale-data/cs'; +import sk from 'react-intl/locale-data/sk'; +import vi from 'react-intl/locale-data/vi'; import globalMessages from './global-messages'; import type { $npm$ReactIntl$MessageDescriptor } from 'react-intl'; import { ReactComponent as EnglishFlag } from '../assets/images/flags/english.inline.svg'; @@ -18,8 +34,26 @@ import { ReactComponent as CzechFlag } from '../assets/images/flags/czech.inlin import { ReactComponent as SlovakFlag } from '../assets/images/flags/slovak.inline.svg'; import { ReactComponent as VietnameseFlag } from '../assets/images/flags/vietnamese.inline.svg'; -// This is essentially bulk require +export const locales = Object.freeze([ + ...en, + ...ko, + ...ja, + ...zh, + ...ru, + ...de, + ...fr, + ...nl, + ...pt, + ...id, + ...es, + ...it, + ...tr, + ...cs, + ...sk, + ...vi, +]); +// This is essentially bulk require // $FlowExpectedError[prop-missing] require.context comes from webpack const req = require.context('./locales', true, /\.json.*$/, 'lazy'); export const translations: {| From b25eb739c14cbd693b0213c41207c2851616e37e Mon Sep 17 00:00:00 2001 From: vantuz-subhuman Date: Fri, 30 Jun 2023 16:10:04 +0300 Subject: [PATCH 79/80] flow fix --- packages/yoroi-extension/app/i18n/translations.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/i18n/translations.js b/packages/yoroi-extension/app/i18n/translations.js index 5e89b1966d..7fe3be2d5c 100644 --- a/packages/yoroi-extension/app/i18n/translations.js +++ b/packages/yoroi-extension/app/i18n/translations.js @@ -34,7 +34,7 @@ import { ReactComponent as CzechFlag } from '../assets/images/flags/czech.inlin import { ReactComponent as SlovakFlag } from '../assets/images/flags/slovak.inline.svg'; import { ReactComponent as VietnameseFlag } from '../assets/images/flags/vietnamese.inline.svg'; -export const locales = Object.freeze([ +export const locales: any = Object.freeze([ ...en, ...ko, ...ja, From e984112adc253e7da8dd31804eba095b273f3dc9 Mon Sep 17 00:00:00 2001 From: vantuz-subhuman Date: Fri, 30 Jun 2023 16:18:00 +0300 Subject: [PATCH 80/80] Version bump: 4.22.0 --- packages/yoroi-extension/package-lock.json | 2 +- packages/yoroi-extension/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/yoroi-extension/package-lock.json b/packages/yoroi-extension/package-lock.json index df96701dd3..2803c7f99c 100644 --- a/packages/yoroi-extension/package-lock.json +++ b/packages/yoroi-extension/package-lock.json @@ -1,6 +1,6 @@ { "name": "yoroi", - "version": "4.21.1", + "version": "4.22.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/yoroi-extension/package.json b/packages/yoroi-extension/package.json index a6e29b90ac..a37a154615 100644 --- a/packages/yoroi-extension/package.json +++ b/packages/yoroi-extension/package.json @@ -1,6 +1,6 @@ { "name": "yoroi", - "version": "4.21.1", + "version": "4.22.0", "description": "Cardano ADA wallet", "scripts": { "dev:build": "rimraf dev/ && babel-node scripts/build --type=debug",