Skip to content

Commit 7196d8e

Browse files
fix: [lw-10691]: add register as dRep banner and stake key raw info (#1537)
* fix: [lw-10691]: show register as drep banner and stake key raw info in staking center * fix: [lw-10691]: fix sonarcloud issues * fix: [lw-10691]: resolve pr comments * fix: [lw-10691]: fix ci issues * fix: [lw-10691]: fix tests * fix: [lw-10691]: resolve pr comments * fix: [lw-10691]: resolve pr comments * fix: [lw-10691] update to the latest figma * fix: [lw-10691]: resolve pr comments * fix: [lw-10691]: handle retired drep flow * fix: resolve sdet comments --------- Co-authored-by: Mircea Hasegan <mircea.hasegan@iohk.io>
1 parent cc85153 commit 7196d8e

File tree

29 files changed

+398
-194
lines changed

29 files changed

+398
-194
lines changed

apps/browser-extension-wallet/.env.defaults

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ TERMS_OF_USE_URL=https://www.lace.io/iohktermsandconditions.pdf
5252
YOUTUBE_RECOVERY_PHRASE_VIDEO_URL=https://www.youtube-nocookie.com/embed/hOFVXo969rk?si=0a-hNDVME6eTboIX
5353
BANXA_LACE_URL=https://lacewallet.banxa-sandbox.com/
5454
BANXA_HOMEPAGE_URL=https://banxa.com/
55+
GOV_TOOLS_URL_MAINNET=https://gov.tools
56+
GOV_TOOLS_URL_PREPROD=
57+
GOV_TOOLS_URL_PREVIEW=https://preview.gov.tools
58+
GOV_TOOLS_URL_SANCHONET=
5559

5660
# events tracking
5761
POSTHOG_HOST=https://e.lw.iog.io

apps/browser-extension-wallet/.env.developerpreview

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ TERMS_OF_USE_URL=https://www.lace.io/iohktermsandconditions.pdf
5151
YOUTUBE_RECOVERY_PHRASE_VIDEO_URL=https://www.youtube-nocookie.com/embed/hOFVXo969rk?si=0a-hNDVME6eTboIX
5252
BANXA_LACE_URL=https://lacewallet.banxa-sandbox.com/
5353
BANXA_HOMEPAGE_URL=https://banxa.com/
54+
GOV_TOOLS_URL_MAINNET=https://gov.tools
55+
GOV_TOOLS_URL_PREPROD=
56+
GOV_TOOLS_URL_PREVIEW=https://preview.gov.tools
57+
GOV_TOOLS_URL_SANCHONET=
5458

5559
# events tracking
5660
POSTHOG_HOST=https://e.lw.iog.io

apps/browser-extension-wallet/.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ TERMS_OF_USE_URL=https://www.lace.io/iohktermsandconditions.pdf
5050
YOUTUBE_RECOVERY_PHRASE_VIDEO_URL=https://www.youtube-nocookie.com/embed/hOFVXo969rk?si=0a-hNDVME6eTboIX
5151
BANXA_LACE_URL=https://lacewallet.banxa-sandbox.com/
5252
BANXA_HOMEPAGE_URL=https://banxa.com/
53+
GOV_TOOLS_URL_MAINNET=https://gov.tools
54+
GOV_TOOLS_URL_PREPROD=
55+
GOV_TOOLS_URL_PREVIEW=https://preview.gov.tools
56+
GOV_TOOLS_URL_SANCHONET=
5357
# events tracking
5458
POSTHOG_HOST=https://e.lw.iog.io
5559
# set this variable to true only in release packages. By having this set to false, we ensure that we will not be using Post Hog production projects tokens in development stage

apps/browser-extension-wallet/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"prepack": "yarn build",
3535
"prepare": "ts-patch install -s",
3636
"prettier": "run -T prettier --write .",
37-
"test": "run -T jest --config test/jest.config.js --silent",
37+
"test": "run -T jest --config test/jest.config.js",
3838
"test:e2e": "yarn exec echo \"No e2e tests on this app yet!\"",
3939
"type-check": "echo \"@lace/browser-extension-wallet: no type-check command specified\"",
4040
"watch": "NODE_OPTIONS='--openssl-legacy-provider' rm -rf dist & run -T webpack --config webpack.sw.dev.js --progress --watch & run -T webpack --config webpack.app.dev.js --progress --watch"

apps/browser-extension-wallet/src/config.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export type Config = {
3232
CEXPLORER_URL_PATHS: CExplorerUrlPaths;
3333
SAVED_PRICE_DURATION: number;
3434
DEFAULT_SUBMIT_API: string;
35+
GOV_TOOLS_URLS: Record<EnvironmentTypes, string>;
3536
};
3637

3738
// eslint-disable-next-line complexity
@@ -134,6 +135,12 @@ export const config = (): Config => {
134135
SAVED_PRICE_DURATION: !Number.isNaN(Number(process.env.SAVED_PRICE_DURATION_IN_MINUTES))
135136
? Number(process.env.SAVED_PRICE_DURATION_IN_MINUTES)
136137
: 720,
137-
DEFAULT_SUBMIT_API: 'http://localhost:8090/api/submit/tx'
138+
DEFAULT_SUBMIT_API: 'http://localhost:8090/api/submit/tx',
139+
GOV_TOOLS_URLS: {
140+
Mainnet: `${process.env.GOV_TOOLS_URL_MAINNET}`,
141+
Preprod: `${process.env.GOV_TOOLS_URL_PREPROD}`,
142+
Preview: `${process.env.GOV_TOOLS_URL_PREVIEW}`,
143+
Sanchonet: `${process.env.GOV_TOOLS_URL_SANCHONET}`
144+
}
138145
};
139146
};

