diff --git a/apps/token/src/components/locked-progress/locked-progress.tsx b/apps/token/src/components/locked-progress/locked-progress.tsx
index c1cf2cc3b..ed9637b8a 100644
--- a/apps/token/src/components/locked-progress/locked-progress.tsx
+++ b/apps/token/src/components/locked-progress/locked-progress.tsx
@@ -70,6 +70,7 @@ export interface LockedProgressProps {
leftColor?: string;
rightColor?: string;
light?: boolean;
+ decimals?: number;
}
export const LockedProgress = ({
@@ -81,6 +82,7 @@ export const LockedProgress = ({
leftColor = Colors.vega.pink,
rightColor = Colors.vega.green,
light = false,
+ decimals = 2,
}: LockedProgressProps) => {
const lockedPercentage = React.useMemo(() => {
return locked.div(total).times(100);
@@ -117,8 +119,8 @@ export const LockedProgress = ({
- {formatNumber(locked, 2)}
- {formatNumber(unlocked, 2)}
+ {formatNumber(locked, decimals)}
+ {formatNumber(unlocked, decimals)}
>
);
diff --git a/apps/token/src/i18n/translations/dev.json b/apps/token/src/i18n/translations/dev.json
index bc61ef421..6f6463837 100644
--- a/apps/token/src/i18n/translations/dev.json
+++ b/apps/token/src/i18n/translations/dev.json
@@ -193,6 +193,7 @@
"noGovernanceTokens": "You need some VEGA tokens to participate in governance",
"youVoted": "You voted",
"changeVote": "Change vote",
+ "voteRequested": "Please confirm transaction in wallet",
"votePending": "Casting vote",
"voteError": "Something went wrong, and your vote was not seen by the network",
"back": "back",
@@ -280,6 +281,7 @@
"stakingHasAssociated": "You have {{tokens}} $VEGA tokens associated.",
"stakingAssociateMoreButton": "Associate more $VEGA tokens with wallet",
"stakingDisassociateButton": "Disassociate $VEGA tokens from wallet",
+ "stakingConfirm": "Open you wallet app to confirm",
"associateButton": "Associate $VEGA tokens with wallet",
"nodeQueryFailed": "Could not get data for validator {{node}}",
"stakeAddPendingTitle": "Adding {{amount}} $VEGA to validator {{node}}",
@@ -540,5 +542,8 @@
"numberOfAgainstVotes": "Number of votes against",
"yesPercentage": "Yes percentage",
"noPercentage": "No percentage",
- "proposalTerms": "Proposal terms"
+ "proposalTerms": "Proposal terms",
+ "currentlySetTo": "Currently set to ",
+ "pass": "Pass",
+ "fail": "Fail"
}
diff --git a/apps/token/src/routes/governance/components/current-proposal-status/current-proposal-status.tsx b/apps/token/src/routes/governance/components/current-proposal-status/current-proposal-status.tsx
index 1000a146b..1ecbfb938 100644
--- a/apps/token/src/routes/governance/components/current-proposal-status/current-proposal-status.tsx
+++ b/apps/token/src/routes/governance/components/current-proposal-status/current-proposal-status.tsx
@@ -34,30 +34,22 @@ export const CurrentProposalStatus = ({
{ addSuffix: true }
);
- if (proposal.state === ProposalState.Open && willPass) {
- return {t('shouldPass')};
- }
-
- if (!participationMet) {
- return (
- <>
- {t('voteFailedReason')}
-
- {t('participationNotMet')}
-
- {daysClosedAgo}.
- >
- );
- }
-
- if (!majorityMet) {
- return (
- <>
- {t('voteFailedReason')}
- {t('majorityNotMet')}
- {daysClosedAgo}.
- >
- );
+ if (proposal.state === ProposalState.Open) {
+ if (willPass) {
+ return (
+ <>
+ {t('currentlySetTo')}
+ {t('pass')}
+ >
+ );
+ } else {
+ return (
+ <>
+ {t('currentlySetTo')}
+ {t('fail')}
+ >
+ );
+ }
}
if (
@@ -65,6 +57,26 @@ export const CurrentProposalStatus = ({
proposal.state === ProposalState.Declined ||
proposal.state === ProposalState.Rejected
) {
+ if (!participationMet) {
+ return (
+ <>
+ {t('voteFailedReason')}
+ {t('participationNotMet')}
+ {daysClosedAgo}.
+ >
+ );
+ }
+
+ if (!majorityMet) {
+ return (
+ <>
+ {t('voteFailedReason')}
+ {t('majorityNotMet')}
+ {daysClosedAgo}.
+ >
+ );
+ }
+
return (
<>
{t('voteFailedReason')}
diff --git a/apps/token/src/routes/governance/components/vote-details/use-user-vote.tsx b/apps/token/src/routes/governance/components/vote-details/use-user-vote.tsx
index a9fd5be7d..cced62554 100644
--- a/apps/token/src/routes/governance/components/vote-details/use-user-vote.tsx
+++ b/apps/token/src/routes/governance/components/vote-details/use-user-vote.tsx
@@ -17,6 +17,7 @@ export enum VoteState {
NotCast = 'NotCast',
Yes = 'Yes',
No = 'No',
+ Requested = 'Requested',
Pending = 'Pending',
Failed = 'Failed',
}
@@ -69,7 +70,7 @@ export function useUserVote(
}
}, [userVote]);
- // Start a starts a timeout of 30s to set a failed message if
+ // Starts a timeout of 30s to set a failed message if
// the vote is not seen by the time the callback is invoked
React.useEffect(() => {
// eslint-disable-next-line
@@ -93,7 +94,7 @@ export function useUserVote(
async function castVote(value: VoteValue) {
if (!proposalId || !keypair) return;
- setVoteState(VoteState.Pending);
+ setVoteState(VoteState.Requested);
try {
const variables = {
@@ -105,6 +106,7 @@ export function useUserVote(
},
};
await sendTx(variables);
+ setVoteState(VoteState.Pending);
// Now await vote via poll in parent component
} catch (err) {
diff --git a/apps/token/src/routes/governance/components/vote-details/vote-buttons.tsx b/apps/token/src/routes/governance/components/vote-details/vote-buttons.tsx
index e8d70992a..ef588ed0a 100644
--- a/apps/token/src/routes/governance/components/vote-details/vote-buttons.tsx
+++ b/apps/token/src/routes/governance/components/vote-details/vote-buttons.tsx
@@ -124,6 +124,10 @@ export const VoteButtons = ({
return
{cantVoteUI}
;
}
+ if (voteState === VoteState.Requested) {
+ return {t('voteRequested')}...
;
+ }
+
if (voteState === VoteState.Pending) {
return {t('votePending')}...
;
}
diff --git a/apps/token/src/routes/governance/components/vote-details/vote-details.tsx b/apps/token/src/routes/governance/components/vote-details/vote-details.tsx
index 287644684..5057c4bd7 100644
--- a/apps/token/src/routes/governance/components/vote-details/vote-details.tsx
+++ b/apps/token/src/routes/governance/components/vote-details/vote-details.tsx
@@ -49,7 +49,7 @@ export const VoteDetails = ({ proposal }: VoteDetailsProps) => {
- .
+ {'. '}
{proposal.state === ProposalState.Open ? daysLeft : null}
diff --git a/apps/token/src/routes/redemption/tranche-item.tsx b/apps/token/src/routes/redemption/tranche-item.tsx
index 54e157dd2..3a3de1b2b 100644
--- a/apps/token/src/routes/redemption/tranche-item.tsx
+++ b/apps/token/src/routes/redemption/tranche-item.tsx
@@ -76,6 +76,7 @@ export const TrancheItem = ({
total={total}
leftLabel={t('Locked')}
rightLabel={t('Unlocked')}
+ decimals={18}
/>
diff --git a/apps/token/src/routes/staking/disassociate/disassociate-page.tsx b/apps/token/src/routes/staking/disassociate/disassociate-page.tsx
index 5219a48bc..0c472dcc8 100644
--- a/apps/token/src/routes/staking/disassociate/disassociate-page.tsx
+++ b/apps/token/src/routes/staking/disassociate/disassociate-page.tsx
@@ -8,6 +8,7 @@ import {
} from '../../../components/staking-method-radio';
import { TxState } from '../../../hooks/transaction-reducer';
import { useSearchParams } from '../../../hooks/use-search-params';
+import { useRefreshAssociatedBalances } from '../../../hooks/use-refresh-associated-balances';
import { ContractDisassociate } from './contract-disassociate';
import { DisassociateTransaction } from './disassociate-transaction';
import { useRemoveStake } from './hooks';
@@ -26,6 +27,7 @@ export const DisassociatePage = ({
const [amount, setAmount] = React.useState
('');
const [selectedStakingMethod, setSelectedStakingMethod] =
React.useState(params.method || null);
+ const refreshBalances = useRefreshAssociatedBalances();
// Clear the amount when the staking method changes
React.useEffect(() => {
@@ -38,6 +40,12 @@ export const DisassociatePage = ({
perform: txPerform,
} = useRemoveStake(address, amount, vegaKey.pub, selectedStakingMethod);
+ React.useEffect(() => {
+ if (txState.txState === TxState.Complete) {
+ refreshBalances(address, vegaKey.pub);
+ }
+ }, [txState, refreshBalances, address, vegaKey.pub]);
+
if (txState.txState !== TxState.Default) {
return (
;
+ } else if (formState === FormState.Requested) {
+ return (
+
+ {t('stakingConfirm')}
+
+ );
} else if (formState === FormState.Pending) {
return ;
} else if (formState === FormState.Success) {