fix: governance page crashing when a freeform proposal exists (#941)
This commit is contained in:
parent
f11403b1af
commit
33a044e6ad
@ -17,5 +17,9 @@ export const NetworkParams = {
|
|||||||
'governance.proposal.updateNetParam.requiredMajority',
|
'governance.proposal.updateNetParam.requiredMajority',
|
||||||
GOV_UPDATE_NET_PARAM_REQUIRED_PARTICIPATION:
|
GOV_UPDATE_NET_PARAM_REQUIRED_PARTICIPATION:
|
||||||
'governance.proposal.updateNetParam.requiredParticipation',
|
'governance.proposal.updateNetParam.requiredParticipation',
|
||||||
|
GOV_FREEFORM_REQUIRED_PARTICIPATION:
|
||||||
|
'governance.proposal.freeform.requiredParticipation',
|
||||||
|
GOV_FREEFORM_REQUIRED_MAJORITY:
|
||||||
|
'governance.proposal.freeform.requiredMajority',
|
||||||
VALIDATOR_DELEGATION_MIN_AMOUNT: 'validators.delegation.minAmount',
|
VALIDATOR_DELEGATION_MIN_AMOUNT: 'validators.delegation.minAmount',
|
||||||
};
|
};
|
||||||
|
@ -25,6 +25,8 @@ const useProposalNetworkParams = ({
|
|||||||
NetworkParams.GOV_ASSET_REQUIRED_PARTICIPATION,
|
NetworkParams.GOV_ASSET_REQUIRED_PARTICIPATION,
|
||||||
NetworkParams.GOV_UPDATE_NET_PARAM_REQUIRED_MAJORITY,
|
NetworkParams.GOV_UPDATE_NET_PARAM_REQUIRED_MAJORITY,
|
||||||
NetworkParams.GOV_UPDATE_NET_PARAM_REQUIRED_PARTICIPATION,
|
NetworkParams.GOV_UPDATE_NET_PARAM_REQUIRED_PARTICIPATION,
|
||||||
|
NetworkParams.GOV_FREEFORM_REQUIRED_MAJORITY,
|
||||||
|
NetworkParams.GOV_FREEFORM_REQUIRED_PARTICIPATION,
|
||||||
]);
|
]);
|
||||||
if (loading || !data) {
|
if (loading || !data) {
|
||||||
return {
|
return {
|
||||||
@ -42,6 +44,8 @@ const useProposalNetworkParams = ({
|
|||||||
assetParticipation,
|
assetParticipation,
|
||||||
paramMajority,
|
paramMajority,
|
||||||
paramParticipation,
|
paramParticipation,
|
||||||
|
freeformMajority,
|
||||||
|
freeformParticipation,
|
||||||
] = data;
|
] = data;
|
||||||
|
|
||||||
switch (proposal.terms.change.__typename) {
|
switch (proposal.terms.change.__typename) {
|
||||||
@ -65,6 +69,11 @@ const useProposalNetworkParams = ({
|
|||||||
requiredMajority: newMarketMajority,
|
requiredMajority: newMarketMajority,
|
||||||
requiredParticipation: new BigNumber(newMarketParticipation),
|
requiredParticipation: new BigNumber(newMarketParticipation),
|
||||||
};
|
};
|
||||||
|
case 'NewFreeform':
|
||||||
|
return {
|
||||||
|
requiredMajority: freeformMajority,
|
||||||
|
requiredParticipation: freeformParticipation,
|
||||||
|
};
|
||||||
default:
|
default:
|
||||||
throw new Error('Unknown proposal type');
|
throw new Error('Unknown proposal type');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user