From f26e0b26bb3a3c82d5a20a6c16fa8647ed60eaa7 Mon Sep 17 00:00:00 2001 From: Paul Ccari Date: Sat, 18 Dec 2021 01:51:54 -0500 Subject: [PATCH 01/28] add epoch progress ui with placeholders --- .../dashboard-revamp/EpochProgressCard.js | 91 +++++++++++++++++++ .../staking/dashboard-revamp/StakingTabs.js | 13 ++- 2 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js new file mode 100644 index 0000000000..76b7d7084c --- /dev/null +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js @@ -0,0 +1,91 @@ +// @flow +import type { Node } from 'react'; +import { Box } from '@mui/system'; +import { CircularProgress, Stack, Typography } from '@mui/material'; + +type Props = {| + +percentage: number, + +days: string, + +currentEpoch: number, + +epochStartDate: string, + +epochEndDate: string, +|}; + +// TODO: Remove placeholders +export function EpochProgressCard({ + percentage, + days, + currentEpoch, + epochStartDate, + epochEndDate, +}: Props): Node { + return ( + + + + + + + + + ); +} + +type InfoColumnProps = {| + +label: string, + +value: string | number, +|}; +const LabelWithValue = ({ label, value }: InfoColumnProps): Node => { + return ( + + + {label} + + {value} + + ); +}; + +const Graph = ({ value, days }): Node => { + return ( + + + + + + {value}% + + + {days} days + + + + ); +}; diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js index 1772547c78..149b62aa2a 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js @@ -12,6 +12,7 @@ import { defineMessages, injectIntl } from 'react-intl'; import type { $npm$ReactIntl$IntlShape } from 'react-intl'; import globalMessages from '../../../../i18n/global-messages'; import type { PoolData } from '../../../../containers/wallet/staking/SeizaFetcher'; +import { EpochProgressCard } from './EpochProgressCard'; type Props = {| delegatedPool: PoolData, @@ -59,8 +60,16 @@ function StakingTabs({ delegatedPool, undelegate, intl }: Props & Intl): Node { { id: 2, label: 'Epoch progress', - disabled: true, - component: TODO: Epoch progress!, + disabled: false, + component: ( + + ), }, ]; From f40c1706ea349f09afe0000a5f381085c50b0516 Mon Sep 17 00:00:00 2001 From: Paul Ccari Date: Mon, 20 Dec 2021 11:24:45 -0500 Subject: [PATCH 02/28] integrate epochProgress data --- .../dashboard-revamp/EpochProgressCard.js | 12 ++-- .../staking/dashboard-revamp/StakingTabs.js | 13 ++-- .../containers/wallet/staking/StakingPage.js | 59 ++++++++++++++++++- 3 files changed, 73 insertions(+), 11 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js index 76b7d7084c..48f3285f9b 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js @@ -7,8 +7,8 @@ type Props = {| +percentage: number, +days: string, +currentEpoch: number, - +epochStartDate: string, - +epochEndDate: string, + +startEpochDate: string, + +endEpochDate: string, |}; // TODO: Remove placeholders @@ -16,16 +16,16 @@ export function EpochProgressCard({ percentage, days, currentEpoch, - epochStartDate, - epochEndDate, + startEpochDate, + endEpochDate, }: Props): Node { return ( - - + + ); diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js index 149b62aa2a..2842cb2ae6 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js @@ -16,6 +16,10 @@ import { EpochProgressCard } from './EpochProgressCard'; type Props = {| delegatedPool: PoolData, + epochProgress: {| + currentEpoch: number, + endEpochDate: string, + |}, +undelegate: void | (void => Promise), |}; type Intl = {| @@ -30,7 +34,7 @@ const messages = defineMessages({ }, }); -function StakingTabs({ delegatedPool, undelegate, intl }: Props & Intl): Node { +function StakingTabs({ delegatedPool, undelegate, epochProgress, intl }: Props & Intl): Node { const [value, setValue] = useState(0); const handleChange = (event, newValue) => { @@ -63,11 +67,12 @@ function StakingTabs({ delegatedPool, undelegate, intl }: Props & Intl): Node { disabled: false, component: ( ), }, diff --git a/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js b/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js index 04dcdab12e..9e4e68d906 100644 --- a/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js +++ b/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js @@ -50,6 +50,12 @@ import type { GeneratedData as WithdrawalTxDialogContainerData } from '../../tra import type { GeneratedData as DeregisterDialogContainerData } from '../../transfer/DeregisterDialogContainer'; import UndelegateDialog from '../../../components/wallet/staking/dashboard/UndelegateDialog'; import type { PoolRequest } from '../../../api/jormungandr/lib/storage/bridge/delegationUtils'; +import { ApiOptions, getApiForNetwork } from '../../../api/common/utils'; +import type { + CurrentTimeRequests, + TimeCalcRequests, +} from '../../../stores/base/BaseCardanoTimeStore'; +import moment from 'moment'; export type GeneratedData = typeof StakingPage.prototype.generated; // populated by ConfigWebpackPlugin @@ -167,6 +173,31 @@ class StakingPage extends Component { }; getStakePools: (PublicDeriver<>) => Node | void = publicDeriver => { + const timeStore = this.generated.stores.time; + const timeCalcRequests = timeStore.getTimeCalcRequests(publicDeriver); + const currTimeRequests = timeStore.getCurrentTimeRequests(publicDeriver); + const toAbsoluteSlot = timeCalcRequests.requests.toAbsoluteSlot.result; + if (toAbsoluteSlot == null) return undefined; + const toRealTime = timeCalcRequests.requests.toRealTime.result; + if (toRealTime == null) return undefined; + const timeSinceGenesis = timeCalcRequests.requests.timeSinceGenesis.result; + if (timeSinceGenesis == null) return undefined; + const getEpochLength = timeCalcRequests.requests.currentEpochLength.result; + if (getEpochLength == null) return undefined; + const currentEpoch = currTimeRequests.currentEpoch; + + const endEpochTime = toRealTime({ + absoluteSlotNum: toAbsoluteSlot({ + epoch: currentEpoch, + // in Jormungandr, rewards were distributed at the start of the epoch + // in Haskell, rewards are calculated at the start of the epoch but distributed at the end + slot: isJormungandr(publicDeriver.getParent().getNetworkInfo()) ? 0 : getEpochLength(), + }), + timeSinceGenesisFunc: timeSinceGenesis, + }); + + const endEpochDate = moment(endEpochTime).format('lll'); + const delegationStore = this.generated.stores.delegation; const delegationRequests = delegationStore.getDelegationRequests(publicDeriver); if (delegationRequests == null) { @@ -214,6 +245,7 @@ class StakingPage extends Component { return ( { |}, |}, |}, + time: {| + getCurrentTimeRequests: (PublicDeriver<>) => CurrentTimeRequests, + getTimeCalcRequests: (PublicDeriver<>) => TimeCalcRequests, + |}, delegation: {| selectedPage: number, getLocalPoolInfo: ($ReadOnly, string) => void | PoolMeta, @@ -474,7 +510,27 @@ class StakingPage extends Component { if (selected == null) { throw new Error(`${nameof(EpochProgressContainer)} no wallet selected`); } - + const api = getApiForNetwork(selected.getParent().getNetworkInfo()); + const time = (() => { + if (api === ApiOptions.ada) { + return { + getTimeCalcRequests: stores.substores.ada.time.getTimeCalcRequests, + getCurrentTimeRequests: stores.substores.ada.time.getCurrentTimeRequests, + }; + } + if (api === ApiOptions.jormungandr) { + return { + getTimeCalcRequests: stores.substores.jormungandr.time.getTimeCalcRequests, + getCurrentTimeRequests: stores.substores.jormungandr.time.getCurrentTimeRequests, + }; + } + return { + getTimeCalcRequests: (undefined: any), + getCurrentTimeRequests: () => { + throw new Error(`${nameof(StakingPage)} api not supported`); + }, + }; + })(); return Object.freeze({ stores: { wallets: { @@ -489,6 +545,7 @@ class StakingPage extends Component { getLocalPoolInfo: stores.delegation.getLocalPoolInfo, getDelegationRequests: stores.delegation.getDelegationRequests, }, + time, uiDialogs: { isOpen: stores.uiDialogs.isOpen, getParam: stores.uiDialogs.getParam, From a72e0e8c8ee8285c166ee87402f6097568db83f8 Mon Sep 17 00:00:00 2001 From: Paul Ccari Date: Mon, 20 Dec 2021 11:41:28 -0500 Subject: [PATCH 03/28] add percentage --- .../wallet/staking/dashboard-revamp/StakingTabs.js | 3 ++- .../app/containers/wallet/staking/StakingPage.js | 11 ++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js index 2842cb2ae6..b63b6dd6d6 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js @@ -19,6 +19,7 @@ type Props = {| epochProgress: {| currentEpoch: number, endEpochDate: string, + percentage: number, |}, +undelegate: void | (void => Promise), |}; @@ -68,7 +69,7 @@ function StakingTabs({ delegatedPool, undelegate, epochProgress, intl }: Props & component: ( { const getEpochLength = timeCalcRequests.requests.currentEpochLength.result; if (getEpochLength == null) return undefined; const currentEpoch = currTimeRequests.currentEpoch; + const epochLength = getEpochLength(); const endEpochTime = toRealTime({ absoluteSlotNum: toAbsoluteSlot({ epoch: currentEpoch, // in Jormungandr, rewards were distributed at the start of the epoch // in Haskell, rewards are calculated at the start of the epoch but distributed at the end - slot: isJormungandr(publicDeriver.getParent().getNetworkInfo()) ? 0 : getEpochLength(), + slot: isJormungandr(publicDeriver.getParent().getNetworkInfo()) ? 0 : epochLength, }), timeSinceGenesisFunc: timeSinceGenesis, }); @@ -242,10 +243,14 @@ class StakingPage extends Component { // tw: '', // }, // }; - + console.log(currTimeRequests, epochLength) return ( Date: Mon, 20 Dec 2021 19:31:21 -0500 Subject: [PATCH 04/28] remove log --- .../yoroi-extension/app/containers/wallet/staking/StakingPage.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js b/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js index 7340466408..7fd434d372 100644 --- a/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js +++ b/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js @@ -243,7 +243,6 @@ class StakingPage extends Component { // tw: '', // }, // }; - console.log(currTimeRequests, epochLength) return ( Date: Fri, 7 Jan 2022 20:01:31 -0500 Subject: [PATCH 05/28] add start epoch date --- .../dashboard-revamp/EpochProgressCard.js | 2 +- .../staking/dashboard-revamp/StakingTabs.js | 3 ++- .../containers/wallet/staking/StakingPage.js | 26 ++++++++++++------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js index 48f3285f9b..646ccc5fd8 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js @@ -22,7 +22,7 @@ export function EpochProgressCard({ return ( - + diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js index b63b6dd6d6..b1c7512fea 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js @@ -18,6 +18,7 @@ type Props = {| delegatedPool: PoolData, epochProgress: {| currentEpoch: number, + startEpochDate: string, endEpochDate: string, percentage: number, |}, @@ -72,7 +73,7 @@ function StakingTabs({ delegatedPool, undelegate, epochProgress, intl }: Props & percentage={epochProgress.percentage} days="2.5" currentEpoch={epochProgress.currentEpoch} - startEpochDate="-" + startEpochDate={epochProgress.startEpochDate} endEpochDate={epochProgress.endEpochDate} /> ), diff --git a/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js b/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js index 7fd434d372..d3ae27e0ea 100644 --- a/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js +++ b/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js @@ -187,17 +187,22 @@ class StakingPage extends Component { const currentEpoch = currTimeRequests.currentEpoch; const epochLength = getEpochLength(); - const endEpochTime = toRealTime({ - absoluteSlotNum: toAbsoluteSlot({ - epoch: currentEpoch, - // in Jormungandr, rewards were distributed at the start of the epoch - // in Haskell, rewards are calculated at the start of the epoch but distributed at the end - slot: isJormungandr(publicDeriver.getParent().getNetworkInfo()) ? 0 : epochLength, - }), - timeSinceGenesisFunc: timeSinceGenesis, - }); + const getDateFromEpoch = epoch => { + const epochTime = toRealTime({ + absoluteSlotNum: toAbsoluteSlot({ + epoch, + // in Jormungandr, rewards were distributed at the start of the epoch + // in Haskell, rewards are calculated at the start of the epoch but distributed at the end + slot: isJormungandr(publicDeriver.getParent().getNetworkInfo()) ? 0 : getEpochLength(), + }), + timeSinceGenesisFunc: timeSinceGenesis, + }); + const epochMoment = moment(epochTime).format('lll'); + return epochMoment; + }; - const endEpochDate = moment(endEpochTime).format('lll'); + const endEpochDate = getDateFromEpoch(currentEpoch); + const previousEpochDate = getDateFromEpoch(currentEpoch - 1); const delegationStore = this.generated.stores.delegation; const delegationRequests = delegationStore.getDelegationRequests(publicDeriver); @@ -246,6 +251,7 @@ class StakingPage extends Component { return ( Date: Mon, 4 Jul 2022 21:19:15 +0200 Subject: [PATCH 06/28] add epoch progress ui with placeholders --- .../dashboard-revamp/EpochProgressCard.js | 91 +++++++++++++++++++ .../staking/dashboard-revamp/StakingTabs.js | 13 ++- 2 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js new file mode 100644 index 0000000000..76b7d7084c --- /dev/null +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js @@ -0,0 +1,91 @@ +// @flow +import type { Node } from 'react'; +import { Box } from '@mui/system'; +import { CircularProgress, Stack, Typography } from '@mui/material'; + +type Props = {| + +percentage: number, + +days: string, + +currentEpoch: number, + +epochStartDate: string, + +epochEndDate: string, +|}; + +// TODO: Remove placeholders +export function EpochProgressCard({ + percentage, + days, + currentEpoch, + epochStartDate, + epochEndDate, +}: Props): Node { + return ( + + + + + + + + + ); +} + +type InfoColumnProps = {| + +label: string, + +value: string | number, +|}; +const LabelWithValue = ({ label, value }: InfoColumnProps): Node => { + return ( + + + {label} + + {value} + + ); +}; + +const Graph = ({ value, days }): Node => { + return ( + + + + + + {value}% + + + {days} days + + + + ); +}; diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js index ed0cd4a6e6..1d0cce8d5f 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js @@ -14,6 +14,7 @@ import globalMessages from '../../../../i18n/global-messages'; import type { PoolData } from '../../../../containers/wallet/staking/SeizaFetcher'; import RewardGraph from './RewardsGraph'; import type { GraphData } from '../dashboard/StakingDashboard'; +import { EpochProgressCard } from './EpochProgressCard'; type Props = {| delegatedPool: PoolData, @@ -99,8 +100,16 @@ function StakingTabs({ { id: 2, label: 'Epoch progress', - disabled: true, - component: TODO: Epoch progress!, + disabled: false, + component: ( + + ), }, ]; From 598e1e619fbaa24d5367a09578e31dc5253d910d Mon Sep 17 00:00:00 2001 From: Patriciu Nista Date: Mon, 4 Jul 2022 21:23:41 +0200 Subject: [PATCH 07/28] integrate epochProgress data --- .../dashboard-revamp/EpochProgressCard.js | 12 ++--- .../staking/dashboard-revamp/StakingTabs.js | 12 +++-- .../containers/wallet/staking/StakingPage.js | 44 +++++++++++++++++-- 3 files changed, 55 insertions(+), 13 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js index 76b7d7084c..48f3285f9b 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js @@ -7,8 +7,8 @@ type Props = {| +percentage: number, +days: string, +currentEpoch: number, - +epochStartDate: string, - +epochEndDate: string, + +startEpochDate: string, + +endEpochDate: string, |}; // TODO: Remove placeholders @@ -16,16 +16,16 @@ export function EpochProgressCard({ percentage, days, currentEpoch, - epochStartDate, - epochEndDate, + startEpochDate, + endEpochDate, }: Props): Node { return ( - - + + ); diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js index 1d0cce8d5f..f54de5cbc1 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js @@ -18,6 +18,10 @@ import { EpochProgressCard } from './EpochProgressCard'; type Props = {| delegatedPool: PoolData, + epochProgress: {| + currentEpoch: number, + endEpochDate: string, + |}, +undelegate: void | (void => Promise), +epochLength: ?number, +graphData: GraphData @@ -47,6 +51,7 @@ function StakingTabs({ delegatedPool, epochLength, undelegate, + epochProgress, intl, graphData }: Props & Intl): Node { @@ -103,11 +108,12 @@ function StakingTabs({ disabled: false, component: ( ), }, diff --git a/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js b/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js index 3b9a5402b1..ebeba7423e 100644 --- a/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js +++ b/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js @@ -51,9 +51,13 @@ import type { GeneratedData as DeregisterDialogContainerData } from '../../trans import UndelegateDialog from '../../../components/wallet/staking/dashboard/UndelegateDialog'; import type { PoolRequest } from '../../../api/jormungandr/lib/storage/bridge/delegationUtils'; import { generateGraphData } from '../../../utils/graph'; -import { ApiOptions, getApiForNetwork, } from '../../../api/common/utils'; -import type { CurrentTimeRequests, TimeCalcRequests } from '../../../stores/base/BaseCardanoTimeStore'; import type { TokenEntry } from '../../../api/common/lib/MultiToken'; +import { ApiOptions, getApiForNetwork } from '../../../api/common/utils'; +import type { + CurrentTimeRequests, + TimeCalcRequests, +} from '../../../stores/base/BaseCardanoTimeStore'; +import moment from 'moment'; export type GeneratedData = typeof StakingPage.prototype.generated; // populated by ConfigWebpackPlugin @@ -168,6 +172,31 @@ class StakingPage extends Component { getStakePools: (PublicDeriver<>) => Node | void = publicDeriver => { + const timeStore = this.generated.stores.time; + const timeCalcRequests = timeStore.getTimeCalcRequests(publicDeriver); + const currTimeRequests = timeStore.getCurrentTimeRequests(publicDeriver); + const toAbsoluteSlot = timeCalcRequests.requests.toAbsoluteSlot.result; + if (toAbsoluteSlot == null) return undefined; + const toRealTime = timeCalcRequests.requests.toRealTime.result; + if (toRealTime == null) return undefined; + const timeSinceGenesis = timeCalcRequests.requests.timeSinceGenesis.result; + if (timeSinceGenesis == null) return undefined; + const getEpochLength = timeCalcRequests.requests.currentEpochLength.result; + if (getEpochLength == null) return undefined; + const currentEpoch = currTimeRequests.currentEpoch; + + const endEpochTime = toRealTime({ + absoluteSlotNum: toAbsoluteSlot({ + epoch: currentEpoch, + // in Jormungandr, rewards were distributed at the start of the epoch + // in Haskell, rewards are calculated at the start of the epoch but distributed at the end + slot: isJormungandr(publicDeriver.getParent().getNetworkInfo()) ? 0 : getEpochLength(), + }), + timeSinceGenesisFunc: timeSinceGenesis, + }); + + const endEpochDate = moment(endEpochTime).format('lll'); + const delegationStore = this.generated.stores.delegation; const delegationRequests = delegationStore.getDelegationRequests(publicDeriver); if (delegationRequests == null) { @@ -215,6 +244,7 @@ class StakingPage extends Component { return ( { |}, |}, |}, + time: {| + getCurrentTimeRequests: (PublicDeriver<>) => CurrentTimeRequests, + getTimeCalcRequests: (PublicDeriver<>) => TimeCalcRequests, + |}, delegation: {| selectedPage: number, getLocalPoolInfo: ($ReadOnly, string) => void | PoolMeta, @@ -507,10 +541,11 @@ class StakingPage extends Component { } return { getTimeCalcRequests: (undefined: any), - getCurrentTimeRequests: () => { throw new Error(`${nameof(StakingPage)} api not supported`) }, + getCurrentTimeRequests: () => { + throw new Error(`${nameof(StakingPage)} api not supported`); + }, }; })(); - return Object.freeze({ stores: { wallets: { @@ -525,6 +560,7 @@ class StakingPage extends Component { getLocalPoolInfo: stores.delegation.getLocalPoolInfo, getDelegationRequests: stores.delegation.getDelegationRequests, }, + time, uiDialogs: { isOpen: stores.uiDialogs.isOpen, getParam: stores.uiDialogs.getParam, From 1648637dddabb14dbfb6881da8600a447eae63b6 Mon Sep 17 00:00:00 2001 From: Paul Ccari Date: Mon, 20 Dec 2021 11:41:28 -0500 Subject: [PATCH 08/28] add percentage --- .../wallet/staking/dashboard-revamp/StakingTabs.js | 3 ++- .../app/containers/wallet/staking/StakingPage.js | 11 ++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js index f54de5cbc1..47c03cc29a 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js @@ -21,6 +21,7 @@ type Props = {| epochProgress: {| currentEpoch: number, endEpochDate: string, + percentage: number, |}, +undelegate: void | (void => Promise), +epochLength: ?number, @@ -109,7 +110,7 @@ function StakingTabs({ component: ( { const getEpochLength = timeCalcRequests.requests.currentEpochLength.result; if (getEpochLength == null) return undefined; const currentEpoch = currTimeRequests.currentEpoch; + const epochLength = getEpochLength(); const endEpochTime = toRealTime({ absoluteSlotNum: toAbsoluteSlot({ epoch: currentEpoch, // in Jormungandr, rewards were distributed at the start of the epoch // in Haskell, rewards are calculated at the start of the epoch but distributed at the end - slot: isJormungandr(publicDeriver.getParent().getNetworkInfo()) ? 0 : getEpochLength(), + slot: isJormungandr(publicDeriver.getParent().getNetworkInfo()) ? 0 : epochLength, }), timeSinceGenesisFunc: timeSinceGenesis, }); @@ -241,10 +242,14 @@ class StakingPage extends Component { // tw: '', // }, // }; - + console.log(currTimeRequests, epochLength) return ( Date: Mon, 20 Dec 2021 19:31:21 -0500 Subject: [PATCH 09/28] remove log --- .../yoroi-extension/app/containers/wallet/staking/StakingPage.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js b/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js index 95bdf27fbf..51a10fa1e1 100644 --- a/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js +++ b/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js @@ -242,7 +242,6 @@ class StakingPage extends Component { // tw: '', // }, // }; - console.log(currTimeRequests, epochLength) return ( Date: Fri, 7 Jan 2022 20:01:31 -0500 Subject: [PATCH 10/28] add start epoch date --- .../dashboard-revamp/EpochProgressCard.js | 2 +- .../staking/dashboard-revamp/StakingTabs.js | 3 ++- .../containers/wallet/staking/StakingPage.js | 26 ++++++++++++------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js index 48f3285f9b..646ccc5fd8 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js @@ -22,7 +22,7 @@ export function EpochProgressCard({ return ( - + diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js index 47c03cc29a..fef67e5227 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js @@ -20,6 +20,7 @@ type Props = {| delegatedPool: PoolData, epochProgress: {| currentEpoch: number, + startEpochDate: string, endEpochDate: string, percentage: number, |}, @@ -113,7 +114,7 @@ function StakingTabs({ percentage={epochProgress.percentage} days="2.5" currentEpoch={epochProgress.currentEpoch} - startEpochDate="-" + startEpochDate={epochProgress.startEpochDate} endEpochDate={epochProgress.endEpochDate} /> ), diff --git a/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js b/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js index 51a10fa1e1..e433ff25e9 100644 --- a/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js +++ b/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js @@ -186,17 +186,22 @@ class StakingPage extends Component { const currentEpoch = currTimeRequests.currentEpoch; const epochLength = getEpochLength(); - const endEpochTime = toRealTime({ - absoluteSlotNum: toAbsoluteSlot({ - epoch: currentEpoch, - // in Jormungandr, rewards were distributed at the start of the epoch - // in Haskell, rewards are calculated at the start of the epoch but distributed at the end - slot: isJormungandr(publicDeriver.getParent().getNetworkInfo()) ? 0 : epochLength, - }), - timeSinceGenesisFunc: timeSinceGenesis, - }); + const getDateFromEpoch = epoch => { + const epochTime = toRealTime({ + absoluteSlotNum: toAbsoluteSlot({ + epoch, + // in Jormungandr, rewards were distributed at the start of the epoch + // in Haskell, rewards are calculated at the start of the epoch but distributed at the end + slot: isJormungandr(publicDeriver.getParent().getNetworkInfo()) ? 0 : getEpochLength(), + }), + timeSinceGenesisFunc: timeSinceGenesis, + }); + const epochMoment = moment(epochTime).format('lll'); + return epochMoment; + }; - const endEpochDate = moment(endEpochTime).format('lll'); + const endEpochDate = getDateFromEpoch(currentEpoch); + const previousEpochDate = getDateFromEpoch(currentEpoch - 1); const delegationStore = this.generated.stores.delegation; const delegationRequests = delegationStore.getDelegationRequests(publicDeriver); @@ -245,6 +250,7 @@ class StakingPage extends Component { return ( Date: Thu, 7 Jul 2022 02:40:39 +0200 Subject: [PATCH 11/28] Fixed styles to match last revamp version --- .../dashboard-revamp/EpochProgressCard.js | 51 ++++++++++++++----- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js index 646ccc5fd8..24f8d088b6 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js @@ -21,16 +21,34 @@ export function EpochProgressCard({ }: Props): Node { return ( - - - - - + + + + + <Stack direction="row" spacing={3} mt="50px" justifyContent="space-between"> + <LabelWithValue label="Epoch started at" value={startEpochDate} /> + <LabelWithValue label="Epoch end at" value={endEpochDate} /> + </Stack> + </Stack> </Stack> </Box> ); } +type TitleProps = {| + +label: string, + +value: string | number, +|}; +const Title = ({ label, value }: TitleProps): Node => { + return ( + <Box> + <Typography fontWeight="500" color="var(--yoroi-palette-primary-300)"> + {label}: {value} + </Typography> + </Box> + ); +}; + type InfoColumnProps = {| +label: string, +value: string | number, @@ -38,7 +56,12 @@ type InfoColumnProps = {| const LabelWithValue = ({ label, value }: InfoColumnProps): Node => { return ( <Box> - <Typography mb="6px" color="var(--yoroi-palette-gray-600)"> + <Typography + style={{ textTransform: 'uppercase' }} + variant="caption" + mb="4px" + color="var(--yoroi-palette-gray-600)" + > {label} </Typography> <Typography color="var(--yoroi-palette-gray-900)">{value}</Typography> @@ -48,10 +71,10 @@ const LabelWithValue = ({ label, value }: InfoColumnProps): Node => { const Graph = ({ value, days }): Node => { return ( - <Box position="relative" display="flex" justifyContent="center"> + <Box mr="8px" position="relative" display="flex" justifyContent="center"> <CircularProgress - size={190} - thickness={4} + size={120} + thickness={7} variant="determinate" value={value} sx={{ @@ -62,8 +85,8 @@ const Graph = ({ value, days }): Node => { }} /> <CircularProgress - size={190} - thickness={4} + size={120} + thickness={7} variant="determinate" sx={{ color: 'var(--yoroi-palette-gray-50)', @@ -73,16 +96,16 @@ const Graph = ({ value, days }): Node => { <Box position="absolute" sx={{ - top: '40%', + top: '30%', left: '50%', transform: 'translate(-50%)', textAlign: 'center', }} > - <Typography variant="h2" color="var(--yoroi-palette-gray-900)"> + <Typography variant="h4" color="var(--yoroi-palette-gray-900)"> {value}% </Typography> - <Typography variant="body2" color="var(--yoroi-palette-gray-600)"> + <Typography variant="caption1" fontSize="12px" color="var(--yoroi-palette-gray-600)"> {days} days </Typography> </Box> From ea7de80f3aa68e5a7e651f76e7bc843a20e715b6 Mon Sep 17 00:00:00 2001 From: Patriciu Nista <patriciu.nista@gmail.com> Date: Thu, 7 Jul 2022 02:42:38 +0200 Subject: [PATCH 12/28] Fix typo --- .../wallet/staking/dashboard-revamp/EpochProgressCard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js index 24f8d088b6..e88bd78713 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js @@ -27,7 +27,7 @@ export function EpochProgressCard({ <Title label="Current Epoch" value={currentEpoch} /> <Stack direction="row" spacing={3} mt="50px" justifyContent="space-between"> <LabelWithValue label="Epoch started at" value={startEpochDate} /> - <LabelWithValue label="Epoch end at" value={endEpochDate} /> + <LabelWithValue label="Epoch ends at" value={endEpochDate} /> </Stack> </Stack> </Stack> From 1ca7033b1eeb43231395cf23c07299af1995df77 Mon Sep 17 00:00:00 2001 From: Patriciu Nista <patriciu.nista@gmail.com> Date: Thu, 7 Jul 2022 14:15:21 +0200 Subject: [PATCH 13/28] Calculate days left to finish epoch --- .../dashboard-revamp/EpochProgressCard.js | 1 - .../staking/dashboard-revamp/StakingTabs.js | 18 +++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js index e88bd78713..4f5f94ff50 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/EpochProgressCard.js @@ -11,7 +11,6 @@ type Props = {| +endEpochDate: string, |}; -// TODO: Remove placeholders export function EpochProgressCard({ percentage, days, diff --git a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js index fef67e5227..7e5aec8d32 100644 --- a/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js +++ b/packages/yoroi-extension/app/components/wallet/staking/dashboard-revamp/StakingTabs.js @@ -5,8 +5,8 @@ import { Box, styled } from '@mui/system'; import { TabContext, TabList, TabPanel } from '@mui/lab'; import { IconButton, Tab, Typography } from '@mui/material'; import { observer } from 'mobx-react'; -import { ReactComponent as InfoIconSVG } from '../../../../assets/images/info-icon.inline.svg'; -import { ReactComponent as CloseIcon } from '../../../../assets/images/forms/close.inline.svg'; +import { ReactComponent as InfoIconSVG } from '../../../../assets/images/info-icon.inline.svg'; +import { ReactComponent as CloseIcon } from '../../../../assets/images/forms/close.inline.svg'; import DelegatedStakePoolCard from './DelegatedStakePoolCard'; import { defineMessages, injectIntl } from 'react-intl'; import type { $npm$ReactIntl$IntlShape } from 'react-intl'; @@ -15,6 +15,7 @@ import type { PoolData } from '../../../../containers/wallet/staking/SeizaFetche import RewardGraph from './RewardsGraph'; import type { GraphData } from '../dashboard/StakingDashboard'; import { EpochProgressCard } from './EpochProgressCard'; +import moment from 'moment'; type Props = {| delegatedPool: PoolData, @@ -26,7 +27,7 @@ type Props = {| |}, +undelegate: void | (void => Promise<void>), +epochLength: ?number, - +graphData: GraphData + +graphData: GraphData, |}; type Intl = {| @@ -55,8 +56,8 @@ function StakingTabs({ undelegate, epochProgress, intl, - graphData - }: Props & Intl): Node { + graphData, +}: Props & Intl): Node { const [value, setValue] = useState(0); const handleChange = (event, newValue) => { @@ -71,9 +72,9 @@ function StakingTabs({ return epochLength === 1 ? intl.formatMessage(messages.singleEpochAxisLabel) : intl.formatMessage(messages.epochAxisLabel, { epochLength }); - } + }; - const { hideYAxis, items } = graphData.rewardsGraphData + const { hideYAxis, items } = graphData.rewardsGraphData; const tabs = [ { id: 0, @@ -110,9 +111,8 @@ function StakingTabs({ disabled: false, component: ( <EpochProgressCard - // TODO: Remove placeholders percentage={epochProgress.percentage} - days="2.5" + days={moment(epochProgress.endEpochDate).diff(moment(), 'days')} currentEpoch={epochProgress.currentEpoch} startEpochDate={epochProgress.startEpochDate} endEpochDate={epochProgress.endEpochDate} From bfb4252b26211cb6e40f47c26f63b59963540f9a Mon Sep 17 00:00:00 2001 From: yushi <yushihuang@gmail.com> Date: Mon, 18 Jul 2022 18:00:56 +0800 Subject: [PATCH 14/28] support analytics --- packages/yoroi-extension/app/App.js | 4 + .../app/api/analytics/index.js | 130 ++++++++++++++++++ .../app/api/localStorage/index.js | 10 ++ .../app/components/buySell/BuySellDialog.js | 2 + .../WalletSendPreviewStepContainer.js | 2 + .../app/containers/profile/UriPromptPage.js | 3 + .../transfer/WithdrawalTxDialogContainer.js | 5 +- .../app/containers/wallet/WalletSendPage.js | 27 ++-- .../WalletSendConfirmationDialogContainer.js | 2 + packages/yoroi-extension/app/routes-config.js | 23 ++++ .../ada/AdaDelegationTransactionStore.js | 37 +++-- .../app/stores/ada/AdaWalletRestoreStore.js | 2 + .../app/stores/ada/AdaWalletsStore.js | 3 + .../app/stores/ada/LedgerConnectStore.js | 2 + .../app/stores/ada/TrezorConnectStore.js | 2 + .../app/stores/ada/VotingStore.js | 37 +++-- .../app/stores/base/BaseProfileStore.js | 13 +- packages/yoroi-extension/chrome/constants.js | 3 + .../yoroi-extension/chrome/extension/index.js | 2 + 19 files changed, 257 insertions(+), 52 deletions(-) create mode 100644 packages/yoroi-extension/app/api/analytics/index.js diff --git a/packages/yoroi-extension/app/App.js b/packages/yoroi-extension/app/App.js index e8ace513c7..1e9e2581a5 100644 --- a/packages/yoroi-extension/app/App.js +++ b/packages/yoroi-extension/app/App.js @@ -36,6 +36,7 @@ import { ThemeProvider } from '@mui/material/styles'; import { CssBaseline } from '@mui/material'; import { globalStyles } from './styles/globalStyles'; import Support from './components/widgets/Support'; +import { trackNavigation } from './api/analytics'; // https://github.com/yahoo/react-intl/wiki#loading-locale-data addLocaleData([ @@ -80,6 +81,9 @@ class App extends Component<Props, State> { this.mergedMessages = _mergedMessages; }); }); + this.props.history.listen(({ pathname }) => { + trackNavigation(pathname); + }); } state: State = { diff --git a/packages/yoroi-extension/app/api/analytics/index.js b/packages/yoroi-extension/app/api/analytics/index.js new file mode 100644 index 0000000000..ca9da85c1e --- /dev/null +++ b/packages/yoroi-extension/app/api/analytics/index.js @@ -0,0 +1,130 @@ +// @flow +import cryptoRandomString from 'crypto-random-string'; +import querystring from 'querystring'; + +import LocalStorageApi, { + loadAnalyticsInstanceId, + saveAnalyticsInstanceId, +} from '../localStorage'; +import { environment } from '../../environment'; +import { TRACKED_ROUTES } from '../../routes-config'; + +const MATOMO_URL = 'https://analytics.emurgo-rnd.com/matomo.php'; +const SITE_ID = '4'; +let INSTANCE_ID; + +export async function trackStartup(): Promise<void> { + let event; + if (await (new LocalStorageApi()).getUserLocale() != null) { + INSTANCE_ID = await loadAnalyticsInstanceId(); + if (INSTANCE_ID) { + emitEvent(INSTANCE_ID, 'launch'); + return; + } + event = 'pre-existing-instance'; + } else { + event = 'new-instance'; + } + INSTANCE_ID = generateAnalyticsInstanceId(); + await saveAnalyticsInstanceId(INSTANCE_ID); + emitEvent(INSTANCE_ID, event); +} + +type NewWalletType = 'hardware' | 'created' | 'restored'; + +export function trackWalletCreation(newWalletType: NewWalletType): void { + if (INSTANCE_ID == null) { + return; + } + emitEvent(INSTANCE_ID, 'new-wallet/' + newWalletType); +} + +export function trackNavigation(path: string): void { + if (path.match(TRACKED_ROUTES)) { + if (INSTANCE_ID == null) { + return; + } + emitEvent(INSTANCE_ID, 'navigate' + path); + } +} + +export function trackSend(): void { + if (INSTANCE_ID == null) { + return; + } + emitEvent(INSTANCE_ID, 'new-transaction/send'); +} + +export function trackDelegation(): void { + if (INSTANCE_ID == null) { + return; + } + emitEvent(INSTANCE_ID, 'delegation'); +} + +export function trackWithdrawal(): void { + if (INSTANCE_ID == null) { + return; + } + emitEvent(INSTANCE_ID, 'withdrawal'); +} + +export function trackCatalystRegistration(): void { + if (INSTANCE_ID == null) { + return; + } + emitEvent(INSTANCE_ID, 'new-transaction/catalyst'); +} + +export function trackSetLocale(locale: string): void { + if (INSTANCE_ID == null) { + return; + } + emitEvent(INSTANCE_ID, 'set-locale/' + locale); +} + +export function trackUpdateTheme(theme: string): void { + if (INSTANCE_ID == null) { + return; + } + emitEvent(INSTANCE_ID, 'update-theme/' + theme); +} + +export function trackUriPrompt(choice: 'skip' | 'allow'): void { + if (INSTANCE_ID == null) { + return; + } + emitEvent(INSTANCE_ID, 'uri-prompt/' + choice); +} + +export function trackBuySellDialog(): void { + if (INSTANCE_ID == null) { + return; + } + emitEvent(INSTANCE_ID, 'buy-sell-ada'); +} + +function generateAnalyticsInstanceId(): string { + // Matomo requires 16 character hex string + return cryptoRandomString({ length: 16 }); +} + +function emitEvent(instanceId: string, event: string): void { + if (environment.isDev() || environment.isTest()) { + return; + } + + // https://developer.matomo.org/api-reference/tracking-api + const params = { + idsite: SITE_ID, + rec: '1', + action_name: event, + url: `yoroi.extension/${event}`, + _id: INSTANCE_ID, + rand: `${Date.now()}-${Math.random()}`, + apiv: '1' + }; + const url = `${MATOMO_URL}?${querystring.stringify(params)}`; + + fetch(url); +} diff --git a/packages/yoroi-extension/app/api/localStorage/index.js b/packages/yoroi-extension/app/api/localStorage/index.js index efdc33bab5..d183008186 100644 --- a/packages/yoroi-extension/app/api/localStorage/index.js +++ b/packages/yoroi-extension/app/api/localStorage/index.js @@ -32,6 +32,7 @@ const storageKeys = { TOGGLE_SIDEBAR: networkForLocalStorage + '-TOGGLE-SIDEBAR', WALLETS_NAVIGATION: networkForLocalStorage + '-WALLETS-NAVIGATION', SUBMITTED_TRANSACTIONS: 'submittedTransactions', + ANALYTICS_INSTANCE_ID: networkForLocalStorage + '-ANALYTICS', // ========== CONNECTOR ========== // ERGO_CONNECTOR_WHITELIST: 'connector_whitelist', }; @@ -360,3 +361,12 @@ export function loadSubmittedTransactions(): any { } return JSON.parse(dataStr); } + +export async function loadAnalyticsInstanceId(): Promise<?string> { + return getLocalItem(storageKeys.ANALYTICS_INSTANCE_ID); +} + +export async function saveAnalyticsInstanceId(id: string): Promise<void> { + await setLocalItem(storageKeys.ANALYTICS_INSTANCE_ID, id); +} + diff --git a/packages/yoroi-extension/app/components/buySell/BuySellDialog.js b/packages/yoroi-extension/app/components/buySell/BuySellDialog.js index fe8a5749ff..a3497124d6 100644 --- a/packages/yoroi-extension/app/components/buySell/BuySellDialog.js +++ b/packages/yoroi-extension/app/components/buySell/BuySellDialog.js @@ -15,6 +15,7 @@ import { ReactComponent as VerifyIcon } from '../../assets/images/verify-icon.i import VerticalFlexContainer from '../layout/VerticalFlexContainer' import LoadingSpinner from '../widgets/LoadingSpinner' import globalMessages from '../../i18n/global-messages'; +import { trackBuySellDialog } from '../../api/analytics'; const messages = defineMessages({ dialogTitle: { @@ -77,6 +78,7 @@ export default class BuySellDialog extends Component<Props, State> { } ] this.setState({ walletList: wallets }) + trackBuySellDialog(); } createRows: ($npm$ReactIntl$IntlFormat, Array<WalletInfo>) => Node = (intl, wallets) => ( diff --git a/packages/yoroi-extension/app/components/wallet/send/WalletSendFormSteps/WalletSendPreviewStepContainer.js b/packages/yoroi-extension/app/components/wallet/send/WalletSendFormSteps/WalletSendPreviewStepContainer.js index be8b3c4489..569b8eed55 100644 --- a/packages/yoroi-extension/app/components/wallet/send/WalletSendFormSteps/WalletSendPreviewStepContainer.js +++ b/packages/yoroi-extension/app/components/wallet/send/WalletSendFormSteps/WalletSendPreviewStepContainer.js @@ -20,6 +20,7 @@ import { } from '../../../../api/ada/lib/storage/models/ConceptualWallet'; import type { SendUsingLedgerParams } from '../../../../actions/ada/ledger-send-actions'; import type { SendUsingTrezorParams } from '../../../../actions/ada/trezor-send-actions'; +import { trackSend } from '../../../../api/analytics'; export type GeneratedData = typeof WalletSendPreviewStepContainer.prototype.generated; @@ -88,6 +89,7 @@ export default class WalletSendPreviewStepContainer extends Component<Props> { onSuccess: openTransactionSuccessDialog, }); } + trackSend() } render(): Node { diff --git a/packages/yoroi-extension/app/containers/profile/UriPromptPage.js b/packages/yoroi-extension/app/containers/profile/UriPromptPage.js index ee29484524..4af863dbed 100644 --- a/packages/yoroi-extension/app/containers/profile/UriPromptPage.js +++ b/packages/yoroi-extension/app/containers/profile/UriPromptPage.js @@ -21,6 +21,7 @@ import type { $npm$ReactIntl$IntlFormat } from 'react-intl'; import type { ServerStatusErrorType } from '../../types/serverStatusErrorType'; import { PublicDeriver } from '../../api/ada/lib/storage/models/PublicDeriver/index'; import { isTestnet } from '../../api/ada/lib/storage/database/prepackaged/networks'; +import { trackUriPrompt } from '../../api/analytics'; type GeneratedData = typeof UriPromptPage.prototype.generated; @@ -39,10 +40,12 @@ export default class UriPromptPage extends Component<InjectedOrGenerated<Generat runInAction(() => { this.isAccepted = true; }); + trackUriPrompt('allow'); }; onSkip: void => void = () => { this.generated.actions.profile.acceptUriScheme.trigger() + trackUriPrompt('skip'); }; onBack: void => void = () => { diff --git a/packages/yoroi-extension/app/containers/transfer/WithdrawalTxDialogContainer.js b/packages/yoroi-extension/app/containers/transfer/WithdrawalTxDialogContainer.js index de6c1c4b87..41b79aa05c 100644 --- a/packages/yoroi-extension/app/containers/transfer/WithdrawalTxDialogContainer.js +++ b/packages/yoroi-extension/app/containers/transfer/WithdrawalTxDialogContainer.js @@ -17,6 +17,7 @@ import { } from '../../api/common/lib/MultiToken'; import type { NetworkRow, TokenRow } from '../../api/ada/lib/storage/database/primitives/tables'; import { getDefaultEntryToken } from '../../stores/toplevel/TokenInfoStore'; +import { trackWithdrawal } from '../../api/analytics'; export type GeneratedData = typeof WithdrawalTxDialogContainer.prototype.generated; @@ -51,7 +52,9 @@ export default class WithdrawalTxDialogContainer extends Component<Props> { label: intl.formatMessage(globalMessages.cancel), }} onSubmit={{ - trigger: () => {}, // nothing extra to do + trigger: () => { + trackWithdrawal(); + }, label: intl.formatMessage(globalMessages.confirm), }} transactionRequest={createWithdrawalTx} diff --git a/packages/yoroi-extension/app/containers/wallet/WalletSendPage.js b/packages/yoroi-extension/app/containers/wallet/WalletSendPage.js index cff0baff6e..2e24cdc8c8 100644 --- a/packages/yoroi-extension/app/containers/wallet/WalletSendPage.js +++ b/packages/yoroi-extension/app/containers/wallet/WalletSendPage.js @@ -49,6 +49,7 @@ import { withLayout } from '../../styles/context/layout'; import WalletSendPreviewStepContainer from '../../components/wallet/send/WalletSendFormSteps/WalletSendPreviewStepContainer'; import AddNFTDialog from '../../components/wallet/send/WalletSendFormSteps/AddNFTDialog'; import AddTokenDialog from '../../components/wallet/send/WalletSendFormSteps/AddTokenDialog'; +import { trackSend } from '../../api/analytics'; const messages = defineMessages({ txConfirmationLedgerNanoLine1: { @@ -395,11 +396,14 @@ class WalletSendPage extends Component<AllProps> { isSubmitting={ledgerSendStore.isActionProcessing} error={ledgerSendStore.error} onSubmit={ - () => ledgerSendAction.sendUsingLedgerWallet.trigger({ - params: { signRequest }, - publicDeriver, - onSuccess: this.openTransactionSuccessDialog, - }) + () => { + ledgerSendAction.sendUsingLedgerWallet.trigger({ + params: { signRequest }, + publicDeriver, + onSuccess: this.openTransactionSuccessDialog, + }); + trackSend(); + } } onCancel={ledgerSendAction.cancel.trigger} unitOfAccountSetting={this.generated.stores.profile.unitOfAccount} @@ -429,11 +433,14 @@ class WalletSendPage extends Component<AllProps> { isSubmitting={trezorSendStore.isActionProcessing} error={trezorSendStore.error} onSubmit={ - () => trezorSendAction.sendUsingTrezor.trigger({ - params: { signRequest }, - publicDeriver, - onSuccess: this.openTransactionSuccessDialog, - }) + () => { + trezorSendAction.sendUsingTrezor.trigger({ + params: { signRequest }, + publicDeriver, + onSuccess: this.openTransactionSuccessDialog, + }) + trackSend(); + } } onCancel={trezorSendAction.cancel.trigger} unitOfAccountSetting={this.generated.stores.profile.unitOfAccount} diff --git a/packages/yoroi-extension/app/containers/wallet/dialogs/WalletSendConfirmationDialogContainer.js b/packages/yoroi-extension/app/containers/wallet/dialogs/WalletSendConfirmationDialogContainer.js index bff0bf286b..e35eaa0534 100644 --- a/packages/yoroi-extension/app/containers/wallet/dialogs/WalletSendConfirmationDialogContainer.js +++ b/packages/yoroi-extension/app/containers/wallet/dialogs/WalletSendConfirmationDialogContainer.js @@ -13,6 +13,7 @@ import { addressToDisplayString } from '../../../api/ada/lib/storage/bridge/util import type { ISignRequest } from '../../../api/common/lib/transactions/ISignRequest'; import type { TokenInfoMap } from '../../../stores/toplevel/TokenInfoStore'; import { genLookupOrFail } from '../../../stores/stateless/tokenHelpers'; +import { trackSend } from '../../../api/analytics'; export type GeneratedData = typeof WalletSendConfirmationDialogContainer.prototype.generated; @@ -85,6 +86,7 @@ export default class WalletSendConfirmationDialogContainer extends Component<Pro publicDeriver, onSuccess: openTransactionSuccessDialog, }); + trackSend(); }} isSubmitting={sendMoneyRequest.isExecuting} onCancel={() => { diff --git a/packages/yoroi-extension/app/routes-config.js b/packages/yoroi-extension/app/routes-config.js index ff4536e54d..2cbcef7d3b 100644 --- a/packages/yoroi-extension/app/routes-config.js +++ b/packages/yoroi-extension/app/routes-config.js @@ -1,4 +1,27 @@ // @flow +// routes to by tracked by analytics +export const TRACKED_ROUTES: RegExp = new RegExp( + '^(' + + '(/my-wallets)|' + + '(/wallets/add)|' + + '(/wallets/transactions)|' + + '(/wallets/send)|' + + '(/wallets/assets)|' + + '(/wallets/receive/.+)|' + + '(/wallets/delegation-dashboard)|' + + '(/wallets/cardano-delegation)|' + + '(/wallets/voting)|' + + '(/settings/.+)|' + + '(/transfer(/.+)?)|' + + '(/send-from-uri)|' + + '(/notice-board)|' + + '(/staking)|' + + '(/assets/.*)|' + + '(/connector/connected-websites)|' + + '(/experimental/.*)' + + ')$' +); + export const ROUTES = { ROOT: '/', diff --git a/packages/yoroi-extension/app/stores/ada/AdaDelegationTransactionStore.js b/packages/yoroi-extension/app/stores/ada/AdaDelegationTransactionStore.js index 3341357905..e03d287da3 100644 --- a/packages/yoroi-extension/app/stores/ada/AdaDelegationTransactionStore.js +++ b/packages/yoroi-extension/app/stores/ada/AdaDelegationTransactionStore.js @@ -27,6 +27,7 @@ import { import { MultiToken } from '../../api/common/lib/MultiToken'; import type { ActionsMap } from '../../actions/index'; import type { StoresMap } from '../index'; +import { trackDelegation } from '../../api/analytics'; export default class AdaDelegationTransactionStore extends Store<StoresMap, ActionsMap> { @@ -214,9 +215,7 @@ export default class AdaDelegationTransactionStore extends Store<StoresMap, Acti }, refreshWallet: () => this.stores.wallets.refreshWalletFromRemote(request.publicDeriver), }); - return; - } - if (isTrezorTWallet(request.publicDeriver.getParent())) { + } else if (isTrezorTWallet(request.publicDeriver.getParent())) { await this.stores.substores.ada.wallets.adaSendAndRefresh({ broadcastRequest: { trezor: { @@ -226,23 +225,23 @@ export default class AdaDelegationTransactionStore extends Store<StoresMap, Acti }, refreshWallet: () => this.stores.wallets.refreshWalletFromRemote(request.publicDeriver), }); - return; - } - - // normal password-based wallet - if (request.password == null) { - throw new Error(`${nameof(this._signTransaction)} missing password for non-hardware signing`); - } - await this.stores.substores.ada.wallets.adaSendAndRefresh({ - broadcastRequest: { - normal: { - publicDeriver: request.publicDeriver, - password: request.password, - signRequest: result.signTxRequest, + } else { + // normal password-based wallet + if (request.password == null) { + throw new Error(`${nameof(this._signTransaction)} missing password for non-hardware signing`); + } + await this.stores.substores.ada.wallets.adaSendAndRefresh({ + broadcastRequest: { + normal: { + publicDeriver: request.publicDeriver, + password: request.password, + signRequest: result.signTxRequest, + }, }, - }, - refreshWallet: () => this.stores.wallets.refreshWalletFromRemote(request.publicDeriver), - }); + refreshWallet: () => this.stores.wallets.refreshWalletFromRemote(request.publicDeriver), + }); + } + trackDelegation(); } _complete: void => void = () => { diff --git a/packages/yoroi-extension/app/stores/ada/AdaWalletRestoreStore.js b/packages/yoroi-extension/app/stores/ada/AdaWalletRestoreStore.js index 017c230947..7737985e54 100644 --- a/packages/yoroi-extension/app/stores/ada/AdaWalletRestoreStore.js +++ b/packages/yoroi-extension/app/stores/ada/AdaWalletRestoreStore.js @@ -14,6 +14,7 @@ import type { } from '../../api/ada/lib/storage/models/PublicDeriver/interfaces'; import type { ActionsMap } from '../../actions/index'; import type { StoresMap } from '../index'; +import { trackWalletCreation } from '../../api/analytics'; export default class AdaWalletRestoreStore extends Store<StoresMap, ActionsMap> { @@ -129,6 +130,7 @@ export default class AdaWalletRestoreStore extends Store<StoresMap, ActionsMap> }); return wallet; }).promise; + trackWalletCreation('restored'); }; teardown(): void { diff --git a/packages/yoroi-extension/app/stores/ada/AdaWalletsStore.js b/packages/yoroi-extension/app/stores/ada/AdaWalletsStore.js index 821f8d4909..4dbc040ba4 100644 --- a/packages/yoroi-extension/app/stores/ada/AdaWalletsStore.js +++ b/packages/yoroi-extension/app/stores/ada/AdaWalletsStore.js @@ -12,6 +12,7 @@ import { buildCheckAndCall } from '../lib/check'; import { getApiForNetwork, ApiOptions } from '../../api/common/utils'; import type { ActionsMap } from '../../actions/index'; import type { StoresMap } from '../index'; +import { trackWalletCreation } from '../../api/analytics'; export default class AdaWalletsStore extends Store<StoresMap, ActionsMap> { @@ -129,5 +130,7 @@ export default class AdaWalletsStore extends Store<StoresMap, ActionsMap> { }); return wallet; }).promise; + + trackWalletCreation('created'); }; } diff --git a/packages/yoroi-extension/app/stores/ada/LedgerConnectStore.js b/packages/yoroi-extension/app/stores/ada/LedgerConnectStore.js index 96cdde4094..de52bce9f1 100644 --- a/packages/yoroi-extension/app/stores/ada/LedgerConnectStore.js +++ b/packages/yoroi-extension/app/stores/ada/LedgerConnectStore.js @@ -61,6 +61,7 @@ import type { StoresMap } from '../index'; import type { GetExtendedPublicKeyResponse, } from '@cardano-foundation/ledgerjs-hw-app-cardano'; +import { trackWalletCreation } from '../../api/analytics'; export default class LedgerConnectStore extends Store<StoresMap, ActionsMap> @@ -365,6 +366,7 @@ export default class LedgerConnectStore await this._saveHW( walletName, ); + trackWalletCreation('hardware'); }; /** creates new wallet and loads it */ diff --git a/packages/yoroi-extension/app/stores/ada/TrezorConnectStore.js b/packages/yoroi-extension/app/stores/ada/TrezorConnectStore.js index 23abfad637..1b6bb28333 100644 --- a/packages/yoroi-extension/app/stores/ada/TrezorConnectStore.js +++ b/packages/yoroi-extension/app/stores/ada/TrezorConnectStore.js @@ -51,6 +51,7 @@ import type { } from '../../actions/common/wallet-restore-actions'; import type { ActionsMap } from '../../actions/index'; import type { StoresMap } from '../index'; +import { trackWalletCreation } from '../../api/analytics'; type TrezorConnectionResponse = {| trezorResp: Success<CardanoPublicKey> | Unsuccessful, @@ -333,6 +334,7 @@ export default class TrezorConnectStore await this._saveHW( walletName, ); + trackWalletCreation('hardware'); }; /** creates new wallet and loads it */ diff --git a/packages/yoroi-extension/app/stores/ada/VotingStore.js b/packages/yoroi-extension/app/stores/ada/VotingStore.js index 4a7dd6bccd..36a4f2282a 100644 --- a/packages/yoroi-extension/app/stores/ada/VotingStore.js +++ b/packages/yoroi-extension/app/stores/ada/VotingStore.js @@ -45,6 +45,7 @@ import { generateRegistration } from '../../api/ada/lib/cardanoCrypto/catalyst'; import { derivePublicByAddressing } from '../../api/ada/lib/cardanoCrypto/utils' import type { ConceptualWallet } from '../../api/ada/lib/storage/models/ConceptualWallet' import type { CatalystRoundInfoResponse } from '../../api/ada/lib/state-fetch/types' +import { trackCatalystRegistration } from '../../api/analytics'; export const ProgressStep = Object.freeze({ GENERATE: 0, @@ -392,9 +393,7 @@ export default class VotingStore extends Store<StoresMap, ActionsMap> { }, refreshWallet: () => this.stores.wallets.refreshWalletFromRemote(request.publicDeriver), }); - return; - } - if (isTrezorTWallet(request.publicDeriver.getParent())) { + } else if (isTrezorTWallet(request.publicDeriver.getParent())) { await this.stores.substores.ada.wallets.adaSendAndRefresh({ broadcastRequest: { trezor: { @@ -404,23 +403,23 @@ export default class VotingStore extends Store<StoresMap, ActionsMap> { }, refreshWallet: () => this.stores.wallets.refreshWalletFromRemote(request.publicDeriver), }); - return; - } - - // normal password-based wallet - if (request.password == null) { - throw new Error(`${nameof(this._signTransaction)} missing password for non-hardware signing`); - } - await this.stores.substores.ada.wallets.adaSendAndRefresh({ - broadcastRequest: { - normal: { - publicDeriver: request.publicDeriver, - password: request.password, - signRequest: result, + } else { + // normal password-based wallet + if (request.password == null) { + throw new Error(`${nameof(this._signTransaction)} missing password for non-hardware signing`); + } + await this.stores.substores.ada.wallets.adaSendAndRefresh({ + broadcastRequest: { + normal: { + publicDeriver: request.publicDeriver, + password: request.password, + signRequest: result, + }, }, - }, - refreshWallet: () => this.stores.wallets.refreshWalletFromRemote(request.publicDeriver), - }); + refreshWallet: () => this.stores.wallets.refreshWalletFromRemote(request.publicDeriver), + }); + } + trackCatalystRegistration(); }; @action _generateCatalystKey: void => Promise<void> = async () => { diff --git a/packages/yoroi-extension/app/stores/base/BaseProfileStore.js b/packages/yoroi-extension/app/stores/base/BaseProfileStore.js index 87370108ff..7c31d6f988 100644 --- a/packages/yoroi-extension/app/stores/base/BaseProfileStore.js +++ b/packages/yoroi-extension/app/stores/base/BaseProfileStore.js @@ -15,6 +15,10 @@ import type { UnitOfAccountSettingType } from '../../types/unitOfAccountType'; import { SUPPORTED_CURRENCIES } from '../../config/unitOfAccount'; import type { ComplexityLevelType } from '../../types/complexityLevelType'; import BaseProfileActions from '../../actions/base/base-profile-actions'; +import { + trackSetLocale, + trackUpdateTheme +} from '../../api/analytics'; interface CoinPriceStore { refreshCurrentUnit: Request<void => Promise<void>> @@ -221,13 +225,15 @@ export default class BaseProfileStore _acceptLocale: void => Promise<void> = async () => { // commit in-memory language to storage - await this.setProfileLocaleRequest.execute( - this.inMemoryLanguage != null ? this.inMemoryLanguage : BaseProfileStore.getDefaultLocale() - ); + const locale = this.inMemoryLanguage != null ? + this.inMemoryLanguage : + BaseProfileStore.getDefaultLocale(); + await this.setProfileLocaleRequest.execute(locale); await this.getProfileLocaleRequest.execute(); // eagerly cache runInAction(() => { this.inMemoryLanguage = null; }); + trackSetLocale(locale); }; _updateMomentJsLocaleAfterLocaleChange: void => void = () => { @@ -312,6 +318,7 @@ export default class BaseProfileStore await this.getCustomThemeRequest.execute(); // eagerly cache await this.setThemeRequest.execute(theme); await this.getThemeRequest.execute(); // eagerly cache + trackUpdateTheme(theme); }; diff --git a/packages/yoroi-extension/chrome/constants.js b/packages/yoroi-extension/chrome/constants.js index b4b57f36a5..49f80c2b52 100644 --- a/packages/yoroi-extension/chrome/constants.js +++ b/packages/yoroi-extension/chrome/constants.js @@ -54,6 +54,9 @@ export function genCSP(request: {| connectSrc.push('https://*.zdassets.com/') connectSrc.push('https://emurgohelpdesk.zendesk.com/') + // Analytics + connectSrc.push('https://analytics.emurgo-rnd.com/'); + // wasm-eval is needed to compile WebAssembly in the browser // note: wasm-eval is not standardized but empirically works in Firefox & Chrome https://github.com/w3c/webappsec-csp/pull/293 const evalSrc = "'wasm-eval'"; diff --git a/packages/yoroi-extension/chrome/extension/index.js b/packages/yoroi-extension/chrome/extension/index.js index 5d401703c3..076706e773 100644 --- a/packages/yoroi-extension/chrome/extension/index.js +++ b/packages/yoroi-extension/chrome/extension/index.js @@ -15,6 +15,7 @@ import { addCloseListener, TabIdKeys } from '../../app/utils/tabManager'; import { Logger } from '../../app/utils/logging'; import { LazyLoadPromises } from '../../app/Routes'; import environment from '../../app/environment'; +import { trackStartup } from '../../app/api/analytics'; // run MobX in strict mode configure({ enforceActions: 'always' }); @@ -30,6 +31,7 @@ const initializeYoroi: void => Promise<void> = async () => { const hashHistory = createHashHistory(); const history = syncHistoryWithStore(hashHistory, router); const stores = createStores(api, actions, router); + await trackStartup(); Logger.debug(`[yoroi] stores created`); From c08c84115f71e1d4d8140ef6665e2fbe1cf71d85 Mon Sep 17 00:00:00 2001 From: yushi <yushihuang@gmail.com> Date: Thu, 21 Jul 2022 12:05:36 +0800 Subject: [PATCH 15/28] add more events --- .../yoroi-extension/app/api/analytics/index.js | 15 +++++++++++++-- .../settings/categories/BlockchainSettingsPage.js | 8 +++++++- .../settings/categories/GeneralSettingsPage.js | 9 ++++++++- .../transfer/WithdrawalTxDialogContainer.js | 9 +++++++-- .../transfer/YoroiTransferPage.stories.js | 1 + .../staking/StakingDashboardPage.stories.js | 1 + 6 files changed, 37 insertions(+), 6 deletions(-) diff --git a/packages/yoroi-extension/app/api/analytics/index.js b/packages/yoroi-extension/app/api/analytics/index.js index ca9da85c1e..572bc50479 100644 --- a/packages/yoroi-extension/app/api/analytics/index.js +++ b/packages/yoroi-extension/app/api/analytics/index.js @@ -62,11 +62,15 @@ export function trackDelegation(): void { emitEvent(INSTANCE_ID, 'delegation'); } -export function trackWithdrawal(): void { +export function trackWithdrawal(shouldDeregister: boolean): void { if (INSTANCE_ID == null) { return; } - emitEvent(INSTANCE_ID, 'withdrawal'); + if (shouldDeregister) { + emitEvent(INSTANCE_ID, 'deregister'); + } else { + emitEvent(INSTANCE_ID, 'withdrawal'); + } } export function trackCatalystRegistration(): void { @@ -83,6 +87,13 @@ export function trackSetLocale(locale: string): void { emitEvent(INSTANCE_ID, 'set-locale/' + locale); } +export function trackSetUnitOfAccount(unitOfAccount: string): void { + if (INSTANCE_ID == null) { + return; + } + emitEvent(INSTANCE_ID, 'unit-of-account/' + unitOfAccount); +} + export function trackUpdateTheme(theme: string): void { if (INSTANCE_ID == null) { return; diff --git a/packages/yoroi-extension/app/containers/settings/categories/BlockchainSettingsPage.js b/packages/yoroi-extension/app/containers/settings/categories/BlockchainSettingsPage.js index 5d1ae8d5e9..fc2cdeae2b 100644 --- a/packages/yoroi-extension/app/containers/settings/categories/BlockchainSettingsPage.js +++ b/packages/yoroi-extension/app/containers/settings/categories/BlockchainSettingsPage.js @@ -23,6 +23,7 @@ import { SelectedExplorer } from '../../../domain/SelectedExplorer'; import type { GetAllExplorersResponse, } from '../../../api/ada/lib/storage/bridge/explorers'; +import { trackUriPrompt } from '../../../api/analytics'; type GeneratedData = typeof BlockchainSettingsPage.prototype.generated; @@ -50,7 +51,12 @@ export default class BlockchainSettingsPage extends Component<InjectedOrGenerate ) ? ( <UriSettingsBlock - registerUriScheme={() => registerProtocols()} + registerUriScheme={ + () => { + registerProtocols(); + trackUriPrompt('allow'); + } + } isFirefox={environment.userAgentInfo.isFirefox()} /> ) diff --git a/packages/yoroi-extension/app/containers/settings/categories/GeneralSettingsPage.js b/packages/yoroi-extension/app/containers/settings/categories/GeneralSettingsPage.js index 5d2870cb2f..8f23f23343 100644 --- a/packages/yoroi-extension/app/containers/settings/categories/GeneralSettingsPage.js +++ b/packages/yoroi-extension/app/containers/settings/categories/GeneralSettingsPage.js @@ -18,6 +18,7 @@ import { ReactComponent as AdaCurrency } from '../../../assets/images/currencie import { unitOfAccountDisabledValue } from '../../../types/unitOfAccountType'; import type { UnitOfAccountSettingType } from '../../../types/unitOfAccountType'; import type { $npm$ReactIntl$IntlFormat } from 'react-intl'; +import { trackSetUnitOfAccount, trackSetLocale } from '../../../api/analytics'; const currencyLabels = defineMessages({ USD: { @@ -84,6 +85,12 @@ export default class GeneralSettingsPage extends Component<InjectedOrGenerated<G ? unitOfAccountDisabledValue : { enabled: true, currency: value }; await this.generated.actions.profile.updateUnitOfAccount.trigger(unitOfAccount); + trackSetUnitOfAccount(value); + }; + + onSelectLanguage: {| locale: string |} => PossiblyAsync<void> = ({ locale }) => { + this.generated.actions.profile.updateLocale.trigger({ locale }); + trackSetLocale(locale); }; render(): Node { @@ -120,7 +127,7 @@ export default class GeneralSettingsPage extends Component<InjectedOrGenerated<G return ( <> <GeneralSettings - onSelectLanguage={this.generated.actions.profile.updateLocale.trigger} + onSelectLanguage={this.onSelectLanguage} isSubmitting={isSubmittingLocale} languages={profileStore.LANGUAGE_OPTIONS} currentLocale={profileStore.currentLocale} diff --git a/packages/yoroi-extension/app/containers/transfer/WithdrawalTxDialogContainer.js b/packages/yoroi-extension/app/containers/transfer/WithdrawalTxDialogContainer.js index 41b79aa05c..48c240b274 100644 --- a/packages/yoroi-extension/app/containers/transfer/WithdrawalTxDialogContainer.js +++ b/packages/yoroi-extension/app/containers/transfer/WithdrawalTxDialogContainer.js @@ -35,7 +35,10 @@ export default class WithdrawalTxDialogContainer extends Component<Props> { render(): Node { const { intl } = this.context; - const { createWithdrawalTx } = this.generated.stores.substores.ada.delegationTransaction; + const { + createWithdrawalTx, + shouldDeregister, + } = this.generated.stores.substores.ada.delegationTransaction; if (this.generated.stores.profile.selectedNetwork == null) { throw new Error(`${nameof(WithdrawalTxDialogContainer)} no selected network`); @@ -53,7 +56,7 @@ export default class WithdrawalTxDialogContainer extends Component<Props> { }} onSubmit={{ trigger: () => { - trackWithdrawal(); + trackWithdrawal(shouldDeregister); }, label: intl.formatMessage(globalMessages.confirm), }} @@ -100,6 +103,7 @@ export default class WithdrawalTxDialogContainer extends Component<Props> { error: ?LocalizableError, result: ?ISignRequest<any> |}, + shouldDeregister: boolean, |}, |}, |}, @@ -131,6 +135,7 @@ export default class WithdrawalTxDialogContainer extends Component<Props> { result: stores.substores.ada.delegationTransaction.createWithdrawalTx.result, reset: stores.substores.ada.delegationTransaction.createWithdrawalTx.reset, }, + shouldDeregister: stores.substores.ada.delegationTransaction.shouldDeregister, }, }, }, diff --git a/packages/yoroi-extension/app/containers/transfer/YoroiTransferPage.stories.js b/packages/yoroi-extension/app/containers/transfer/YoroiTransferPage.stories.js index 66313bc1ff..f8682fccdf 100644 --- a/packages/yoroi-extension/app/containers/transfer/YoroiTransferPage.stories.js +++ b/packages/yoroi-extension/app/containers/transfer/YoroiTransferPage.stories.js @@ -559,6 +559,7 @@ export const WithdrawalTxPage = (): Node => { ), reset: action('createWithdrawalTx reset'), }, + shouldDeregister: false, }, }, }, diff --git a/packages/yoroi-extension/app/containers/wallet/staking/StakingDashboardPage.stories.js b/packages/yoroi-extension/app/containers/wallet/staking/StakingDashboardPage.stories.js index 47d07bea8c..134b155f02 100644 --- a/packages/yoroi-extension/app/containers/wallet/staking/StakingDashboardPage.stories.js +++ b/packages/yoroi-extension/app/containers/wallet/staking/StakingDashboardPage.stories.js @@ -1014,6 +1014,7 @@ export const AdaWithdrawDialog = (): Node => { ), reset: action('createWithdrawalTx reset'), }, + shouldDeregister: false, }, }, }, From 415571e906cfd4bd65d2d6978b039315d6897316 Mon Sep 17 00:00:00 2001 From: yushi <yushihuang@gmail.com> Date: Thu, 21 Jul 2022 21:06:49 +0800 Subject: [PATCH 16/28] add more events --- .../app/api/analytics/index.js | 21 +++++++++++++++++++ .../categories/RemoveWalletDialogContainer.js | 15 ++++++++----- .../categories/ResyncWalletDialogContainer.js | 2 ++ .../settings/categories/WalletSettingsPage.js | 10 ++++++--- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/packages/yoroi-extension/app/api/analytics/index.js b/packages/yoroi-extension/app/api/analytics/index.js index 572bc50479..8f63825fab 100644 --- a/packages/yoroi-extension/app/api/analytics/index.js +++ b/packages/yoroi-extension/app/api/analytics/index.js @@ -115,6 +115,27 @@ export function trackBuySellDialog(): void { emitEvent(INSTANCE_ID, 'buy-sell-ada'); } +export function trackExportWallet(): void { + if (INSTANCE_ID == null) { + return; + } + emitEvent(INSTANCE_ID, 'export-wallet'); +} + +export function trackRemoveWallet(): void { + if (INSTANCE_ID == null) { + return; + } + emitEvent(INSTANCE_ID, 'remove-wallet'); +} + +export function trackResyncWallet(): void { + if (INSTANCE_ID == null) { + return; + } + emitEvent(INSTANCE_ID, 'remove-wallet'); +} + function generateAnalyticsInstanceId(): string { // Matomo requires 16 character hex string return cryptoRandomString({ length: 16 }); diff --git a/packages/yoroi-extension/app/containers/settings/categories/RemoveWalletDialogContainer.js b/packages/yoroi-extension/app/containers/settings/categories/RemoveWalletDialogContainer.js index 60fa635b42..eed5c51322 100644 --- a/packages/yoroi-extension/app/containers/settings/categories/RemoveWalletDialogContainer.js +++ b/packages/yoroi-extension/app/containers/settings/categories/RemoveWalletDialogContainer.js @@ -17,6 +17,7 @@ import { withLayout } from '../../../styles/context/layout'; import type { LayoutComponentMap } from '../../../styles/context/layout'; import { getWalletType } from '../../../stores/toplevel/WalletSettingsStore'; import type { WalletsNavigation } from '../../../api/localStorage' +import { trackRemoveWallet } from '../../../api/analytics'; export type GeneratedData = typeof RemoveWalletDialogContainer.prototype.generated; @@ -75,6 +76,7 @@ class RemoveWalletDialogContainer extends Component<AllProps> { quickAccess: walletsNavigation.quickAccess.filter(walletId => walletId !== selectedWalletId) } await this.generated.actions.profile.updateSortedWalletList.trigger(newWalletsNavigation); + trackRemoveWallet(); } this.props.publicDeriver && @@ -99,11 +101,14 @@ class RemoveWalletDialogContainer extends Component<AllProps> { onCancel={this.generated.actions.dialogs.closeActiveDialog.trigger} primaryButton={{ label: intl.formatMessage(globalMessages.remove), - onClick: () => - this.props.publicDeriver && - settingsActions.removeWallet.trigger({ - publicDeriver: this.props.publicDeriver, - }), + onClick: () => { + if (this.props.publicDeriver != null) { + settingsActions.removeWallet.trigger({ + publicDeriver: this.props.publicDeriver, + }); + trackRemoveWallet(); + } + } }} secondaryButton={{ onClick: this.generated.actions.dialogs.closeActiveDialog.trigger, diff --git a/packages/yoroi-extension/app/containers/settings/categories/ResyncWalletDialogContainer.js b/packages/yoroi-extension/app/containers/settings/categories/ResyncWalletDialogContainer.js index e41c482456..7a86838c4f 100644 --- a/packages/yoroi-extension/app/containers/settings/categories/ResyncWalletDialogContainer.js +++ b/packages/yoroi-extension/app/containers/settings/categories/ResyncWalletDialogContainer.js @@ -13,6 +13,7 @@ import type { InjectedOrGenerated } from '../../../types/injectedPropsType'; import DangerousActionDialog from '../../../components/widgets/DangerousActionDialog'; import LocalizableError from '../../../i18n/LocalizableError'; +import { trackResyncWallet } from '../../../api/analytics'; export type GeneratedData = typeof ResyncWalletDialogContainer.prototype.generated; @@ -65,6 +66,7 @@ export default class ResyncWalletDialogContainer extends Component<Props> { publicDeriver: this.props.publicDeriver, }); this.generated.actions.dialogs.closeActiveDialog.trigger(); + trackResyncWallet(); } }} onCancel={this.generated.actions.dialogs.closeActiveDialog.trigger} diff --git a/packages/yoroi-extension/app/containers/settings/categories/WalletSettingsPage.js b/packages/yoroi-extension/app/containers/settings/categories/WalletSettingsPage.js index 45a3395701..49f4d087e2 100644 --- a/packages/yoroi-extension/app/containers/settings/categories/WalletSettingsPage.js +++ b/packages/yoroi-extension/app/containers/settings/categories/WalletSettingsPage.js @@ -27,6 +27,7 @@ import type { SigningKeyCache } from '../../../stores/toplevel/WalletStore'; import LocalizableError from '../../../i18n/LocalizableError'; import type { RenameModelFunc } from '../../../api/common/index'; import type { IGetSigningKey } from '../../../api/ada/lib/storage/models/PublicDeriver/interfaces'; +import { trackExportWallet } from '../../../api/analytics'; type GeneratedData = typeof WalletSettingsPage.prototype.generated; @@ -108,9 +109,12 @@ export default class WalletSettingsPage extends Component<InjectedOrGenerated<Ge })} /> <ExportWallet - openDialog={() => actions.dialogs.open.trigger({ - dialog: ExportWalletDialogContainer, - })} + openDialog={() => { + actions.dialogs.open.trigger({ + dialog: ExportWalletDialogContainer, + }); + trackExportWallet(); + }} /> <RemoveWallet walletName={settingsCache.conceptualWalletName} From 50927c4e1c4d625a4ece27837573bcb6e47f558a Mon Sep 17 00:00:00 2001 From: yushi <yushihuang@gmail.com> Date: Mon, 25 Jul 2022 17:47:51 +0800 Subject: [PATCH 17/28] differentiate testnet --- .../yoroi-extension/app/api/analytics/index.js | 18 +++++++++++++++--- .../yoroi-extension/chrome/extension/index.js | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/yoroi-extension/app/api/analytics/index.js b/packages/yoroi-extension/app/api/analytics/index.js index 8f63825fab..85de658af1 100644 --- a/packages/yoroi-extension/app/api/analytics/index.js +++ b/packages/yoroi-extension/app/api/analytics/index.js @@ -8,12 +8,17 @@ import LocalStorageApi, { } from '../localStorage'; import { environment } from '../../environment'; import { TRACKED_ROUTES } from '../../routes-config'; +import type { StoresMap } from '../../stores'; +import { isTestnet as isTestnetFunc} from '../ada/lib/storage/database/prepackaged/networks'; const MATOMO_URL = 'https://analytics.emurgo-rnd.com/matomo.php'; const SITE_ID = '4'; let INSTANCE_ID; +let stores; + +export async function trackStartup(stores_: StoresMap): Promise<void> { + stores = stores_; -export async function trackStartup(): Promise<void> { let event; if (await (new LocalStorageApi()).getUserLocale() != null) { INSTANCE_ID = await loadAnalyticsInstanceId(); @@ -141,17 +146,24 @@ function generateAnalyticsInstanceId(): string { return cryptoRandomString({ length: 16 }); } +function getCurrentWalletInfo() { +} + function emitEvent(instanceId: string, event: string): void { - if (environment.isDev() || environment.isTest()) { + if (/*fixme environment.isDev() ||*/ environment.isTest()) { return; } + const isTestnet = stores.profile.selectedNetwork != null ? + isTestnetFunc(stores.profile.selectedNetwork) : + false; + // https://developer.matomo.org/api-reference/tracking-api const params = { idsite: SITE_ID, rec: '1', action_name: event, - url: `yoroi.extension/${event}`, + url: `yoroi.extension/${isTestnet ? 'testnet/' : ''}${event}`, _id: INSTANCE_ID, rand: `${Date.now()}-${Math.random()}`, apiv: '1' diff --git a/packages/yoroi-extension/chrome/extension/index.js b/packages/yoroi-extension/chrome/extension/index.js index 076706e773..02aa079632 100644 --- a/packages/yoroi-extension/chrome/extension/index.js +++ b/packages/yoroi-extension/chrome/extension/index.js @@ -31,7 +31,7 @@ const initializeYoroi: void => Promise<void> = async () => { const hashHistory = createHashHistory(); const history = syncHistoryWithStore(hashHistory, router); const stores = createStores(api, actions, router); - await trackStartup(); + await trackStartup(stores); Logger.debug(`[yoroi] stores created`); From 8ebc709419988b7b5b0276ca907aab159d8bf9dc Mon Sep 17 00:00:00 2001 From: yushi <yushihuang@gmail.com> Date: Mon, 25 Jul 2022 20:37:06 +0800 Subject: [PATCH 18/28] remove tmp code --- packages/yoroi-extension/app/api/analytics/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/api/analytics/index.js b/packages/yoroi-extension/app/api/analytics/index.js index 85de658af1..011e84b957 100644 --- a/packages/yoroi-extension/app/api/analytics/index.js +++ b/packages/yoroi-extension/app/api/analytics/index.js @@ -150,7 +150,7 @@ function getCurrentWalletInfo() { } function emitEvent(instanceId: string, event: string): void { - if (/*fixme environment.isDev() ||*/ environment.isTest()) { + if (environment.isDev() || environment.isTest()) { return; } From bc5f1d7412cca437d391e134825cfddc5f4d6356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Akkurt?= <oezgurmakkurt@gmail.com> Date: Mon, 25 Jul 2022 16:11:36 +0300 Subject: [PATCH 19/28] remove mutex on connector handler --- .../chrome/extension/background.js | 61 +++++++++---------- packages/yoroi-extension/package-lock.json | 15 ----- packages/yoroi-extension/package.json | 1 - 3 files changed, 29 insertions(+), 48 deletions(-) diff --git a/packages/yoroi-extension/chrome/extension/background.js b/packages/yoroi-extension/chrome/extension/background.js index a6b354be0b..82f20df22b 100644 --- a/packages/yoroi-extension/chrome/extension/background.js +++ b/packages/yoroi-extension/chrome/extension/background.js @@ -77,7 +77,6 @@ import type { lf$Database, } from 'lovefield'; import { schema } from 'lovefield'; import { copyDbToMemory, loadLovefieldDB, } from '../../app/api/ada/lib/storage/database/index'; import { migrateNoRefresh } from '../../app/api/common/migration'; -import { Mutex, } from 'async-mutex'; import { getCardanoHaskellBaseConfig, isCardanoHaskell @@ -214,39 +213,37 @@ const dbAccessMutex = new Mutex(); async function withDb<T>( continuation: (lf$Database, LocalStorageApi) => Promise<T> ): Promise<T> { - return await dbAccessMutex.runExclusive(async () => { - // note: lovefield internally caches queries an optimization - // this doesn't work for us because the DB can change under our feet through the Yoroi Extension - // so instead, we create the DB, use it, then close the connection - const db = await loadLovefieldDB(schema.DataStoreType.INDEXED_DB); - let inMemoryDb: void | lf$Database = undefined; - try { - // process migration here before anything involving storage is cached - // as dApp can't easily recover from refreshing a page to wipe cache after storage migration - const localStorageApi = new LocalStorageApi(); - // note: it's safe that this call modifies the DB that is shared with the main extension - // since if a migration actually needs to be processed, - // it means the extension hasn't been launched since the Yoroi version updated - // which means it's not running at the same time as the connector - await migrateNoRefresh({ - localStorageApi, - persistentDb: db, - currVersion: environment.getVersion(), - }) + // note: lovefield internally caches queries an optimization + // this doesn't work for us because the DB can change under our feet through the Yoroi Extension + // so instead, we create the DB, use it, then close the connection + const db = await loadLovefieldDB(schema.DataStoreType.INDEXED_DB); + let inMemoryDb: void | lf$Database = undefined; + try { + // process migration here before anything involving storage is cached + // as dApp can't easily recover from refreshing a page to wipe cache after storage migration + const localStorageApi = new LocalStorageApi(); + // note: it's safe that this call modifies the DB that is shared with the main extension + // since if a migration actually needs to be processed, + // it means the extension hasn't been launched since the Yoroi version updated + // which means it's not running at the same time as the connector + await migrateNoRefresh({ + localStorageApi, + persistentDb: db, + currVersion: environment.getVersion(), + }) - // note: we can't close the persistent DB connection here after copying it - // since lovefield closes some shared workers causing the in-memory connection to fail as well - inMemoryDb = await copyDbToMemory(db); + // note: we can't close the persistent DB connection here after copying it + // since lovefield closes some shared workers causing the in-memory connection to fail as well + inMemoryDb = await copyDbToMemory(db); - return await continuation(inMemoryDb, localStorageApi); - } catch (e) { - Logger.error(`DB continuation call failed due to internal error: ${e}\n${e.stack}`); - throw e; - } finally { - inMemoryDb?.close(); - db.close(); - } - }); + return await continuation(inMemoryDb, localStorageApi); + } catch (e) { + Logger.error(`DB continuation call failed due to internal error: ${e}\n${e.stack}`); + throw e; + } finally { + inMemoryDb?.close(); + db.close(); + } } async function createFetcher( diff --git a/packages/yoroi-extension/package-lock.json b/packages/yoroi-extension/package-lock.json index 1302955388..8b20ce7b40 100644 --- a/packages/yoroi-extension/package-lock.json +++ b/packages/yoroi-extension/package-lock.json @@ -8899,21 +8899,6 @@ "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", "dev": true }, - "async-mutex": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.3.2.tgz", - "integrity": "sha512-HuTK7E7MT7jZEh1P9GtRW9+aTWiDWWi9InbZ5hjxrnRa39KS4BW04+xLBhYNS2aXhHUIKZSw3gj4Pn1pj+qGAA==", - "requires": { - "tslib": "^2.3.1" - }, - "dependencies": { - "tslib": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", - "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" - } - } - }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", diff --git a/packages/yoroi-extension/package.json b/packages/yoroi-extension/package.json index c78c16126d..469cb569dd 100644 --- a/packages/yoroi-extension/package.json +++ b/packages/yoroi-extension/package.json @@ -185,7 +185,6 @@ "@mui/lab": "^5.0.0-alpha.51", "@mui/material": "^5.0.4", "@svgr/webpack": "5.5.0", - "async-mutex": "^0.3.1", "axios": "0.21.1", "bech32": "2.0.0", "bignumber.js": "9.0.1", From 9b3706e7830923b2c08d5025851383b115ab5c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Akkurt?= <oezgurmakkurt@gmail.com> Date: Mon, 25 Jul 2022 16:44:32 +0300 Subject: [PATCH 20/28] remove Mutex usage --- packages/yoroi-extension/chrome/extension/background.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/yoroi-extension/chrome/extension/background.js b/packages/yoroi-extension/chrome/extension/background.js index 82f20df22b..ce20bd9cb2 100644 --- a/packages/yoroi-extension/chrome/extension/background.js +++ b/packages/yoroi-extension/chrome/extension/background.js @@ -196,13 +196,6 @@ const ports: Map<TabId, any> = new Map(); let pendingTxs: PendingTransaction[] = []; -/** -* need to make sure JS tasks run in an order where no two of them have different DB instances -* Otherwise, caching logic may make things go wrong -* TODO: this doesn't help if the Yoroi Extension or a Web Worker makes a query during this execution -*/ -const dbAccessMutex = new Mutex(); - /** * Performs wallet version migration if needed * Then calls the continuation with storage objects From 360935212257c437de9cf2a86e9e29d705747b6f Mon Sep 17 00:00:00 2001 From: yushi <yushihuang@gmail.com> Date: Fri, 29 Jul 2022 01:32:25 +0800 Subject: [PATCH 21/28] prefix testnet/ to testnet wallet action names --- packages/yoroi-extension/app/api/analytics/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/api/analytics/index.js b/packages/yoroi-extension/app/api/analytics/index.js index 011e84b957..e11c46cdd9 100644 --- a/packages/yoroi-extension/app/api/analytics/index.js +++ b/packages/yoroi-extension/app/api/analytics/index.js @@ -162,7 +162,7 @@ function emitEvent(instanceId: string, event: string): void { const params = { idsite: SITE_ID, rec: '1', - action_name: event, + action_name: (isTestnet ? 'testnet/' : '') + event, url: `yoroi.extension/${isTestnet ? 'testnet/' : ''}${event}`, _id: INSTANCE_ID, rand: `${Date.now()}-${Math.random()}`, From d699271505c2cbd1a4027cd79084e3e2f7b50018 Mon Sep 17 00:00:00 2001 From: yushi <yushihuang@gmail.com> Date: Fri, 29 Jul 2022 11:49:32 +0800 Subject: [PATCH 22/28] fix action name --- packages/yoroi-extension/app/api/analytics/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/api/analytics/index.js b/packages/yoroi-extension/app/api/analytics/index.js index e11c46cdd9..a00d81ab6e 100644 --- a/packages/yoroi-extension/app/api/analytics/index.js +++ b/packages/yoroi-extension/app/api/analytics/index.js @@ -138,7 +138,7 @@ export function trackResyncWallet(): void { if (INSTANCE_ID == null) { return; } - emitEvent(INSTANCE_ID, 'remove-wallet'); + emitEvent(INSTANCE_ID, 'resync-wallet'); } function generateAnalyticsInstanceId(): string { From bbe680a7951d4ce8ee73dbee8897a5a577db7e68 Mon Sep 17 00:00:00 2001 From: Pedro <pedromtcosta@users.noreply.github.com> Date: Wed, 3 Aug 2022 12:32:22 -0300 Subject: [PATCH 23/28] fix fund message --- .../yoroi-extension/app/api/ada/lib/state-fetch/types.js | 1 + .../app/components/wallet/voting/Voting.js | 8 ++++---- .../app/containers/wallet/voting/VotingPage.js | 3 ++- packages/yoroi-extension/app/i18n/locales/cs-CZ.json | 2 +- packages/yoroi-extension/app/i18n/locales/de-DE.json | 2 +- packages/yoroi-extension/app/i18n/locales/el-GR.json | 2 +- packages/yoroi-extension/app/i18n/locales/en-US.json | 2 +- packages/yoroi-extension/app/i18n/locales/es-ES.json | 2 +- packages/yoroi-extension/app/i18n/locales/fr-FR.json | 2 +- packages/yoroi-extension/app/i18n/locales/hr-HR.json | 2 +- packages/yoroi-extension/app/i18n/locales/id-ID.json | 2 +- packages/yoroi-extension/app/i18n/locales/it-IT.json | 2 +- packages/yoroi-extension/app/i18n/locales/ja-JP.json | 2 +- packages/yoroi-extension/app/i18n/locales/ko-KR.json | 2 +- packages/yoroi-extension/app/i18n/locales/nl-NL.json | 2 +- packages/yoroi-extension/app/i18n/locales/pt-BR.json | 2 +- packages/yoroi-extension/app/i18n/locales/ru-RU.json | 2 +- packages/yoroi-extension/app/i18n/locales/sk-SK.json | 2 +- packages/yoroi-extension/app/i18n/locales/tr-TR.json | 2 +- packages/yoroi-extension/app/i18n/locales/zh-Hans.json | 2 +- packages/yoroi-extension/app/i18n/locales/zh-Hant.json | 2 +- 21 files changed, 25 insertions(+), 23 deletions(-) diff --git a/packages/yoroi-extension/app/api/ada/lib/state-fetch/types.js b/packages/yoroi-extension/app/api/ada/lib/state-fetch/types.js index 14655040fc..21655aadf7 100644 --- a/packages/yoroi-extension/app/api/ada/lib/state-fetch/types.js +++ b/packages/yoroi-extension/app/api/ada/lib/state-fetch/types.js @@ -353,6 +353,7 @@ export type CatalystRoundInfoRequest = {| export type CatalystRound = {| +id: number, + +name: string, +registrationStart: string, +registrationEnd: string, +votingStart: string, diff --git a/packages/yoroi-extension/app/components/wallet/voting/Voting.js b/packages/yoroi-extension/app/components/wallet/voting/Voting.js index c88e57a22d..44b22d2d1e 100644 --- a/packages/yoroi-extension/app/components/wallet/voting/Voting.js +++ b/packages/yoroi-extension/app/components/wallet/voting/Voting.js @@ -17,7 +17,7 @@ import type { WalletType } from './types'; const messages = defineMessages({ lineTitle: { id: 'wallet.voting.lineTitle', - defaultMessage: '!!!Register to vote on Fund {round}', + defaultMessage: '!!!Register to vote on {fundName}', }, line2: { id: 'wallet.voting.line2', @@ -54,7 +54,7 @@ type Props = {| +onExternalLinkClick: MouseEvent => void, +hasAnyPending: boolean, +isDelegated: boolean, - +round: number, + +name: string, +walletType: WalletType, |}; @@ -100,7 +100,7 @@ export default class Voting extends Component<Props> { render(): Node { const { intl } = this.context; - const round = this.props.round; + const fundName = this.props.name; const pendingTxWarningComponent = this.props.hasAnyPending ? ( @@ -135,7 +135,7 @@ export default class Voting extends Component<Props> { </div> <div className={classnames([styles.lineTitle, styles.firstItem])}> - {intl.formatMessage(messages.lineTitle, { round })} + {intl.formatMessage(messages.lineTitle, { fundName })} </div> <div className={styles.lineText}> diff --git a/packages/yoroi-extension/app/containers/wallet/voting/VotingPage.js b/packages/yoroi-extension/app/containers/wallet/voting/VotingPage.js index 2da42be0e9..c1128236b1 100644 --- a/packages/yoroi-extension/app/containers/wallet/voting/VotingPage.js +++ b/packages/yoroi-extension/app/containers/wallet/voting/VotingPage.js @@ -280,6 +280,7 @@ export default class VotingPage extends Component<Props> { out of the registration dates. */ const round = catalystRoundInfo?.currentFund?.id || catalystRoundInfo?.nextFund?.id || 5 + const fundName = catalystRoundInfo?.currentFund?.name || round.toString(); return ( // <div> @@ -289,7 +290,7 @@ export default class VotingPage extends Component<Props> { hasAnyPending={this.generated.hasAnyPending} onExternalLinkClick={handleExternalLinkClick} isDelegated={this.isDelegated === true} - round={round} + name={fundName} walletType={walletType} /> </div> diff --git a/packages/yoroi-extension/app/i18n/locales/cs-CZ.json b/packages/yoroi-extension/app/i18n/locales/cs-CZ.json index 53e90d7f83..057298ffe5 100644 --- a/packages/yoroi-extension/app/i18n/locales/cs-CZ.json +++ b/packages/yoroi-extension/app/i18n/locales/cs-CZ.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "Copy to clipboard", "widgets.explorer.tooltip": "Go to {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/de-DE.json b/packages/yoroi-extension/app/i18n/locales/de-DE.json index 6672fe795e..009bc2d244 100644 --- a/packages/yoroi-extension/app/i18n/locales/de-DE.json +++ b/packages/yoroi-extension/app/i18n/locales/de-DE.json @@ -776,7 +776,7 @@ "wallet.voting.line2": "Bevor du beginnst, schließe bitte die folgenden Schritte ab", "wallet.voting.line3": "Lade die Catalyst Abstimmungs-App herunter.", "wallet.voting.line4": "Öffne die Catalyst Voting App und klicke auf die Schaltfläche Registrierung abschließen.", - "wallet.voting.lineTitle": "Registrierung für die Fund { round } Abstimmung", + "wallet.voting.lineTitle": "Registrierung für die { fundName } Abstimmung", "wallet.withdrawal.transaction.unregister": "Diese Transaktion wird eine oder mehrere Staking Schlüssel zurückziehen, und Dir {refundAmount} {ticker} zurückgeben", "widgets.copyableaddress.addressCopyTooltipMessage": "In die Zwischenablage kopieren", "widgets.explorer.tooltip": "Gehe zu {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/el-GR.json b/packages/yoroi-extension/app/i18n/locales/el-GR.json index 9d84623e26..ee57fa9108 100644 --- a/packages/yoroi-extension/app/i18n/locales/el-GR.json +++ b/packages/yoroi-extension/app/i18n/locales/el-GR.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "Αντιγραφή στο πρόχειρο", "widgets.explorer.tooltip": "Πηγαίνετε στο {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/en-US.json b/packages/yoroi-extension/app/i18n/locales/en-US.json index 56c0be9dee..1302ea9b76 100644 --- a/packages/yoroi-extension/app/i18n/locales/en-US.json +++ b/packages/yoroi-extension/app/i18n/locales/en-US.json @@ -926,7 +926,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.voting.notDelegated": "You haven't delegated anything. Your voting power is determined by the amount you delegate and voting rewards are distributed to your delegation reward address. Please remember to delegate prior to voting.", "wallet.voting.trezorTRequirement": "<a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://wiki.trezor.io/User_manual:Updating_the_Trezor_device_firmware\">Update</a> your Trezor Model T firmware version to 2.4.1 or above.", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", diff --git a/packages/yoroi-extension/app/i18n/locales/es-ES.json b/packages/yoroi-extension/app/i18n/locales/es-ES.json index fd516ea326..220b391d1a 100644 --- a/packages/yoroi-extension/app/i18n/locales/es-ES.json +++ b/packages/yoroi-extension/app/i18n/locales/es-ES.json @@ -776,7 +776,7 @@ "wallet.voting.line2": "Antes de empezar, asegúrate de completar los siguientes pasos", "wallet.voting.line3": "Descarga la aplicación Catalyst Voting App.", "wallet.voting.line4": "Abre la Catalyst Voting App y haz clic en el botón Completar registro.", - "wallet.voting.lineTitle": "Registrarse para votar en el Fondo { round }", + "wallet.voting.lineTitle": "Registrarse para votar en el { fundName }", "wallet.withdrawal.transaction.unregister": "Esta transacción desregistrará una o más claves de delegación, devolviendo las {refundAmount} {ticker} de tu depósito", "widgets.copyableaddress.addressCopyTooltipMessage": "Copiar al portapapeles", "widgets.explorer.tooltip": "Ir a {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/fr-FR.json b/packages/yoroi-extension/app/i18n/locales/fr-FR.json index 1e22d32775..c076525099 100644 --- a/packages/yoroi-extension/app/i18n/locales/fr-FR.json +++ b/packages/yoroi-extension/app/i18n/locales/fr-FR.json @@ -776,7 +776,7 @@ "wallet.voting.line2": "Avant de commencer, assurez-vous de suivre les étapes suivantes", "wallet.voting.line3": "Télécharger l'application Catalyst Voting.", "wallet.voting.line4": "Ouvrez l'application Catalyst Voting App et cliquez sur le bouton Compléter l'inscription.", - "wallet.voting.lineTitle": "S'enregistrer pour voter au Fund { round }", + "wallet.voting.lineTitle": "S'enregistrer pour voter au { fundName }", "wallet.withdrawal.transaction.unregister": "Cette opération va désinscrire une ou plusieurs clés de staking, ce qui vous permettra de récupérer votre dépôt de {refundAmount} {ticker}", "widgets.copyableaddress.addressCopyTooltipMessage": "Copier dans le presse-papier", "widgets.explorer.tooltip": "Aller sur {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/hr-HR.json b/packages/yoroi-extension/app/i18n/locales/hr-HR.json index 088b4a2f9b..010e48fa84 100644 --- a/packages/yoroi-extension/app/i18n/locales/hr-HR.json +++ b/packages/yoroi-extension/app/i18n/locales/hr-HR.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "Copy to clipboard", "widgets.explorer.tooltip": "Go to {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/id-ID.json b/packages/yoroi-extension/app/i18n/locales/id-ID.json index b900f04c66..d2e53cfd13 100644 --- a/packages/yoroi-extension/app/i18n/locales/id-ID.json +++ b/packages/yoroi-extension/app/i18n/locales/id-ID.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "Menyalin ke clipboard", "widgets.explorer.tooltip": "Pergi ke {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/it-IT.json b/packages/yoroi-extension/app/i18n/locales/it-IT.json index 44f63b15ec..5d3ff93c07 100644 --- a/packages/yoroi-extension/app/i18n/locales/it-IT.json +++ b/packages/yoroi-extension/app/i18n/locales/it-IT.json @@ -776,7 +776,7 @@ "wallet.voting.line2": "Prima di iniziare, assicurati di completare i seguenti passi", "wallet.voting.line3": "Scarica la Catalyst Voting App.", "wallet.voting.line4": "Aprire la Catalyst Voting App e clicca sul pulsante Completa la registrazione.", - "wallet.voting.lineTitle": "Registrati per votare sul Fund { round }", + "wallet.voting.lineTitle": "Registrati per votare sul { fundName }", "wallet.withdrawal.transaction.unregister": "Questa transazione deregistrerà una o più chiavi di staking, restituendovi i vostri {refundAmount} {ticker} dal vostro deposito", "widgets.copyableaddress.addressCopyTooltipMessage": "Copia negli appunti", "widgets.explorer.tooltip": "Vai a {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/ja-JP.json b/packages/yoroi-extension/app/i18n/locales/ja-JP.json index f1bf903f1c..97de7c3656 100644 --- a/packages/yoroi-extension/app/i18n/locales/ja-JP.json +++ b/packages/yoroi-extension/app/i18n/locales/ja-JP.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "クリップボードにコピーする", "widgets.explorer.tooltip": "{websiteName}へ", diff --git a/packages/yoroi-extension/app/i18n/locales/ko-KR.json b/packages/yoroi-extension/app/i18n/locales/ko-KR.json index 69608f4e6d..a6f4fb82b8 100644 --- a/packages/yoroi-extension/app/i18n/locales/ko-KR.json +++ b/packages/yoroi-extension/app/i18n/locales/ko-KR.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "클립보드로 복사", "widgets.explorer.tooltip": "{websiteName} 로 가기", diff --git a/packages/yoroi-extension/app/i18n/locales/nl-NL.json b/packages/yoroi-extension/app/i18n/locales/nl-NL.json index 1a506e55bb..0b1a8f80cb 100644 --- a/packages/yoroi-extension/app/i18n/locales/nl-NL.json +++ b/packages/yoroi-extension/app/i18n/locales/nl-NL.json @@ -776,7 +776,7 @@ "wallet.voting.line2": "Zorg ervoor dat u de onderstaande stappen uitvoert voordat u begint", "wallet.voting.line3": "Download de Catalyst Stem-applicatie.", "wallet.voting.line4": "Open de Catalyst Stem-applicatie en klik op de knop \"Registratie voltooien\".", - "wallet.voting.lineTitle": "Registreer uzelf om op Fonds { round } te stemmen", + "wallet.voting.lineTitle": "Registreer uzelf om op { fundName } te stemmen", "wallet.withdrawal.transaction.unregister": "Met deze transactie wordt de registratie van een of meer stemsleutels ongedaan gemaakt, waardoor u uw {refundAmount} {ticker} van uw storting terugkrijgt", "widgets.copyableaddress.addressCopyTooltipMessage": "Kopieer naar klembord", "widgets.explorer.tooltip": "Ga naar {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/pt-BR.json b/packages/yoroi-extension/app/i18n/locales/pt-BR.json index 5b50369079..26b9388898 100644 --- a/packages/yoroi-extension/app/i18n/locales/pt-BR.json +++ b/packages/yoroi-extension/app/i18n/locales/pt-BR.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "Essa transação irá revogar uma ou mais chave de participação, reembolsando suas {refundAmount}{ticker} pagas como depósito no registro de sua chave de participação", "widgets.copyableaddress.addressCopyTooltipMessage": "Copiar para área de transferência", "widgets.explorer.tooltip": "Ir para {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/ru-RU.json b/packages/yoroi-extension/app/i18n/locales/ru-RU.json index cca36055fb..c9900d60d9 100644 --- a/packages/yoroi-extension/app/i18n/locales/ru-RU.json +++ b/packages/yoroi-extension/app/i18n/locales/ru-RU.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "Скопировать в буфер обмена", "widgets.explorer.tooltip": "Перейти на {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/sk-SK.json b/packages/yoroi-extension/app/i18n/locales/sk-SK.json index e8b7190294..b3d54cc43c 100644 --- a/packages/yoroi-extension/app/i18n/locales/sk-SK.json +++ b/packages/yoroi-extension/app/i18n/locales/sk-SK.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "Copy to clipboard", "widgets.explorer.tooltip": "Go to {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/tr-TR.json b/packages/yoroi-extension/app/i18n/locales/tr-TR.json index 1c6eed49ff..65caeb6c2b 100644 --- a/packages/yoroi-extension/app/i18n/locales/tr-TR.json +++ b/packages/yoroi-extension/app/i18n/locales/tr-TR.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "Panoya kopyala", "widgets.explorer.tooltip": "{websiteName} Adresine Git", diff --git a/packages/yoroi-extension/app/i18n/locales/zh-Hans.json b/packages/yoroi-extension/app/i18n/locales/zh-Hans.json index 7fac048c45..2006e6cb55 100644 --- a/packages/yoroi-extension/app/i18n/locales/zh-Hans.json +++ b/packages/yoroi-extension/app/i18n/locales/zh-Hans.json @@ -776,7 +776,7 @@ "wallet.voting.line2": "在您开始之前,请确保完成了下列步骤", "wallet.voting.line3": "下载Catalyst投票应用。", "wallet.voting.line4": "打开Catalyst投票应用,点击完成注册按钮。", - "wallet.voting.lineTitle": "注册并给资金{ round }投票", + "wallet.voting.lineTitle": "注册并给资金{ fundName }投票", "wallet.withdrawal.transaction.unregister": "此交易将取消注册一个或多个委托密钥,从而从您的存款中退还您的{refundAmount}{ticker}。", "widgets.copyableaddress.addressCopyTooltipMessage": "复制到剪贴板", "widgets.explorer.tooltip": "前往{websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/zh-Hant.json b/packages/yoroi-extension/app/i18n/locales/zh-Hant.json index 9892d39224..92ecc3cc5c 100644 --- a/packages/yoroi-extension/app/i18n/locales/zh-Hant.json +++ b/packages/yoroi-extension/app/i18n/locales/zh-Hant.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "複製到剪貼板", "widgets.explorer.tooltip": "前往{websiteName}", From ca314fd96d5d998942c7ab58f3842dce7f63f65f Mon Sep 17 00:00:00 2001 From: Pedro <pedromtcosta@users.noreply.github.com> Date: Wed, 3 Aug 2022 12:32:22 -0300 Subject: [PATCH 24/28] fix fund message --- .../yoroi-extension/app/api/ada/lib/state-fetch/types.js | 1 + .../app/components/wallet/voting/Voting.js | 8 ++++---- .../app/containers/wallet/voting/VotingPage.js | 3 ++- packages/yoroi-extension/app/i18n/locales/cs-CZ.json | 2 +- packages/yoroi-extension/app/i18n/locales/de-DE.json | 2 +- packages/yoroi-extension/app/i18n/locales/el-GR.json | 2 +- packages/yoroi-extension/app/i18n/locales/en-US.json | 2 +- packages/yoroi-extension/app/i18n/locales/es-ES.json | 2 +- packages/yoroi-extension/app/i18n/locales/fr-FR.json | 2 +- packages/yoroi-extension/app/i18n/locales/hr-HR.json | 2 +- packages/yoroi-extension/app/i18n/locales/id-ID.json | 2 +- packages/yoroi-extension/app/i18n/locales/it-IT.json | 2 +- packages/yoroi-extension/app/i18n/locales/ja-JP.json | 2 +- packages/yoroi-extension/app/i18n/locales/ko-KR.json | 2 +- packages/yoroi-extension/app/i18n/locales/nl-NL.json | 2 +- packages/yoroi-extension/app/i18n/locales/pt-BR.json | 2 +- packages/yoroi-extension/app/i18n/locales/ru-RU.json | 2 +- packages/yoroi-extension/app/i18n/locales/sk-SK.json | 2 +- packages/yoroi-extension/app/i18n/locales/tr-TR.json | 2 +- packages/yoroi-extension/app/i18n/locales/zh-Hans.json | 2 +- packages/yoroi-extension/app/i18n/locales/zh-Hant.json | 2 +- 21 files changed, 25 insertions(+), 23 deletions(-) diff --git a/packages/yoroi-extension/app/api/ada/lib/state-fetch/types.js b/packages/yoroi-extension/app/api/ada/lib/state-fetch/types.js index 49910833c8..ea8b28ad9d 100644 --- a/packages/yoroi-extension/app/api/ada/lib/state-fetch/types.js +++ b/packages/yoroi-extension/app/api/ada/lib/state-fetch/types.js @@ -353,6 +353,7 @@ export type CatalystRoundInfoRequest = {| export type CatalystRound = {| +id: number, + +name: string, +registrationStart: string, +registrationEnd: string, +votingStart: string, diff --git a/packages/yoroi-extension/app/components/wallet/voting/Voting.js b/packages/yoroi-extension/app/components/wallet/voting/Voting.js index c88e57a22d..44b22d2d1e 100644 --- a/packages/yoroi-extension/app/components/wallet/voting/Voting.js +++ b/packages/yoroi-extension/app/components/wallet/voting/Voting.js @@ -17,7 +17,7 @@ import type { WalletType } from './types'; const messages = defineMessages({ lineTitle: { id: 'wallet.voting.lineTitle', - defaultMessage: '!!!Register to vote on Fund {round}', + defaultMessage: '!!!Register to vote on {fundName}', }, line2: { id: 'wallet.voting.line2', @@ -54,7 +54,7 @@ type Props = {| +onExternalLinkClick: MouseEvent => void, +hasAnyPending: boolean, +isDelegated: boolean, - +round: number, + +name: string, +walletType: WalletType, |}; @@ -100,7 +100,7 @@ export default class Voting extends Component<Props> { render(): Node { const { intl } = this.context; - const round = this.props.round; + const fundName = this.props.name; const pendingTxWarningComponent = this.props.hasAnyPending ? ( @@ -135,7 +135,7 @@ export default class Voting extends Component<Props> { </div> <div className={classnames([styles.lineTitle, styles.firstItem])}> - {intl.formatMessage(messages.lineTitle, { round })} + {intl.formatMessage(messages.lineTitle, { fundName })} </div> <div className={styles.lineText}> diff --git a/packages/yoroi-extension/app/containers/wallet/voting/VotingPage.js b/packages/yoroi-extension/app/containers/wallet/voting/VotingPage.js index 2da42be0e9..c1128236b1 100644 --- a/packages/yoroi-extension/app/containers/wallet/voting/VotingPage.js +++ b/packages/yoroi-extension/app/containers/wallet/voting/VotingPage.js @@ -280,6 +280,7 @@ export default class VotingPage extends Component<Props> { out of the registration dates. */ const round = catalystRoundInfo?.currentFund?.id || catalystRoundInfo?.nextFund?.id || 5 + const fundName = catalystRoundInfo?.currentFund?.name || round.toString(); return ( // <div> @@ -289,7 +290,7 @@ export default class VotingPage extends Component<Props> { hasAnyPending={this.generated.hasAnyPending} onExternalLinkClick={handleExternalLinkClick} isDelegated={this.isDelegated === true} - round={round} + name={fundName} walletType={walletType} /> </div> diff --git a/packages/yoroi-extension/app/i18n/locales/cs-CZ.json b/packages/yoroi-extension/app/i18n/locales/cs-CZ.json index 53e90d7f83..057298ffe5 100644 --- a/packages/yoroi-extension/app/i18n/locales/cs-CZ.json +++ b/packages/yoroi-extension/app/i18n/locales/cs-CZ.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "Copy to clipboard", "widgets.explorer.tooltip": "Go to {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/de-DE.json b/packages/yoroi-extension/app/i18n/locales/de-DE.json index 6672fe795e..009bc2d244 100644 --- a/packages/yoroi-extension/app/i18n/locales/de-DE.json +++ b/packages/yoroi-extension/app/i18n/locales/de-DE.json @@ -776,7 +776,7 @@ "wallet.voting.line2": "Bevor du beginnst, schließe bitte die folgenden Schritte ab", "wallet.voting.line3": "Lade die Catalyst Abstimmungs-App herunter.", "wallet.voting.line4": "Öffne die Catalyst Voting App und klicke auf die Schaltfläche Registrierung abschließen.", - "wallet.voting.lineTitle": "Registrierung für die Fund { round } Abstimmung", + "wallet.voting.lineTitle": "Registrierung für die { fundName } Abstimmung", "wallet.withdrawal.transaction.unregister": "Diese Transaktion wird eine oder mehrere Staking Schlüssel zurückziehen, und Dir {refundAmount} {ticker} zurückgeben", "widgets.copyableaddress.addressCopyTooltipMessage": "In die Zwischenablage kopieren", "widgets.explorer.tooltip": "Gehe zu {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/el-GR.json b/packages/yoroi-extension/app/i18n/locales/el-GR.json index 9d84623e26..ee57fa9108 100644 --- a/packages/yoroi-extension/app/i18n/locales/el-GR.json +++ b/packages/yoroi-extension/app/i18n/locales/el-GR.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "Αντιγραφή στο πρόχειρο", "widgets.explorer.tooltip": "Πηγαίνετε στο {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/en-US.json b/packages/yoroi-extension/app/i18n/locales/en-US.json index 56c0be9dee..1302ea9b76 100644 --- a/packages/yoroi-extension/app/i18n/locales/en-US.json +++ b/packages/yoroi-extension/app/i18n/locales/en-US.json @@ -926,7 +926,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.voting.notDelegated": "You haven't delegated anything. Your voting power is determined by the amount you delegate and voting rewards are distributed to your delegation reward address. Please remember to delegate prior to voting.", "wallet.voting.trezorTRequirement": "<a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://wiki.trezor.io/User_manual:Updating_the_Trezor_device_firmware\">Update</a> your Trezor Model T firmware version to 2.4.1 or above.", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", diff --git a/packages/yoroi-extension/app/i18n/locales/es-ES.json b/packages/yoroi-extension/app/i18n/locales/es-ES.json index fd516ea326..220b391d1a 100644 --- a/packages/yoroi-extension/app/i18n/locales/es-ES.json +++ b/packages/yoroi-extension/app/i18n/locales/es-ES.json @@ -776,7 +776,7 @@ "wallet.voting.line2": "Antes de empezar, asegúrate de completar los siguientes pasos", "wallet.voting.line3": "Descarga la aplicación Catalyst Voting App.", "wallet.voting.line4": "Abre la Catalyst Voting App y haz clic en el botón Completar registro.", - "wallet.voting.lineTitle": "Registrarse para votar en el Fondo { round }", + "wallet.voting.lineTitle": "Registrarse para votar en el { fundName }", "wallet.withdrawal.transaction.unregister": "Esta transacción desregistrará una o más claves de delegación, devolviendo las {refundAmount} {ticker} de tu depósito", "widgets.copyableaddress.addressCopyTooltipMessage": "Copiar al portapapeles", "widgets.explorer.tooltip": "Ir a {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/fr-FR.json b/packages/yoroi-extension/app/i18n/locales/fr-FR.json index 1e22d32775..c076525099 100644 --- a/packages/yoroi-extension/app/i18n/locales/fr-FR.json +++ b/packages/yoroi-extension/app/i18n/locales/fr-FR.json @@ -776,7 +776,7 @@ "wallet.voting.line2": "Avant de commencer, assurez-vous de suivre les étapes suivantes", "wallet.voting.line3": "Télécharger l'application Catalyst Voting.", "wallet.voting.line4": "Ouvrez l'application Catalyst Voting App et cliquez sur le bouton Compléter l'inscription.", - "wallet.voting.lineTitle": "S'enregistrer pour voter au Fund { round }", + "wallet.voting.lineTitle": "S'enregistrer pour voter au { fundName }", "wallet.withdrawal.transaction.unregister": "Cette opération va désinscrire une ou plusieurs clés de staking, ce qui vous permettra de récupérer votre dépôt de {refundAmount} {ticker}", "widgets.copyableaddress.addressCopyTooltipMessage": "Copier dans le presse-papier", "widgets.explorer.tooltip": "Aller sur {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/hr-HR.json b/packages/yoroi-extension/app/i18n/locales/hr-HR.json index 088b4a2f9b..010e48fa84 100644 --- a/packages/yoroi-extension/app/i18n/locales/hr-HR.json +++ b/packages/yoroi-extension/app/i18n/locales/hr-HR.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "Copy to clipboard", "widgets.explorer.tooltip": "Go to {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/id-ID.json b/packages/yoroi-extension/app/i18n/locales/id-ID.json index b900f04c66..d2e53cfd13 100644 --- a/packages/yoroi-extension/app/i18n/locales/id-ID.json +++ b/packages/yoroi-extension/app/i18n/locales/id-ID.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "Menyalin ke clipboard", "widgets.explorer.tooltip": "Pergi ke {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/it-IT.json b/packages/yoroi-extension/app/i18n/locales/it-IT.json index 44f63b15ec..5d3ff93c07 100644 --- a/packages/yoroi-extension/app/i18n/locales/it-IT.json +++ b/packages/yoroi-extension/app/i18n/locales/it-IT.json @@ -776,7 +776,7 @@ "wallet.voting.line2": "Prima di iniziare, assicurati di completare i seguenti passi", "wallet.voting.line3": "Scarica la Catalyst Voting App.", "wallet.voting.line4": "Aprire la Catalyst Voting App e clicca sul pulsante Completa la registrazione.", - "wallet.voting.lineTitle": "Registrati per votare sul Fund { round }", + "wallet.voting.lineTitle": "Registrati per votare sul { fundName }", "wallet.withdrawal.transaction.unregister": "Questa transazione deregistrerà una o più chiavi di staking, restituendovi i vostri {refundAmount} {ticker} dal vostro deposito", "widgets.copyableaddress.addressCopyTooltipMessage": "Copia negli appunti", "widgets.explorer.tooltip": "Vai a {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/ja-JP.json b/packages/yoroi-extension/app/i18n/locales/ja-JP.json index f1bf903f1c..97de7c3656 100644 --- a/packages/yoroi-extension/app/i18n/locales/ja-JP.json +++ b/packages/yoroi-extension/app/i18n/locales/ja-JP.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "クリップボードにコピーする", "widgets.explorer.tooltip": "{websiteName}へ", diff --git a/packages/yoroi-extension/app/i18n/locales/ko-KR.json b/packages/yoroi-extension/app/i18n/locales/ko-KR.json index 69608f4e6d..a6f4fb82b8 100644 --- a/packages/yoroi-extension/app/i18n/locales/ko-KR.json +++ b/packages/yoroi-extension/app/i18n/locales/ko-KR.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "클립보드로 복사", "widgets.explorer.tooltip": "{websiteName} 로 가기", diff --git a/packages/yoroi-extension/app/i18n/locales/nl-NL.json b/packages/yoroi-extension/app/i18n/locales/nl-NL.json index 1a506e55bb..0b1a8f80cb 100644 --- a/packages/yoroi-extension/app/i18n/locales/nl-NL.json +++ b/packages/yoroi-extension/app/i18n/locales/nl-NL.json @@ -776,7 +776,7 @@ "wallet.voting.line2": "Zorg ervoor dat u de onderstaande stappen uitvoert voordat u begint", "wallet.voting.line3": "Download de Catalyst Stem-applicatie.", "wallet.voting.line4": "Open de Catalyst Stem-applicatie en klik op de knop \"Registratie voltooien\".", - "wallet.voting.lineTitle": "Registreer uzelf om op Fonds { round } te stemmen", + "wallet.voting.lineTitle": "Registreer uzelf om op { fundName } te stemmen", "wallet.withdrawal.transaction.unregister": "Met deze transactie wordt de registratie van een of meer stemsleutels ongedaan gemaakt, waardoor u uw {refundAmount} {ticker} van uw storting terugkrijgt", "widgets.copyableaddress.addressCopyTooltipMessage": "Kopieer naar klembord", "widgets.explorer.tooltip": "Ga naar {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/pt-BR.json b/packages/yoroi-extension/app/i18n/locales/pt-BR.json index 5b50369079..26b9388898 100644 --- a/packages/yoroi-extension/app/i18n/locales/pt-BR.json +++ b/packages/yoroi-extension/app/i18n/locales/pt-BR.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "Essa transação irá revogar uma ou mais chave de participação, reembolsando suas {refundAmount}{ticker} pagas como depósito no registro de sua chave de participação", "widgets.copyableaddress.addressCopyTooltipMessage": "Copiar para área de transferência", "widgets.explorer.tooltip": "Ir para {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/ru-RU.json b/packages/yoroi-extension/app/i18n/locales/ru-RU.json index cca36055fb..c9900d60d9 100644 --- a/packages/yoroi-extension/app/i18n/locales/ru-RU.json +++ b/packages/yoroi-extension/app/i18n/locales/ru-RU.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "Скопировать в буфер обмена", "widgets.explorer.tooltip": "Перейти на {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/sk-SK.json b/packages/yoroi-extension/app/i18n/locales/sk-SK.json index e8b7190294..b3d54cc43c 100644 --- a/packages/yoroi-extension/app/i18n/locales/sk-SK.json +++ b/packages/yoroi-extension/app/i18n/locales/sk-SK.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "Copy to clipboard", "widgets.explorer.tooltip": "Go to {websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/tr-TR.json b/packages/yoroi-extension/app/i18n/locales/tr-TR.json index 1c6eed49ff..65caeb6c2b 100644 --- a/packages/yoroi-extension/app/i18n/locales/tr-TR.json +++ b/packages/yoroi-extension/app/i18n/locales/tr-TR.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "Panoya kopyala", "widgets.explorer.tooltip": "{websiteName} Adresine Git", diff --git a/packages/yoroi-extension/app/i18n/locales/zh-Hans.json b/packages/yoroi-extension/app/i18n/locales/zh-Hans.json index 7fac048c45..2006e6cb55 100644 --- a/packages/yoroi-extension/app/i18n/locales/zh-Hans.json +++ b/packages/yoroi-extension/app/i18n/locales/zh-Hans.json @@ -776,7 +776,7 @@ "wallet.voting.line2": "在您开始之前,请确保完成了下列步骤", "wallet.voting.line3": "下载Catalyst投票应用。", "wallet.voting.line4": "打开Catalyst投票应用,点击完成注册按钮。", - "wallet.voting.lineTitle": "注册并给资金{ round }投票", + "wallet.voting.lineTitle": "注册并给资金{ fundName }投票", "wallet.withdrawal.transaction.unregister": "此交易将取消注册一个或多个委托密钥,从而从您的存款中退还您的{refundAmount}{ticker}。", "widgets.copyableaddress.addressCopyTooltipMessage": "复制到剪贴板", "widgets.explorer.tooltip": "前往{websiteName}", diff --git a/packages/yoroi-extension/app/i18n/locales/zh-Hant.json b/packages/yoroi-extension/app/i18n/locales/zh-Hant.json index 9892d39224..92ecc3cc5c 100644 --- a/packages/yoroi-extension/app/i18n/locales/zh-Hant.json +++ b/packages/yoroi-extension/app/i18n/locales/zh-Hant.json @@ -776,7 +776,7 @@ "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.", - "wallet.voting.lineTitle": "Register to vote on Fund { round }", + "wallet.voting.lineTitle": "Register to vote on { fundName }", "wallet.withdrawal.transaction.unregister": "This transaction will unregister one or more staking keys, giving you back your {refundAmount} {ticker} from your deposit", "widgets.copyableaddress.addressCopyTooltipMessage": "複製到剪貼板", "widgets.explorer.tooltip": "前往{websiteName}", From f61477e8e73713c5e69af2cfe01f0f93268811ea Mon Sep 17 00:00:00 2001 From: vantuz-subhuman <vantuz-subhuman@yandex.ru> Date: Thu, 4 Aug 2022 12:53:01 +0300 Subject: [PATCH 25/28] Version bump: 4.15.200 --- 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 56aea72eb8..dc6f236eef 100644 --- a/packages/yoroi-extension/package-lock.json +++ b/packages/yoroi-extension/package-lock.json @@ -1,6 +1,6 @@ { "name": "yoroi", - "version": "4.15.100", + "version": "4.15.200", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/yoroi-extension/package.json b/packages/yoroi-extension/package.json index 445cabc3a4..894ecb0a8c 100644 --- a/packages/yoroi-extension/package.json +++ b/packages/yoroi-extension/package.json @@ -1,6 +1,6 @@ { "name": "yoroi", - "version": "4.15.100", + "version": "4.15.200", "description": "Cardano ADA wallet", "scripts": { "dev:build": "rimraf dev/ && babel-node scripts/build --type=debug", From 9d2db4c48656d2092c21a063db6b2701422d24e5 Mon Sep 17 00:00:00 2001 From: Denis <nebytov.d@gmail.com> Date: Thu, 4 Aug 2022 13:16:01 +0300 Subject: [PATCH 26/28] Updated the step of downloading trezor firmwares --- .github/workflows/tests.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2054a2c773..028a1d0fe9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -153,16 +153,11 @@ jobs: - name: Download firmware working-directory: ../trezor-user-env/src/binaries/firmware/bin/ - run: | - sed '/^.*R_LATEST_BUILD.*$/d' download.sh | sed '/^.*trezor_r_master.*$/d' > temp_file.sh - rm download.sh - mv temp_file.sh download.sh - chmod +x download.sh - sudo ./download.sh + run: sudo ./download.sh - name: Download trezord-go - working-directory: ../trezor-user-env - run: sudo ./src/binaries/trezord-go/bin/download.sh + working-directory: ../trezor-user-env/src/binaries/trezord-go/bin/ + run: sudo ./download.sh - name: Copy the v2-master firmware to the root of the project working-directory: ../trezor-user-env From 3dbf52ab433f70d133388220ec89d21a4eb819c2 Mon Sep 17 00:00:00 2001 From: vantuz-subhuman <vantuz-subhuman@yandex.ru> Date: Mon, 8 Aug 2022 12:31:00 +0300 Subject: [PATCH 27/28] lint fixes --- packages/yoroi-extension/app/api/analytics/index.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/yoroi-extension/app/api/analytics/index.js b/packages/yoroi-extension/app/api/analytics/index.js index a00d81ab6e..73f063a9bd 100644 --- a/packages/yoroi-extension/app/api/analytics/index.js +++ b/packages/yoroi-extension/app/api/analytics/index.js @@ -9,7 +9,7 @@ import LocalStorageApi, { import { environment } from '../../environment'; import { TRACKED_ROUTES } from '../../routes-config'; import type { StoresMap } from '../../stores'; -import { isTestnet as isTestnetFunc} from '../ada/lib/storage/database/prepackaged/networks'; +import { isTestnet as isTestnetFunc } from '../ada/lib/storage/database/prepackaged/networks'; const MATOMO_URL = 'https://analytics.emurgo-rnd.com/matomo.php'; const SITE_ID = '4'; @@ -146,9 +146,6 @@ function generateAnalyticsInstanceId(): string { return cryptoRandomString({ length: 16 }); } -function getCurrentWalletInfo() { -} - function emitEvent(instanceId: string, event: string): void { if (environment.isDev() || environment.isTest()) { return; From 9da586801109b2e78520fe857d5193ddd4679bbd Mon Sep 17 00:00:00 2001 From: vantuz-subhuman <vantuz-subhuman@yandex.ru> Date: Mon, 8 Aug 2022 12:43:28 +0300 Subject: [PATCH 28/28] lint fixes --- .../app/containers/wallet/staking/StakingPage.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js b/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js index d551c087e7..24aad61761 100644 --- a/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js +++ b/packages/yoroi-extension/app/containers/wallet/staking/StakingPage.js @@ -507,10 +507,6 @@ class StakingPage extends Component<AllProps> { getLocalPoolInfo: ($ReadOnly<NetworkRow>, string) => void | PoolMeta, getDelegationRequests: (PublicDeriver<>) => void | DelegationRequests, |}, - time: {| - getCurrentTimeRequests: (PublicDeriver<>) => CurrentTimeRequests, - getTimeCalcRequests: (PublicDeriver<>) => TimeCalcRequests, - |}, profile: {| shouldHideBalance: boolean, unitOfAccount: UnitOfAccountSettingType, @@ -589,7 +585,6 @@ class StakingPage extends Component<AllProps> { coinPriceStore: { getCurrentPrice: stores.coinPriceStore.getCurrentPrice, }, - time, substores: { ada: { delegation: {