From 6d71109798dbb45c3503395d56402682c9daffe9 Mon Sep 17 00:00:00 2001 From: Sam Keen Date: Fri, 14 Oct 2022 14:13:51 +0100 Subject: [PATCH] =?UTF-8?q?Fix/1326:=20Do=20not=20allow=20proposal=20votin?= =?UTF-8?q?g=20unless=20sufficient=20associated=20t=E2=80=A6=20(#1701)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix/1326: Do not allow proposal voting unless sufficient associated tokens * Fix/1326: Renaming string * Fix/1326: Changes from PR comments and vote-buttons tests * Fix/1326: Switched to enum * Fix/1326: Used enum in unit tests --- apps/token/src/i18n/translations/dev.json | 1 + .../governance/components/propose/index.tsx | 1 - .../proposal-form-min-requirements.tsx | 30 -- .../governance/components/shared/index.tsx | 1 + .../proposal-min-requirements.spec.tsx} | 13 +- .../shared/proposal-min-requirements.tsx | 39 ++ .../{VoteButtons.ts => VoteButtonsQuery.ts} | 14 +- .../vote-details/vote-buttons.spec.tsx | 267 +++++++++++ .../components/vote-details/vote-buttons.tsx | 100 ++-- .../components/vote-details/vote-details.tsx | 41 +- .../propose/freeform/propose-freeform.tsx | 14 +- .../propose-network-parameter.tsx | 14 +- .../propose/new-asset/propose-new-asset.tsx | 25 +- .../propose/new-market/propose-new-market.tsx | 25 +- .../update-asset/propose-update-asset.tsx | 25 +- .../update-market/propose-update-market.tsx | 23 +- .../src/hooks/use-network-params.ts | 17 +- libs/types/src/__generated__/globalTypes.ts | 427 +++++++++--------- 18 files changed, 742 insertions(+), 335 deletions(-) delete mode 100644 apps/token/src/routes/governance/components/propose/proposal-form-min-requirements.tsx create mode 100644 apps/token/src/routes/governance/components/shared/index.tsx rename apps/token/src/routes/governance/components/{propose/proposal-form-min-requirements.spec.tsx => shared/proposal-min-requirements.spec.tsx} (67%) create mode 100644 apps/token/src/routes/governance/components/shared/proposal-min-requirements.tsx rename apps/token/src/routes/governance/components/vote-details/__generated__/{VoteButtons.ts => VoteButtonsQuery.ts} (70%) create mode 100644 apps/token/src/routes/governance/components/vote-details/vote-buttons.spec.tsx diff --git a/apps/token/src/i18n/translations/dev.json b/apps/token/src/i18n/translations/dev.json index 077b19080..08afd712f 100644 --- a/apps/token/src/i18n/translations/dev.json +++ b/apps/token/src/i18n/translations/dev.json @@ -640,6 +640,7 @@ "NewFreeformProposal": "New freeform proposal", "NewRawProposal": "New raw proposal", "MinProposalRequirements": "You must have at least {{value}} VEGA associated to make a proposal", + "MinProposalVoteRequirements": "You must have at least {{value}} VEGA associated to vote on this proposal", "totalSupply": "Total Supply", "viaWallet": "via wallet", "viaContract": "via vesting", diff --git a/apps/token/src/routes/governance/components/propose/index.tsx b/apps/token/src/routes/governance/components/propose/index.tsx index 92f807ec4..d8476c841 100644 --- a/apps/token/src/routes/governance/components/propose/index.tsx +++ b/apps/token/src/routes/governance/components/propose/index.tsx @@ -1,5 +1,4 @@ export * from './proposal-form-subheader'; -export * from './proposal-form-min-requirements'; export * from './proposal-form-title'; export * from './proposal-form-description'; export * from './proposal-form-terms'; diff --git a/apps/token/src/routes/governance/components/propose/proposal-form-min-requirements.tsx b/apps/token/src/routes/governance/components/propose/proposal-form-min-requirements.tsx deleted file mode 100644 index 476147f59..000000000 --- a/apps/token/src/routes/governance/components/propose/proposal-form-min-requirements.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { useTranslation } from 'react-i18next'; -import BigNumber from 'bignumber.js'; -import { addDecimal } from '@vegaprotocol/react-helpers'; - -interface ProposalFormMinRequirementsProps { - minProposerBalance: string | undefined; - spamProtectionMin: string | undefined; -} - -export const ProposalFormMinRequirements = ({ - minProposerBalance, - spamProtectionMin, -}: ProposalFormMinRequirementsProps) => { - const { t } = useTranslation(); - const minProposerBalanceFormatted = - minProposerBalance && new BigNumber(addDecimal(minProposerBalance, 18)); - const spamProtectionMinFormatted = - spamProtectionMin && new BigNumber(addDecimal(spamProtectionMin, 18)); - - const larger = - Number(minProposerBalanceFormatted) > (spamProtectionMinFormatted || 0) - ? minProposerBalanceFormatted - : spamProtectionMinFormatted; - - return ( -

- {t('MinProposalRequirements', { value: larger })} -

- ); -}; diff --git a/apps/token/src/routes/governance/components/shared/index.tsx b/apps/token/src/routes/governance/components/shared/index.tsx new file mode 100644 index 000000000..3668b1714 --- /dev/null +++ b/apps/token/src/routes/governance/components/shared/index.tsx @@ -0,0 +1 @@ +export * from './proposal-min-requirements'; diff --git a/apps/token/src/routes/governance/components/propose/proposal-form-min-requirements.spec.tsx b/apps/token/src/routes/governance/components/shared/proposal-min-requirements.spec.tsx similarity index 67% rename from apps/token/src/routes/governance/components/propose/proposal-form-min-requirements.spec.tsx rename to apps/token/src/routes/governance/components/shared/proposal-min-requirements.spec.tsx index 5be606756..f97c2e6b1 100644 --- a/apps/token/src/routes/governance/components/propose/proposal-form-min-requirements.spec.tsx +++ b/apps/token/src/routes/governance/components/shared/proposal-min-requirements.spec.tsx @@ -1,12 +1,14 @@ import { render } from '@testing-library/react'; -import { ProposalFormMinRequirements } from './proposal-form-min-requirements'; +import { ProposalMinRequirements } from './proposal-min-requirements'; +import { ProposalUserAction } from '@vegaprotocol/types'; describe('ProposalFormMinRequirements', () => { it('should render successfully with spam protection value, if larger', () => { const { baseElement } = render( - ); expect(baseElement).toBeTruthy(); @@ -18,9 +20,10 @@ describe('ProposalFormMinRequirements', () => { it('should render successfully with min proposer value, if larger', () => { const { baseElement } = render( - ); expect(baseElement).toBeTruthy(); diff --git a/apps/token/src/routes/governance/components/shared/proposal-min-requirements.tsx b/apps/token/src/routes/governance/components/shared/proposal-min-requirements.tsx new file mode 100644 index 000000000..3a43b00f8 --- /dev/null +++ b/apps/token/src/routes/governance/components/shared/proposal-min-requirements.tsx @@ -0,0 +1,39 @@ +import { useTranslation } from 'react-i18next'; +import BigNumber from 'bignumber.js'; +import { addDecimal } from '@vegaprotocol/react-helpers'; +import { ProposalUserAction } from '@vegaprotocol/types'; + +interface ProposalFormMinRequirementsProps { + minProposalBalance: string; + spamProtectionMin: string; + userAction: ProposalUserAction.CREATE | ProposalUserAction.VOTE; +} + +// Returns the larger, formatted value of the two token amounts +export const ProposalMinRequirements = ({ + minProposalBalance, + spamProtectionMin, + userAction, +}: ProposalFormMinRequirementsProps) => { + const { t } = useTranslation(); + const minProposalBalanceFormatted = new BigNumber( + addDecimal(minProposalBalance, 18) + ); + const spamProtectionMinFormatted = new BigNumber( + addDecimal(spamProtectionMin, 18) + ); + + const larger = + minProposalBalanceFormatted > spamProtectionMinFormatted + ? minProposalBalanceFormatted + : spamProtectionMinFormatted; + + return ( +
+ {userAction === ProposalUserAction.CREATE && + t('MinProposalRequirements', { value: Number(larger) })} + {userAction === ProposalUserAction.VOTE && + t('MinProposalVoteRequirements', { value: Number(larger) })} +
+ ); +}; diff --git a/apps/token/src/routes/governance/components/vote-details/__generated__/VoteButtons.ts b/apps/token/src/routes/governance/components/vote-details/__generated__/VoteButtonsQuery.ts similarity index 70% rename from apps/token/src/routes/governance/components/vote-details/__generated__/VoteButtons.ts rename to apps/token/src/routes/governance/components/vote-details/__generated__/VoteButtonsQuery.ts index 094fd9d4d..6b7751f9e 100644 --- a/apps/token/src/routes/governance/components/vote-details/__generated__/VoteButtons.ts +++ b/apps/token/src/routes/governance/components/vote-details/__generated__/VoteButtonsQuery.ts @@ -4,10 +4,10 @@ // This file was automatically generated and should not be edited. // ==================================================== -// GraphQL query operation: VoteButtons +// GraphQL query operation: VoteButtonsQuery // ==================================================== -export interface VoteButtons_party_stake { +export interface VoteButtonsQuery_party_stake { __typename: "PartyStake"; /** * The stake currently available for the party @@ -19,7 +19,7 @@ export interface VoteButtons_party_stake { currentStakeAvailableFormatted: string; } -export interface VoteButtons_party { +export interface VoteButtonsQuery_party { __typename: "Party"; /** * Party identifier @@ -28,16 +28,16 @@ export interface VoteButtons_party { /** * The staking information for this Party */ - stake: VoteButtons_party_stake; + stake: VoteButtonsQuery_party_stake; } -export interface VoteButtons { +export interface VoteButtonsQuery { /** * An entity that is trading on the Vega network */ - party: VoteButtons_party | null; + party: VoteButtonsQuery_party | null; } -export interface VoteButtonsVariables { +export interface VoteButtonsQueryVariables { partyId: string; } diff --git a/apps/token/src/routes/governance/components/vote-details/vote-buttons.spec.tsx b/apps/token/src/routes/governance/components/vote-details/vote-buttons.spec.tsx new file mode 100644 index 000000000..e8d35e746 --- /dev/null +++ b/apps/token/src/routes/governance/components/vote-details/vote-buttons.spec.tsx @@ -0,0 +1,267 @@ +import { render, screen, fireEvent } from '@testing-library/react'; +import BigNumber from 'bignumber.js'; +import { VoteButtons } from './vote-buttons'; +import { VoteState } from './use-user-vote'; +import { ProposalState, VoteValue } from '@vegaprotocol/types'; +import { VegaWalletContext } from '@vegaprotocol/wallet'; +import { mockWalletContext } from '../../test-helpers/mocks'; +import { AppStateProvider } from '../../../../contexts/app-state/app-state-provider'; + +describe('Vote buttons', () => { + it('should render successfully', () => { + const { baseElement } = render( + + + + + + ); + expect(baseElement).toBeTruthy(); + }); + + it('should explain that voting is closed if the proposal is not open', () => { + render( + + + + + + ); + expect(screen.getByText('Voting has ended. You did not vote')).toBeTruthy(); + }); + + it('should provide a connect wallet prompt if no pubkey', () => { + const mockWalletNoPubKeyContext = { + pubKey: null, + pubKeys: [], + sendTx: jest.fn().mockReturnValue(Promise.resolve(null)), + connect: jest.fn(), + disconnect: jest.fn(), + selectPubKey: jest.fn(), + connector: null, + }; + + render( + + + + + + ); + + expect(screen.getByTestId('connect-wallet')).toBeTruthy(); + }); + + it('should tell the user they need tokens if their current stake is 0', () => { + render( + + + + + + ); + expect( + screen.getByText('You need some VEGA tokens to participate in governance') + ).toBeTruthy(); + }); + + it('should tell the user of the minimum requirements if they have some, but not enough tokens', () => { + render( + + + + + + ); + expect( + screen.getByText( + 'You must have at least 2 VEGA associated to vote on this proposal' + ) + ).toBeTruthy(); + }); + + it('should display vote requested', () => { + render( + + + + + + ); + expect(screen.getByTestId('vote-requested')).toBeInTheDocument(); + }); + + it('should display vote pending', () => { + render( + + + + + + ); + expect(screen.getByTestId('vote-pending')).toBeInTheDocument(); + }); + + it('should show you voted if vote state is correct, and if the proposal is still open, it will display a change vote button', () => { + render( + + + + + + ); + expect(screen.getByTestId('you-voted')).toBeInTheDocument(); + expect(screen.getByTestId('change-vote-button')).toBeInTheDocument(); + }); + + it('should display vote failure', () => { + render( + + + + + + ); + expect(screen.getByTestId('vote-failure')).toBeInTheDocument(); + }); + + it('should cast yes vote when vote-for button is clicked', () => { + const castVote = jest.fn(); + render( + + + + + + ); + expect(screen.getByTestId('vote-buttons')).toBeInTheDocument(); + const button = screen.getByTestId('vote-for'); + fireEvent.click(button); + expect(castVote).toHaveBeenCalledWith(VoteValue.VALUE_YES); + }); + + it('should cast no vote when vote-against button is clicked', () => { + const castVote = jest.fn(); + render( + + + + + + ); + expect(screen.getByTestId('vote-buttons')).toBeInTheDocument(); + const button = screen.getByTestId('vote-against'); + fireEvent.click(button); + expect(castVote).toHaveBeenCalledWith(VoteValue.VALUE_NO); + }); + + it('should allow you to change your vote', () => { + const castVote = jest.fn(); + render( + + + + + + ); + fireEvent.click(screen.getByTestId('change-vote-button')); + fireEvent.click(screen.getByTestId('vote-for')); + expect(castVote).toHaveBeenCalledWith(VoteValue.VALUE_YES); + }); +}); 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 cec676c78..5e31a0fe5 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 @@ -10,24 +10,32 @@ import { import { BigNumber } from '../../../../lib/bignumber'; import { DATE_FORMAT_LONG } from '../../../../lib/date-formats'; import type { - VoteButtons as VoteButtonsQueryResult, - VoteButtonsVariables, -} from './__generated__/VoteButtons'; + VoteButtonsQuery as VoteButtonsQueryResult, + VoteButtonsQueryVariables, +} from './__generated__/VoteButtonsQuery'; import { VoteState } from './use-user-vote'; import { useVegaWallet } from '@vegaprotocol/wallet'; -import { ProposalState, VoteValue } from '@vegaprotocol/types'; -import { Button, ButtonLink } from '@vegaprotocol/ui-toolkit'; +import { + ProposalState, + ProposalUserAction, + VoteValue, +} from '@vegaprotocol/types'; +import { AsyncRenderer, Button, ButtonLink } from '@vegaprotocol/ui-toolkit'; +import { ProposalMinRequirements } from '../shared'; +import { addDecimal } from '@vegaprotocol/react-helpers'; interface VoteButtonsContainerProps { voteState: VoteState | null; castVote: (vote: VoteValue) => void; voteDatetime: Date | null; proposalState: ProposalState; + minVoterBalance: string | null; + spamProtectionMinTokens: string | null; className?: string; } -const VOTE_BUTTONS_QUERY = gql` - query VoteButtons($partyId: ID!) { +export const VOTE_BUTTONS_QUERY = gql` + query VoteButtonsQuery($partyId: ID!) { party(id: $partyId) { id stake { @@ -40,23 +48,23 @@ const VOTE_BUTTONS_QUERY = gql` export const VoteButtonsContainer = (props: VoteButtonsContainerProps) => { const { pubKey } = useVegaWallet(); - const { data, loading } = useQuery< + const { data, loading, error } = useQuery< VoteButtonsQueryResult, - VoteButtonsVariables + VoteButtonsQueryVariables >(VOTE_BUTTONS_QUERY, { variables: { partyId: pubKey || '' }, skip: !pubKey, }); - if (loading) return null; - return ( - + + + ); }; @@ -70,6 +78,8 @@ export const VoteButtons = ({ voteDatetime, proposalState, currentStakeAvailable, + minVoterBalance, + spamProtectionMinTokens, }: VoteButtonsProps) => { const { t } = useTranslation(); const { appDispatch } = useAppState(); @@ -83,7 +93,7 @@ export const VoteButtons = ({ if (!pubKey) { return ( - <> +
appDispatch({ @@ -95,7 +105,7 @@ export const VoteButtons = ({ {t('connectVegaWallet')} {' '} {t('toVote')} - +
); } @@ -103,8 +113,38 @@ export const VoteButtons = ({ return t('noGovernanceTokens'); } + if (minVoterBalance && spamProtectionMinTokens) { + const formattedMinVoterBalance = new BigNumber( + addDecimal(minVoterBalance, 18) + ); + const formattedSpamProtectionMinTokens = new BigNumber( + addDecimal(spamProtectionMinTokens, 18) + ); + + if ( + currentStakeAvailable.isLessThan(formattedMinVoterBalance) || + currentStakeAvailable.isLessThan(formattedSpamProtectionMinTokens) + ) { + return ( + + ); + } + } + return false; - }, [t, pubKey, currentStakeAvailable, proposalState, appDispatch]); + }, [ + t, + pubKey, + currentStakeAvailable, + proposalState, + appDispatch, + minVoterBalance, + spamProtectionMinTokens, + ]); function submitVote(vote: VoteValue) { setChangeVote(false); @@ -118,15 +158,15 @@ export const VoteButtons = ({ } if (cantVoteUI) { - return

{cantVoteUI}

; + return
{cantVoteUI}
; } if (voteState === VoteState.Requested) { - return

{t('voteRequested')}...

; + return

{t('voteRequested')}...

; } if (voteState === VoteState.Pending) { - return

{t('votePending')}...

; + return

{t('votePending')}...

; } // If voted show current vote info` @@ -137,7 +177,7 @@ export const VoteButtons = ({ const className = voteState === VoteState.Yes ? 'text-success' : 'text-danger'; return ( -

+

{t('youVoted')}:{' '} {t(`voteState_${voteState}`)}{' '} {voteDatetime ? ( @@ -158,18 +198,24 @@ export const VoteButtons = ({ } if (!changeVote && voteState === VoteState.Failed) { - return

{t('voteError')}

; + return

{t('voteError')}

; } return (
-
-
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 7f6f6429a..9b8c6be19 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 @@ -1,6 +1,5 @@ import { formatDistanceToNow } from 'date-fns'; import { useTranslation } from 'react-i18next'; - import { formatNumber } from '../../../../lib/format-number'; import { ConnectToVega } from '../../../staking/connect-to-vega'; import { useVoteInformation } from '../../hooks'; @@ -11,6 +10,7 @@ import { VoteProgress } from './vote-progress'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { ProposalState } from '@vegaprotocol/types'; import type { Proposal_proposal } from '../../proposal/__generated__/Proposal'; +import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers'; interface VoteDetailsProps { proposal: Proposal_proposal; @@ -30,6 +30,43 @@ export const VoteDetails = ({ proposal }: VoteDetailsProps) => { requiredParticipation, } = useVoteInformation({ proposal }); + let minVoterBalance = null; + const { params } = useNetworkParams([ + NetworkParams.governance_proposal_market_minVoterBalance, + NetworkParams.governance_proposal_updateMarket_minVoterBalance, + NetworkParams.governance_proposal_asset_minVoterBalance, + NetworkParams.governance_proposal_updateAsset_minVoterBalance, + NetworkParams.governance_proposal_updateNetParam_minVoterBalance, + NetworkParams.governance_proposal_freeform_minVoterBalance, + NetworkParams.spam_protection_voting_min_tokens, + ]); + + if (params) { + switch (proposal.terms.change.__typename) { + case 'NewMarket': + minVoterBalance = params.governance_proposal_market_minVoterBalance; + break; + case 'UpdateMarket': + minVoterBalance = + params.governance_proposal_updateMarket_minVoterBalance; + break; + case 'NewAsset': + minVoterBalance = params.governance_proposal_asset_minVoterBalance; + break; + case 'UpdateAsset': + minVoterBalance = + params.governance_proposal_updateAsset_minVoterBalance; + break; + case 'UpdateNetworkParameter': + minVoterBalance = + params.governance_proposal_updateNetParam_minVoterBalance; + break; + case 'NewFreeform': + minVoterBalance = params.governance_proposal_freeform_minVoterBalance; + break; + } + } + const { t } = useTranslation(); const { voteState, voteDatetime, castVote } = useUserVote( proposal.id, @@ -122,6 +159,8 @@ export const VoteDetails = ({ proposal }: VoteDetailsProps) => { castVote={castVote} voteDatetime={voteDatetime} proposalState={proposal.state} + minVoterBalance={minVoterBalance} + spamProtectionMinTokens={params.spam_protection_voting_min_tokens} className="flex" /> diff --git a/apps/token/src/routes/governance/propose/freeform/propose-freeform.tsx b/apps/token/src/routes/governance/propose/freeform/propose-freeform.tsx index 6f82bd335..e13ed79f8 100644 --- a/apps/token/src/routes/governance/propose/freeform/propose-freeform.tsx +++ b/apps/token/src/routes/governance/propose/freeform/propose-freeform.tsx @@ -6,18 +6,19 @@ import { } from '@vegaprotocol/governance'; import { useEnvironment } from '@vegaprotocol/environment'; import { - ProposalFormSubheader, - ProposalFormMinRequirements, - ProposalFormTitle, ProposalFormDescription, + ProposalFormSubheader, ProposalFormSubmit, + ProposalFormTitle, ProposalFormTransactionDialog, ProposalFormVoteAndEnactmentDeadline, } from '../../components/propose'; +import { ProposalMinRequirements } from '../../components/shared'; import { AsyncRenderer, Link } from '@vegaprotocol/ui-toolkit'; import { Heading } from '../../../../components/heading'; import { VegaWalletContainer } from '../../../../components/vega-wallet-container'; -import { useNetworkParams, NetworkParams } from '@vegaprotocol/react-helpers'; +import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers'; +import { ProposalUserAction } from '@vegaprotocol/types'; export interface FreeformProposalFormFields { proposalVoteDeadline: string; @@ -65,11 +66,12 @@ export const ProposeFreeform = () => { {() => ( <> - {VEGA_DOCS_URL && ( diff --git a/apps/token/src/routes/governance/propose/network-parameter/propose-network-parameter.tsx b/apps/token/src/routes/governance/propose/network-parameter/propose-network-parameter.tsx index 73fd0caec..12118c3ed 100644 --- a/apps/token/src/routes/governance/propose/network-parameter/propose-network-parameter.tsx +++ b/apps/token/src/routes/governance/propose/network-parameter/propose-network-parameter.tsx @@ -6,20 +6,20 @@ import { useNetworkParams, } from '@vegaprotocol/react-helpers'; import { - useProposalSubmit, getClosingTimestamp, getEnactmentTimestamp, + useProposalSubmit, } from '@vegaprotocol/governance'; import { useEnvironment } from '@vegaprotocol/environment'; import { - ProposalFormSubheader, - ProposalFormMinRequirements, - ProposalFormTitle, ProposalFormDescription, + ProposalFormSubheader, ProposalFormSubmit, + ProposalFormTitle, ProposalFormTransactionDialog, ProposalFormVoteAndEnactmentDeadline, } from '../../components/propose'; +import { ProposalMinRequirements } from '../../components/shared'; import { AsyncRenderer, FormGroup, @@ -32,6 +32,7 @@ import { } from '@vegaprotocol/ui-toolkit'; import { Heading } from '../../../../components/heading'; import { VegaWalletContainer } from '../../../../components/vega-wallet-container'; +import { ProposalUserAction } from '@vegaprotocol/types'; interface SelectedNetworkParamCurrentValueProps { value: string; @@ -130,11 +131,12 @@ export const ProposeNetworkParameter = () => { {() => ( <> - {VEGA_DOCS_URL && ( diff --git a/apps/token/src/routes/governance/propose/new-asset/propose-new-asset.tsx b/apps/token/src/routes/governance/propose/new-asset/propose-new-asset.tsx index 6e63d3ace..ac8e440da 100644 --- a/apps/token/src/routes/governance/propose/new-asset/propose-new-asset.tsx +++ b/apps/token/src/routes/governance/propose/new-asset/propose-new-asset.tsx @@ -1,27 +1,31 @@ import { useForm } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import { - useProposalSubmit, getClosingTimestamp, getEnactmentTimestamp, getValidationTimestamp, + useProposalSubmit, } from '@vegaprotocol/governance'; import { useEnvironment } from '@vegaprotocol/environment'; -import { validateJson } from '@vegaprotocol/react-helpers'; import { - ProposalFormMinRequirements, - ProposalFormTitle, + NetworkParams, + useNetworkParams, + validateJson, +} from '@vegaprotocol/react-helpers'; +import { ProposalFormDescription, - ProposalFormTerms, - ProposalFormSubmit, - ProposalFormTransactionDialog, ProposalFormSubheader, + ProposalFormSubmit, + ProposalFormTerms, + ProposalFormTitle, + ProposalFormTransactionDialog, ProposalFormVoteAndEnactmentDeadline, } from '../../components/propose'; +import { ProposalMinRequirements } from '../../components/shared'; import { AsyncRenderer, Link } from '@vegaprotocol/ui-toolkit'; import { Heading } from '../../../../components/heading'; import { VegaWalletContainer } from '../../../../components/vega-wallet-container'; -import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers'; +import { ProposalUserAction } from '@vegaprotocol/types'; export interface NewAssetProposalFormFields { proposalVoteDeadline: string; @@ -90,11 +94,12 @@ export const ProposeNewAsset = () => { {() => ( <> - {VEGA_DOCS_URL && ( diff --git a/apps/token/src/routes/governance/propose/new-market/propose-new-market.tsx b/apps/token/src/routes/governance/propose/new-market/propose-new-market.tsx index 4aa0bf0fa..892f695b7 100644 --- a/apps/token/src/routes/governance/propose/new-market/propose-new-market.tsx +++ b/apps/token/src/routes/governance/propose/new-market/propose-new-market.tsx @@ -1,26 +1,30 @@ import { useForm } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import { - useProposalSubmit, getClosingTimestamp, getEnactmentTimestamp, + useProposalSubmit, } from '@vegaprotocol/governance'; import { useEnvironment } from '@vegaprotocol/environment'; -import { validateJson } from '@vegaprotocol/react-helpers'; import { - ProposalFormMinRequirements, - ProposalFormTitle, + NetworkParams, + useNetworkParams, + validateJson, +} from '@vegaprotocol/react-helpers'; +import { ProposalFormDescription, - ProposalFormTerms, - ProposalFormSubmit, - ProposalFormTransactionDialog, ProposalFormSubheader, + ProposalFormSubmit, + ProposalFormTerms, + ProposalFormTitle, + ProposalFormTransactionDialog, ProposalFormVoteAndEnactmentDeadline, } from '../../components/propose'; +import { ProposalMinRequirements } from '../../components/shared'; import { AsyncRenderer, Link } from '@vegaprotocol/ui-toolkit'; import { Heading } from '../../../../components/heading'; import { VegaWalletContainer } from '../../../../components/vega-wallet-container'; -import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers'; +import { ProposalUserAction } from '@vegaprotocol/types'; export interface NewMarketProposalFormFields { proposalVoteDeadline: string; @@ -85,11 +89,12 @@ export const ProposeNewMarket = () => { {() => ( <> - {VEGA_DOCS_URL && ( diff --git a/apps/token/src/routes/governance/propose/update-asset/propose-update-asset.tsx b/apps/token/src/routes/governance/propose/update-asset/propose-update-asset.tsx index ad9009f43..045ebc954 100644 --- a/apps/token/src/routes/governance/propose/update-asset/propose-update-asset.tsx +++ b/apps/token/src/routes/governance/propose/update-asset/propose-update-asset.tsx @@ -1,26 +1,30 @@ import { useForm } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import { - useProposalSubmit, getClosingTimestamp, getEnactmentTimestamp, + useProposalSubmit, } from '@vegaprotocol/governance'; import { useEnvironment } from '@vegaprotocol/environment'; -import { validateJson } from '@vegaprotocol/react-helpers'; import { - ProposalFormMinRequirements, - ProposalFormTitle, + NetworkParams, + useNetworkParams, + validateJson, +} from '@vegaprotocol/react-helpers'; +import { ProposalFormDescription, - ProposalFormTerms, - ProposalFormSubmit, - ProposalFormTransactionDialog, ProposalFormSubheader, + ProposalFormSubmit, + ProposalFormTerms, + ProposalFormTitle, + ProposalFormTransactionDialog, ProposalFormVoteAndEnactmentDeadline, } from '../../components/propose'; +import { ProposalMinRequirements } from '../../components/shared'; import { AsyncRenderer, Link } from '@vegaprotocol/ui-toolkit'; import { Heading } from '../../../../components/heading'; import { VegaWalletContainer } from '../../../../components/vega-wallet-container'; -import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers'; +import { ProposalUserAction } from '@vegaprotocol/types'; export interface UpdateAssetProposalFormFields { proposalVoteDeadline: string; @@ -85,11 +89,12 @@ export const ProposeUpdateAsset = () => { {() => ( <> - {VEGA_DOCS_URL && ( diff --git a/apps/token/src/routes/governance/propose/update-market/propose-update-market.tsx b/apps/token/src/routes/governance/propose/update-market/propose-update-market.tsx index 303101da5..37732d8a8 100644 --- a/apps/token/src/routes/governance/propose/update-market/propose-update-market.tsx +++ b/apps/token/src/routes/governance/propose/update-market/propose-update-market.tsx @@ -3,22 +3,26 @@ import { useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useForm } from 'react-hook-form'; import { - useProposalSubmit, getClosingTimestamp, getEnactmentTimestamp, + useProposalSubmit, } from '@vegaprotocol/governance'; import { useEnvironment } from '@vegaprotocol/environment'; -import { validateJson } from '@vegaprotocol/react-helpers'; import { - ProposalFormSubheader, - ProposalFormMinRequirements, - ProposalFormTitle, + NetworkParams, + useNetworkParams, + validateJson, +} from '@vegaprotocol/react-helpers'; +import { ProposalFormDescription, - ProposalFormTerms, + ProposalFormSubheader, ProposalFormSubmit, + ProposalFormTerms, + ProposalFormTitle, ProposalFormTransactionDialog, ProposalFormVoteAndEnactmentDeadline, } from '../../components/propose'; +import { ProposalMinRequirements } from '../../components/shared'; import { AsyncRenderer, FormGroup, @@ -31,7 +35,7 @@ import { import { Heading } from '../../../../components/heading'; import { VegaWalletContainer } from '../../../../components/vega-wallet-container'; import type { ProposalMarketsQuery } from './__generated__/ProposalMarketsQuery'; -import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers'; +import { ProposalUserAction } from '@vegaprotocol/types'; export const MARKETS_QUERY = gql` query ProposalMarketsQuery { @@ -148,11 +152,12 @@ export const ProposeUpdateMarket = () => { {() => ( <> - {VEGA_DOCS_URL && ( diff --git a/libs/react-helpers/src/hooks/use-network-params.ts b/libs/react-helpers/src/hooks/use-network-params.ts index a4c2e14d0..6ae92f57f 100644 --- a/libs/react-helpers/src/hooks/use-network-params.ts +++ b/libs/react-helpers/src/hooks/use-network-params.ts @@ -25,12 +25,16 @@ export const NetworkParams = { reward_asset: 'reward_asset', reward_staking_delegation_payoutDelay: 'reward_staking_delegation_payoutDelay', - governance_proposal_updateMarket_requiredMajority: - 'governance_proposal_updateMarket_requiredMajority', + governance_proposal_market_minVoterBalance: + 'governance_proposal_market_minVoterBalance', governance_proposal_market_minClose: 'governance_proposal_market_minClose', governance_proposal_market_maxClose: 'governance_proposal_market_maxClose', governance_proposal_market_minEnact: 'governance_proposal_market_minEnact', governance_proposal_market_maxEnact: 'governance_proposal_market_maxEnact', + governance_proposal_updateMarket_minVoterBalance: + 'governance_proposal_updateMarket_minVoterBalance', + governance_proposal_updateMarket_requiredMajority: + 'governance_proposal_updateMarket_requiredMajority', governance_proposal_updateMarket_minClose: 'governance_proposal_updateMarket_minClose', governance_proposal_updateMarket_maxClose: @@ -39,10 +43,14 @@ export const NetworkParams = { 'governance_proposal_updateMarket_minEnact', governance_proposal_updateMarket_maxEnact: 'governance_proposal_updateMarket_maxEnact', + governance_proposal_asset_minVoterBalance: + 'governance_proposal_asset_minVoterBalance', governance_proposal_asset_minClose: 'governance_proposal_asset_minClose', governance_proposal_asset_maxClose: 'governance_proposal_asset_maxClose', governance_proposal_asset_minEnact: 'governance_proposal_asset_minEnact', governance_proposal_asset_maxEnact: 'governance_proposal_asset_maxEnact', + governance_proposal_updateAsset_minVoterBalance: + 'governance_proposal_updateAsset_minVoterBalance', governance_proposal_updateAsset_minClose: 'governance_proposal_updateAsset_minClose', governance_proposal_updateAsset_maxClose: @@ -53,12 +61,16 @@ export const NetworkParams = { 'governance_proposal_updateAsset_maxEnact', governance_proposal_updateNetParam_minClose: 'governance_proposal_updateNetParam_minClose', + governance_proposal_updateNetParam_minVoterBalance: + 'governance_proposal_updateNetParam_minVoterBalance', governance_proposal_updateNetParam_maxClose: 'governance_proposal_updateNetParam_maxClose', governance_proposal_updateNetParam_minEnact: 'governance_proposal_updateNetParam_minEnact', governance_proposal_updateNetParam_maxEnact: 'governance_proposal_updateNetParam_maxEnact', + governance_proposal_freeform_minVoterBalance: + 'governance_proposal_freeform_minVoterBalance', governance_proposal_freeform_minClose: 'governance_proposal_freeform_minClose', governance_proposal_freeform_maxClose: @@ -94,6 +106,7 @@ export const NetworkParams = { governance_proposal_freeform_minProposerBalance: 'governance_proposal_freeform_minProposerBalance', validators_delegation_minAmount: 'validators_delegation_minAmount', + spam_protection_voting_min_tokens: 'spam_protection_voting_min_tokens', spam_protection_proposal_min_tokens: 'spam_protection_proposal_min_tokens', market_liquidity_stakeToCcySiskas: 'market_liquidity_stakeToCcySiskas', } as const; diff --git a/libs/types/src/__generated__/globalTypes.ts b/libs/types/src/__generated__/globalTypes.ts index 4dff07b9d..4ea025e21 100644 --- a/libs/types/src/__generated__/globalTypes.ts +++ b/libs/types/src/__generated__/globalTypes.ts @@ -11,225 +11,225 @@ * The various account types in Vega (used by collateral) */ export enum AccountType { - ACCOUNT_TYPE_BOND = "ACCOUNT_TYPE_BOND", - ACCOUNT_TYPE_EXTERNAL = "ACCOUNT_TYPE_EXTERNAL", - ACCOUNT_TYPE_FEES_INFRASTRUCTURE = "ACCOUNT_TYPE_FEES_INFRASTRUCTURE", - ACCOUNT_TYPE_FEES_LIQUIDITY = "ACCOUNT_TYPE_FEES_LIQUIDITY", - ACCOUNT_TYPE_FEES_MAKER = "ACCOUNT_TYPE_FEES_MAKER", - ACCOUNT_TYPE_GENERAL = "ACCOUNT_TYPE_GENERAL", - ACCOUNT_TYPE_GLOBAL_INSURANCE = "ACCOUNT_TYPE_GLOBAL_INSURANCE", - ACCOUNT_TYPE_GLOBAL_REWARD = "ACCOUNT_TYPE_GLOBAL_REWARD", - ACCOUNT_TYPE_INSURANCE = "ACCOUNT_TYPE_INSURANCE", - ACCOUNT_TYPE_MARGIN = "ACCOUNT_TYPE_MARGIN", - ACCOUNT_TYPE_PENDING_TRANSFERS = "ACCOUNT_TYPE_PENDING_TRANSFERS", - ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES = "ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES", - ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES = "ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES", - ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES = "ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES", - ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS = "ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS", - ACCOUNT_TYPE_SETTLEMENT = "ACCOUNT_TYPE_SETTLEMENT", + ACCOUNT_TYPE_BOND = 'ACCOUNT_TYPE_BOND', + ACCOUNT_TYPE_EXTERNAL = 'ACCOUNT_TYPE_EXTERNAL', + ACCOUNT_TYPE_FEES_INFRASTRUCTURE = 'ACCOUNT_TYPE_FEES_INFRASTRUCTURE', + ACCOUNT_TYPE_FEES_LIQUIDITY = 'ACCOUNT_TYPE_FEES_LIQUIDITY', + ACCOUNT_TYPE_FEES_MAKER = 'ACCOUNT_TYPE_FEES_MAKER', + ACCOUNT_TYPE_GENERAL = 'ACCOUNT_TYPE_GENERAL', + ACCOUNT_TYPE_GLOBAL_INSURANCE = 'ACCOUNT_TYPE_GLOBAL_INSURANCE', + ACCOUNT_TYPE_GLOBAL_REWARD = 'ACCOUNT_TYPE_GLOBAL_REWARD', + ACCOUNT_TYPE_INSURANCE = 'ACCOUNT_TYPE_INSURANCE', + ACCOUNT_TYPE_MARGIN = 'ACCOUNT_TYPE_MARGIN', + ACCOUNT_TYPE_PENDING_TRANSFERS = 'ACCOUNT_TYPE_PENDING_TRANSFERS', + ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES = 'ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES', + ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES = 'ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES', + ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES = 'ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES', + ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS = 'ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS', + ACCOUNT_TYPE_SETTLEMENT = 'ACCOUNT_TYPE_SETTLEMENT', } export enum AssetStatus { - STATUS_ENABLED = "STATUS_ENABLED", - STATUS_PENDING_LISTING = "STATUS_PENDING_LISTING", - STATUS_PROPOSED = "STATUS_PROPOSED", - STATUS_REJECTED = "STATUS_REJECTED", + STATUS_ENABLED = 'STATUS_ENABLED', + STATUS_PENDING_LISTING = 'STATUS_PENDING_LISTING', + STATUS_PROPOSED = 'STATUS_PROPOSED', + STATUS_REJECTED = 'STATUS_REJECTED', } export enum AuctionTrigger { - AUCTION_TRIGGER_BATCH = "AUCTION_TRIGGER_BATCH", - AUCTION_TRIGGER_LIQUIDITY = "AUCTION_TRIGGER_LIQUIDITY", - AUCTION_TRIGGER_OPENING = "AUCTION_TRIGGER_OPENING", - AUCTION_TRIGGER_PRICE = "AUCTION_TRIGGER_PRICE", - AUCTION_TRIGGER_UNSPECIFIED = "AUCTION_TRIGGER_UNSPECIFIED", + AUCTION_TRIGGER_BATCH = 'AUCTION_TRIGGER_BATCH', + AUCTION_TRIGGER_LIQUIDITY = 'AUCTION_TRIGGER_LIQUIDITY', + AUCTION_TRIGGER_OPENING = 'AUCTION_TRIGGER_OPENING', + AUCTION_TRIGGER_PRICE = 'AUCTION_TRIGGER_PRICE', + AUCTION_TRIGGER_UNSPECIFIED = 'AUCTION_TRIGGER_UNSPECIFIED', } export enum BusEventType { - Account = "Account", - Asset = "Asset", - Auction = "Auction", - Deposit = "Deposit", - LiquidityProvision = "LiquidityProvision", - LossSocialization = "LossSocialization", - MarginLevels = "MarginLevels", - Market = "Market", - MarketCreated = "MarketCreated", - MarketData = "MarketData", - MarketTick = "MarketTick", - MarketUpdated = "MarketUpdated", - NodeSignature = "NodeSignature", - OracleSpec = "OracleSpec", - Order = "Order", - Party = "Party", - PositionResolution = "PositionResolution", - Proposal = "Proposal", - RiskFactor = "RiskFactor", - SettleDistressed = "SettleDistressed", - SettlePosition = "SettlePosition", - TimeUpdate = "TimeUpdate", - Trade = "Trade", - TransferResponses = "TransferResponses", - Vote = "Vote", - Withdrawal = "Withdrawal", + Account = 'Account', + Asset = 'Asset', + Auction = 'Auction', + Deposit = 'Deposit', + LiquidityProvision = 'LiquidityProvision', + LossSocialization = 'LossSocialization', + MarginLevels = 'MarginLevels', + Market = 'Market', + MarketCreated = 'MarketCreated', + MarketData = 'MarketData', + MarketTick = 'MarketTick', + MarketUpdated = 'MarketUpdated', + NodeSignature = 'NodeSignature', + OracleSpec = 'OracleSpec', + Order = 'Order', + Party = 'Party', + PositionResolution = 'PositionResolution', + Proposal = 'Proposal', + RiskFactor = 'RiskFactor', + SettleDistressed = 'SettleDistressed', + SettlePosition = 'SettlePosition', + TimeUpdate = 'TimeUpdate', + Trade = 'Trade', + TransferResponses = 'TransferResponses', + Vote = 'Vote', + Withdrawal = 'Withdrawal', } /** * Comparator describes the type of comparison. */ export enum ConditionOperator { - OPERATOR_EQUALS = "OPERATOR_EQUALS", - OPERATOR_GREATER_THAN = "OPERATOR_GREATER_THAN", - OPERATOR_GREATER_THAN_OR_EQUAL = "OPERATOR_GREATER_THAN_OR_EQUAL", - OPERATOR_LESS_THAN = "OPERATOR_LESS_THAN", - OPERATOR_LESS_THAN_OR_EQUAL = "OPERATOR_LESS_THAN_OR_EQUAL", + OPERATOR_EQUALS = 'OPERATOR_EQUALS', + OPERATOR_GREATER_THAN = 'OPERATOR_GREATER_THAN', + OPERATOR_GREATER_THAN_OR_EQUAL = 'OPERATOR_GREATER_THAN_OR_EQUAL', + OPERATOR_LESS_THAN = 'OPERATOR_LESS_THAN', + OPERATOR_LESS_THAN_OR_EQUAL = 'OPERATOR_LESS_THAN_OR_EQUAL', } /** * The interval for trade candles when subscribing via Vega GraphQL, default is I15M */ export enum Interval { - INTERVAL_I15M = "INTERVAL_I15M", - INTERVAL_I1D = "INTERVAL_I1D", - INTERVAL_I1H = "INTERVAL_I1H", - INTERVAL_I1M = "INTERVAL_I1M", - INTERVAL_I5M = "INTERVAL_I5M", - INTERVAL_I6H = "INTERVAL_I6H", + INTERVAL_I15M = 'INTERVAL_I15M', + INTERVAL_I1D = 'INTERVAL_I1D', + INTERVAL_I1H = 'INTERVAL_I1H', + INTERVAL_I1M = 'INTERVAL_I1M', + INTERVAL_I5M = 'INTERVAL_I5M', + INTERVAL_I6H = 'INTERVAL_I6H', } /** * Status of a liquidity provision order */ export enum LiquidityProvisionStatus { - STATUS_ACTIVE = "STATUS_ACTIVE", - STATUS_CANCELLED = "STATUS_CANCELLED", - STATUS_PENDING = "STATUS_PENDING", - STATUS_REJECTED = "STATUS_REJECTED", - STATUS_STOPPED = "STATUS_STOPPED", - STATUS_UNDEPLOYED = "STATUS_UNDEPLOYED", + STATUS_ACTIVE = 'STATUS_ACTIVE', + STATUS_CANCELLED = 'STATUS_CANCELLED', + STATUS_PENDING = 'STATUS_PENDING', + STATUS_REJECTED = 'STATUS_REJECTED', + STATUS_STOPPED = 'STATUS_STOPPED', + STATUS_UNDEPLOYED = 'STATUS_UNDEPLOYED', } /** * The current state of a market */ export enum MarketState { - STATE_ACTIVE = "STATE_ACTIVE", - STATE_CANCELLED = "STATE_CANCELLED", - STATE_CLOSED = "STATE_CLOSED", - STATE_PENDING = "STATE_PENDING", - STATE_PROPOSED = "STATE_PROPOSED", - STATE_REJECTED = "STATE_REJECTED", - STATE_SETTLED = "STATE_SETTLED", - STATE_SUSPENDED = "STATE_SUSPENDED", - STATE_TRADING_TERMINATED = "STATE_TRADING_TERMINATED", + STATE_ACTIVE = 'STATE_ACTIVE', + STATE_CANCELLED = 'STATE_CANCELLED', + STATE_CLOSED = 'STATE_CLOSED', + STATE_PENDING = 'STATE_PENDING', + STATE_PROPOSED = 'STATE_PROPOSED', + STATE_REJECTED = 'STATE_REJECTED', + STATE_SETTLED = 'STATE_SETTLED', + STATE_SUSPENDED = 'STATE_SUSPENDED', + STATE_TRADING_TERMINATED = 'STATE_TRADING_TERMINATED', } /** * What market trading mode is the market in */ export enum MarketTradingMode { - TRADING_MODE_BATCH_AUCTION = "TRADING_MODE_BATCH_AUCTION", - TRADING_MODE_CONTINUOUS = "TRADING_MODE_CONTINUOUS", - TRADING_MODE_MONITORING_AUCTION = "TRADING_MODE_MONITORING_AUCTION", - TRADING_MODE_NO_TRADING = "TRADING_MODE_NO_TRADING", - TRADING_MODE_OPENING_AUCTION = "TRADING_MODE_OPENING_AUCTION", + TRADING_MODE_BATCH_AUCTION = 'TRADING_MODE_BATCH_AUCTION', + TRADING_MODE_CONTINUOUS = 'TRADING_MODE_CONTINUOUS', + TRADING_MODE_MONITORING_AUCTION = 'TRADING_MODE_MONITORING_AUCTION', + TRADING_MODE_NO_TRADING = 'TRADING_MODE_NO_TRADING', + TRADING_MODE_OPENING_AUCTION = 'TRADING_MODE_OPENING_AUCTION', } /** * Validating status of a node, i.e. validator or non-validator */ export enum NodeStatus { - NODE_STATUS_NON_VALIDATOR = "NODE_STATUS_NON_VALIDATOR", - NODE_STATUS_VALIDATOR = "NODE_STATUS_VALIDATOR", + NODE_STATUS_NON_VALIDATOR = 'NODE_STATUS_NON_VALIDATOR', + NODE_STATUS_VALIDATOR = 'NODE_STATUS_VALIDATOR', } /** * Status describe the status of the oracle spec */ export enum OracleSpecStatus { - STATUS_ACTIVE = "STATUS_ACTIVE", - STATUS_DEACTIVATED = "STATUS_DEACTIVATED", + STATUS_ACTIVE = 'STATUS_ACTIVE', + STATUS_DEACTIVATED = 'STATUS_DEACTIVATED', } /** * Why the order was rejected by the core node */ export enum OrderRejectionReason { - ORDER_ERROR_AMEND_FAILURE = "ORDER_ERROR_AMEND_FAILURE", - ORDER_ERROR_BUY_CANNOT_REFERENCE_BEST_ASK_PRICE = "ORDER_ERROR_BUY_CANNOT_REFERENCE_BEST_ASK_PRICE", - ORDER_ERROR_CANNOT_AMEND_FROM_GFA_OR_GFN = "ORDER_ERROR_CANNOT_AMEND_FROM_GFA_OR_GFN", - ORDER_ERROR_CANNOT_AMEND_PEGGED_ORDER_DETAILS_ON_NON_PEGGED_ORDER = "ORDER_ERROR_CANNOT_AMEND_PEGGED_ORDER_DETAILS_ON_NON_PEGGED_ORDER", - ORDER_ERROR_CANNOT_AMEND_TO_FOK_OR_IOC = "ORDER_ERROR_CANNOT_AMEND_TO_FOK_OR_IOC", - ORDER_ERROR_CANNOT_AMEND_TO_GFA_OR_GFN = "ORDER_ERROR_CANNOT_AMEND_TO_GFA_OR_GFN", - ORDER_ERROR_CANNOT_AMEND_TO_GTT_WITHOUT_EXPIRYAT = "ORDER_ERROR_CANNOT_AMEND_TO_GTT_WITHOUT_EXPIRYAT", - ORDER_ERROR_CANNOT_HAVE_GTC_AND_EXPIRYAT = "ORDER_ERROR_CANNOT_HAVE_GTC_AND_EXPIRYAT", - ORDER_ERROR_CANNOT_SEND_FOK_ORDER_DURING_AUCTION = "ORDER_ERROR_CANNOT_SEND_FOK_ORDER_DURING_AUCTION", - ORDER_ERROR_CANNOT_SEND_IOC_ORDER_DURING_AUCTION = "ORDER_ERROR_CANNOT_SEND_IOC_ORDER_DURING_AUCTION", - ORDER_ERROR_EDIT_NOT_ALLOWED = "ORDER_ERROR_EDIT_NOT_ALLOWED", - ORDER_ERROR_EXPIRYAT_BEFORE_CREATEDAT = "ORDER_ERROR_EXPIRYAT_BEFORE_CREATEDAT", - ORDER_ERROR_GFA_ORDER_DURING_CONTINUOUS_TRADING = "ORDER_ERROR_GFA_ORDER_DURING_CONTINUOUS_TRADING", - ORDER_ERROR_GFN_ORDER_DURING_AN_AUCTION = "ORDER_ERROR_GFN_ORDER_DURING_AN_AUCTION", - ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE = "ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE", - ORDER_ERROR_INSUFFICIENT_FUNDS_TO_PAY_FEES = "ORDER_ERROR_INSUFFICIENT_FUNDS_TO_PAY_FEES", - ORDER_ERROR_INTERNAL_ERROR = "ORDER_ERROR_INTERNAL_ERROR", - ORDER_ERROR_INVALID_EXPIRATION_DATETIME = "ORDER_ERROR_INVALID_EXPIRATION_DATETIME", - ORDER_ERROR_INVALID_MARKET_ID = "ORDER_ERROR_INVALID_MARKET_ID", - ORDER_ERROR_INVALID_ORDER_ID = "ORDER_ERROR_INVALID_ORDER_ID", - ORDER_ERROR_INVALID_ORDER_REFERENCE = "ORDER_ERROR_INVALID_ORDER_REFERENCE", - ORDER_ERROR_INVALID_PARTY_ID = "ORDER_ERROR_INVALID_PARTY_ID", - ORDER_ERROR_INVALID_PERSISTENCE = "ORDER_ERROR_INVALID_PERSISTENCE", - ORDER_ERROR_INVALID_REMAINING_SIZE = "ORDER_ERROR_INVALID_REMAINING_SIZE", - ORDER_ERROR_INVALID_SIZE = "ORDER_ERROR_INVALID_SIZE", - ORDER_ERROR_INVALID_TIME_IN_FORCE = "ORDER_ERROR_INVALID_TIME_IN_FORCE", - ORDER_ERROR_INVALID_TYPE = "ORDER_ERROR_INVALID_TYPE", - ORDER_ERROR_MARGIN_CHECK_FAILED = "ORDER_ERROR_MARGIN_CHECK_FAILED", - ORDER_ERROR_MARKET_CLOSED = "ORDER_ERROR_MARKET_CLOSED", - ORDER_ERROR_MISSING_GENERAL_ACCOUNT = "ORDER_ERROR_MISSING_GENERAL_ACCOUNT", - ORDER_ERROR_MUST_BE_GTT_OR_GTC = "ORDER_ERROR_MUST_BE_GTT_OR_GTC", - ORDER_ERROR_MUST_BE_LIMIT_ORDER = "ORDER_ERROR_MUST_BE_LIMIT_ORDER", - ORDER_ERROR_NON_PERSISTENT_ORDER_OUT_OF_PRICE_BOUNDS = "ORDER_ERROR_NON_PERSISTENT_ORDER_OUT_OF_PRICE_BOUNDS", - ORDER_ERROR_NOT_FOUND = "ORDER_ERROR_NOT_FOUND", - ORDER_ERROR_OFFSET_MUST_BE_GREATER_OR_EQUAL_TO_ZERO = "ORDER_ERROR_OFFSET_MUST_BE_GREATER_OR_EQUAL_TO_ZERO", - ORDER_ERROR_OFFSET_MUST_BE_GREATER_THAN_ZERO = "ORDER_ERROR_OFFSET_MUST_BE_GREATER_THAN_ZERO", - ORDER_ERROR_OUT_OF_SEQUENCE = "ORDER_ERROR_OUT_OF_SEQUENCE", - ORDER_ERROR_REMOVAL_FAILURE = "ORDER_ERROR_REMOVAL_FAILURE", - ORDER_ERROR_SELF_TRADING = "ORDER_ERROR_SELF_TRADING", - ORDER_ERROR_SELL_CANNOT_REFERENCE_BEST_BID_PRICE = "ORDER_ERROR_SELL_CANNOT_REFERENCE_BEST_BID_PRICE", - ORDER_ERROR_TIME_FAILURE = "ORDER_ERROR_TIME_FAILURE", - ORDER_ERROR_UNABLE_TO_AMEND_PRICE_ON_PEGGED_ORDER = "ORDER_ERROR_UNABLE_TO_AMEND_PRICE_ON_PEGGED_ORDER", - ORDER_ERROR_UNABLE_TO_REPRICE_PEGGED_ORDER = "ORDER_ERROR_UNABLE_TO_REPRICE_PEGGED_ORDER", - ORDER_ERROR_WITHOUT_REFERENCE_PRICE = "ORDER_ERROR_WITHOUT_REFERENCE_PRICE", + ORDER_ERROR_AMEND_FAILURE = 'ORDER_ERROR_AMEND_FAILURE', + ORDER_ERROR_BUY_CANNOT_REFERENCE_BEST_ASK_PRICE = 'ORDER_ERROR_BUY_CANNOT_REFERENCE_BEST_ASK_PRICE', + ORDER_ERROR_CANNOT_AMEND_FROM_GFA_OR_GFN = 'ORDER_ERROR_CANNOT_AMEND_FROM_GFA_OR_GFN', + ORDER_ERROR_CANNOT_AMEND_PEGGED_ORDER_DETAILS_ON_NON_PEGGED_ORDER = 'ORDER_ERROR_CANNOT_AMEND_PEGGED_ORDER_DETAILS_ON_NON_PEGGED_ORDER', + ORDER_ERROR_CANNOT_AMEND_TO_FOK_OR_IOC = 'ORDER_ERROR_CANNOT_AMEND_TO_FOK_OR_IOC', + ORDER_ERROR_CANNOT_AMEND_TO_GFA_OR_GFN = 'ORDER_ERROR_CANNOT_AMEND_TO_GFA_OR_GFN', + ORDER_ERROR_CANNOT_AMEND_TO_GTT_WITHOUT_EXPIRYAT = 'ORDER_ERROR_CANNOT_AMEND_TO_GTT_WITHOUT_EXPIRYAT', + ORDER_ERROR_CANNOT_HAVE_GTC_AND_EXPIRYAT = 'ORDER_ERROR_CANNOT_HAVE_GTC_AND_EXPIRYAT', + ORDER_ERROR_CANNOT_SEND_FOK_ORDER_DURING_AUCTION = 'ORDER_ERROR_CANNOT_SEND_FOK_ORDER_DURING_AUCTION', + ORDER_ERROR_CANNOT_SEND_IOC_ORDER_DURING_AUCTION = 'ORDER_ERROR_CANNOT_SEND_IOC_ORDER_DURING_AUCTION', + ORDER_ERROR_EDIT_NOT_ALLOWED = 'ORDER_ERROR_EDIT_NOT_ALLOWED', + ORDER_ERROR_EXPIRYAT_BEFORE_CREATEDAT = 'ORDER_ERROR_EXPIRYAT_BEFORE_CREATEDAT', + ORDER_ERROR_GFA_ORDER_DURING_CONTINUOUS_TRADING = 'ORDER_ERROR_GFA_ORDER_DURING_CONTINUOUS_TRADING', + ORDER_ERROR_GFN_ORDER_DURING_AN_AUCTION = 'ORDER_ERROR_GFN_ORDER_DURING_AN_AUCTION', + ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE = 'ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE', + ORDER_ERROR_INSUFFICIENT_FUNDS_TO_PAY_FEES = 'ORDER_ERROR_INSUFFICIENT_FUNDS_TO_PAY_FEES', + ORDER_ERROR_INTERNAL_ERROR = 'ORDER_ERROR_INTERNAL_ERROR', + ORDER_ERROR_INVALID_EXPIRATION_DATETIME = 'ORDER_ERROR_INVALID_EXPIRATION_DATETIME', + ORDER_ERROR_INVALID_MARKET_ID = 'ORDER_ERROR_INVALID_MARKET_ID', + ORDER_ERROR_INVALID_ORDER_ID = 'ORDER_ERROR_INVALID_ORDER_ID', + ORDER_ERROR_INVALID_ORDER_REFERENCE = 'ORDER_ERROR_INVALID_ORDER_REFERENCE', + ORDER_ERROR_INVALID_PARTY_ID = 'ORDER_ERROR_INVALID_PARTY_ID', + ORDER_ERROR_INVALID_PERSISTENCE = 'ORDER_ERROR_INVALID_PERSISTENCE', + ORDER_ERROR_INVALID_REMAINING_SIZE = 'ORDER_ERROR_INVALID_REMAINING_SIZE', + ORDER_ERROR_INVALID_SIZE = 'ORDER_ERROR_INVALID_SIZE', + ORDER_ERROR_INVALID_TIME_IN_FORCE = 'ORDER_ERROR_INVALID_TIME_IN_FORCE', + ORDER_ERROR_INVALID_TYPE = 'ORDER_ERROR_INVALID_TYPE', + ORDER_ERROR_MARGIN_CHECK_FAILED = 'ORDER_ERROR_MARGIN_CHECK_FAILED', + ORDER_ERROR_MARKET_CLOSED = 'ORDER_ERROR_MARKET_CLOSED', + ORDER_ERROR_MISSING_GENERAL_ACCOUNT = 'ORDER_ERROR_MISSING_GENERAL_ACCOUNT', + ORDER_ERROR_MUST_BE_GTT_OR_GTC = 'ORDER_ERROR_MUST_BE_GTT_OR_GTC', + ORDER_ERROR_MUST_BE_LIMIT_ORDER = 'ORDER_ERROR_MUST_BE_LIMIT_ORDER', + ORDER_ERROR_NON_PERSISTENT_ORDER_OUT_OF_PRICE_BOUNDS = 'ORDER_ERROR_NON_PERSISTENT_ORDER_OUT_OF_PRICE_BOUNDS', + ORDER_ERROR_NOT_FOUND = 'ORDER_ERROR_NOT_FOUND', + ORDER_ERROR_OFFSET_MUST_BE_GREATER_OR_EQUAL_TO_ZERO = 'ORDER_ERROR_OFFSET_MUST_BE_GREATER_OR_EQUAL_TO_ZERO', + ORDER_ERROR_OFFSET_MUST_BE_GREATER_THAN_ZERO = 'ORDER_ERROR_OFFSET_MUST_BE_GREATER_THAN_ZERO', + ORDER_ERROR_OUT_OF_SEQUENCE = 'ORDER_ERROR_OUT_OF_SEQUENCE', + ORDER_ERROR_REMOVAL_FAILURE = 'ORDER_ERROR_REMOVAL_FAILURE', + ORDER_ERROR_SELF_TRADING = 'ORDER_ERROR_SELF_TRADING', + ORDER_ERROR_SELL_CANNOT_REFERENCE_BEST_BID_PRICE = 'ORDER_ERROR_SELL_CANNOT_REFERENCE_BEST_BID_PRICE', + ORDER_ERROR_TIME_FAILURE = 'ORDER_ERROR_TIME_FAILURE', + ORDER_ERROR_UNABLE_TO_AMEND_PRICE_ON_PEGGED_ORDER = 'ORDER_ERROR_UNABLE_TO_AMEND_PRICE_ON_PEGGED_ORDER', + ORDER_ERROR_UNABLE_TO_REPRICE_PEGGED_ORDER = 'ORDER_ERROR_UNABLE_TO_REPRICE_PEGGED_ORDER', + ORDER_ERROR_WITHOUT_REFERENCE_PRICE = 'ORDER_ERROR_WITHOUT_REFERENCE_PRICE', } /** * Valid order statuses, these determine several states for an order that cannot be expressed with other fields in Order. */ export enum OrderStatus { - STATUS_ACTIVE = "STATUS_ACTIVE", - STATUS_CANCELLED = "STATUS_CANCELLED", - STATUS_EXPIRED = "STATUS_EXPIRED", - STATUS_FILLED = "STATUS_FILLED", - STATUS_PARKED = "STATUS_PARKED", - STATUS_PARTIALLY_FILLED = "STATUS_PARTIALLY_FILLED", - STATUS_REJECTED = "STATUS_REJECTED", - STATUS_STOPPED = "STATUS_STOPPED", + STATUS_ACTIVE = 'STATUS_ACTIVE', + STATUS_CANCELLED = 'STATUS_CANCELLED', + STATUS_EXPIRED = 'STATUS_EXPIRED', + STATUS_FILLED = 'STATUS_FILLED', + STATUS_PARKED = 'STATUS_PARKED', + STATUS_PARTIALLY_FILLED = 'STATUS_PARTIALLY_FILLED', + STATUS_REJECTED = 'STATUS_REJECTED', + STATUS_STOPPED = 'STATUS_STOPPED', } /** * Valid order types, these determine what happens when an order is added to the book */ export enum OrderTimeInForce { - TIME_IN_FORCE_FOK = "TIME_IN_FORCE_FOK", - TIME_IN_FORCE_GFA = "TIME_IN_FORCE_GFA", - TIME_IN_FORCE_GFN = "TIME_IN_FORCE_GFN", - TIME_IN_FORCE_GTC = "TIME_IN_FORCE_GTC", - TIME_IN_FORCE_GTT = "TIME_IN_FORCE_GTT", - TIME_IN_FORCE_IOC = "TIME_IN_FORCE_IOC", + TIME_IN_FORCE_FOK = 'TIME_IN_FORCE_FOK', + TIME_IN_FORCE_GFA = 'TIME_IN_FORCE_GFA', + TIME_IN_FORCE_GFN = 'TIME_IN_FORCE_GFN', + TIME_IN_FORCE_GTC = 'TIME_IN_FORCE_GTC', + TIME_IN_FORCE_GTT = 'TIME_IN_FORCE_GTT', + TIME_IN_FORCE_IOC = 'TIME_IN_FORCE_IOC', } export enum OrderType { - TYPE_LIMIT = "TYPE_LIMIT", - TYPE_MARKET = "TYPE_MARKET", - TYPE_NETWORK = "TYPE_NETWORK", + TYPE_LIMIT = 'TYPE_LIMIT', + TYPE_MARKET = 'TYPE_MARKET', + TYPE_NETWORK = 'TYPE_NETWORK', } /** @@ -237,56 +237,56 @@ export enum OrderType { * engine. */ export enum PropertyKeyType { - TYPE_BOOLEAN = "TYPE_BOOLEAN", - TYPE_DECIMAL = "TYPE_DECIMAL", - TYPE_EMPTY = "TYPE_EMPTY", - TYPE_INTEGER = "TYPE_INTEGER", - TYPE_STRING = "TYPE_STRING", - TYPE_TIMESTAMP = "TYPE_TIMESTAMP", + TYPE_BOOLEAN = 'TYPE_BOOLEAN', + TYPE_DECIMAL = 'TYPE_DECIMAL', + TYPE_EMPTY = 'TYPE_EMPTY', + TYPE_INTEGER = 'TYPE_INTEGER', + TYPE_STRING = 'TYPE_STRING', + TYPE_TIMESTAMP = 'TYPE_TIMESTAMP', } /** * Why the proposal was rejected by the core node */ export enum ProposalRejectionReason { - PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE = "PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE", - PROPOSAL_ERROR_CLOSE_TIME_TOO_SOON = "PROPOSAL_ERROR_CLOSE_TIME_TOO_SOON", - PROPOSAL_ERROR_COULD_NOT_INSTANTIATE_MARKET = "PROPOSAL_ERROR_COULD_NOT_INSTANTIATE_MARKET", - PROPOSAL_ERROR_ENACT_TIME_TOO_LATE = "PROPOSAL_ERROR_ENACT_TIME_TOO_LATE", - PROPOSAL_ERROR_ENACT_TIME_TOO_SOON = "PROPOSAL_ERROR_ENACT_TIME_TOO_SOON", - PROPOSAL_ERROR_INCOMPATIBLE_TIMESTAMPS = "PROPOSAL_ERROR_INCOMPATIBLE_TIMESTAMPS", - PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE = "PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE", - PROPOSAL_ERROR_INSUFFICIENT_TOKENS = "PROPOSAL_ERROR_INSUFFICIENT_TOKENS", - PROPOSAL_ERROR_INVALID_ASSET = "PROPOSAL_ERROR_INVALID_ASSET", - PROPOSAL_ERROR_INVALID_ASSET_DETAILS = "PROPOSAL_ERROR_INVALID_ASSET_DETAILS", - PROPOSAL_ERROR_INVALID_FEE_AMOUNT = "PROPOSAL_ERROR_INVALID_FEE_AMOUNT", - PROPOSAL_ERROR_INVALID_FREEFORM = "PROPOSAL_ERROR_INVALID_FREEFORM", - PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT = "PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT", - PROPOSAL_ERROR_INVALID_INSTRUMENT_SECURITY = "PROPOSAL_ERROR_INVALID_INSTRUMENT_SECURITY", - PROPOSAL_ERROR_INVALID_MARKET = "PROPOSAL_ERROR_INVALID_MARKET", - PROPOSAL_ERROR_INVALID_RISK_PARAMETER = "PROPOSAL_ERROR_INVALID_RISK_PARAMETER", - PROPOSAL_ERROR_INVALID_SHAPE = "PROPOSAL_ERROR_INVALID_SHAPE", - PROPOSAL_ERROR_MAJORITY_THRESHOLD_NOT_REACHED = "PROPOSAL_ERROR_MAJORITY_THRESHOLD_NOT_REACHED", - PROPOSAL_ERROR_MARKET_MISSING_LIQUIDITY_COMMITMENT = "PROPOSAL_ERROR_MARKET_MISSING_LIQUIDITY_COMMITMENT", - PROPOSAL_ERROR_MISSING_BUILTIN_ASSET_FIELD = "PROPOSAL_ERROR_MISSING_BUILTIN_ASSET_FIELD", - PROPOSAL_ERROR_MISSING_COMMITMENT_AMOUNT = "PROPOSAL_ERROR_MISSING_COMMITMENT_AMOUNT", - PROPOSAL_ERROR_MISSING_ERC20_CONTRACT_ADDRESS = "PROPOSAL_ERROR_MISSING_ERC20_CONTRACT_ADDRESS", - PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_KEY = "PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_KEY", - PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_VALUE = "PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_VALUE", - PROPOSAL_ERROR_NETWORK_PARAMETER_VALIDATION_FAILED = "PROPOSAL_ERROR_NETWORK_PARAMETER_VALIDATION_FAILED", - PROPOSAL_ERROR_NODE_VALIDATION_FAILED = "PROPOSAL_ERROR_NODE_VALIDATION_FAILED", - PROPOSAL_ERROR_NO_PRODUCT = "PROPOSAL_ERROR_NO_PRODUCT", - PROPOSAL_ERROR_NO_RISK_PARAMETERS = "PROPOSAL_ERROR_NO_RISK_PARAMETERS", - PROPOSAL_ERROR_NO_TRADING_MODE = "PROPOSAL_ERROR_NO_TRADING_MODE", - PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_LARGE = "PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_LARGE", - PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_SMALL = "PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_SMALL", - PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED = "PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED", - PROPOSAL_ERROR_TOO_MANY_MARKET_DECIMAL_PLACES = "PROPOSAL_ERROR_TOO_MANY_MARKET_DECIMAL_PLACES", - PROPOSAL_ERROR_TOO_MANY_PRICE_MONITORING_TRIGGERS = "PROPOSAL_ERROR_TOO_MANY_PRICE_MONITORING_TRIGGERS", - PROPOSAL_ERROR_UNKNOWN_RISK_PARAMETER_TYPE = "PROPOSAL_ERROR_UNKNOWN_RISK_PARAMETER_TYPE", - PROPOSAL_ERROR_UNKNOWN_TYPE = "PROPOSAL_ERROR_UNKNOWN_TYPE", - PROPOSAL_ERROR_UNSUPPORTED_PRODUCT = "PROPOSAL_ERROR_UNSUPPORTED_PRODUCT", - PROPOSAL_ERROR_UNSUPPORTED_TRADING_MODE = "PROPOSAL_ERROR_UNSUPPORTED_TRADING_MODE", + PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE = 'PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE', + PROPOSAL_ERROR_CLOSE_TIME_TOO_SOON = 'PROPOSAL_ERROR_CLOSE_TIME_TOO_SOON', + PROPOSAL_ERROR_COULD_NOT_INSTANTIATE_MARKET = 'PROPOSAL_ERROR_COULD_NOT_INSTANTIATE_MARKET', + PROPOSAL_ERROR_ENACT_TIME_TOO_LATE = 'PROPOSAL_ERROR_ENACT_TIME_TOO_LATE', + PROPOSAL_ERROR_ENACT_TIME_TOO_SOON = 'PROPOSAL_ERROR_ENACT_TIME_TOO_SOON', + PROPOSAL_ERROR_INCOMPATIBLE_TIMESTAMPS = 'PROPOSAL_ERROR_INCOMPATIBLE_TIMESTAMPS', + PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE = 'PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE', + PROPOSAL_ERROR_INSUFFICIENT_TOKENS = 'PROPOSAL_ERROR_INSUFFICIENT_TOKENS', + PROPOSAL_ERROR_INVALID_ASSET = 'PROPOSAL_ERROR_INVALID_ASSET', + PROPOSAL_ERROR_INVALID_ASSET_DETAILS = 'PROPOSAL_ERROR_INVALID_ASSET_DETAILS', + PROPOSAL_ERROR_INVALID_FEE_AMOUNT = 'PROPOSAL_ERROR_INVALID_FEE_AMOUNT', + PROPOSAL_ERROR_INVALID_FREEFORM = 'PROPOSAL_ERROR_INVALID_FREEFORM', + PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT = 'PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT', + PROPOSAL_ERROR_INVALID_INSTRUMENT_SECURITY = 'PROPOSAL_ERROR_INVALID_INSTRUMENT_SECURITY', + PROPOSAL_ERROR_INVALID_MARKET = 'PROPOSAL_ERROR_INVALID_MARKET', + PROPOSAL_ERROR_INVALID_RISK_PARAMETER = 'PROPOSAL_ERROR_INVALID_RISK_PARAMETER', + PROPOSAL_ERROR_INVALID_SHAPE = 'PROPOSAL_ERROR_INVALID_SHAPE', + PROPOSAL_ERROR_MAJORITY_THRESHOLD_NOT_REACHED = 'PROPOSAL_ERROR_MAJORITY_THRESHOLD_NOT_REACHED', + PROPOSAL_ERROR_MARKET_MISSING_LIQUIDITY_COMMITMENT = 'PROPOSAL_ERROR_MARKET_MISSING_LIQUIDITY_COMMITMENT', + PROPOSAL_ERROR_MISSING_BUILTIN_ASSET_FIELD = 'PROPOSAL_ERROR_MISSING_BUILTIN_ASSET_FIELD', + PROPOSAL_ERROR_MISSING_COMMITMENT_AMOUNT = 'PROPOSAL_ERROR_MISSING_COMMITMENT_AMOUNT', + PROPOSAL_ERROR_MISSING_ERC20_CONTRACT_ADDRESS = 'PROPOSAL_ERROR_MISSING_ERC20_CONTRACT_ADDRESS', + PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_KEY = 'PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_KEY', + PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_VALUE = 'PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_VALUE', + PROPOSAL_ERROR_NETWORK_PARAMETER_VALIDATION_FAILED = 'PROPOSAL_ERROR_NETWORK_PARAMETER_VALIDATION_FAILED', + PROPOSAL_ERROR_NODE_VALIDATION_FAILED = 'PROPOSAL_ERROR_NODE_VALIDATION_FAILED', + PROPOSAL_ERROR_NO_PRODUCT = 'PROPOSAL_ERROR_NO_PRODUCT', + PROPOSAL_ERROR_NO_RISK_PARAMETERS = 'PROPOSAL_ERROR_NO_RISK_PARAMETERS', + PROPOSAL_ERROR_NO_TRADING_MODE = 'PROPOSAL_ERROR_NO_TRADING_MODE', + PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_LARGE = 'PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_LARGE', + PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_SMALL = 'PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_SMALL', + PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED = 'PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED', + PROPOSAL_ERROR_TOO_MANY_MARKET_DECIMAL_PLACES = 'PROPOSAL_ERROR_TOO_MANY_MARKET_DECIMAL_PLACES', + PROPOSAL_ERROR_TOO_MANY_PRICE_MONITORING_TRIGGERS = 'PROPOSAL_ERROR_TOO_MANY_PRICE_MONITORING_TRIGGERS', + PROPOSAL_ERROR_UNKNOWN_RISK_PARAMETER_TYPE = 'PROPOSAL_ERROR_UNKNOWN_RISK_PARAMETER_TYPE', + PROPOSAL_ERROR_UNKNOWN_TYPE = 'PROPOSAL_ERROR_UNKNOWN_TYPE', + PROPOSAL_ERROR_UNSUPPORTED_PRODUCT = 'PROPOSAL_ERROR_UNSUPPORTED_PRODUCT', + PROPOSAL_ERROR_UNSUPPORTED_TRADING_MODE = 'PROPOSAL_ERROR_UNSUPPORTED_TRADING_MODE', } /** @@ -297,50 +297,55 @@ export enum ProposalRejectionReason { * Proposal can enter Failed state from any other state. */ export enum ProposalState { - STATE_DECLINED = "STATE_DECLINED", - STATE_ENACTED = "STATE_ENACTED", - STATE_FAILED = "STATE_FAILED", - STATE_OPEN = "STATE_OPEN", - STATE_PASSED = "STATE_PASSED", - STATE_REJECTED = "STATE_REJECTED", - STATE_WAITING_FOR_NODE_VOTE = "STATE_WAITING_FOR_NODE_VOTE", + STATE_DECLINED = 'STATE_DECLINED', + STATE_ENACTED = 'STATE_ENACTED', + STATE_FAILED = 'STATE_FAILED', + STATE_OPEN = 'STATE_OPEN', + STATE_PASSED = 'STATE_PASSED', + STATE_REJECTED = 'STATE_REJECTED', + STATE_WAITING_FOR_NODE_VOTE = 'STATE_WAITING_FOR_NODE_VOTE', } /** * Whether the placer of an order is aiming to buy or sell on the market */ export enum Side { - SIDE_BUY = "SIDE_BUY", - SIDE_SELL = "SIDE_SELL", + SIDE_BUY = 'SIDE_BUY', + SIDE_SELL = 'SIDE_SELL', } /** * The status of the stake linking */ export enum StakeLinkingStatus { - STATUS_ACCEPTED = "STATUS_ACCEPTED", - STATUS_PENDING = "STATUS_PENDING", - STATUS_REJECTED = "STATUS_REJECTED", + STATUS_ACCEPTED = 'STATUS_ACCEPTED', + STATUS_PENDING = 'STATUS_PENDING', + STATUS_REJECTED = 'STATUS_REJECTED', } export enum ValidatorStatus { - VALIDATOR_NODE_STATUS_ERSATZ = "VALIDATOR_NODE_STATUS_ERSATZ", - VALIDATOR_NODE_STATUS_PENDING = "VALIDATOR_NODE_STATUS_PENDING", - VALIDATOR_NODE_STATUS_TENDERMINT = "VALIDATOR_NODE_STATUS_TENDERMINT", + VALIDATOR_NODE_STATUS_ERSATZ = 'VALIDATOR_NODE_STATUS_ERSATZ', + VALIDATOR_NODE_STATUS_PENDING = 'VALIDATOR_NODE_STATUS_PENDING', + VALIDATOR_NODE_STATUS_TENDERMINT = 'VALIDATOR_NODE_STATUS_TENDERMINT', } export enum VoteValue { - VALUE_NO = "VALUE_NO", - VALUE_YES = "VALUE_YES", + VALUE_NO = 'VALUE_NO', + VALUE_YES = 'VALUE_YES', +} + +export enum ProposalUserAction { + CREATE = 'CREATE', + VOTE = 'VOTE', } /** * The status of a withdrawal */ export enum WithdrawalStatus { - STATUS_FINALIZED = "STATUS_FINALIZED", - STATUS_OPEN = "STATUS_OPEN", - STATUS_REJECTED = "STATUS_REJECTED", + STATUS_FINALIZED = 'STATUS_FINALIZED', + STATUS_OPEN = 'STATUS_OPEN', + STATUS_REJECTED = 'STATUS_REJECTED', } /**