+
-
{t(
@@ -23,7 +23,7 @@ export const RiskMessage = () => {
-
+
{t(
'By using the Vega Governance App, you acknowledge that you have read and understood the'
)}{' '}
diff --git a/apps/governance/src/components/vega-wallet-dialogs/vega-wallet-dialogs.tsx b/apps/governance/src/components/vega-wallet-dialogs/vega-wallet-dialogs.tsx
index d202e5bf5..4230bf05b 100644
--- a/apps/governance/src/components/vega-wallet-dialogs/vega-wallet-dialogs.tsx
+++ b/apps/governance/src/components/vega-wallet-dialogs/vega-wallet-dialogs.tsx
@@ -1,25 +1,39 @@
import {
- VegaConnectDialog,
- VegaManageDialog,
- ViewAsDialog,
-} from '@vegaprotocol/wallet';
+ ConnectDialogWithRiskAck,
+ useDialogStore,
+} from '@vegaprotocol/wallet-react';
import {
AppStateActionType,
useAppState,
} from '../../contexts/app-state/app-state-context';
-import { useConnectors } from '../../lib/vega-connectors';
import { RiskMessage } from './risk-message';
+import { VegaManageDialog } from '../manage-dialog';
+import { useLocalStorage } from '@vegaprotocol/react-helpers';
+import { Networks, useEnvironment } from '@vegaprotocol/environment';
export const VegaWalletDialogs = () => {
+ const { VEGA_ENV } = useEnvironment();
const { appState, appDispatch } = useAppState();
- const connectors = useConnectors();
+ const [riskAccepted, setRiskAccepted] = useLocalStorage(
+ 'vega_wallet_risk_accepted'
+ );
+ const vegaWalletDialogOpen = useDialogStore((store) => store.isOpen);
+ const setVegaWalletDialog = useDialogStore((store) => store.set);
return (
<>
- }
+ }
+ onRiskAccepted={() => setRiskAccepted('true')}
+ onRiskRejected={() => {
+ setRiskAccepted('false');
+ setVegaWalletDialog(false);
+ }}
/>
-
@@ -29,8 +43,6 @@ export const VegaWalletDialogs = () => {
})
}
/>
-
-
>
);
};
diff --git a/apps/governance/src/components/vega-wallet/hooks.ts b/apps/governance/src/components/vega-wallet/hooks.ts
index 38f9f9d10..6936ef815 100644
--- a/apps/governance/src/components/vega-wallet/hooks.ts
+++ b/apps/governance/src/components/vega-wallet/hooks.ts
@@ -4,14 +4,13 @@ import keyBy from 'lodash/keyBy';
import uniq from 'lodash/uniq';
import React from 'react';
import { useTranslation } from 'react-i18next';
-import { ENV } from '../../config';
import noIcon from '../../images/token-no-icon.png';
import vegaBlack from '../../images/vega_black.png';
import vegaVesting from '../../images/vega_vesting.png';
import { BigNumber } from '../../lib/bignumber';
import { type WalletCardAssetProps } from '../wallet-card';
-import { useVegaWallet } from '@vegaprotocol/wallet';
+import { useVegaWallet } from '@vegaprotocol/wallet-react';
import { useContracts } from '../../contexts/contracts/contracts-context';
import * as Schema from '@vegaprotocol/types';
import {
@@ -37,7 +36,6 @@ export const usePollForDelegations = () => {
const { t } = useTranslation();
const { pubKey } = useVegaWallet();
const client = useApolloClient();
- const { delegationsPagination } = ENV;
const [delegations, setDelegations] = React.useState<
WalletDelegationFieldsFragment[]
>([]);
@@ -68,11 +66,9 @@ export const usePollForDelegations = () => {
query: DelegationsDocument,
variables: {
partyId: pubKey,
- delegationsPagination: delegationsPagination
- ? {
- first: Number(delegationsPagination),
- }
- : undefined,
+ delegationsPagination: {
+ first: 50,
+ },
},
fetchPolicy: 'network-only',
})
@@ -236,14 +232,14 @@ export const usePollForDelegations = () => {
// will just continue to fail
clearInterval(interval);
});
- }, 1000);
+ }, 20000);
}
return () => {
clearInterval(interval);
mounted = false;
};
- }, [delegationsPagination, client, decimals, pubKey, t, vegaToken.address]);
+ }, [client, decimals, pubKey, t, vegaToken.address]);
return { delegations, currentStakeAvailable, delegatedNodes, accounts };
};
diff --git a/apps/governance/src/components/vega-wallet/vega-wallet-prompt.tsx b/apps/governance/src/components/vega-wallet/vega-wallet-prompt.tsx
index 340aa389e..73b461695 100644
--- a/apps/governance/src/components/vega-wallet/vega-wallet-prompt.tsx
+++ b/apps/governance/src/components/vega-wallet/vega-wallet-prompt.tsx
@@ -1,11 +1,11 @@
import { ButtonLink, Link } from '@vegaprotocol/ui-toolkit';
import { useTranslation } from 'react-i18next';
import { ExternalLinks } from '@vegaprotocol/environment';
-import { useViewAsDialog } from '@vegaprotocol/wallet';
+import { useConnect } from '@vegaprotocol/wallet-react';
export const VegaWalletPrompt = () => {
const { t } = useTranslation();
- const setViewAsDialog = useViewAsDialog((state) => state.setOpen);
+ const { connect } = useConnect();
return (
<>
{t('getWallet')}
@@ -16,7 +16,7 @@ export const VegaWalletPrompt = () => {
setViewAsDialog(true)}
+ onClick={() => connect('viewParty')}
>
{t('viewAsParty')}
diff --git a/apps/governance/src/components/vega-wallet/vega-wallet.tsx b/apps/governance/src/components/vega-wallet/vega-wallet.tsx
index 0e6d5c8fe..472626e8a 100644
--- a/apps/governance/src/components/vega-wallet/vega-wallet.tsx
+++ b/apps/governance/src/components/vega-wallet/vega-wallet.tsx
@@ -25,7 +25,7 @@ import {
} from '../wallet-card';
import { VegaWalletPrompt } from './vega-wallet-prompt';
import { usePollForDelegations } from './hooks';
-import { useVegaWallet, useVegaWalletDialogStore } from '@vegaprotocol/wallet';
+import { useVegaWallet, useDialogStore } from '@vegaprotocol/wallet-react';
import { Button, ButtonLink } from '@vegaprotocol/ui-toolkit';
import { toBigNum } from '@vegaprotocol/utils';
import { usePendingBalancesStore } from '../../hooks/use-pending-balances-manager';
@@ -34,16 +34,17 @@ import omit from 'lodash/omit';
export const VegaWallet = () => {
const { t } = useTranslation();
- const { pubKey, pubKeys } = useVegaWallet();
+ const { status, pubKey, pubKeys } = useVegaWallet();
const pubKeyObj = useMemo(() => {
return pubKeys?.find((pk) => pk.publicKey === pubKey);
}, [pubKey, pubKeys]);
- const child = !pubKeys ? (
-
- ) : (
- pk.publicKey)} />
- );
+ const child =
+ status === 'connected' ? (
+ pk.publicKey)} />
+ ) : (
+
+ );
return (
@@ -75,9 +76,7 @@ export const VegaWallet = () => {
const VegaWalletNotConnected = () => {
const { t } = useTranslation();
- const { openVegaWalletDialog } = useVegaWalletDialogStore((store) => ({
- openVegaWalletDialog: store.openVegaWalletDialog,
- }));
+ const openVegaWalletDialog = useDialogStore((store) => store.open);
return (
<>
)}
-
+
{/** REQUIREMENTS */}
{dispatchStrategy && (
)}
@@ -365,6 +406,190 @@ const RewardCard = ({
);
};
+const StakingRewardCard = ({
+ colour,
+ rewardAmount,
+ rewardAsset,
+ endsIn,
+}: {
+ colour: CardColour;
+ rewardAmount: string;
+ /** The asset linked to the dispatch strategy via `dispatchMetricAssetId` property. */
+ rewardAsset?: Asset;
+ /** The number of epochs until the transfer stops. */
+ endsIn?: number;
+ /** The VEGA asset details, required to format the min staking amount. */
+ vegaAsset?: BasicAssetDetails;
+}) => {
+ const t = useT();
+ return (
+