apps/browser-extension-wallet/src/features/delegation/components/DelegationLayout.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import isNumber from 'lodash/isNumber';
33
import { useTranslation } from 'react-i18next';
44
import { Skeleton, Typography } from 'antd';
55
import { Wallet } from '@lace/cardano';
6-
import { StakePoolSearch, StakePoolSearchProps } from '@lace/staking';
6+
import { StakePoolSearch, StakePoolSearchProps, RegisterAsDRepBanner } from '@lace/staking';
77
import { StakeFundsBanner } from '@views/browser/features/staking/components/StakeFundsBanner';
88
import { FundWalletBanner } from '@src/views/browser-view/components';
99
import { StakingInfo } from '@views/browser/features/staking/components/StakingInfo';
@@ -12,6 +12,10 @@ import { ExpandViewBanner } from './ExpandViewBanner';
1212
import styles from './DelegationLayout.module.scss';
1313
import { SectionTitle } from '@components/Layout/SectionTitle';
1414
import { useWalletStore } from '@src/stores';
15+
import { Box } from '@input-output-hk/lace-ui-toolkit';
16+
import { useExternalLinkOpener } from '@providers';
17+
import { useRewardAccountsData } from '@src/views/browser-view/features/staking/hooks';
18+
import { config } from '@src/config';
1519

1620
const { Text } = Typography;
1721

@@ -69,7 +73,10 @@ export const DelegationLayout = ({
6973
cardanoCoin
7074
}: DelegationLayoutProps): React.ReactElement => {
7175
const { t } = useTranslation();
76+
const { environmentName } = useWalletStore();
7277
const totalResultCount = useWalletStore(({ stakePoolSearchResults }) => stakePoolSearchResults?.totalResultCount);
78+
const openExternalLink = useExternalLinkOpener();
79+
const { GOV_TOOLS_URLS } = config();
7380
const showExpandView = hasNoFunds || (!hasNoFunds && !isDelegating) || isDelegating;
7481

7582
const stakePoolSearchTranslations = {
@@ -80,6 +87,9 @@ export const DelegationLayout = ({
8087
searchPlaceholder: t('cardano.stakePoolSearch.searchPlaceholder')
8188
};
8289

90+
const { areAllRegisteredStakeKeysWithoutVotingDelegation, poolIdToRewardAccountsMap } = useRewardAccountsData();
91+
const showRegisterAsDRepBanner = !hasNoFunds && areAllRegisteredStakeKeysWithoutVotingDelegation;
92+
8393
return (
8494
<ContentLayout
8595
title={<SectionTitle title={t('staking.sectionTitle')} classname={styles.sectionTilte} />}
@@ -88,6 +98,16 @@ export const DelegationLayout = ({
8898
<div className={styles.content}>
8999
<Skeleton loading={!isNumber(coinBalance)}>
90100
<div className={styles.contentWrapper}>
101+
{showRegisterAsDRepBanner && (
102+
<Box mt="$16">
103+
<RegisterAsDRepBanner
104+
openExternalLink={openExternalLink}
105+
govToolUrl={GOV_TOOLS_URLS[environmentName]}
106+
popupView
107+
/>
108+
</Box>
109+
)}
110+
91111
{canDelegate && <StakeFundsBanner balance={coinBalance} popupView />}
92112

93113
{hasNoFunds && (
@@ -103,6 +123,7 @@ export const DelegationLayout = ({
103123
<StakingInfo
104124
{...{
105125
...currentStakePool,
126+
rewardAccount: poolIdToRewardAccountsMap.get(currentStakePool.id)?.[0],
106127
coinBalance,
107128
fiat,
108129
totalRewards,

apps/browser-extension-wallet/src/features/delegation/components/MultiDelegationStakingPopup.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import { withSignTxConfirmation } from '@lib/wallet-api-ui';
2828
import { isMultidelegationSupportedByDevice } from '@views/browser/features/staking';
2929
import { useSharedWalletData } from '@hooks/useSharedWalletData';
3030
import { SignPolicy, useSecrets } from '@lace/core';
31+
import { useRewardAccountsData } from '@src/views/browser-view/features/staking/hooks';
32+
import { config } from '@src/config';
3133

3234
export const MultiDelegationStakingPopup = (): JSX.Element => {
3335
const { t } = useTranslation();
@@ -115,6 +117,8 @@ export const MultiDelegationStakingPopup = (): JSX.Element => {
115117
fetchNetworkInfo();
116118
}, [fetchNetworkInfo, blockchainProvider]);
117119

120+
const { GOV_TOOLS_URLS } = config();
121+
118122
return (
119123
<OutsideHandlesProvider
120124
{...{
@@ -162,7 +166,9 @@ export const MultiDelegationStakingPopup = (): JSX.Element => {
162166
isSharedWallet,
163167
signPolicy,
164168
sharedWalletKey,
165-
coSigners
169+
coSigners,
170+
useRewardAccountsData,
171+
govToolUrl: GOV_TOOLS_URLS[environmentName]
166172
}}
167173
>
168174
<ContentLayout

apps/browser-extension-wallet/src/features/delegation/components/Staking.tsx

Lines changed: 0 additions & 130 deletions
This file was deleted.

0 commit comments

Comments
 (0)