feat(explorer): show signers in proposal multisig bundles (#3122)
This commit is contained in:
parent
ae020a8dca
commit
f1fa13e0bd
@ -5,7 +5,6 @@ import type { components } from '../../../../../types/explorer';
|
|||||||
import { MockedProvider } from '@apollo/client/testing';
|
import { MockedProvider } from '@apollo/client/testing';
|
||||||
import { MemoryRouter } from 'react-router-dom';
|
import { MemoryRouter } from 'react-router-dom';
|
||||||
import { TxDetailsChainMultisigSigner } from './tx-multisig-signer';
|
import { TxDetailsChainMultisigSigner } from './tx-multisig-signer';
|
||||||
import { getBlockTime } from './lib/get-block-time';
|
|
||||||
|
|
||||||
type Added = components['schemas']['vegaERC20SignerAdded'];
|
type Added = components['schemas']['vegaERC20SignerAdded'];
|
||||||
type Removed = components['schemas']['vegaERC20SignerRemoved'];
|
type Removed = components['schemas']['vegaERC20SignerRemoved'];
|
||||||
@ -61,10 +60,7 @@ describe('Chain Event: multisig signer change', () => {
|
|||||||
expect(screen.getByText(t('Add signer'))).toBeInTheDocument();
|
expect(screen.getByText(t('Add signer'))).toBeInTheDocument();
|
||||||
expect(screen.getByText(`${addedMock.newSigner}`)).toBeInTheDocument();
|
expect(screen.getByText(`${addedMock.newSigner}`)).toBeInTheDocument();
|
||||||
|
|
||||||
const expectedDate = getBlockTime(mockBlockTime);
|
|
||||||
|
|
||||||
expect(screen.getByText(t('Signer change at'))).toBeInTheDocument();
|
expect(screen.getByText(t('Signer change at'))).toBeInTheDocument();
|
||||||
expect(screen.getByText(expectedDate)).toBeInTheDocument();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Renders TableRows if all data is provided', () => {
|
it('Renders TableRows if all data is provided', () => {
|
||||||
@ -93,9 +89,6 @@ describe('Chain Event: multisig signer change', () => {
|
|||||||
expect(screen.getByText(t('Remove signer'))).toBeInTheDocument();
|
expect(screen.getByText(t('Remove signer'))).toBeInTheDocument();
|
||||||
expect(screen.getByText(`${removedMock.oldSigner}`)).toBeInTheDocument();
|
expect(screen.getByText(`${removedMock.oldSigner}`)).toBeInTheDocument();
|
||||||
|
|
||||||
const expectedDate = getBlockTime(mockBlockTime);
|
|
||||||
|
|
||||||
expect(screen.getByText(t('Signer change at'))).toBeInTheDocument();
|
expect(screen.getByText(t('Signer change at'))).toBeInTheDocument();
|
||||||
expect(screen.getByText(expectedDate)).toBeInTheDocument();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -6,7 +6,6 @@ import { MockedProvider } from '@apollo/client/testing';
|
|||||||
import { MemoryRouter } from 'react-router-dom';
|
import { MemoryRouter } from 'react-router-dom';
|
||||||
import { TxDetailsChainMultisigThreshold } from './tx-multisig-threshold';
|
import { TxDetailsChainMultisigThreshold } from './tx-multisig-threshold';
|
||||||
import omit from 'lodash/omit';
|
import omit from 'lodash/omit';
|
||||||
import { getBlockTime } from './lib/get-block-time';
|
|
||||||
|
|
||||||
type Threshold =
|
type Threshold =
|
||||||
components['schemas']['vegaERC20MultiSigEvent']['thresholdSet'];
|
components['schemas']['vegaERC20MultiSigEvent']['thresholdSet'];
|
||||||
@ -74,9 +73,6 @@ describe('Chain Event: multisig threshold change', () => {
|
|||||||
expect(screen.getByText(t('Threshold'))).toBeInTheDocument();
|
expect(screen.getByText(t('Threshold'))).toBeInTheDocument();
|
||||||
expect(screen.getByText(`66.7%`)).toBeInTheDocument();
|
expect(screen.getByText(`66.7%`)).toBeInTheDocument();
|
||||||
|
|
||||||
const expectedDate = getBlockTime(mockBlockTime);
|
|
||||||
|
|
||||||
expect(screen.getByText(t('Threshold change date'))).toBeInTheDocument();
|
expect(screen.getByText(t('Threshold change date'))).toBeInTheDocument();
|
||||||
expect(screen.getByText(expectedDate)).toBeInTheDocument();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -5,6 +5,11 @@ query ExplorerNewAssetSignatureBundle($id: ID!) {
|
|||||||
}
|
}
|
||||||
asset(id: $id) {
|
asset(id: $id) {
|
||||||
status
|
status
|
||||||
|
source {
|
||||||
|
... on ERC20 {
|
||||||
|
contractAddress
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,5 +20,10 @@ query ExplorerUpdateAssetSignatureBundle($id: ID!) {
|
|||||||
}
|
}
|
||||||
asset(id: $id) {
|
asset(id: $id) {
|
||||||
status
|
status
|
||||||
|
source {
|
||||||
|
... on ERC20 {
|
||||||
|
contractAddress
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,14 +8,14 @@ export type ExplorerNewAssetSignatureBundleQueryVariables = Types.Exact<{
|
|||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type ExplorerNewAssetSignatureBundleQuery = { __typename?: 'Query', erc20ListAssetBundle?: { __typename?: 'Erc20ListAssetBundle', signatures: string, nonce: string } | null, asset?: { __typename?: 'Asset', status: Types.AssetStatus } | null };
|
export type ExplorerNewAssetSignatureBundleQuery = { __typename?: 'Query', erc20ListAssetBundle?: { __typename?: 'Erc20ListAssetBundle', signatures: string, nonce: string } | null, asset?: { __typename?: 'Asset', status: Types.AssetStatus, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } } | null };
|
||||||
|
|
||||||
export type ExplorerUpdateAssetSignatureBundleQueryVariables = Types.Exact<{
|
export type ExplorerUpdateAssetSignatureBundleQueryVariables = Types.Exact<{
|
||||||
id: Types.Scalars['ID'];
|
id: Types.Scalars['ID'];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type ExplorerUpdateAssetSignatureBundleQuery = { __typename?: 'Query', erc20SetAssetLimitsBundle: { __typename?: 'ERC20SetAssetLimitsBundle', signatures: string, nonce: string }, asset?: { __typename?: 'Asset', status: Types.AssetStatus } | null };
|
export type ExplorerUpdateAssetSignatureBundleQuery = { __typename?: 'Query', erc20SetAssetLimitsBundle: { __typename?: 'ERC20SetAssetLimitsBundle', signatures: string, nonce: string }, asset?: { __typename?: 'Asset', status: Types.AssetStatus, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } } | null };
|
||||||
|
|
||||||
|
|
||||||
export const ExplorerNewAssetSignatureBundleDocument = gql`
|
export const ExplorerNewAssetSignatureBundleDocument = gql`
|
||||||
@ -26,6 +26,11 @@ export const ExplorerNewAssetSignatureBundleDocument = gql`
|
|||||||
}
|
}
|
||||||
asset(id: $id) {
|
asset(id: $id) {
|
||||||
status
|
status
|
||||||
|
source {
|
||||||
|
... on ERC20 {
|
||||||
|
contractAddress
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@ -65,6 +70,11 @@ export const ExplorerUpdateAssetSignatureBundleDocument = gql`
|
|||||||
}
|
}
|
||||||
asset(id: $id) {
|
asset(id: $id) {
|
||||||
status
|
status
|
||||||
|
source {
|
||||||
|
... on ERC20 {
|
||||||
|
contractAddress
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
@ -110,7 +110,9 @@ export const ProposalStatusIcon = ({ id }: ProposalStatusIconProps) => {
|
|||||||
return (
|
return (
|
||||||
<div className="float-left mr-3">
|
<div className="float-left mr-3">
|
||||||
<Tooltip description={<p>{label}</p>}>
|
<Tooltip description={<p>{label}</p>}>
|
||||||
<Icon name={icon} />
|
<div>
|
||||||
|
<Icon name={icon} />
|
||||||
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import { Loader } from '@vegaprotocol/ui-toolkit';
|
import { Loader } from '@vegaprotocol/ui-toolkit';
|
||||||
|
import type { ProposalTerms } from '../tx-proposal';
|
||||||
import { BundleError } from './signature-bundle/bundle-error';
|
import { BundleError } from './signature-bundle/bundle-error';
|
||||||
import { BundleExists } from './signature-bundle/bundle-exists';
|
import { BundleExists } from './signature-bundle/bundle-exists';
|
||||||
import { useExplorerNewAssetSignatureBundleQuery } from './__generated__/SignatureBundle';
|
import { useExplorerNewAssetSignatureBundleQuery } from './__generated__/SignatureBundle';
|
||||||
|
|
||||||
export interface ProposalSignatureBundleByTypeProps {
|
export interface ProposalSignatureBundleByTypeProps {
|
||||||
id: string;
|
id: string;
|
||||||
|
tx?: ProposalTerms['newAsset'] | ProposalTerms['updateAsset'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -16,6 +18,7 @@ export interface ProposalSignatureBundleByTypeProps {
|
|||||||
*/
|
*/
|
||||||
export const ProposalSignatureBundleNewAsset = ({
|
export const ProposalSignatureBundleNewAsset = ({
|
||||||
id,
|
id,
|
||||||
|
tx,
|
||||||
}: ProposalSignatureBundleByTypeProps) => {
|
}: ProposalSignatureBundleByTypeProps) => {
|
||||||
const { data, error, loading } = useExplorerNewAssetSignatureBundleQuery({
|
const { data, error, loading } = useExplorerNewAssetSignatureBundleQuery({
|
||||||
variables: {
|
variables: {
|
||||||
@ -24,7 +27,20 @@ export const ProposalSignatureBundleNewAsset = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return <Loader />;
|
return (
|
||||||
|
<div className="w-auto max-w-lg p-5 mt-5">
|
||||||
|
<Loader />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
!tx?.changes?.erc20 ||
|
||||||
|
!tx?.changes?.erc20 ||
|
||||||
|
!('contractAddress' in tx.changes.erc20) ||
|
||||||
|
tx.changes.erc20.contractAddress === undefined
|
||||||
|
) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data?.erc20ListAssetBundle?.signatures) {
|
if (data?.erc20ListAssetBundle?.signatures) {
|
||||||
@ -32,8 +48,10 @@ export const ProposalSignatureBundleNewAsset = ({
|
|||||||
<BundleExists
|
<BundleExists
|
||||||
signatures={data.erc20ListAssetBundle.signatures}
|
signatures={data.erc20ListAssetBundle.signatures}
|
||||||
nonce={data.erc20ListAssetBundle.nonce}
|
nonce={data.erc20ListAssetBundle.nonce}
|
||||||
|
assetAddress={tx.changes.erc20.contractAddress}
|
||||||
status={data.asset?.status}
|
status={data.asset?.status}
|
||||||
proposalId={id}
|
proposalId={id}
|
||||||
|
tx={tx}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -13,6 +13,7 @@ import { useExplorerUpdateAssetSignatureBundleQuery } from './__generated__/Sign
|
|||||||
*/
|
*/
|
||||||
export const ProposalSignatureBundleUpdateAsset = ({
|
export const ProposalSignatureBundleUpdateAsset = ({
|
||||||
id,
|
id,
|
||||||
|
tx,
|
||||||
}: ProposalSignatureBundleByTypeProps) => {
|
}: ProposalSignatureBundleByTypeProps) => {
|
||||||
const { data, error, loading } = useExplorerUpdateAssetSignatureBundleQuery({
|
const { data, error, loading } = useExplorerUpdateAssetSignatureBundleQuery({
|
||||||
variables: {
|
variables: {
|
||||||
@ -24,11 +25,16 @@ export const ProposalSignatureBundleUpdateAsset = ({
|
|||||||
return <Loader />;
|
return <Loader />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data?.asset?.source?.__typename !== 'ERC20') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (data?.erc20SetAssetLimitsBundle?.signatures) {
|
if (data?.erc20SetAssetLimitsBundle?.signatures) {
|
||||||
return (
|
return (
|
||||||
<BundleExists
|
<BundleExists
|
||||||
signatures={data.erc20SetAssetLimitsBundle.signatures}
|
signatures={data.erc20SetAssetLimitsBundle.signatures}
|
||||||
nonce={data.erc20SetAssetLimitsBundle.nonce}
|
nonce={data.erc20SetAssetLimitsBundle.nonce}
|
||||||
|
assetAddress={data.asset.source.contractAddress}
|
||||||
status={data.asset?.status}
|
status={data.asset?.status}
|
||||||
proposalId={id}
|
proposalId={id}
|
||||||
/>
|
/>
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
import { ProposalSignatureBundleNewAsset } from './signature-bundle-new';
|
|
||||||
import { ProposalSignatureBundleUpdateAsset } from './signature-bundle-update';
|
|
||||||
|
|
||||||
export function format(date: string | undefined, def: string) {
|
|
||||||
if (!date) {
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Date().toLocaleDateString() || def;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ProposalSignatureBundleProps {
|
|
||||||
id: string;
|
|
||||||
type: 'NewAsset' | 'UpdateAsset';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Some proposals, if enacted, generate a signature bundle.
|
|
||||||
* The queries have to be split due to the way the API returns
|
|
||||||
* errors, hence this slightly redundant feeling switcher.
|
|
||||||
*/
|
|
||||||
export const ProposalSignatureBundle = ({
|
|
||||||
id,
|
|
||||||
type,
|
|
||||||
}: ProposalSignatureBundleProps) => {
|
|
||||||
return type === 'NewAsset' ? (
|
|
||||||
<ProposalSignatureBundleNewAsset id={id} />
|
|
||||||
) : (
|
|
||||||
<ProposalSignatureBundleUpdateAsset id={id} />
|
|
||||||
);
|
|
||||||
};
|
|
@ -0,0 +1,17 @@
|
|||||||
|
query ExplorerBundleSigners {
|
||||||
|
networkParameter(key: "blockchains.ethereumConfig") {
|
||||||
|
value
|
||||||
|
}
|
||||||
|
nodesConnection(pagination: { first: 25 }) {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
status
|
||||||
|
ethereumAddress
|
||||||
|
pubkey
|
||||||
|
tmPubkey
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
import * as Types from '@vegaprotocol/types';
|
||||||
|
|
||||||
|
import { gql } from '@apollo/client';
|
||||||
|
import * as Apollo from '@apollo/client';
|
||||||
|
const defaultOptions = {} as const;
|
||||||
|
export type ExplorerBundleSignersQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||||
|
|
||||||
|
|
||||||
|
export type ExplorerBundleSignersQuery = { __typename?: 'Query', networkParameter?: { __typename?: 'NetworkParameter', value: string } | null, nodesConnection: { __typename?: 'NodesConnection', edges?: Array<{ __typename?: 'NodeEdge', node: { __typename?: 'Node', id: string, name: string, status: Types.NodeStatus, ethereumAddress: string, pubkey: string, tmPubkey: string } } | null> | null } };
|
||||||
|
|
||||||
|
|
||||||
|
export const ExplorerBundleSignersDocument = gql`
|
||||||
|
query ExplorerBundleSigners {
|
||||||
|
networkParameter(key: "blockchains.ethereumConfig") {
|
||||||
|
value
|
||||||
|
}
|
||||||
|
nodesConnection(pagination: {first: 25}) {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
status
|
||||||
|
ethereumAddress
|
||||||
|
pubkey
|
||||||
|
tmPubkey
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* __useExplorerBundleSignersQuery__
|
||||||
|
*
|
||||||
|
* To run a query within a React component, call `useExplorerBundleSignersQuery` and pass it any options that fit your needs.
|
||||||
|
* When your component renders, `useExplorerBundleSignersQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
||||||
|
* you can use to render your UI.
|
||||||
|
*
|
||||||
|
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const { data, loading, error } = useExplorerBundleSignersQuery({
|
||||||
|
* variables: {
|
||||||
|
* },
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
export function useExplorerBundleSignersQuery(baseOptions?: Apollo.QueryHookOptions<ExplorerBundleSignersQuery, ExplorerBundleSignersQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useQuery<ExplorerBundleSignersQuery, ExplorerBundleSignersQueryVariables>(ExplorerBundleSignersDocument, options);
|
||||||
|
}
|
||||||
|
export function useExplorerBundleSignersLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ExplorerBundleSignersQuery, ExplorerBundleSignersQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useLazyQuery<ExplorerBundleSignersQuery, ExplorerBundleSignersQueryVariables>(ExplorerBundleSignersDocument, options);
|
||||||
|
}
|
||||||
|
export type ExplorerBundleSignersQueryHookResult = ReturnType<typeof useExplorerBundleSignersQuery>;
|
||||||
|
export type ExplorerBundleSignersLazyQueryHookResult = ReturnType<typeof useExplorerBundleSignersLazyQuery>;
|
||||||
|
export type ExplorerBundleSignersQueryResult = Apollo.QueryResult<ExplorerBundleSignersQuery, ExplorerBundleSignersQueryVariables>;
|
@ -8,14 +8,16 @@ import { BundleError } from './bundle-error';
|
|||||||
describe('Bundle Error', () => {
|
describe('Bundle Error', () => {
|
||||||
const NON_ENABLED_STATUS: AssetStatus[] = [
|
const NON_ENABLED_STATUS: AssetStatus[] = [
|
||||||
AssetStatus.STATUS_PENDING_LISTING,
|
AssetStatus.STATUS_PENDING_LISTING,
|
||||||
|
];
|
||||||
|
|
||||||
|
const NOT_SHOWN_STATUS: AssetStatus[] = [
|
||||||
AssetStatus.STATUS_PROPOSED,
|
AssetStatus.STATUS_PROPOSED,
|
||||||
AssetStatus.STATUS_REJECTED,
|
AssetStatus.STATUS_REJECTED,
|
||||||
];
|
];
|
||||||
|
|
||||||
const ENABLED_STATUS: AssetStatus[] = [AssetStatus.STATUS_ENABLED];
|
const ENABLED_STATUS: AssetStatus[] = [AssetStatus.STATUS_ENABLED];
|
||||||
|
it.each(NOT_SHOWN_STATUS)(
|
||||||
it.each(NON_ENABLED_STATUS)(
|
'does not render for proposed or rejected bundles',
|
||||||
'shows the apollo error if not enabled and a message is provided',
|
|
||||||
(status) => {
|
(status) => {
|
||||||
const screen = render(
|
const screen = render(
|
||||||
<MemoryRouter>
|
<MemoryRouter>
|
||||||
@ -28,7 +30,24 @@ describe('Bundle Error', () => {
|
|||||||
</MemoryRouter>
|
</MemoryRouter>
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(screen.getByText('test-error-message')).toBeInTheDocument();
|
expect(screen.container).toBeEmptyDOMElement();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
it.each(NON_ENABLED_STATUS)(
|
||||||
|
'shows the apollo error in a syntax highlighter if not enabled and a message is provided',
|
||||||
|
(status) => {
|
||||||
|
const screen = render(
|
||||||
|
<MemoryRouter>
|
||||||
|
<MockedProvider>
|
||||||
|
<BundleError
|
||||||
|
error={{ message: 'test-error-message' } as ApolloError}
|
||||||
|
status={status}
|
||||||
|
/>
|
||||||
|
</MockedProvider>
|
||||||
|
</MemoryRouter>
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(screen.getByText('No signature bundle')).toBeInTheDocument();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -43,7 +62,7 @@ describe('Bundle Error', () => {
|
|||||||
</MemoryRouter>
|
</MemoryRouter>
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(screen.getByText('No bundle for proposal ID')).toBeInTheDocument();
|
expect(screen.getByText('No signature bundle')).toBeInTheDocument();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@ import type { ApolloError } from '@apollo/client';
|
|||||||
import type { AssetStatus } from '@vegaprotocol/types';
|
import type { AssetStatus } from '@vegaprotocol/types';
|
||||||
|
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import Hash from '../../../../links/hash';
|
|
||||||
import { IconForBundleStatus } from './bundle-icon';
|
import { IconForBundleStatus } from './bundle-icon';
|
||||||
|
import { SyntaxHighlighter } from '@vegaprotocol/ui-toolkit';
|
||||||
|
|
||||||
export interface BundleErrorProps {
|
export interface BundleErrorProps {
|
||||||
status?: AssetStatus;
|
status?: AssetStatus;
|
||||||
@ -17,18 +17,33 @@ export interface BundleErrorProps {
|
|||||||
* the status - if it's already enabled, pretend this isn't an error
|
* the status - if it's already enabled, pretend this isn't an error
|
||||||
*/
|
*/
|
||||||
export const BundleError = ({ status, error }: BundleErrorProps) => {
|
export const BundleError = ({ status, error }: BundleErrorProps) => {
|
||||||
|
if (!status || status === 'STATUS_PROPOSED' || status === 'STATUS_REJECTED') {
|
||||||
|
// If there is no status, there is no asset and no bundle - ProposalDetails will make it clear why.
|
||||||
|
// If the asset exists but is just proposed, or rejected, there won't be a signature bundle yet
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div className="w-auto max-w-lg border-2 border-solid border-vega-light-100 dark:border-vega-dark-200 p-5 mt-5">
|
<div className="w-auto max-w-lg border-2 border-solid border-vega-light-100 dark:border-vega-dark-200 p-5 mt-5">
|
||||||
<IconForBundleStatus status={status} />
|
<IconForBundleStatus status={status} />
|
||||||
<h1 className="text-xl pb-1">{t('No signature bundle found')}</h1>
|
<h1 className="text-xl pb-1">{t('No signature bundle')}</h1>
|
||||||
|
|
||||||
<p>
|
<p className="my-4">
|
||||||
|
{t(
|
||||||
|
'No signature bundle was generated as a result of this proposal, or the signature bundle could not be found.'
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div>
|
||||||
{status === 'STATUS_ENABLED' ? (
|
{status === 'STATUS_ENABLED' ? (
|
||||||
t('Asset already enabled')
|
t('Asset already enabled')
|
||||||
) : (
|
) : (
|
||||||
<Hash text={error ? error.message : t('No bundle for proposal ID')} />
|
<details>
|
||||||
|
<summary>{t('Show server error message')}</summary>
|
||||||
|
|
||||||
|
<SyntaxHighlighter data={error} size="smaller" />
|
||||||
|
</details>
|
||||||
)}
|
)}
|
||||||
</p>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -32,6 +32,7 @@ describe('Bundle Exists', () => {
|
|||||||
nonce={MOCK_NONCE}
|
nonce={MOCK_NONCE}
|
||||||
proposalId={MOCK_PROPOSAL_ID}
|
proposalId={MOCK_PROPOSAL_ID}
|
||||||
signatures={MOCK_SIGNATURES}
|
signatures={MOCK_SIGNATURES}
|
||||||
|
assetAddress={'0x123413423'}
|
||||||
status={status}
|
status={status}
|
||||||
/>
|
/>
|
||||||
</MockedProvider>
|
</MockedProvider>
|
||||||
@ -52,6 +53,7 @@ describe('Bundle Exists', () => {
|
|||||||
nonce={MOCK_NONCE}
|
nonce={MOCK_NONCE}
|
||||||
proposalId={MOCK_PROPOSAL_ID}
|
proposalId={MOCK_PROPOSAL_ID}
|
||||||
signatures={MOCK_SIGNATURES}
|
signatures={MOCK_SIGNATURES}
|
||||||
|
assetAddress={'0x123413423'}
|
||||||
status={status}
|
status={status}
|
||||||
/>
|
/>
|
||||||
</MockedProvider>
|
</MockedProvider>
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import type { AssetStatus } from '@vegaprotocol/types';
|
|
||||||
import ProposalLink from '../../../../links/proposal-link/proposal-link';
|
import ProposalLink from '../../../../links/proposal-link/proposal-link';
|
||||||
import { IconForBundleStatus } from './bundle-icon';
|
import { IconForBundleStatus } from './bundle-icon';
|
||||||
import { ProposalSignatureBundleDetails } from './details';
|
import type { AssetStatus } from '@vegaprotocol/types';
|
||||||
|
import type { ProposalTerms } from '../../tx-proposal';
|
||||||
|
import { BundleSigners } from './bundle-signers';
|
||||||
|
|
||||||
export interface BundleExistsProps {
|
export interface BundleExistsProps {
|
||||||
signatures: string;
|
signatures: string;
|
||||||
nonce: string;
|
nonce: string;
|
||||||
status?: AssetStatus;
|
status?: AssetStatus;
|
||||||
|
assetAddress: string;
|
||||||
proposalId: string;
|
proposalId: string;
|
||||||
|
tx?: ProposalTerms['newAsset'] | ProposalTerms['updateAsset'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,7 +24,11 @@ export const BundleExists = ({
|
|||||||
nonce,
|
nonce,
|
||||||
status,
|
status,
|
||||||
proposalId,
|
proposalId,
|
||||||
|
assetAddress,
|
||||||
|
tx,
|
||||||
}: BundleExistsProps) => {
|
}: BundleExistsProps) => {
|
||||||
|
// Note if this is wrong, the wrong decoder will be used which will give incorrect data
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-auto max-w-lg border-2 border-solid border-vega-light-100 dark:border-vega-dark-200 p-5 mt-5">
|
<div className="w-auto max-w-lg border-2 border-solid border-vega-light-100 dark:border-vega-dark-200 p-5 mt-5">
|
||||||
<IconForBundleStatus status={status} />
|
<IconForBundleStatus status={status} />
|
||||||
@ -31,7 +38,42 @@ export const BundleExists = ({
|
|||||||
: t('Signature bundle generated')}
|
: t('Signature bundle generated')}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<ProposalSignatureBundleDetails signatures={signatures} nonce={nonce} />
|
<details className="mt-5">
|
||||||
|
<summary>{t('Signature bundle details')}</summary>
|
||||||
|
|
||||||
|
<div className="ml-4">
|
||||||
|
<h2 className="text-lg mt-2 mb-2">{t('Signatures')}</h2>
|
||||||
|
<p>
|
||||||
|
<textarea
|
||||||
|
className="font-mono bg-neutral-300 text-[11px] leading-3 text-gray-900 w-full p-2 max-w-[615px]"
|
||||||
|
readOnly={true}
|
||||||
|
rows={12}
|
||||||
|
cols={120}
|
||||||
|
value={signatures}
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2 className="text-lg mt-5 mb-2">{t('Nonce')}</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<textarea
|
||||||
|
className="font-mono bg-neutral-300 text-[11px] leading-3 text-gray-900 w-full p-2 max-w-[615px]"
|
||||||
|
readOnly={true}
|
||||||
|
rows={2}
|
||||||
|
cols={120}
|
||||||
|
value={nonce}
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<BundleSigners
|
||||||
|
signatures={signatures}
|
||||||
|
nonce={nonce}
|
||||||
|
tx={tx}
|
||||||
|
id={proposalId}
|
||||||
|
assetAddress={assetAddress}
|
||||||
|
/>
|
||||||
|
|
||||||
{status !== 'STATUS_ENABLED' ? (
|
{status !== 'STATUS_ENABLED' ? (
|
||||||
<p className="mt-5">
|
<p className="mt-5">
|
||||||
|
@ -1,33 +1,34 @@
|
|||||||
import { render } from '@testing-library/react';
|
|
||||||
import { AssetStatus } from '@vegaprotocol/types';
|
import { AssetStatus } from '@vegaprotocol/types';
|
||||||
import { IconForBundleStatus } from './bundle-icon';
|
import { getIcon } from './bundle-icon';
|
||||||
|
|
||||||
describe('Bundle status icon', () => {
|
describe('Bundle status icon', () => {
|
||||||
const NON_ENABLED_STATUS: AssetStatus[] = [
|
const NON_ENABLED_STATUS: AssetStatus[] = [
|
||||||
AssetStatus.STATUS_PENDING_LISTING,
|
AssetStatus.STATUS_PENDING_LISTING,
|
||||||
AssetStatus.STATUS_PROPOSED,
|
AssetStatus.STATUS_PROPOSED,
|
||||||
AssetStatus.STATUS_REJECTED,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const ERROR_STATUS: AssetStatus[] = [AssetStatus.STATUS_REJECTED];
|
||||||
|
|
||||||
const ENABLED_STATUS: AssetStatus[] = [AssetStatus.STATUS_ENABLED];
|
const ENABLED_STATUS: AssetStatus[] = [AssetStatus.STATUS_ENABLED];
|
||||||
|
|
||||||
it.each(NON_ENABLED_STATUS)(
|
it.each(NON_ENABLED_STATUS)(
|
||||||
'show a sparkle icon if the bundle is unused',
|
'show a sparkle icon if the bundle is unused',
|
||||||
(status) => {
|
(status) => {
|
||||||
const screen = render(<IconForBundleStatus status={status} />);
|
expect(getIcon(status)).toEqual('clean');
|
||||||
const i = screen.getByRole('img');
|
}
|
||||||
expect(i).toHaveAttribute('aria-label');
|
);
|
||||||
expect(i.getAttribute('aria-label')).toMatch(/clean/);
|
|
||||||
|
it.each(ERROR_STATUS)(
|
||||||
|
'show an error icon if the bundle is unavailable',
|
||||||
|
(status) => {
|
||||||
|
expect(getIcon(status)).toEqual('disable');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
it.each(ENABLED_STATUS)(
|
it.each(ENABLED_STATUS)(
|
||||||
'shows a tick if the bundle is already used',
|
'shows a tick if the bundle is already used',
|
||||||
(status) => {
|
(status) => {
|
||||||
const screen = render(<IconForBundleStatus status={status} />);
|
expect(getIcon(status)).toEqual('tick-circle');
|
||||||
const i = screen.getByRole('img');
|
|
||||||
expect(i).toHaveAttribute('aria-label');
|
|
||||||
expect(i.getAttribute('aria-label')).toMatch(/tick-circle/);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -12,6 +12,26 @@ export interface IconForBundleStatusProps {
|
|||||||
* asset should not exist
|
* asset should not exist
|
||||||
*/
|
*/
|
||||||
export const IconForBundleStatus = ({ status }: IconForBundleStatusProps) => {
|
export const IconForBundleStatus = ({ status }: IconForBundleStatusProps) => {
|
||||||
const i: IconName = status === 'STATUS_ENABLED' ? 'tick-circle' : 'clean';
|
const i = getIcon(status);
|
||||||
return <Icon className="float-left mt-2 mr-3" name={i} />;
|
|
||||||
|
return (
|
||||||
|
<Icon
|
||||||
|
className="float-left mt-2 mr-3"
|
||||||
|
name={i}
|
||||||
|
data-testid={i}
|
||||||
|
ariaLabel={status}
|
||||||
|
/>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function getIcon(status?: AssetStatus): IconName {
|
||||||
|
switch (status) {
|
||||||
|
case 'STATUS_ENABLED':
|
||||||
|
return 'tick-circle';
|
||||||
|
case undefined:
|
||||||
|
case 'STATUS_REJECTED':
|
||||||
|
return 'disable';
|
||||||
|
default:
|
||||||
|
return 'clean';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -0,0 +1,94 @@
|
|||||||
|
import type { EncodeListAssetParameters } from '../../../../../lib/encoders/abis/list-asset';
|
||||||
|
import type { BridgeFunction } from './bundle-signers';
|
||||||
|
import {
|
||||||
|
getBridgeAddressFromNetworkParameter,
|
||||||
|
getSigners,
|
||||||
|
} from './bundle-signers';
|
||||||
|
|
||||||
|
describe('Bundle Signers helpers', () => {
|
||||||
|
it('getBridgeAddressFromNetworkParameter handles invalid json', () => {
|
||||||
|
expect(getBridgeAddressFromNetworkParameter('hi')).toEqual(null);
|
||||||
|
expect(getBridgeAddressFromNetworkParameter('{hi]')).toEqual(null);
|
||||||
|
expect(getBridgeAddressFromNetworkParameter('{"hi"}')).toEqual(null);
|
||||||
|
expect(
|
||||||
|
getBridgeAddressFromNetworkParameter(false as unknown as string)
|
||||||
|
).toEqual(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('getBridgeAddressFromNetworkParameter returns null if bridge adderss is not in expected place', () => {
|
||||||
|
expect(
|
||||||
|
getBridgeAddressFromNetworkParameter(`{
|
||||||
|
"NetworkParamter": false
|
||||||
|
}`)
|
||||||
|
).toEqual(null);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
getBridgeAddressFromNetworkParameter(`{
|
||||||
|
"network_id": "11155111",
|
||||||
|
"chain_id": "11155111",
|
||||||
|
"confirmations": 3,
|
||||||
|
"staking_bridge_contract": {
|
||||||
|
"address": "0xFFb0A0d4806502ceF491aF1141f66669A1Bd0D03",
|
||||||
|
"deployment_block_height": 2011705
|
||||||
|
},
|
||||||
|
"token_vesting_contract": {
|
||||||
|
"address": "0x680fF88252FA7071CAce7398e77872d54D781d0B",
|
||||||
|
"deployment_block_height": 2011709
|
||||||
|
},
|
||||||
|
"multisig_control_contract": {
|
||||||
|
"address": "0x6eBc32d66277D94DB8FF2ccF86E36f37F29a52D3",
|
||||||
|
"deployment_block_height": 2011699
|
||||||
|
}
|
||||||
|
}`)
|
||||||
|
).toEqual(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('getBridgeAddressFromNetworkParameter returns address if the collateral_bridge_contract has an address', () => {
|
||||||
|
expect(
|
||||||
|
getBridgeAddressFromNetworkParameter(`{
|
||||||
|
"network_id": "11155111",
|
||||||
|
"chain_id": "11155111",
|
||||||
|
"confirmations": 3,
|
||||||
|
"collateral_bridge_contract": {
|
||||||
|
"address": "0x7fe27d970bc8Afc3B11Cc8d9737bfB66B1efd799"
|
||||||
|
},
|
||||||
|
"staking_bridge_contract": {
|
||||||
|
"address": "0xFFb0A0d4806502ceF491aF1141f66669A1Bd0D03",
|
||||||
|
"deployment_block_height": 2011705
|
||||||
|
},
|
||||||
|
"token_vesting_contract": {
|
||||||
|
"address": "0x680fF88252FA7071CAce7398e77872d54D781d0B",
|
||||||
|
"deployment_block_height": 2011709
|
||||||
|
},
|
||||||
|
"multisig_control_contract": {
|
||||||
|
"address": "0x6eBc32d66277D94DB8FF2ccF86E36f37F29a52D3",
|
||||||
|
"deployment_block_height": 2011699
|
||||||
|
}
|
||||||
|
}`)
|
||||||
|
).toEqual('0x7fe27d970bc8Afc3B11Cc8d9737bfB66B1efd799');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('getSigners to return [] in the case of bad inputs', () => {
|
||||||
|
expect(
|
||||||
|
getSigners('list_asset', '123', '', {
|
||||||
|
assetERC20: '123',
|
||||||
|
assetId: '456',
|
||||||
|
limit: 'bad',
|
||||||
|
threshold: 'data',
|
||||||
|
nonce: 'here',
|
||||||
|
})
|
||||||
|
).toEqual([]);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
getSigners('nothing' as unknown as BridgeFunction, '123', '', {
|
||||||
|
nonce: 'here',
|
||||||
|
} as unknown as EncodeListAssetParameters)
|
||||||
|
).toEqual([]);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
getSigners('set_asset_limits', '0x123', '0x456', {
|
||||||
|
nonce: 'here',
|
||||||
|
} as unknown as EncodeListAssetParameters)
|
||||||
|
).toEqual([]);
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,197 @@
|
|||||||
|
import { encodeListAssetBridgeTx } from '../../../../../lib/encoders/abis/list-asset';
|
||||||
|
import { recoverAddress } from 'ethers/lib/utils';
|
||||||
|
import { useExplorerBundleSignersQuery } from './__generated__/BundleSigners';
|
||||||
|
import type { ProposalTerms } from '../../tx-proposal';
|
||||||
|
import { DApp, TOKEN_VALIDATOR, useLinks } from '@vegaprotocol/environment';
|
||||||
|
import { ExternalLink, Icon } from '@vegaprotocol/ui-toolkit';
|
||||||
|
import { t } from '@vegaprotocol/i18n';
|
||||||
|
import { IconNames } from '@blueprintjs/icons';
|
||||||
|
import { encodeUpdateAssetBridgeTx } from '../../../../../lib/encoders/abis/update-asset';
|
||||||
|
import { prepend0x } from '@vegaprotocol/smart-contracts';
|
||||||
|
import type { EncodeListAssetParameters } from '../../../../../lib/encoders/abis/list-asset';
|
||||||
|
|
||||||
|
import omit from 'lodash/omit';
|
||||||
|
|
||||||
|
export type BridgeFunction = 'list_asset' | 'set_asset_limits';
|
||||||
|
|
||||||
|
export interface BundleSignersProps {
|
||||||
|
signatures: string;
|
||||||
|
assetAddress: string;
|
||||||
|
nonce: string;
|
||||||
|
tx?: ProposalTerms['updateAsset'] | ProposalTerms['newAsset'];
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A logic-heavy component that takes in a signature bundle and returns
|
||||||
|
* the list of validators that signed the bundle. To do this it requires
|
||||||
|
* data from quite a few places - a network parameter, the signature bundle,
|
||||||
|
* the asset that has been modified
|
||||||
|
*/
|
||||||
|
export const BundleSigners = ({
|
||||||
|
signatures,
|
||||||
|
nonce,
|
||||||
|
assetAddress,
|
||||||
|
tx,
|
||||||
|
id,
|
||||||
|
}: BundleSignersProps) => {
|
||||||
|
const tokenLink = useLinks(DApp.Token);
|
||||||
|
|
||||||
|
const bridgeFunction: BridgeFunction =
|
||||||
|
tx?.changes?.erc20 && 'contractAddress' in tx.changes.erc20
|
||||||
|
? 'list_asset'
|
||||||
|
: 'set_asset_limits';
|
||||||
|
|
||||||
|
const { data } = useExplorerBundleSignersQuery();
|
||||||
|
|
||||||
|
const bridgeAddress = getBridgeAddressFromNetworkParameter(
|
||||||
|
data?.networkParameter?.value
|
||||||
|
);
|
||||||
|
|
||||||
|
const allEthereumKeys =
|
||||||
|
data?.nodesConnection?.edges
|
||||||
|
?.filter((n) => n?.node.status === 'NODE_STATUS_VALIDATOR')
|
||||||
|
.map((s) => s?.node) || [];
|
||||||
|
|
||||||
|
if (!tx || !tx.changes?.erc20) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { lifetimeLimit, withdrawThreshold } = tx.changes.erc20;
|
||||||
|
|
||||||
|
if (
|
||||||
|
!id ||
|
||||||
|
allEthereumKeys.length === 0 ||
|
||||||
|
!bridgeAddress ||
|
||||||
|
!lifetimeLimit ||
|
||||||
|
!withdrawThreshold
|
||||||
|
) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const signersLowerCase = getSigners(
|
||||||
|
bridgeFunction,
|
||||||
|
bridgeAddress,
|
||||||
|
signatures,
|
||||||
|
{
|
||||||
|
assetERC20: assetAddress,
|
||||||
|
assetId: prepend0x(id),
|
||||||
|
limit: lifetimeLimit,
|
||||||
|
threshold: withdrawThreshold,
|
||||||
|
nonce,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<h2 className="mt-4 mb-2 text-lg">{t('Signed by validators')}</h2>
|
||||||
|
<ul>
|
||||||
|
{allEthereumKeys?.map((n) => {
|
||||||
|
if (!n) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const validatorPage = tokenLink(TOKEN_VALIDATOR.replace(':id', n.id));
|
||||||
|
return signersLowerCase?.indexOf(
|
||||||
|
n?.ethereumAddress.toLowerCase() || '??'
|
||||||
|
) !== -1 ? (
|
||||||
|
<li key={n?.pubkey}>
|
||||||
|
<ExternalLink href={validatorPage}>
|
||||||
|
<Icon name={IconNames.ENDORSED} className="ml-1 mr-2" />
|
||||||
|
{n?.name}
|
||||||
|
<Icon size={3} name={IconNames.SHARE} className="ml-2" />
|
||||||
|
</ExternalLink>
|
||||||
|
</li>
|
||||||
|
) : (
|
||||||
|
<li>
|
||||||
|
<ExternalLink href={validatorPage}>
|
||||||
|
<Icon name={IconNames.MINUS} className="ml-1 mr-2" />
|
||||||
|
{n?.name}
|
||||||
|
<Icon size={3} name={IconNames.SHARE} className="ml-2" />
|
||||||
|
</ExternalLink>
|
||||||
|
</li>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given all of the collated information, this function creates an equivalent unsigned bundle
|
||||||
|
* and recovers the signers from it, In the case of an error, it returns an empty array.
|
||||||
|
*
|
||||||
|
* @param bridgeFunction Decides which data goes in to the digest
|
||||||
|
* @param bridgeAddress ERC20 bridge address
|
||||||
|
* @param signatures Long string of signatures
|
||||||
|
* @param params The object containing all data that the bridge requires for New or Updating assets
|
||||||
|
* @returns String[] Empty if there was an error or no signers were recovered, otherwise lowercased ETH addresses
|
||||||
|
*/
|
||||||
|
export function getSigners(
|
||||||
|
bridgeFunction: BridgeFunction,
|
||||||
|
bridgeAddress: string,
|
||||||
|
signatures: string,
|
||||||
|
params: EncodeListAssetParameters
|
||||||
|
): string[] {
|
||||||
|
try {
|
||||||
|
if (bridgeFunction === 'list_asset') {
|
||||||
|
const digest = encodeListAssetBridgeTx(params, bridgeAddress);
|
||||||
|
|
||||||
|
// Recover Address from digest can return null, which is handled as an empty array
|
||||||
|
return recoverAddressesFromDigest(digest, signatures) || [];
|
||||||
|
} else {
|
||||||
|
// The params bundles are so similar, rather than force the component to make two different
|
||||||
|
// styles, just delete the one different property
|
||||||
|
const p = omit(params, 'assetId');
|
||||||
|
const digest = encodeUpdateAssetBridgeTx(p, bridgeAddress);
|
||||||
|
return recoverAddressesFromDigest(digest, signatures) || [];
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// In the worst case, no signing addresses are recovered. This means that all nodes will
|
||||||
|
// be rendered as if they had not signed the bundle.
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Querying for the network parameter value gets us all of the contract details for this network
|
||||||
|
* encoded as a JSON object. This function pulls out the address for the bridge, or returns null
|
||||||
|
* in any of the many cases where it may fail
|
||||||
|
*
|
||||||
|
* @param networkParameterAsString the stringified JSON object
|
||||||
|
* @returns null or bridge address as a string
|
||||||
|
*/
|
||||||
|
export function getBridgeAddressFromNetworkParameter(
|
||||||
|
networkParameterAsString: string | undefined
|
||||||
|
): string | null {
|
||||||
|
if (!networkParameterAsString) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const networkParameter = JSON.parse(networkParameterAsString);
|
||||||
|
return networkParameter.collateral_bridge_contract.address;
|
||||||
|
} catch (e) {
|
||||||
|
// There is no good recovery state so return null
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function recoverAddressesFromDigest(
|
||||||
|
digest: string,
|
||||||
|
unprefixedBundle: string
|
||||||
|
) {
|
||||||
|
// Remove 0x from bundle, then split it in to signatures
|
||||||
|
const sigs = unprefixedBundle.substring(2).match(/.{1,130}/g);
|
||||||
|
|
||||||
|
// Convert each of the signatures from hex to a string
|
||||||
|
const hexSigs = sigs?.map((s) => `0x${s.toString()}`);
|
||||||
|
|
||||||
|
if (!hexSigs) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// toLowerCase is a hack - something somewhere is lowercasing some
|
||||||
|
// pubkeys
|
||||||
|
return hexSigs.map((h) => recoverAddress(digest, h).toLowerCase());
|
||||||
|
}
|
@ -1,41 +0,0 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
|
||||||
|
|
||||||
export interface ProposalSignatureBundleDetailsProps {
|
|
||||||
signatures: string;
|
|
||||||
nonce: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const ProposalSignatureBundleDetails = ({
|
|
||||||
signatures,
|
|
||||||
nonce,
|
|
||||||
}: ProposalSignatureBundleDetailsProps) => {
|
|
||||||
return (
|
|
||||||
<details className="mt-5">
|
|
||||||
<summary>{t('Signature bundle details')}</summary>
|
|
||||||
|
|
||||||
<div className="ml-4">
|
|
||||||
<h2 className="text-lg mt-2 mb-2">{t('Signatures')}</h2>
|
|
||||||
<p>
|
|
||||||
<textarea
|
|
||||||
className="font-mono bg-neutral-300 text-[11px] leading-3 text-gray-900 w-full p-2 max-w-[615px]"
|
|
||||||
readOnly={true}
|
|
||||||
rows={12}
|
|
||||||
cols={120}
|
|
||||||
value={signatures}
|
|
||||||
/>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h2 className="text-lg mt-5 mb-2">{t('Nonce')}</h2>
|
|
||||||
<p>
|
|
||||||
<textarea
|
|
||||||
className="font-mono bg-neutral-300 text-[11px] leading-3 text-gray-900 w-full p-2 max-w-[615px]"
|
|
||||||
readOnly={true}
|
|
||||||
rows={2}
|
|
||||||
cols={120}
|
|
||||||
value={nonce}
|
|
||||||
/>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</details>
|
|
||||||
);
|
|
||||||
};
|
|
@ -61,7 +61,7 @@ export const ProposalSummary = ({
|
|||||||
{id && <ProposalStatusIcon id={id} />}
|
{id && <ProposalStatusIcon id={id} />}
|
||||||
{rationale?.title && <h1 className="text-xl pb-1">{rationale.title}</h1>}
|
{rationale?.title && <h1 className="text-xl pb-1">{rationale.title}</h1>}
|
||||||
{rationale?.description && (
|
{rationale?.description && (
|
||||||
<p className="pt-2 text-sm leading-tight">
|
<div className="pt-2 text-sm leading-tight">
|
||||||
<ReactMarkdown
|
<ReactMarkdown
|
||||||
className="react-markdown-container"
|
className="react-markdown-container"
|
||||||
skipHtml={true}
|
skipHtml={true}
|
||||||
@ -70,15 +70,15 @@ export const ProposalSummary = ({
|
|||||||
>
|
>
|
||||||
{md}
|
{md}
|
||||||
</ReactMarkdown>
|
</ReactMarkdown>
|
||||||
</p>
|
</div>
|
||||||
)}
|
)}
|
||||||
<p className="pt-5">
|
<div className="pt-5">
|
||||||
<button className="underline max-md:hidden mr-5" onClick={openDialog}>
|
<button className="underline max-md:hidden mr-5" onClick={openDialog}>
|
||||||
{t('View terms')}
|
{t('View terms')}
|
||||||
</button>{' '}
|
</button>{' '}
|
||||||
<ProposalLink id={id} text={t('Full details')} />
|
<ProposalLink id={id} text={t('Full details')} />
|
||||||
{terms && <ProposalDate terms={terms} id={id} />}
|
{terms && <ProposalDate terms={terms} id={id} />}
|
||||||
</p>
|
</div>
|
||||||
<JsonViewerDialog
|
<JsonViewerDialog
|
||||||
open={dialog.open}
|
open={dialog.open}
|
||||||
onChange={(isOpen) => setDialog({ ...dialog, open: isOpen })}
|
onChange={(isOpen) => setDialog({ ...dialog, open: isOpen })}
|
||||||
|
@ -7,8 +7,9 @@ import { txSignatureToDeterministicId } from '../lib/deterministic-ids';
|
|||||||
import has from 'lodash/has';
|
import has from 'lodash/has';
|
||||||
import { ProposalSummary } from './proposal/summary';
|
import { ProposalSummary } from './proposal/summary';
|
||||||
import Hash from '../../links/hash';
|
import Hash from '../../links/hash';
|
||||||
import { ProposalSignatureBundle } from './proposal/signature-bundle';
|
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
|
import { ProposalSignatureBundleNewAsset } from './proposal/signature-bundle-new';
|
||||||
|
import { ProposalSignatureBundleUpdateAsset } from './proposal/signature-bundle-update';
|
||||||
|
|
||||||
export type Proposal = components['schemas']['v1ProposalSubmission'];
|
export type Proposal = components['schemas']['v1ProposalSubmission'];
|
||||||
export type ProposalTerms = components['schemas']['vegaProposalTerms'];
|
export type ProposalTerms = components['schemas']['vegaProposalTerms'];
|
||||||
@ -78,6 +79,12 @@ export const TxProposal = ({ txData, pubKey, blockData }: TxProposalProps) => {
|
|||||||
deterministicId = txSignatureToDeterministicId(sig);
|
deterministicId = txSignatureToDeterministicId(sig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const tx = proposal.terms?.newAsset || proposal.terms?.updateAsset;
|
||||||
|
|
||||||
|
const SignatureBundleComponent = proposal.terms?.newAsset
|
||||||
|
? ProposalSignatureBundleNewAsset
|
||||||
|
: ProposalSignatureBundleUpdateAsset;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<TableWithTbody className="mb-8" allowWrap={true}>
|
<TableWithTbody className="mb-8" allowWrap={true}>
|
||||||
@ -105,10 +112,7 @@ export const TxProposal = ({ txData, pubKey, blockData }: TxProposalProps) => {
|
|||||||
terms={proposal?.terms}
|
terms={proposal?.terms}
|
||||||
/>
|
/>
|
||||||
{proposalRequiresSignatureBundle(proposal) && (
|
{proposalRequiresSignatureBundle(proposal) && (
|
||||||
<ProposalSignatureBundle
|
<SignatureBundleComponent id={deterministicId} tx={tx} />
|
||||||
id={deterministicId}
|
|
||||||
type={proposal.terms?.newAsset ? 'NewAsset' : 'UpdateAsset'}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
2
apps/explorer/src/app/lib/encoders/abis/abi-types.ts
Normal file
2
apps/explorer/src/app/lib/encoders/abis/abi-types.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// The subset of ABI types that we use in relevant types
|
||||||
|
export type AbiType = 'address' | 'bytes' | 'bytes32' | 'uint256' | 'string';
|
31
apps/explorer/src/app/lib/encoders/abis/bridge-command.ts
Normal file
31
apps/explorer/src/app/lib/encoders/abis/bridge-command.ts
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import { keccak256, defaultAbiCoder, isAddress } from 'ethers/lib/utils';
|
||||||
|
import type { AbiType } from './abi-types';
|
||||||
|
|
||||||
|
export const BRIDGE_COMMAND: AbiType[] = [
|
||||||
|
// The abi encoded bytes of the message
|
||||||
|
'bytes',
|
||||||
|
// The address of the bridge
|
||||||
|
'address',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ABI encode values for a bridge call, getting back its digest
|
||||||
|
*
|
||||||
|
* @param bytes The packed bytes of the command for the bridge
|
||||||
|
* @param address the Ethereum address of the ERC20 bridge
|
||||||
|
* @param raw defaults to false. If set, does not keccak256 the output
|
||||||
|
*/
|
||||||
|
export function encodeBridgeCommand(
|
||||||
|
bytes: string,
|
||||||
|
address: string,
|
||||||
|
raw = false
|
||||||
|
) {
|
||||||
|
if (!isAddress(address)) {
|
||||||
|
throw new Error('Bridge address must be a hex value');
|
||||||
|
}
|
||||||
|
|
||||||
|
const values = [bytes, address];
|
||||||
|
|
||||||
|
const value = defaultAbiCoder.encode(BRIDGE_COMMAND, values);
|
||||||
|
return raw === true ? value : keccak256(value);
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
import { encodeBridgeCommand } from './bridge-command';
|
||||||
|
|
||||||
|
describe('Bridge command encoder', () => {
|
||||||
|
const VALID_BYTES =
|
||||||
|
'0x000000000000000000000000b063f5504610ba4b8db230d9f884bfadc1e31da00b87ac58d4af7fc11c8b417153fcb62631cfd9643835ef28db3f5a1caef0b3790000000000000000000000000000000000000000000000487a9a30453944000000000000000000000000000000000000000000000000000000000000000000010b87ac58d4af7fc11c8b417153fcb62631cfd9643835ef28db3f5a1caef0b37900000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000a6c6973745f617373657400000000000000000000000000000000000000000000';
|
||||||
|
const VALID_ADDRESS = '0x7fe27d970bc8Afc3B11Cc8d9737bfB66B1efd799';
|
||||||
|
|
||||||
|
it('rejects non valid bridge addresses', () => {
|
||||||
|
expect(() => {
|
||||||
|
encodeBridgeCommand(VALID_BYTES, '456789');
|
||||||
|
}).toThrowError('Bridge address must be a hex value');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('throws if the bytes are not bytes-like', () => {
|
||||||
|
expect(() => {
|
||||||
|
encodeBridgeCommand('hello', VALID_ADDRESS);
|
||||||
|
}).toThrowError(/invalid/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('keccac256s the value by default', () => {
|
||||||
|
const res = encodeBridgeCommand(VALID_BYTES, VALID_ADDRESS);
|
||||||
|
// Magic number: Known output, including 0x
|
||||||
|
expect(res.length).toEqual(66);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Does not keccac256 the value if third param is set', () => {
|
||||||
|
const res = encodeBridgeCommand(VALID_BYTES, VALID_ADDRESS, true);
|
||||||
|
// Magic number: Known output
|
||||||
|
expect(res.length).toEqual(706);
|
||||||
|
});
|
||||||
|
});
|
76
apps/explorer/src/app/lib/encoders/abis/list-asset.spec.ts
Normal file
76
apps/explorer/src/app/lib/encoders/abis/list-asset.spec.ts
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
import { encodeListAsset, encodeListAssetBridgeTx } from './list-asset';
|
||||||
|
|
||||||
|
describe('List Asset ABI encoder', () => {
|
||||||
|
it('throws if asset erc20 address is invalid', () => {
|
||||||
|
expect(() => {
|
||||||
|
encodeListAsset({
|
||||||
|
assetERC20: '123',
|
||||||
|
assetId: '0x456',
|
||||||
|
limit: '1',
|
||||||
|
threshold: '1',
|
||||||
|
nonce: '1',
|
||||||
|
});
|
||||||
|
}).toThrowError('Asset ERC20 and assetID must be hex values');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('throws if assetId is not hex encoded', () => {
|
||||||
|
expect(() => {
|
||||||
|
encodeListAsset({
|
||||||
|
assetERC20: '0x123',
|
||||||
|
assetId: '456',
|
||||||
|
limit: '1',
|
||||||
|
threshold: '1',
|
||||||
|
nonce: '1',
|
||||||
|
});
|
||||||
|
}).toThrowError('Asset ERC20 and assetID must be hex values');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('throws if values to not match expected format', () => {
|
||||||
|
expect(() => {
|
||||||
|
encodeListAsset({
|
||||||
|
assetERC20: '0xb063f5504610ba4b8db230d9f884bfadc1e31da0',
|
||||||
|
assetId: '0xb063f5504610ba4b8db230d9f884bfadc1e31da0',
|
||||||
|
limit: 'not a valid number',
|
||||||
|
threshold: '1',
|
||||||
|
nonce: '1',
|
||||||
|
});
|
||||||
|
}).toThrowError(/incorrect data length/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns an ABI encoded value if inputs are valid', () => {
|
||||||
|
const EXPECTED_OUTPUT =
|
||||||
|
'0x000000000000000000000000b063f5504610ba4b8db230d9f884bfadc1e31da00b87ac58d4af7fc11c8b417153fcb62631cfd9643835ef28db3f5a1caef0b37900000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000a6c6973745f617373657400000000000000000000000000000000000000000000';
|
||||||
|
|
||||||
|
const res = encodeListAsset({
|
||||||
|
assetERC20: '0xb063f5504610ba4b8db230d9f884bfadc1e31da0',
|
||||||
|
assetId:
|
||||||
|
'0x0b87ac58d4af7fc11c8b417153fcb62631cfd9643835ef28db3f5a1caef0b379',
|
||||||
|
limit: '1',
|
||||||
|
threshold: '1',
|
||||||
|
nonce: '1',
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(res).toEqual(EXPECTED_OUTPUT);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('encodeListAssetBridge returns a keccak256 hash of the bridge tx', () => {
|
||||||
|
const EXPECTED_OUTPUT =
|
||||||
|
'0xe0e62b27fe4490025d312bb2e37486f56935a3d9442dc34c2b918b2a28a386f2';
|
||||||
|
|
||||||
|
const res = encodeListAssetBridgeTx(
|
||||||
|
{
|
||||||
|
assetERC20: '0xb063f5504610ba4b8db230d9f884bfadc1e31da0',
|
||||||
|
assetId:
|
||||||
|
'0x0b87ac58d4af7fc11c8b417153fcb62631cfd9643835ef28db3f5a1caef0b379',
|
||||||
|
limit: '1',
|
||||||
|
threshold: '1',
|
||||||
|
nonce: '1',
|
||||||
|
},
|
||||||
|
'0xb063f5504610ba4b8db230d9f884bfadc1e31da0'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Magic number: keccak256 hash length + '0x'
|
||||||
|
expect(res.length).toEqual(66);
|
||||||
|
expect(res).toEqual(EXPECTED_OUTPUT);
|
||||||
|
});
|
||||||
|
});
|
76
apps/explorer/src/app/lib/encoders/abis/list-asset.ts
Normal file
76
apps/explorer/src/app/lib/encoders/abis/list-asset.ts
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
import { defaultAbiCoder, isAddress, isHexString } from 'ethers/lib/utils';
|
||||||
|
import { encodeBridgeCommand } from './bridge-command';
|
||||||
|
import type { AbiType } from './abi-types';
|
||||||
|
|
||||||
|
export const METHOD_NAME = 'list_asset';
|
||||||
|
|
||||||
|
export const LIST_ASSET_ABI: AbiType[] = [
|
||||||
|
// Asset address
|
||||||
|
'address',
|
||||||
|
// Asset ID on Vega
|
||||||
|
'bytes32',
|
||||||
|
// Lifetime limit
|
||||||
|
'uint256',
|
||||||
|
// Withdraw threshold
|
||||||
|
'uint256',
|
||||||
|
// Nonce
|
||||||
|
'uint256',
|
||||||
|
// Contract method name
|
||||||
|
'string',
|
||||||
|
];
|
||||||
|
|
||||||
|
export interface EncodeListAssetParameters {
|
||||||
|
// The ETH address of the ERC20 asset
|
||||||
|
assetERC20: string;
|
||||||
|
// The Vega ID of the asset, 0x prefixed
|
||||||
|
assetId: string;
|
||||||
|
// The number as a string of the asset
|
||||||
|
limit: string;
|
||||||
|
// THe number-as-a-string of the withdraw threshold
|
||||||
|
threshold: string;
|
||||||
|
// The n-once supplied to the contract
|
||||||
|
nonce: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates an ABI encoded function call to list an asset. This is
|
||||||
|
* used in the Signature Bundle view on some proposals to recover
|
||||||
|
* which validators signed a multisig bundle. It does this by recovering
|
||||||
|
* the ERC20 addresses of the signers, then comparing those to the list
|
||||||
|
* of signers on the bundle. In order to do this, we recreate the signed
|
||||||
|
* data from the values we know from the transaction. That last part
|
||||||
|
* is what this function does.
|
||||||
|
*
|
||||||
|
* @param EncodeListAssetParameters The arguments for the ABI call
|
||||||
|
* @returns string encoded message
|
||||||
|
*/
|
||||||
|
export function encodeListAsset({
|
||||||
|
assetERC20,
|
||||||
|
assetId,
|
||||||
|
limit,
|
||||||
|
threshold,
|
||||||
|
nonce,
|
||||||
|
}: EncodeListAssetParameters) {
|
||||||
|
if (!isAddress(assetERC20) || !isHexString(assetId)) {
|
||||||
|
throw new Error('Asset ERC20 and assetID must be hex values');
|
||||||
|
}
|
||||||
|
|
||||||
|
const values = [assetERC20, assetId, limit, threshold, nonce, METHOD_NAME];
|
||||||
|
|
||||||
|
return defaultAbiCoder.encode(LIST_ASSET_ABI, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience function that encodes and packs the message as it is encoded by the
|
||||||
|
* validators in a multisig bundle
|
||||||
|
*
|
||||||
|
* @param params Parameters for the List Asset call
|
||||||
|
* @param bridgeAddress Bridge address for the appropiate network
|
||||||
|
* @returns keccak256 encoded message digest
|
||||||
|
*/
|
||||||
|
export function encodeListAssetBridgeTx(
|
||||||
|
params: EncodeListAssetParameters,
|
||||||
|
bridgeAddress: string
|
||||||
|
) {
|
||||||
|
return encodeBridgeCommand(encodeListAsset(params), bridgeAddress);
|
||||||
|
}
|
58
apps/explorer/src/app/lib/encoders/abis/update-asset.spec.ts
Normal file
58
apps/explorer/src/app/lib/encoders/abis/update-asset.spec.ts
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
import { encodeUpdateAsset, encodeUpdateAssetBridgeTx } from './update-asset';
|
||||||
|
|
||||||
|
describe('Update Asset ABI encoder', () => {
|
||||||
|
it('throws if asset erc20 address is invalid', () => {
|
||||||
|
expect(() => {
|
||||||
|
encodeUpdateAsset({
|
||||||
|
assetERC20: '123',
|
||||||
|
limit: '1',
|
||||||
|
threshold: '1',
|
||||||
|
nonce: '1',
|
||||||
|
});
|
||||||
|
}).toThrowError('Asset ERC20 must be a valid address');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('throws if an input is invalid', () => {
|
||||||
|
expect(() => {
|
||||||
|
encodeUpdateAsset({
|
||||||
|
assetERC20: '0xb063f5504610ba4b8db230d9f884bfadc1e31da0',
|
||||||
|
limit: 'hello',
|
||||||
|
threshold: '1',
|
||||||
|
nonce: '1',
|
||||||
|
});
|
||||||
|
}).toThrowError(/invalid BigNumber/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns an ABI encoded value if inputs are valid', () => {
|
||||||
|
const EXPECTED_OUTPUT =
|
||||||
|
'0x000000000000000000000000b063f5504610ba4b8db230d9f884bfadc1e31da000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000107365745f61737365745f6c696d69747300000000000000000000000000000000';
|
||||||
|
|
||||||
|
const res = encodeUpdateAsset({
|
||||||
|
assetERC20: '0xb063f5504610ba4b8db230d9f884bfadc1e31da0',
|
||||||
|
limit: '1',
|
||||||
|
threshold: '1',
|
||||||
|
nonce: '1',
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(res).toEqual(EXPECTED_OUTPUT);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('encodeUpdateAssetBridge returns a keccak256 hash of the bridge tx', () => {
|
||||||
|
const EXPECTED_OUTPUT =
|
||||||
|
'0xeb240131c4558aebfab3da0ddbea1ac0447b9f5670899af2d78795867631d877';
|
||||||
|
|
||||||
|
const res = encodeUpdateAssetBridgeTx(
|
||||||
|
{
|
||||||
|
assetERC20: '0xb063f5504610ba4b8db230d9f884bfadc1e31da0',
|
||||||
|
limit: '1',
|
||||||
|
threshold: '1',
|
||||||
|
nonce: '1',
|
||||||
|
},
|
||||||
|
'0xb063f5504610ba4b8db230d9f884bfadc1e31da0'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Magic number: keccak256 hash length + '0x'
|
||||||
|
expect(res.length).toEqual(66);
|
||||||
|
expect(res).toEqual(EXPECTED_OUTPUT);
|
||||||
|
});
|
||||||
|
});
|
65
apps/explorer/src/app/lib/encoders/abis/update-asset.ts
Normal file
65
apps/explorer/src/app/lib/encoders/abis/update-asset.ts
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
import { defaultAbiCoder, isAddress } from 'ethers/lib/utils';
|
||||||
|
import { encodeBridgeCommand } from './bridge-command';
|
||||||
|
import type { AbiType } from './abi-types';
|
||||||
|
|
||||||
|
export const METHOD_NAME = 'set_asset_limits';
|
||||||
|
|
||||||
|
export const LIST_ASSET_ABI: AbiType[] = [
|
||||||
|
// Asset address
|
||||||
|
'address',
|
||||||
|
// Lifetime limit
|
||||||
|
'uint256',
|
||||||
|
// Withdraw threshold
|
||||||
|
'uint256',
|
||||||
|
// Nonce
|
||||||
|
'uint256',
|
||||||
|
// Contract method name
|
||||||
|
'string',
|
||||||
|
];
|
||||||
|
|
||||||
|
export interface EncodeUpdateAssetParameters {
|
||||||
|
// The ETH address of the ERC20 asset
|
||||||
|
assetERC20: string;
|
||||||
|
// The number as a string of the asset
|
||||||
|
limit: string;
|
||||||
|
// THe number-as-a-string of the withdraw threshold
|
||||||
|
threshold: string;
|
||||||
|
// The n-once supplied to the contract
|
||||||
|
nonce: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates an ABI encoded function call to list an asset
|
||||||
|
*
|
||||||
|
* @param EncodeListAssetParameters The arguments for the ABI call
|
||||||
|
* @returns string encoded message
|
||||||
|
*/
|
||||||
|
export function encodeUpdateAsset({
|
||||||
|
assetERC20,
|
||||||
|
limit,
|
||||||
|
threshold,
|
||||||
|
nonce,
|
||||||
|
}: EncodeUpdateAssetParameters) {
|
||||||
|
if (!isAddress(assetERC20)) {
|
||||||
|
throw new Error('Asset ERC20 must be a valid address');
|
||||||
|
}
|
||||||
|
|
||||||
|
const values = [assetERC20, limit, threshold, nonce, METHOD_NAME];
|
||||||
|
|
||||||
|
return defaultAbiCoder.encode(LIST_ASSET_ABI, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience function that encodes and packs the message as it is encoded by the
|
||||||
|
* validators in a multisig bundle
|
||||||
|
*
|
||||||
|
* @param params Parameters for the List Asset call
|
||||||
|
* @param bridgeAddress Bridge address for the appropiate network
|
||||||
|
* @returns keccak256 encoded message digest
|
||||||
|
*/
|
||||||
|
export function encodeUpdateAssetBridgeTx(
|
||||||
|
params: EncodeUpdateAssetParameters,
|
||||||
|
bridgeAddress: string
|
||||||
|
) {
|
||||||
|
return encodeBridgeCommand(encodeUpdateAsset(params), bridgeAddress);
|
||||||
|
}
|
@ -3,115 +3,66 @@ import * as Types from '@vegaprotocol/types';
|
|||||||
import { gql } from '@apollo/client';
|
import { gql } from '@apollo/client';
|
||||||
import * as Apollo from '@apollo/client';
|
import * as Apollo from '@apollo/client';
|
||||||
const defaultOptions = {} as const;
|
const defaultOptions = {} as const;
|
||||||
export type WalletDelegationFieldsFragment = {
|
export type WalletDelegationFieldsFragment = { __typename?: 'Delegation', amount: string, epoch: number, node: { __typename?: 'Node', id: string, name: string } };
|
||||||
__typename?: 'Delegation';
|
|
||||||
amount: string;
|
|
||||||
epoch: number;
|
|
||||||
node: { __typename?: 'Node'; id: string; name: string };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type DelegationsQueryVariables = Types.Exact<{
|
export type DelegationsQueryVariables = Types.Exact<{
|
||||||
partyId: Types.Scalars['ID'];
|
partyId: Types.Scalars['ID'];
|
||||||
delegationsPagination?: Types.InputMaybe<Types.Pagination>;
|
delegationsPagination?: Types.InputMaybe<Types.Pagination>;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type DelegationsQuery = {
|
|
||||||
__typename?: 'Query';
|
export type DelegationsQuery = { __typename?: 'Query', epoch: { __typename?: 'Epoch', id: string }, party?: { __typename?: 'Party', id: string, delegationsConnection?: { __typename?: 'DelegationsConnection', edges?: Array<{ __typename?: 'DelegationEdge', node: { __typename?: 'Delegation', amount: string, epoch: number, node: { __typename?: 'Node', id: string, name: string } } } | null> | null } | null, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string }, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', name: string, id: string, decimals: number, symbol: string, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string } } } } | null> | null } | null } | null };
|
||||||
epoch: { __typename?: 'Epoch'; id: string };
|
|
||||||
party?: {
|
|
||||||
__typename?: 'Party';
|
|
||||||
id: string;
|
|
||||||
delegationsConnection?: {
|
|
||||||
__typename?: 'DelegationsConnection';
|
|
||||||
edges?: Array<{
|
|
||||||
__typename?: 'DelegationEdge';
|
|
||||||
node: {
|
|
||||||
__typename?: 'Delegation';
|
|
||||||
amount: string;
|
|
||||||
epoch: number;
|
|
||||||
node: { __typename?: 'Node'; id: string; name: string };
|
|
||||||
};
|
|
||||||
} | null> | null;
|
|
||||||
} | null;
|
|
||||||
stakingSummary: {
|
|
||||||
__typename?: 'StakingSummary';
|
|
||||||
currentStakeAvailable: string;
|
|
||||||
};
|
|
||||||
accountsConnection?: {
|
|
||||||
__typename?: 'AccountsConnection';
|
|
||||||
edges?: Array<{
|
|
||||||
__typename?: 'AccountEdge';
|
|
||||||
node: {
|
|
||||||
__typename?: 'AccountBalance';
|
|
||||||
type: Types.AccountType;
|
|
||||||
balance: string;
|
|
||||||
asset: {
|
|
||||||
__typename?: 'Asset';
|
|
||||||
name: string;
|
|
||||||
id: string;
|
|
||||||
decimals: number;
|
|
||||||
symbol: string;
|
|
||||||
source:
|
|
||||||
| { __typename: 'BuiltinAsset' }
|
|
||||||
| { __typename: 'ERC20'; contractAddress: string };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} | null> | null;
|
|
||||||
} | null;
|
|
||||||
} | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const WalletDelegationFieldsFragmentDoc = gql`
|
export const WalletDelegationFieldsFragmentDoc = gql`
|
||||||
fragment WalletDelegationFields on Delegation {
|
fragment WalletDelegationFields on Delegation {
|
||||||
amount
|
amount
|
||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
}
|
|
||||||
epoch
|
|
||||||
}
|
}
|
||||||
`;
|
epoch
|
||||||
|
}
|
||||||
|
`;
|
||||||
export const DelegationsDocument = gql`
|
export const DelegationsDocument = gql`
|
||||||
query Delegations($partyId: ID!, $delegationsPagination: Pagination) {
|
query Delegations($partyId: ID!, $delegationsPagination: Pagination) {
|
||||||
epoch {
|
epoch {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
party(id: $partyId) {
|
party(id: $partyId) {
|
||||||
id
|
id
|
||||||
delegationsConnection(pagination: $delegationsPagination) {
|
delegationsConnection(pagination: $delegationsPagination) {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
...WalletDelegationFields
|
...WalletDelegationFields
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stakingSummary {
|
}
|
||||||
currentStakeAvailable
|
stakingSummary {
|
||||||
}
|
currentStakeAvailable
|
||||||
accountsConnection {
|
}
|
||||||
edges {
|
accountsConnection {
|
||||||
node {
|
edges {
|
||||||
asset {
|
node {
|
||||||
name
|
asset {
|
||||||
id
|
name
|
||||||
decimals
|
id
|
||||||
symbol
|
decimals
|
||||||
source {
|
symbol
|
||||||
__typename
|
source {
|
||||||
... on ERC20 {
|
__typename
|
||||||
contractAddress
|
... on ERC20 {
|
||||||
}
|
contractAddress
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
type
|
|
||||||
balance
|
|
||||||
}
|
}
|
||||||
|
type
|
||||||
|
balance
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
${WalletDelegationFieldsFragmentDoc}
|
}
|
||||||
`;
|
${WalletDelegationFieldsFragmentDoc}`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __useDelegationsQuery__
|
* __useDelegationsQuery__
|
||||||
@ -130,35 +81,14 @@ export const DelegationsDocument = gql`
|
|||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function useDelegationsQuery(
|
export function useDelegationsQuery(baseOptions: Apollo.QueryHookOptions<DelegationsQuery, DelegationsQueryVariables>) {
|
||||||
baseOptions: Apollo.QueryHookOptions<
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
DelegationsQuery,
|
return Apollo.useQuery<DelegationsQuery, DelegationsQueryVariables>(DelegationsDocument, options);
|
||||||
DelegationsQueryVariables
|
}
|
||||||
>
|
export function useDelegationsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<DelegationsQuery, DelegationsQueryVariables>) {
|
||||||
) {
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
return Apollo.useLazyQuery<DelegationsQuery, DelegationsQueryVariables>(DelegationsDocument, options);
|
||||||
return Apollo.useQuery<DelegationsQuery, DelegationsQueryVariables>(
|
}
|
||||||
DelegationsDocument,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
export function useDelegationsLazyQuery(
|
|
||||||
baseOptions?: Apollo.LazyQueryHookOptions<
|
|
||||||
DelegationsQuery,
|
|
||||||
DelegationsQueryVariables
|
|
||||||
>
|
|
||||||
) {
|
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
|
||||||
return Apollo.useLazyQuery<DelegationsQuery, DelegationsQueryVariables>(
|
|
||||||
DelegationsDocument,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
export type DelegationsQueryHookResult = ReturnType<typeof useDelegationsQuery>;
|
export type DelegationsQueryHookResult = ReturnType<typeof useDelegationsQuery>;
|
||||||
export type DelegationsLazyQueryHookResult = ReturnType<
|
export type DelegationsLazyQueryHookResult = ReturnType<typeof useDelegationsLazyQuery>;
|
||||||
typeof useDelegationsLazyQuery
|
export type DelegationsQueryResult = Apollo.QueryResult<DelegationsQuery, DelegationsQueryVariables>;
|
||||||
>;
|
|
||||||
export type DelegationsQueryResult = Apollo.QueryResult<
|
|
||||||
DelegationsQuery,
|
|
||||||
DelegationsQueryVariables
|
|
||||||
>;
|
|
@ -7,44 +7,29 @@ export type ProposalAssetQueryVariables = Types.Exact<{
|
|||||||
assetId: Types.Scalars['ID'];
|
assetId: Types.Scalars['ID'];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type ProposalAssetQuery = {
|
|
||||||
__typename?: 'Query';
|
export type ProposalAssetQuery = { __typename?: 'Query', asset?: { __typename?: 'Asset', status: Types.AssetStatus, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } } | null };
|
||||||
asset?: {
|
|
||||||
__typename?: 'Asset';
|
|
||||||
status: Types.AssetStatus;
|
|
||||||
source:
|
|
||||||
| { __typename?: 'BuiltinAsset' }
|
|
||||||
| { __typename?: 'ERC20'; contractAddress: string };
|
|
||||||
} | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type AssetListBundleQueryVariables = Types.Exact<{
|
export type AssetListBundleQueryVariables = Types.Exact<{
|
||||||
assetId: Types.Scalars['ID'];
|
assetId: Types.Scalars['ID'];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type AssetListBundleQuery = {
|
|
||||||
__typename?: 'Query';
|
export type AssetListBundleQuery = { __typename?: 'Query', erc20ListAssetBundle?: { __typename?: 'Erc20ListAssetBundle', assetSource: string, vegaAssetId: string, nonce: string, signatures: string } | null };
|
||||||
erc20ListAssetBundle?: {
|
|
||||||
__typename?: 'Erc20ListAssetBundle';
|
|
||||||
assetSource: string;
|
|
||||||
vegaAssetId: string;
|
|
||||||
nonce: string;
|
|
||||||
signatures: string;
|
|
||||||
} | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ProposalAssetDocument = gql`
|
export const ProposalAssetDocument = gql`
|
||||||
query ProposalAsset($assetId: ID!) {
|
query ProposalAsset($assetId: ID!) {
|
||||||
asset(id: $assetId) {
|
asset(id: $assetId) {
|
||||||
status
|
status
|
||||||
source {
|
source {
|
||||||
... on ERC20 {
|
... on ERC20 {
|
||||||
contractAddress
|
contractAddress
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __useProposalAssetQuery__
|
* __useProposalAssetQuery__
|
||||||
@ -62,50 +47,27 @@ export const ProposalAssetDocument = gql`
|
|||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function useProposalAssetQuery(
|
export function useProposalAssetQuery(baseOptions: Apollo.QueryHookOptions<ProposalAssetQuery, ProposalAssetQueryVariables>) {
|
||||||
baseOptions: Apollo.QueryHookOptions<
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
ProposalAssetQuery,
|
return Apollo.useQuery<ProposalAssetQuery, ProposalAssetQueryVariables>(ProposalAssetDocument, options);
|
||||||
ProposalAssetQueryVariables
|
}
|
||||||
>
|
export function useProposalAssetLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ProposalAssetQuery, ProposalAssetQueryVariables>) {
|
||||||
) {
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
return Apollo.useLazyQuery<ProposalAssetQuery, ProposalAssetQueryVariables>(ProposalAssetDocument, options);
|
||||||
return Apollo.useQuery<ProposalAssetQuery, ProposalAssetQueryVariables>(
|
}
|
||||||
ProposalAssetDocument,
|
export type ProposalAssetQueryHookResult = ReturnType<typeof useProposalAssetQuery>;
|
||||||
options
|
export type ProposalAssetLazyQueryHookResult = ReturnType<typeof useProposalAssetLazyQuery>;
|
||||||
);
|
export type ProposalAssetQueryResult = Apollo.QueryResult<ProposalAssetQuery, ProposalAssetQueryVariables>;
|
||||||
}
|
|
||||||
export function useProposalAssetLazyQuery(
|
|
||||||
baseOptions?: Apollo.LazyQueryHookOptions<
|
|
||||||
ProposalAssetQuery,
|
|
||||||
ProposalAssetQueryVariables
|
|
||||||
>
|
|
||||||
) {
|
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
|
||||||
return Apollo.useLazyQuery<ProposalAssetQuery, ProposalAssetQueryVariables>(
|
|
||||||
ProposalAssetDocument,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
export type ProposalAssetQueryHookResult = ReturnType<
|
|
||||||
typeof useProposalAssetQuery
|
|
||||||
>;
|
|
||||||
export type ProposalAssetLazyQueryHookResult = ReturnType<
|
|
||||||
typeof useProposalAssetLazyQuery
|
|
||||||
>;
|
|
||||||
export type ProposalAssetQueryResult = Apollo.QueryResult<
|
|
||||||
ProposalAssetQuery,
|
|
||||||
ProposalAssetQueryVariables
|
|
||||||
>;
|
|
||||||
export const AssetListBundleDocument = gql`
|
export const AssetListBundleDocument = gql`
|
||||||
query AssetListBundle($assetId: ID!) {
|
query AssetListBundle($assetId: ID!) {
|
||||||
erc20ListAssetBundle(assetId: $assetId) {
|
erc20ListAssetBundle(assetId: $assetId) {
|
||||||
assetSource
|
assetSource
|
||||||
vegaAssetId
|
vegaAssetId
|
||||||
nonce
|
nonce
|
||||||
signatures
|
signatures
|
||||||
}
|
|
||||||
}
|
}
|
||||||
`;
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __useAssetListBundleQuery__
|
* __useAssetListBundleQuery__
|
||||||
@ -123,37 +85,14 @@ export const AssetListBundleDocument = gql`
|
|||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function useAssetListBundleQuery(
|
export function useAssetListBundleQuery(baseOptions: Apollo.QueryHookOptions<AssetListBundleQuery, AssetListBundleQueryVariables>) {
|
||||||
baseOptions: Apollo.QueryHookOptions<
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
AssetListBundleQuery,
|
return Apollo.useQuery<AssetListBundleQuery, AssetListBundleQueryVariables>(AssetListBundleDocument, options);
|
||||||
AssetListBundleQueryVariables
|
}
|
||||||
>
|
export function useAssetListBundleLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<AssetListBundleQuery, AssetListBundleQueryVariables>) {
|
||||||
) {
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
return Apollo.useLazyQuery<AssetListBundleQuery, AssetListBundleQueryVariables>(AssetListBundleDocument, options);
|
||||||
return Apollo.useQuery<AssetListBundleQuery, AssetListBundleQueryVariables>(
|
}
|
||||||
AssetListBundleDocument,
|
export type AssetListBundleQueryHookResult = ReturnType<typeof useAssetListBundleQuery>;
|
||||||
options
|
export type AssetListBundleLazyQueryHookResult = ReturnType<typeof useAssetListBundleLazyQuery>;
|
||||||
);
|
export type AssetListBundleQueryResult = Apollo.QueryResult<AssetListBundleQuery, AssetListBundleQueryVariables>;
|
||||||
}
|
|
||||||
export function useAssetListBundleLazyQuery(
|
|
||||||
baseOptions?: Apollo.LazyQueryHookOptions<
|
|
||||||
AssetListBundleQuery,
|
|
||||||
AssetListBundleQueryVariables
|
|
||||||
>
|
|
||||||
) {
|
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
|
||||||
return Apollo.useLazyQuery<
|
|
||||||
AssetListBundleQuery,
|
|
||||||
AssetListBundleQueryVariables
|
|
||||||
>(AssetListBundleDocument, options);
|
|
||||||
}
|
|
||||||
export type AssetListBundleQueryHookResult = ReturnType<
|
|
||||||
typeof useAssetListBundleQuery
|
|
||||||
>;
|
|
||||||
export type AssetListBundleLazyQueryHookResult = ReturnType<
|
|
||||||
typeof useAssetListBundleLazyQuery
|
|
||||||
>;
|
|
||||||
export type AssetListBundleQueryResult = Apollo.QueryResult<
|
|
||||||
AssetListBundleQuery,
|
|
||||||
AssetListBundleQueryVariables
|
|
||||||
>;
|
|
@ -7,28 +7,20 @@ export type VoteButtonsQueryVariables = Types.Exact<{
|
|||||||
partyId: Types.Scalars['ID'];
|
partyId: Types.Scalars['ID'];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type VoteButtonsQuery = {
|
|
||||||
__typename?: 'Query';
|
export type VoteButtonsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string } } | null };
|
||||||
party?: {
|
|
||||||
__typename?: 'Party';
|
|
||||||
id: string;
|
|
||||||
stakingSummary: {
|
|
||||||
__typename?: 'StakingSummary';
|
|
||||||
currentStakeAvailable: string;
|
|
||||||
};
|
|
||||||
} | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const VoteButtonsDocument = gql`
|
export const VoteButtonsDocument = gql`
|
||||||
query VoteButtons($partyId: ID!) {
|
query VoteButtons($partyId: ID!) {
|
||||||
party(id: $partyId) {
|
party(id: $partyId) {
|
||||||
id
|
id
|
||||||
stakingSummary {
|
stakingSummary {
|
||||||
currentStakeAvailable
|
currentStakeAvailable
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __useVoteButtonsQuery__
|
* __useVoteButtonsQuery__
|
||||||
@ -46,35 +38,14 @@ export const VoteButtonsDocument = gql`
|
|||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function useVoteButtonsQuery(
|
export function useVoteButtonsQuery(baseOptions: Apollo.QueryHookOptions<VoteButtonsQuery, VoteButtonsQueryVariables>) {
|
||||||
baseOptions: Apollo.QueryHookOptions<
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
VoteButtonsQuery,
|
return Apollo.useQuery<VoteButtonsQuery, VoteButtonsQueryVariables>(VoteButtonsDocument, options);
|
||||||
VoteButtonsQueryVariables
|
}
|
||||||
>
|
export function useVoteButtonsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<VoteButtonsQuery, VoteButtonsQueryVariables>) {
|
||||||
) {
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
return Apollo.useLazyQuery<VoteButtonsQuery, VoteButtonsQueryVariables>(VoteButtonsDocument, options);
|
||||||
return Apollo.useQuery<VoteButtonsQuery, VoteButtonsQueryVariables>(
|
}
|
||||||
VoteButtonsDocument,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
export function useVoteButtonsLazyQuery(
|
|
||||||
baseOptions?: Apollo.LazyQueryHookOptions<
|
|
||||||
VoteButtonsQuery,
|
|
||||||
VoteButtonsQueryVariables
|
|
||||||
>
|
|
||||||
) {
|
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
|
||||||
return Apollo.useLazyQuery<VoteButtonsQuery, VoteButtonsQueryVariables>(
|
|
||||||
VoteButtonsDocument,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
export type VoteButtonsQueryHookResult = ReturnType<typeof useVoteButtonsQuery>;
|
export type VoteButtonsQueryHookResult = ReturnType<typeof useVoteButtonsQuery>;
|
||||||
export type VoteButtonsLazyQueryHookResult = ReturnType<
|
export type VoteButtonsLazyQueryHookResult = ReturnType<typeof useVoteButtonsLazyQuery>;
|
||||||
typeof useVoteButtonsLazyQuery
|
export type VoteButtonsQueryResult = Apollo.QueryResult<VoteButtonsQuery, VoteButtonsQueryVariables>;
|
||||||
>;
|
|
||||||
export type VoteButtonsQueryResult = Apollo.QueryResult<
|
|
||||||
VoteButtonsQuery,
|
|
||||||
VoteButtonsQueryVariables
|
|
||||||
>;
|
|
@ -7,41 +7,27 @@ export type UserVoteQueryVariables = Types.Exact<{
|
|||||||
partyId: Types.Scalars['ID'];
|
partyId: Types.Scalars['ID'];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type UserVoteQuery = {
|
|
||||||
__typename?: 'Query';
|
export type UserVoteQuery = { __typename?: 'Query', party?: { __typename?: 'Party', votesConnection?: { __typename?: 'ProposalVoteConnection', edges?: Array<{ __typename?: 'ProposalVoteEdge', node: { __typename?: 'ProposalVote', proposalId: string, vote: { __typename?: 'Vote', value: Types.VoteValue, datetime: any } } }> | null } | null } | null };
|
||||||
party?: {
|
|
||||||
__typename?: 'Party';
|
|
||||||
votesConnection?: {
|
|
||||||
__typename?: 'ProposalVoteConnection';
|
|
||||||
edges?: Array<{
|
|
||||||
__typename?: 'ProposalVoteEdge';
|
|
||||||
node: {
|
|
||||||
__typename?: 'ProposalVote';
|
|
||||||
proposalId: string;
|
|
||||||
vote: { __typename?: 'Vote'; value: Types.VoteValue; datetime: any };
|
|
||||||
};
|
|
||||||
}> | null;
|
|
||||||
} | null;
|
|
||||||
} | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const UserVoteDocument = gql`
|
export const UserVoteDocument = gql`
|
||||||
query UserVote($partyId: ID!) {
|
query UserVote($partyId: ID!) {
|
||||||
party(id: $partyId) {
|
party(id: $partyId) {
|
||||||
votesConnection {
|
votesConnection {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
proposalId
|
proposalId
|
||||||
vote {
|
vote {
|
||||||
value
|
value
|
||||||
datetime
|
datetime
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __useUserVoteQuery__
|
* __useUserVoteQuery__
|
||||||
@ -59,32 +45,14 @@ export const UserVoteDocument = gql`
|
|||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function useUserVoteQuery(
|
export function useUserVoteQuery(baseOptions: Apollo.QueryHookOptions<UserVoteQuery, UserVoteQueryVariables>) {
|
||||||
baseOptions: Apollo.QueryHookOptions<UserVoteQuery, UserVoteQueryVariables>
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
) {
|
return Apollo.useQuery<UserVoteQuery, UserVoteQueryVariables>(UserVoteDocument, options);
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
}
|
||||||
return Apollo.useQuery<UserVoteQuery, UserVoteQueryVariables>(
|
export function useUserVoteLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<UserVoteQuery, UserVoteQueryVariables>) {
|
||||||
UserVoteDocument,
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
options
|
return Apollo.useLazyQuery<UserVoteQuery, UserVoteQueryVariables>(UserVoteDocument, options);
|
||||||
);
|
}
|
||||||
}
|
|
||||||
export function useUserVoteLazyQuery(
|
|
||||||
baseOptions?: Apollo.LazyQueryHookOptions<
|
|
||||||
UserVoteQuery,
|
|
||||||
UserVoteQueryVariables
|
|
||||||
>
|
|
||||||
) {
|
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
|
||||||
return Apollo.useLazyQuery<UserVoteQuery, UserVoteQueryVariables>(
|
|
||||||
UserVoteDocument,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
export type UserVoteQueryHookResult = ReturnType<typeof useUserVoteQuery>;
|
export type UserVoteQueryHookResult = ReturnType<typeof useUserVoteQuery>;
|
||||||
export type UserVoteLazyQueryHookResult = ReturnType<
|
export type UserVoteLazyQueryHookResult = ReturnType<typeof useUserVoteLazyQuery>;
|
||||||
typeof useUserVoteLazyQuery
|
export type UserVoteQueryResult = Apollo.QueryResult<UserVoteQuery, UserVoteQueryVariables>;
|
||||||
>;
|
|
||||||
export type UserVoteQueryResult = Apollo.QueryResult<
|
|
||||||
UserVoteQuery,
|
|
||||||
UserVoteQueryVariables
|
|
||||||
>;
|
|
File diff suppressed because one or more lines are too long
@ -3,279 +3,106 @@ import * as Types from '@vegaprotocol/types';
|
|||||||
import { gql } from '@apollo/client';
|
import { gql } from '@apollo/client';
|
||||||
import * as Apollo from '@apollo/client';
|
import * as Apollo from '@apollo/client';
|
||||||
const defaultOptions = {} as const;
|
const defaultOptions = {} as const;
|
||||||
export type ProposalFieldsFragment = {
|
export type ProposalFieldsFragment = { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, withdrawThreshold: string, lifetimeLimit: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } };
|
||||||
__typename?: 'Proposal';
|
|
||||||
id?: string | null;
|
|
||||||
reference: string;
|
|
||||||
state: Types.ProposalState;
|
|
||||||
datetime: any;
|
|
||||||
rejectionReason?: Types.ProposalRejectionReason | null;
|
|
||||||
errorDetails?: string | null;
|
|
||||||
rationale: {
|
|
||||||
__typename?: 'ProposalRationale';
|
|
||||||
title: string;
|
|
||||||
description: string;
|
|
||||||
};
|
|
||||||
party: { __typename?: 'Party'; id: string };
|
|
||||||
terms: {
|
|
||||||
__typename?: 'ProposalTerms';
|
|
||||||
closingDatetime: any;
|
|
||||||
enactmentDatetime?: any | null;
|
|
||||||
change:
|
|
||||||
| {
|
|
||||||
__typename: 'NewAsset';
|
|
||||||
name: string;
|
|
||||||
symbol: string;
|
|
||||||
decimals: number;
|
|
||||||
quantum: string;
|
|
||||||
source:
|
|
||||||
| { __typename?: 'BuiltinAsset'; maxFaucetAmountMint: string }
|
|
||||||
| {
|
|
||||||
__typename?: 'ERC20';
|
|
||||||
contractAddress: string;
|
|
||||||
withdrawThreshold: string;
|
|
||||||
lifetimeLimit: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
| { __typename?: 'NewFreeform' }
|
|
||||||
| {
|
|
||||||
__typename?: 'NewMarket';
|
|
||||||
instrument: {
|
|
||||||
__typename?: 'InstrumentConfiguration';
|
|
||||||
name: string;
|
|
||||||
code: string;
|
|
||||||
futureProduct?: {
|
|
||||||
__typename?: 'FutureProduct';
|
|
||||||
settlementAsset: { __typename?: 'Asset'; symbol: string };
|
|
||||||
} | null;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
__typename?: 'UpdateAsset';
|
|
||||||
quantum: string;
|
|
||||||
assetId: string;
|
|
||||||
source: {
|
|
||||||
__typename?: 'UpdateERC20';
|
|
||||||
lifetimeLimit: string;
|
|
||||||
withdrawThreshold: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
| { __typename?: 'UpdateMarket'; marketId: string }
|
|
||||||
| {
|
|
||||||
__typename?: 'UpdateNetworkParameter';
|
|
||||||
networkParameter: {
|
|
||||||
__typename?: 'NetworkParameter';
|
|
||||||
key: string;
|
|
||||||
value: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
votes: {
|
|
||||||
__typename?: 'ProposalVotes';
|
|
||||||
yes: {
|
|
||||||
__typename?: 'ProposalVoteSide';
|
|
||||||
totalTokens: string;
|
|
||||||
totalNumber: string;
|
|
||||||
totalEquityLikeShareWeight: string;
|
|
||||||
};
|
|
||||||
no: {
|
|
||||||
__typename?: 'ProposalVoteSide';
|
|
||||||
totalTokens: string;
|
|
||||||
totalNumber: string;
|
|
||||||
totalEquityLikeShareWeight: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ProposalsQueryVariables = Types.Exact<{ [key: string]: never }>;
|
export type ProposalsQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||||
|
|
||||||
export type ProposalsQuery = {
|
|
||||||
__typename?: 'Query';
|
export type ProposalsQuery = { __typename?: 'Query', proposalsConnection?: { __typename?: 'ProposalsConnection', edges?: Array<{ __typename?: 'ProposalEdge', node: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, withdrawThreshold: string, lifetimeLimit: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } } } | null> | null } | null };
|
||||||
proposalsConnection?: {
|
|
||||||
__typename?: 'ProposalsConnection';
|
|
||||||
edges?: Array<{
|
|
||||||
__typename?: 'ProposalEdge';
|
|
||||||
node: {
|
|
||||||
__typename?: 'Proposal';
|
|
||||||
id?: string | null;
|
|
||||||
reference: string;
|
|
||||||
state: Types.ProposalState;
|
|
||||||
datetime: any;
|
|
||||||
rejectionReason?: Types.ProposalRejectionReason | null;
|
|
||||||
errorDetails?: string | null;
|
|
||||||
rationale: {
|
|
||||||
__typename?: 'ProposalRationale';
|
|
||||||
title: string;
|
|
||||||
description: string;
|
|
||||||
};
|
|
||||||
party: { __typename?: 'Party'; id: string };
|
|
||||||
terms: {
|
|
||||||
__typename?: 'ProposalTerms';
|
|
||||||
closingDatetime: any;
|
|
||||||
enactmentDatetime?: any | null;
|
|
||||||
change:
|
|
||||||
| {
|
|
||||||
__typename: 'NewAsset';
|
|
||||||
name: string;
|
|
||||||
symbol: string;
|
|
||||||
decimals: number;
|
|
||||||
quantum: string;
|
|
||||||
source:
|
|
||||||
| { __typename?: 'BuiltinAsset'; maxFaucetAmountMint: string }
|
|
||||||
| {
|
|
||||||
__typename?: 'ERC20';
|
|
||||||
contractAddress: string;
|
|
||||||
withdrawThreshold: string;
|
|
||||||
lifetimeLimit: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
| { __typename?: 'NewFreeform' }
|
|
||||||
| {
|
|
||||||
__typename?: 'NewMarket';
|
|
||||||
instrument: {
|
|
||||||
__typename?: 'InstrumentConfiguration';
|
|
||||||
name: string;
|
|
||||||
code: string;
|
|
||||||
futureProduct?: {
|
|
||||||
__typename?: 'FutureProduct';
|
|
||||||
settlementAsset: { __typename?: 'Asset'; symbol: string };
|
|
||||||
} | null;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
__typename?: 'UpdateAsset';
|
|
||||||
quantum: string;
|
|
||||||
assetId: string;
|
|
||||||
source: {
|
|
||||||
__typename?: 'UpdateERC20';
|
|
||||||
lifetimeLimit: string;
|
|
||||||
withdrawThreshold: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
| { __typename?: 'UpdateMarket'; marketId: string }
|
|
||||||
| {
|
|
||||||
__typename?: 'UpdateNetworkParameter';
|
|
||||||
networkParameter: {
|
|
||||||
__typename?: 'NetworkParameter';
|
|
||||||
key: string;
|
|
||||||
value: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
votes: {
|
|
||||||
__typename?: 'ProposalVotes';
|
|
||||||
yes: {
|
|
||||||
__typename?: 'ProposalVoteSide';
|
|
||||||
totalTokens: string;
|
|
||||||
totalNumber: string;
|
|
||||||
totalEquityLikeShareWeight: string;
|
|
||||||
};
|
|
||||||
no: {
|
|
||||||
__typename?: 'ProposalVoteSide';
|
|
||||||
totalTokens: string;
|
|
||||||
totalNumber: string;
|
|
||||||
totalEquityLikeShareWeight: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} | null> | null;
|
|
||||||
} | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ProposalFieldsFragmentDoc = gql`
|
export const ProposalFieldsFragmentDoc = gql`
|
||||||
fragment ProposalFields on Proposal {
|
fragment ProposalFields on Proposal {
|
||||||
|
id
|
||||||
|
rationale {
|
||||||
|
title
|
||||||
|
description
|
||||||
|
}
|
||||||
|
reference
|
||||||
|
state
|
||||||
|
datetime
|
||||||
|
rejectionReason
|
||||||
|
party {
|
||||||
id
|
id
|
||||||
rationale {
|
}
|
||||||
title
|
errorDetails
|
||||||
description
|
terms {
|
||||||
}
|
closingDatetime
|
||||||
reference
|
enactmentDatetime
|
||||||
state
|
change {
|
||||||
datetime
|
... on NewMarket {
|
||||||
rejectionReason
|
instrument {
|
||||||
party {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
errorDetails
|
|
||||||
terms {
|
|
||||||
closingDatetime
|
|
||||||
enactmentDatetime
|
|
||||||
change {
|
|
||||||
... on NewMarket {
|
|
||||||
instrument {
|
|
||||||
name
|
|
||||||
code
|
|
||||||
futureProduct {
|
|
||||||
settlementAsset {
|
|
||||||
symbol
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on UpdateMarket {
|
|
||||||
marketId
|
|
||||||
}
|
|
||||||
... on NewAsset {
|
|
||||||
__typename
|
|
||||||
name
|
name
|
||||||
symbol
|
code
|
||||||
decimals
|
futureProduct {
|
||||||
quantum
|
settlementAsset {
|
||||||
source {
|
symbol
|
||||||
... on BuiltinAsset {
|
|
||||||
maxFaucetAmountMint
|
|
||||||
}
|
|
||||||
... on ERC20 {
|
|
||||||
contractAddress
|
|
||||||
withdrawThreshold
|
|
||||||
lifetimeLimit
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on UpdateNetworkParameter {
|
|
||||||
networkParameter {
|
|
||||||
key
|
|
||||||
value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on UpdateAsset {
|
|
||||||
quantum
|
|
||||||
assetId
|
|
||||||
source {
|
|
||||||
... on UpdateERC20 {
|
|
||||||
lifetimeLimit
|
|
||||||
withdrawThreshold
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
... on UpdateMarket {
|
||||||
votes {
|
marketId
|
||||||
yes {
|
|
||||||
totalTokens
|
|
||||||
totalNumber
|
|
||||||
totalEquityLikeShareWeight
|
|
||||||
}
|
}
|
||||||
no {
|
... on NewAsset {
|
||||||
totalTokens
|
__typename
|
||||||
totalNumber
|
name
|
||||||
totalEquityLikeShareWeight
|
symbol
|
||||||
|
decimals
|
||||||
|
quantum
|
||||||
|
source {
|
||||||
|
... on BuiltinAsset {
|
||||||
|
maxFaucetAmountMint
|
||||||
|
}
|
||||||
|
... on ERC20 {
|
||||||
|
contractAddress
|
||||||
|
withdrawThreshold
|
||||||
|
lifetimeLimit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
... on UpdateNetworkParameter {
|
||||||
|
networkParameter {
|
||||||
|
key
|
||||||
|
value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
... on UpdateAsset {
|
||||||
|
quantum
|
||||||
|
assetId
|
||||||
|
source {
|
||||||
|
... on UpdateERC20 {
|
||||||
|
lifetimeLimit
|
||||||
|
withdrawThreshold
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
votes {
|
||||||
|
yes {
|
||||||
|
totalTokens
|
||||||
|
totalNumber
|
||||||
|
totalEquityLikeShareWeight
|
||||||
|
}
|
||||||
|
no {
|
||||||
|
totalTokens
|
||||||
|
totalNumber
|
||||||
|
totalEquityLikeShareWeight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
export const ProposalsDocument = gql`
|
export const ProposalsDocument = gql`
|
||||||
query Proposals {
|
query Proposals {
|
||||||
proposalsConnection {
|
proposalsConnection {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
...ProposalFields
|
...ProposalFields
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
${ProposalFieldsFragmentDoc}
|
}
|
||||||
`;
|
${ProposalFieldsFragmentDoc}`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __useProposalsQuery__
|
* __useProposalsQuery__
|
||||||
@ -292,32 +119,14 @@ export const ProposalsDocument = gql`
|
|||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function useProposalsQuery(
|
export function useProposalsQuery(baseOptions?: Apollo.QueryHookOptions<ProposalsQuery, ProposalsQueryVariables>) {
|
||||||
baseOptions?: Apollo.QueryHookOptions<ProposalsQuery, ProposalsQueryVariables>
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
) {
|
return Apollo.useQuery<ProposalsQuery, ProposalsQueryVariables>(ProposalsDocument, options);
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
}
|
||||||
return Apollo.useQuery<ProposalsQuery, ProposalsQueryVariables>(
|
export function useProposalsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ProposalsQuery, ProposalsQueryVariables>) {
|
||||||
ProposalsDocument,
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
options
|
return Apollo.useLazyQuery<ProposalsQuery, ProposalsQueryVariables>(ProposalsDocument, options);
|
||||||
);
|
}
|
||||||
}
|
|
||||||
export function useProposalsLazyQuery(
|
|
||||||
baseOptions?: Apollo.LazyQueryHookOptions<
|
|
||||||
ProposalsQuery,
|
|
||||||
ProposalsQueryVariables
|
|
||||||
>
|
|
||||||
) {
|
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
|
||||||
return Apollo.useLazyQuery<ProposalsQuery, ProposalsQueryVariables>(
|
|
||||||
ProposalsDocument,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
export type ProposalsQueryHookResult = ReturnType<typeof useProposalsQuery>;
|
export type ProposalsQueryHookResult = ReturnType<typeof useProposalsQuery>;
|
||||||
export type ProposalsLazyQueryHookResult = ReturnType<
|
export type ProposalsLazyQueryHookResult = ReturnType<typeof useProposalsLazyQuery>;
|
||||||
typeof useProposalsLazyQuery
|
export type ProposalsQueryResult = Apollo.QueryResult<ProposalsQuery, ProposalsQueryVariables>;
|
||||||
>;
|
|
||||||
export type ProposalsQueryResult = Apollo.QueryResult<
|
|
||||||
ProposalsQuery,
|
|
||||||
ProposalsQueryVariables
|
|
||||||
>;
|
|
@ -3,45 +3,29 @@ import * as Types from '@vegaprotocol/types';
|
|||||||
import { gql } from '@apollo/client';
|
import { gql } from '@apollo/client';
|
||||||
import * as Apollo from '@apollo/client';
|
import * as Apollo from '@apollo/client';
|
||||||
const defaultOptions = {} as const;
|
const defaultOptions = {} as const;
|
||||||
export type ProposalMarketsQueryQueryVariables = Types.Exact<{
|
export type ProposalMarketsQueryQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||||
[key: string]: never;
|
|
||||||
}>;
|
|
||||||
|
export type ProposalMarketsQueryQuery = { __typename?: 'Query', marketsConnection?: { __typename?: 'MarketConnection', edges: Array<{ __typename?: 'MarketEdge', node: { __typename?: 'Market', id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, code: string } } } }> } | null };
|
||||||
|
|
||||||
export type ProposalMarketsQueryQuery = {
|
|
||||||
__typename?: 'Query';
|
|
||||||
marketsConnection?: {
|
|
||||||
__typename?: 'MarketConnection';
|
|
||||||
edges: Array<{
|
|
||||||
__typename?: 'MarketEdge';
|
|
||||||
node: {
|
|
||||||
__typename?: 'Market';
|
|
||||||
id: string;
|
|
||||||
tradableInstrument: {
|
|
||||||
__typename?: 'TradableInstrument';
|
|
||||||
instrument: { __typename?: 'Instrument'; name: string; code: string };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}>;
|
|
||||||
} | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ProposalMarketsQueryDocument = gql`
|
export const ProposalMarketsQueryDocument = gql`
|
||||||
query ProposalMarketsQuery {
|
query ProposalMarketsQuery {
|
||||||
marketsConnection {
|
marketsConnection {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
tradableInstrument {
|
tradableInstrument {
|
||||||
instrument {
|
instrument {
|
||||||
name
|
name
|
||||||
code
|
code
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __useProposalMarketsQueryQuery__
|
* __useProposalMarketsQueryQuery__
|
||||||
@ -58,37 +42,14 @@ export const ProposalMarketsQueryDocument = gql`
|
|||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function useProposalMarketsQueryQuery(
|
export function useProposalMarketsQueryQuery(baseOptions?: Apollo.QueryHookOptions<ProposalMarketsQueryQuery, ProposalMarketsQueryQueryVariables>) {
|
||||||
baseOptions?: Apollo.QueryHookOptions<
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
ProposalMarketsQueryQuery,
|
return Apollo.useQuery<ProposalMarketsQueryQuery, ProposalMarketsQueryQueryVariables>(ProposalMarketsQueryDocument, options);
|
||||||
ProposalMarketsQueryQueryVariables
|
}
|
||||||
>
|
export function useProposalMarketsQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ProposalMarketsQueryQuery, ProposalMarketsQueryQueryVariables>) {
|
||||||
) {
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
return Apollo.useLazyQuery<ProposalMarketsQueryQuery, ProposalMarketsQueryQueryVariables>(ProposalMarketsQueryDocument, options);
|
||||||
return Apollo.useQuery<
|
}
|
||||||
ProposalMarketsQueryQuery,
|
export type ProposalMarketsQueryQueryHookResult = ReturnType<typeof useProposalMarketsQueryQuery>;
|
||||||
ProposalMarketsQueryQueryVariables
|
export type ProposalMarketsQueryLazyQueryHookResult = ReturnType<typeof useProposalMarketsQueryLazyQuery>;
|
||||||
>(ProposalMarketsQueryDocument, options);
|
export type ProposalMarketsQueryQueryResult = Apollo.QueryResult<ProposalMarketsQueryQuery, ProposalMarketsQueryQueryVariables>;
|
||||||
}
|
|
||||||
export function useProposalMarketsQueryLazyQuery(
|
|
||||||
baseOptions?: Apollo.LazyQueryHookOptions<
|
|
||||||
ProposalMarketsQueryQuery,
|
|
||||||
ProposalMarketsQueryQueryVariables
|
|
||||||
>
|
|
||||||
) {
|
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
|
||||||
return Apollo.useLazyQuery<
|
|
||||||
ProposalMarketsQueryQuery,
|
|
||||||
ProposalMarketsQueryQueryVariables
|
|
||||||
>(ProposalMarketsQueryDocument, options);
|
|
||||||
}
|
|
||||||
export type ProposalMarketsQueryQueryHookResult = ReturnType<
|
|
||||||
typeof useProposalMarketsQueryQuery
|
|
||||||
>;
|
|
||||||
export type ProposalMarketsQueryLazyQueryHookResult = ReturnType<
|
|
||||||
typeof useProposalMarketsQueryLazyQuery
|
|
||||||
>;
|
|
||||||
export type ProposalMarketsQueryQueryResult = Apollo.QueryResult<
|
|
||||||
ProposalMarketsQueryQuery,
|
|
||||||
ProposalMarketsQueryQueryVariables
|
|
||||||
>;
|
|
@ -7,52 +7,30 @@ export type PreviousEpochQueryVariables = Types.Exact<{
|
|||||||
epochId?: Types.InputMaybe<Types.Scalars['ID']>;
|
epochId?: Types.InputMaybe<Types.Scalars['ID']>;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type PreviousEpochQuery = {
|
|
||||||
__typename?: 'Query';
|
export type PreviousEpochQuery = { __typename?: 'Query', epoch: { __typename?: 'Epoch', id: string, validatorsConnection?: { __typename?: 'NodesConnection', edges?: Array<{ __typename?: 'NodeEdge', node: { __typename?: 'Node', id: string, rewardScore?: { __typename?: 'RewardScore', rawValidatorScore: string } | null, rankingScore: { __typename?: 'RankingScore', performanceScore: string } } } | null> | null } | null } };
|
||||||
epoch: {
|
|
||||||
__typename?: 'Epoch';
|
|
||||||
id: string;
|
|
||||||
validatorsConnection?: {
|
|
||||||
__typename?: 'NodesConnection';
|
|
||||||
edges?: Array<{
|
|
||||||
__typename?: 'NodeEdge';
|
|
||||||
node: {
|
|
||||||
__typename?: 'Node';
|
|
||||||
id: string;
|
|
||||||
rewardScore?: {
|
|
||||||
__typename?: 'RewardScore';
|
|
||||||
rawValidatorScore: string;
|
|
||||||
} | null;
|
|
||||||
rankingScore: {
|
|
||||||
__typename?: 'RankingScore';
|
|
||||||
performanceScore: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} | null> | null;
|
|
||||||
} | null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const PreviousEpochDocument = gql`
|
export const PreviousEpochDocument = gql`
|
||||||
query PreviousEpoch($epochId: ID) {
|
query PreviousEpoch($epochId: ID) {
|
||||||
epoch(id: $epochId) {
|
epoch(id: $epochId) {
|
||||||
id
|
id
|
||||||
validatorsConnection {
|
validatorsConnection {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
rewardScore {
|
rewardScore {
|
||||||
rawValidatorScore
|
rawValidatorScore
|
||||||
}
|
}
|
||||||
rankingScore {
|
rankingScore {
|
||||||
performanceScore
|
performanceScore
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __usePreviousEpochQuery__
|
* __usePreviousEpochQuery__
|
||||||
@ -70,37 +48,14 @@ export const PreviousEpochDocument = gql`
|
|||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function usePreviousEpochQuery(
|
export function usePreviousEpochQuery(baseOptions?: Apollo.QueryHookOptions<PreviousEpochQuery, PreviousEpochQueryVariables>) {
|
||||||
baseOptions?: Apollo.QueryHookOptions<
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
PreviousEpochQuery,
|
return Apollo.useQuery<PreviousEpochQuery, PreviousEpochQueryVariables>(PreviousEpochDocument, options);
|
||||||
PreviousEpochQueryVariables
|
}
|
||||||
>
|
export function usePreviousEpochLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<PreviousEpochQuery, PreviousEpochQueryVariables>) {
|
||||||
) {
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
return Apollo.useLazyQuery<PreviousEpochQuery, PreviousEpochQueryVariables>(PreviousEpochDocument, options);
|
||||||
return Apollo.useQuery<PreviousEpochQuery, PreviousEpochQueryVariables>(
|
}
|
||||||
PreviousEpochDocument,
|
export type PreviousEpochQueryHookResult = ReturnType<typeof usePreviousEpochQuery>;
|
||||||
options
|
export type PreviousEpochLazyQueryHookResult = ReturnType<typeof usePreviousEpochLazyQuery>;
|
||||||
);
|
export type PreviousEpochQueryResult = Apollo.QueryResult<PreviousEpochQuery, PreviousEpochQueryVariables>;
|
||||||
}
|
|
||||||
export function usePreviousEpochLazyQuery(
|
|
||||||
baseOptions?: Apollo.LazyQueryHookOptions<
|
|
||||||
PreviousEpochQuery,
|
|
||||||
PreviousEpochQueryVariables
|
|
||||||
>
|
|
||||||
) {
|
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
|
||||||
return Apollo.useLazyQuery<PreviousEpochQuery, PreviousEpochQueryVariables>(
|
|
||||||
PreviousEpochDocument,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
export type PreviousEpochQueryHookResult = ReturnType<
|
|
||||||
typeof usePreviousEpochQuery
|
|
||||||
>;
|
|
||||||
export type PreviousEpochLazyQueryHookResult = ReturnType<
|
|
||||||
typeof usePreviousEpochLazyQuery
|
|
||||||
>;
|
|
||||||
export type PreviousEpochQueryResult = Apollo.QueryResult<
|
|
||||||
PreviousEpochQuery,
|
|
||||||
PreviousEpochQueryVariables
|
|
||||||
>;
|
|
@ -3,64 +3,38 @@ import * as Types from '@vegaprotocol/types';
|
|||||||
import { gql } from '@apollo/client';
|
import { gql } from '@apollo/client';
|
||||||
import * as Apollo from '@apollo/client';
|
import * as Apollo from '@apollo/client';
|
||||||
const defaultOptions = {} as const;
|
const defaultOptions = {} as const;
|
||||||
export type LinkingsFieldsFragment = {
|
export type LinkingsFieldsFragment = { __typename?: 'StakeLinking', id: string, txHash: string, status: Types.StakeLinkingStatus };
|
||||||
__typename?: 'StakeLinking';
|
|
||||||
id: string;
|
|
||||||
txHash: string;
|
|
||||||
status: Types.StakeLinkingStatus;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type PartyStakeLinkingsQueryVariables = Types.Exact<{
|
export type PartyStakeLinkingsQueryVariables = Types.Exact<{
|
||||||
partyId: Types.Scalars['ID'];
|
partyId: Types.Scalars['ID'];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type PartyStakeLinkingsQuery = {
|
|
||||||
__typename?: 'Query';
|
export type PartyStakeLinkingsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', linkings: { __typename?: 'StakesConnection', edges?: Array<{ __typename?: 'StakeLinkingEdge', node: { __typename?: 'StakeLinking', id: string, txHash: string, status: Types.StakeLinkingStatus } } | null> | null } } } | null };
|
||||||
party?: {
|
|
||||||
__typename?: 'Party';
|
|
||||||
id: string;
|
|
||||||
stakingSummary: {
|
|
||||||
__typename?: 'StakingSummary';
|
|
||||||
linkings: {
|
|
||||||
__typename?: 'StakesConnection';
|
|
||||||
edges?: Array<{
|
|
||||||
__typename?: 'StakeLinkingEdge';
|
|
||||||
node: {
|
|
||||||
__typename?: 'StakeLinking';
|
|
||||||
id: string;
|
|
||||||
txHash: string;
|
|
||||||
status: Types.StakeLinkingStatus;
|
|
||||||
};
|
|
||||||
} | null> | null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const LinkingsFieldsFragmentDoc = gql`
|
export const LinkingsFieldsFragmentDoc = gql`
|
||||||
fragment LinkingsFields on StakeLinking {
|
fragment LinkingsFields on StakeLinking {
|
||||||
id
|
id
|
||||||
txHash
|
txHash
|
||||||
status
|
status
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
export const PartyStakeLinkingsDocument = gql`
|
export const PartyStakeLinkingsDocument = gql`
|
||||||
query PartyStakeLinkings($partyId: ID!) {
|
query PartyStakeLinkings($partyId: ID!) {
|
||||||
party(id: $partyId) {
|
party(id: $partyId) {
|
||||||
id
|
id
|
||||||
stakingSummary {
|
stakingSummary {
|
||||||
linkings {
|
linkings {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
...LinkingsFields
|
...LinkingsFields
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
${LinkingsFieldsFragmentDoc}
|
}
|
||||||
`;
|
${LinkingsFieldsFragmentDoc}`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __usePartyStakeLinkingsQuery__
|
* __usePartyStakeLinkingsQuery__
|
||||||
@ -78,37 +52,14 @@ export const PartyStakeLinkingsDocument = gql`
|
|||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function usePartyStakeLinkingsQuery(
|
export function usePartyStakeLinkingsQuery(baseOptions: Apollo.QueryHookOptions<PartyStakeLinkingsQuery, PartyStakeLinkingsQueryVariables>) {
|
||||||
baseOptions: Apollo.QueryHookOptions<
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
PartyStakeLinkingsQuery,
|
return Apollo.useQuery<PartyStakeLinkingsQuery, PartyStakeLinkingsQueryVariables>(PartyStakeLinkingsDocument, options);
|
||||||
PartyStakeLinkingsQueryVariables
|
}
|
||||||
>
|
export function usePartyStakeLinkingsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<PartyStakeLinkingsQuery, PartyStakeLinkingsQueryVariables>) {
|
||||||
) {
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
return Apollo.useLazyQuery<PartyStakeLinkingsQuery, PartyStakeLinkingsQueryVariables>(PartyStakeLinkingsDocument, options);
|
||||||
return Apollo.useQuery<
|
}
|
||||||
PartyStakeLinkingsQuery,
|
export type PartyStakeLinkingsQueryHookResult = ReturnType<typeof usePartyStakeLinkingsQuery>;
|
||||||
PartyStakeLinkingsQueryVariables
|
export type PartyStakeLinkingsLazyQueryHookResult = ReturnType<typeof usePartyStakeLinkingsLazyQuery>;
|
||||||
>(PartyStakeLinkingsDocument, options);
|
export type PartyStakeLinkingsQueryResult = Apollo.QueryResult<PartyStakeLinkingsQuery, PartyStakeLinkingsQueryVariables>;
|
||||||
}
|
|
||||||
export function usePartyStakeLinkingsLazyQuery(
|
|
||||||
baseOptions?: Apollo.LazyQueryHookOptions<
|
|
||||||
PartyStakeLinkingsQuery,
|
|
||||||
PartyStakeLinkingsQueryVariables
|
|
||||||
>
|
|
||||||
) {
|
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
|
||||||
return Apollo.useLazyQuery<
|
|
||||||
PartyStakeLinkingsQuery,
|
|
||||||
PartyStakeLinkingsQueryVariables
|
|
||||||
>(PartyStakeLinkingsDocument, options);
|
|
||||||
}
|
|
||||||
export type PartyStakeLinkingsQueryHookResult = ReturnType<
|
|
||||||
typeof usePartyStakeLinkingsQuery
|
|
||||||
>;
|
|
||||||
export type PartyStakeLinkingsLazyQueryHookResult = ReturnType<
|
|
||||||
typeof usePartyStakeLinkingsLazyQuery
|
|
||||||
>;
|
|
||||||
export type PartyStakeLinkingsQueryResult = Apollo.QueryResult<
|
|
||||||
PartyStakeLinkingsQuery,
|
|
||||||
PartyStakeLinkingsQueryVariables
|
|
||||||
>;
|
|
@ -3,110 +3,54 @@ import * as Types from '@vegaprotocol/types';
|
|||||||
import { gql } from '@apollo/client';
|
import { gql } from '@apollo/client';
|
||||||
import * as Apollo from '@apollo/client';
|
import * as Apollo from '@apollo/client';
|
||||||
const defaultOptions = {} as const;
|
const defaultOptions = {} as const;
|
||||||
export type NodesFragmentFragment = {
|
export type NodesFragmentFragment = { __typename?: 'Node', avatarUrl?: string | null, id: string, name: string, pubkey: string, stakedByOperator: string, stakedByDelegates: string, stakedTotal: string, pendingStake: string, rankingScore: { __typename?: 'RankingScore', rankingScore: string, stakeScore: string, performanceScore: string, votingPower: string, status: Types.ValidatorStatus } };
|
||||||
__typename?: 'Node';
|
|
||||||
avatarUrl?: string | null;
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
pubkey: string;
|
|
||||||
stakedByOperator: string;
|
|
||||||
stakedByDelegates: string;
|
|
||||||
stakedTotal: string;
|
|
||||||
pendingStake: string;
|
|
||||||
rankingScore: {
|
|
||||||
__typename?: 'RankingScore';
|
|
||||||
rankingScore: string;
|
|
||||||
stakeScore: string;
|
|
||||||
performanceScore: string;
|
|
||||||
votingPower: string;
|
|
||||||
status: Types.ValidatorStatus;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export type NodesQueryVariables = Types.Exact<{ [key: string]: never }>;
|
export type NodesQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||||
|
|
||||||
export type NodesQuery = {
|
|
||||||
__typename?: 'Query';
|
export type NodesQuery = { __typename?: 'Query', epoch: { __typename?: 'Epoch', id: string, timestamps: { __typename?: 'EpochTimestamps', start?: any | null, end?: any | null, expiry?: any | null } }, nodesConnection: { __typename?: 'NodesConnection', edges?: Array<{ __typename?: 'NodeEdge', node: { __typename?: 'Node', avatarUrl?: string | null, id: string, name: string, pubkey: string, stakedByOperator: string, stakedByDelegates: string, stakedTotal: string, pendingStake: string, rankingScore: { __typename?: 'RankingScore', rankingScore: string, stakeScore: string, performanceScore: string, votingPower: string, status: Types.ValidatorStatus } } } | null> | null }, nodeData?: { __typename?: 'NodeData', stakedTotal: string } | null };
|
||||||
epoch: {
|
|
||||||
__typename?: 'Epoch';
|
|
||||||
id: string;
|
|
||||||
timestamps: {
|
|
||||||
__typename?: 'EpochTimestamps';
|
|
||||||
start?: any | null;
|
|
||||||
end?: any | null;
|
|
||||||
expiry?: any | null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
nodesConnection: {
|
|
||||||
__typename?: 'NodesConnection';
|
|
||||||
edges?: Array<{
|
|
||||||
__typename?: 'NodeEdge';
|
|
||||||
node: {
|
|
||||||
__typename?: 'Node';
|
|
||||||
avatarUrl?: string | null;
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
pubkey: string;
|
|
||||||
stakedByOperator: string;
|
|
||||||
stakedByDelegates: string;
|
|
||||||
stakedTotal: string;
|
|
||||||
pendingStake: string;
|
|
||||||
rankingScore: {
|
|
||||||
__typename?: 'RankingScore';
|
|
||||||
rankingScore: string;
|
|
||||||
stakeScore: string;
|
|
||||||
performanceScore: string;
|
|
||||||
votingPower: string;
|
|
||||||
status: Types.ValidatorStatus;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} | null> | null;
|
|
||||||
};
|
|
||||||
nodeData?: { __typename?: 'NodeData'; stakedTotal: string } | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const NodesFragmentFragmentDoc = gql`
|
export const NodesFragmentFragmentDoc = gql`
|
||||||
fragment NodesFragment on Node {
|
fragment NodesFragment on Node {
|
||||||
avatarUrl
|
avatarUrl
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
pubkey
|
pubkey
|
||||||
stakedByOperator
|
stakedByOperator
|
||||||
stakedByDelegates
|
stakedByDelegates
|
||||||
stakedTotal
|
stakedTotal
|
||||||
pendingStake
|
pendingStake
|
||||||
rankingScore {
|
rankingScore {
|
||||||
rankingScore
|
rankingScore
|
||||||
stakeScore
|
stakeScore
|
||||||
performanceScore
|
performanceScore
|
||||||
votingPower
|
votingPower
|
||||||
status
|
status
|
||||||
}
|
|
||||||
}
|
}
|
||||||
`;
|
}
|
||||||
|
`;
|
||||||
export const NodesDocument = gql`
|
export const NodesDocument = gql`
|
||||||
query Nodes {
|
query Nodes {
|
||||||
epoch {
|
epoch {
|
||||||
id
|
id
|
||||||
timestamps {
|
timestamps {
|
||||||
start
|
start
|
||||||
end
|
end
|
||||||
expiry
|
expiry
|
||||||
}
|
|
||||||
}
|
|
||||||
nodesConnection {
|
|
||||||
edges {
|
|
||||||
node {
|
|
||||||
...NodesFragment
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nodeData {
|
|
||||||
stakedTotal
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
${NodesFragmentFragmentDoc}
|
nodesConnection {
|
||||||
`;
|
edges {
|
||||||
|
node {
|
||||||
|
...NodesFragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nodeData {
|
||||||
|
stakedTotal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
${NodesFragmentFragmentDoc}`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __useNodesQuery__
|
* __useNodesQuery__
|
||||||
@ -123,27 +67,14 @@ export const NodesDocument = gql`
|
|||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function useNodesQuery(
|
export function useNodesQuery(baseOptions?: Apollo.QueryHookOptions<NodesQuery, NodesQueryVariables>) {
|
||||||
baseOptions?: Apollo.QueryHookOptions<NodesQuery, NodesQueryVariables>
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
) {
|
return Apollo.useQuery<NodesQuery, NodesQueryVariables>(NodesDocument, options);
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
}
|
||||||
return Apollo.useQuery<NodesQuery, NodesQueryVariables>(
|
export function useNodesLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<NodesQuery, NodesQueryVariables>) {
|
||||||
NodesDocument,
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
options
|
return Apollo.useLazyQuery<NodesQuery, NodesQueryVariables>(NodesDocument, options);
|
||||||
);
|
}
|
||||||
}
|
|
||||||
export function useNodesLazyQuery(
|
|
||||||
baseOptions?: Apollo.LazyQueryHookOptions<NodesQuery, NodesQueryVariables>
|
|
||||||
) {
|
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
|
||||||
return Apollo.useLazyQuery<NodesQuery, NodesQueryVariables>(
|
|
||||||
NodesDocument,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
export type NodesQueryHookResult = ReturnType<typeof useNodesQuery>;
|
export type NodesQueryHookResult = ReturnType<typeof useNodesQuery>;
|
||||||
export type NodesLazyQueryHookResult = ReturnType<typeof useNodesLazyQuery>;
|
export type NodesLazyQueryHookResult = ReturnType<typeof useNodesLazyQuery>;
|
||||||
export type NodesQueryResult = Apollo.QueryResult<
|
export type NodesQueryResult = Apollo.QueryResult<NodesQuery, NodesQueryVariables>;
|
||||||
NodesQuery,
|
|
||||||
NodesQueryVariables
|
|
||||||
>;
|
|
@ -3,66 +3,42 @@ import * as Types from '@vegaprotocol/types';
|
|||||||
import { gql } from '@apollo/client';
|
import { gql } from '@apollo/client';
|
||||||
import * as Apollo from '@apollo/client';
|
import * as Apollo from '@apollo/client';
|
||||||
const defaultOptions = {} as const;
|
const defaultOptions = {} as const;
|
||||||
export type StakingDelegationsFieldsFragment = {
|
export type StakingDelegationsFieldsFragment = { __typename?: 'Delegation', amount: string, epoch: number, node: { __typename?: 'Node', id: string } };
|
||||||
__typename?: 'Delegation';
|
|
||||||
amount: string;
|
|
||||||
epoch: number;
|
|
||||||
node: { __typename?: 'Node'; id: string };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type PartyDelegationsQueryVariables = Types.Exact<{
|
export type PartyDelegationsQueryVariables = Types.Exact<{
|
||||||
partyId: Types.Scalars['ID'];
|
partyId: Types.Scalars['ID'];
|
||||||
delegationsPagination?: Types.InputMaybe<Types.Pagination>;
|
delegationsPagination?: Types.InputMaybe<Types.Pagination>;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type PartyDelegationsQuery = {
|
|
||||||
__typename?: 'Query';
|
export type PartyDelegationsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, delegationsConnection?: { __typename?: 'DelegationsConnection', edges?: Array<{ __typename?: 'DelegationEdge', node: { __typename?: 'Delegation', amount: string, epoch: number, node: { __typename?: 'Node', id: string } } } | null> | null } | null } | null, epoch: { __typename?: 'Epoch', id: string } };
|
||||||
party?: {
|
|
||||||
__typename?: 'Party';
|
|
||||||
id: string;
|
|
||||||
delegationsConnection?: {
|
|
||||||
__typename?: 'DelegationsConnection';
|
|
||||||
edges?: Array<{
|
|
||||||
__typename?: 'DelegationEdge';
|
|
||||||
node: {
|
|
||||||
__typename?: 'Delegation';
|
|
||||||
amount: string;
|
|
||||||
epoch: number;
|
|
||||||
node: { __typename?: 'Node'; id: string };
|
|
||||||
};
|
|
||||||
} | null> | null;
|
|
||||||
} | null;
|
|
||||||
} | null;
|
|
||||||
epoch: { __typename?: 'Epoch'; id: string };
|
|
||||||
};
|
|
||||||
|
|
||||||
export const StakingDelegationsFieldsFragmentDoc = gql`
|
export const StakingDelegationsFieldsFragmentDoc = gql`
|
||||||
fragment StakingDelegationsFields on Delegation {
|
fragment StakingDelegationsFields on Delegation {
|
||||||
amount
|
amount
|
||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
}
|
|
||||||
epoch
|
|
||||||
}
|
}
|
||||||
`;
|
epoch
|
||||||
|
}
|
||||||
|
`;
|
||||||
export const PartyDelegationsDocument = gql`
|
export const PartyDelegationsDocument = gql`
|
||||||
query PartyDelegations($partyId: ID!, $delegationsPagination: Pagination) {
|
query PartyDelegations($partyId: ID!, $delegationsPagination: Pagination) {
|
||||||
party(id: $partyId) {
|
party(id: $partyId) {
|
||||||
id
|
id
|
||||||
delegationsConnection(pagination: $delegationsPagination) {
|
delegationsConnection(pagination: $delegationsPagination) {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
...StakingDelegationsFields
|
...StakingDelegationsFields
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
epoch {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
${StakingDelegationsFieldsFragmentDoc}
|
epoch {
|
||||||
`;
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
${StakingDelegationsFieldsFragmentDoc}`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __usePartyDelegationsQuery__
|
* __usePartyDelegationsQuery__
|
||||||
@ -81,37 +57,14 @@ export const PartyDelegationsDocument = gql`
|
|||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function usePartyDelegationsQuery(
|
export function usePartyDelegationsQuery(baseOptions: Apollo.QueryHookOptions<PartyDelegationsQuery, PartyDelegationsQueryVariables>) {
|
||||||
baseOptions: Apollo.QueryHookOptions<
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
PartyDelegationsQuery,
|
return Apollo.useQuery<PartyDelegationsQuery, PartyDelegationsQueryVariables>(PartyDelegationsDocument, options);
|
||||||
PartyDelegationsQueryVariables
|
}
|
||||||
>
|
export function usePartyDelegationsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<PartyDelegationsQuery, PartyDelegationsQueryVariables>) {
|
||||||
) {
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
return Apollo.useLazyQuery<PartyDelegationsQuery, PartyDelegationsQueryVariables>(PartyDelegationsDocument, options);
|
||||||
return Apollo.useQuery<PartyDelegationsQuery, PartyDelegationsQueryVariables>(
|
}
|
||||||
PartyDelegationsDocument,
|
export type PartyDelegationsQueryHookResult = ReturnType<typeof usePartyDelegationsQuery>;
|
||||||
options
|
export type PartyDelegationsLazyQueryHookResult = ReturnType<typeof usePartyDelegationsLazyQuery>;
|
||||||
);
|
export type PartyDelegationsQueryResult = Apollo.QueryResult<PartyDelegationsQuery, PartyDelegationsQueryVariables>;
|
||||||
}
|
|
||||||
export function usePartyDelegationsLazyQuery(
|
|
||||||
baseOptions?: Apollo.LazyQueryHookOptions<
|
|
||||||
PartyDelegationsQuery,
|
|
||||||
PartyDelegationsQueryVariables
|
|
||||||
>
|
|
||||||
) {
|
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
|
||||||
return Apollo.useLazyQuery<
|
|
||||||
PartyDelegationsQuery,
|
|
||||||
PartyDelegationsQueryVariables
|
|
||||||
>(PartyDelegationsDocument, options);
|
|
||||||
}
|
|
||||||
export type PartyDelegationsQueryHookResult = ReturnType<
|
|
||||||
typeof usePartyDelegationsQuery
|
|
||||||
>;
|
|
||||||
export type PartyDelegationsLazyQueryHookResult = ReturnType<
|
|
||||||
typeof usePartyDelegationsLazyQuery
|
|
||||||
>;
|
|
||||||
export type PartyDelegationsQueryResult = Apollo.QueryResult<
|
|
||||||
PartyDelegationsQuery,
|
|
||||||
PartyDelegationsQueryVariables
|
|
||||||
>;
|
|
@ -3,182 +3,84 @@ import * as Types from '@vegaprotocol/types';
|
|||||||
import { gql } from '@apollo/client';
|
import { gql } from '@apollo/client';
|
||||||
import * as Apollo from '@apollo/client';
|
import * as Apollo from '@apollo/client';
|
||||||
const defaultOptions = {} as const;
|
const defaultOptions = {} as const;
|
||||||
export type StakingNodeFieldsFragment = {
|
export type StakingNodeFieldsFragment = { __typename?: 'Node', id: string, name: string, pubkey: string, infoUrl: string, location: string, ethereumAddress: string, stakedByOperator: string, stakedByDelegates: string, stakedTotal: string, pendingStake: string, epochData?: { __typename?: 'EpochData', total: number, offline: number, online: number } | null, rankingScore: { __typename?: 'RankingScore', rankingScore: string, stakeScore: string, performanceScore: string, votingPower: string, status: Types.ValidatorStatus } };
|
||||||
__typename?: 'Node';
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
pubkey: string;
|
|
||||||
infoUrl: string;
|
|
||||||
location: string;
|
|
||||||
ethereumAddress: string;
|
|
||||||
stakedByOperator: string;
|
|
||||||
stakedByDelegates: string;
|
|
||||||
stakedTotal: string;
|
|
||||||
pendingStake: string;
|
|
||||||
epochData?: {
|
|
||||||
__typename?: 'EpochData';
|
|
||||||
total: number;
|
|
||||||
offline: number;
|
|
||||||
online: number;
|
|
||||||
} | null;
|
|
||||||
rankingScore: {
|
|
||||||
__typename?: 'RankingScore';
|
|
||||||
rankingScore: string;
|
|
||||||
stakeScore: string;
|
|
||||||
performanceScore: string;
|
|
||||||
votingPower: string;
|
|
||||||
status: Types.ValidatorStatus;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export type StakingQueryVariables = Types.Exact<{
|
export type StakingQueryVariables = Types.Exact<{
|
||||||
partyId: Types.Scalars['ID'];
|
partyId: Types.Scalars['ID'];
|
||||||
delegationsPagination?: Types.InputMaybe<Types.Pagination>;
|
delegationsPagination?: Types.InputMaybe<Types.Pagination>;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type StakingQuery = {
|
|
||||||
__typename?: 'Query';
|
export type StakingQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string }, delegationsConnection?: { __typename?: 'DelegationsConnection', edges?: Array<{ __typename?: 'DelegationEdge', node: { __typename?: 'Delegation', amount: string, epoch: number, node: { __typename?: 'Node', id: string } } } | null> | null } | null } | null, epoch: { __typename?: 'Epoch', id: string, timestamps: { __typename?: 'EpochTimestamps', start?: any | null, end?: any | null, expiry?: any | null } }, nodesConnection: { __typename?: 'NodesConnection', edges?: Array<{ __typename?: 'NodeEdge', node: { __typename?: 'Node', id: string, name: string, pubkey: string, infoUrl: string, location: string, ethereumAddress: string, stakedByOperator: string, stakedByDelegates: string, stakedTotal: string, pendingStake: string, epochData?: { __typename?: 'EpochData', total: number, offline: number, online: number } | null, rankingScore: { __typename?: 'RankingScore', rankingScore: string, stakeScore: string, performanceScore: string, votingPower: string, status: Types.ValidatorStatus } } } | null> | null }, nodeData?: { __typename?: 'NodeData', stakedTotal: string, totalNodes: number, inactiveNodes: number, uptime: number } | null };
|
||||||
party?: {
|
|
||||||
__typename?: 'Party';
|
|
||||||
id: string;
|
|
||||||
stakingSummary: {
|
|
||||||
__typename?: 'StakingSummary';
|
|
||||||
currentStakeAvailable: string;
|
|
||||||
};
|
|
||||||
delegationsConnection?: {
|
|
||||||
__typename?: 'DelegationsConnection';
|
|
||||||
edges?: Array<{
|
|
||||||
__typename?: 'DelegationEdge';
|
|
||||||
node: {
|
|
||||||
__typename?: 'Delegation';
|
|
||||||
amount: string;
|
|
||||||
epoch: number;
|
|
||||||
node: { __typename?: 'Node'; id: string };
|
|
||||||
};
|
|
||||||
} | null> | null;
|
|
||||||
} | null;
|
|
||||||
} | null;
|
|
||||||
epoch: {
|
|
||||||
__typename?: 'Epoch';
|
|
||||||
id: string;
|
|
||||||
timestamps: {
|
|
||||||
__typename?: 'EpochTimestamps';
|
|
||||||
start?: any | null;
|
|
||||||
end?: any | null;
|
|
||||||
expiry?: any | null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
nodesConnection: {
|
|
||||||
__typename?: 'NodesConnection';
|
|
||||||
edges?: Array<{
|
|
||||||
__typename?: 'NodeEdge';
|
|
||||||
node: {
|
|
||||||
__typename?: 'Node';
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
pubkey: string;
|
|
||||||
infoUrl: string;
|
|
||||||
location: string;
|
|
||||||
ethereumAddress: string;
|
|
||||||
stakedByOperator: string;
|
|
||||||
stakedByDelegates: string;
|
|
||||||
stakedTotal: string;
|
|
||||||
pendingStake: string;
|
|
||||||
epochData?: {
|
|
||||||
__typename?: 'EpochData';
|
|
||||||
total: number;
|
|
||||||
offline: number;
|
|
||||||
online: number;
|
|
||||||
} | null;
|
|
||||||
rankingScore: {
|
|
||||||
__typename?: 'RankingScore';
|
|
||||||
rankingScore: string;
|
|
||||||
stakeScore: string;
|
|
||||||
performanceScore: string;
|
|
||||||
votingPower: string;
|
|
||||||
status: Types.ValidatorStatus;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} | null> | null;
|
|
||||||
};
|
|
||||||
nodeData?: {
|
|
||||||
__typename?: 'NodeData';
|
|
||||||
stakedTotal: string;
|
|
||||||
totalNodes: number;
|
|
||||||
inactiveNodes: number;
|
|
||||||
uptime: number;
|
|
||||||
} | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const StakingNodeFieldsFragmentDoc = gql`
|
export const StakingNodeFieldsFragmentDoc = gql`
|
||||||
fragment StakingNodeFields on Node {
|
fragment StakingNodeFields on Node {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
pubkey
|
pubkey
|
||||||
infoUrl
|
infoUrl
|
||||||
location
|
location
|
||||||
ethereumAddress
|
ethereumAddress
|
||||||
stakedByOperator
|
stakedByOperator
|
||||||
stakedByDelegates
|
stakedByDelegates
|
||||||
stakedTotal
|
stakedTotal
|
||||||
pendingStake
|
pendingStake
|
||||||
epochData {
|
epochData {
|
||||||
total
|
total
|
||||||
offline
|
offline
|
||||||
online
|
online
|
||||||
}
|
|
||||||
rankingScore {
|
|
||||||
rankingScore
|
|
||||||
stakeScore
|
|
||||||
performanceScore
|
|
||||||
votingPower
|
|
||||||
status
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
`;
|
rankingScore {
|
||||||
|
rankingScore
|
||||||
|
stakeScore
|
||||||
|
performanceScore
|
||||||
|
votingPower
|
||||||
|
status
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
export const StakingDocument = gql`
|
export const StakingDocument = gql`
|
||||||
query Staking($partyId: ID!, $delegationsPagination: Pagination) {
|
query Staking($partyId: ID!, $delegationsPagination: Pagination) {
|
||||||
party(id: $partyId) {
|
party(id: $partyId) {
|
||||||
id
|
id
|
||||||
stakingSummary {
|
stakingSummary {
|
||||||
currentStakeAvailable
|
currentStakeAvailable
|
||||||
}
|
}
|
||||||
delegationsConnection(pagination: $delegationsPagination) {
|
delegationsConnection(pagination: $delegationsPagination) {
|
||||||
edges {
|
edges {
|
||||||
|
node {
|
||||||
|
amount
|
||||||
|
epoch
|
||||||
node {
|
node {
|
||||||
amount
|
id
|
||||||
epoch
|
|
||||||
node {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
epoch {
|
}
|
||||||
id
|
epoch {
|
||||||
timestamps {
|
id
|
||||||
start
|
timestamps {
|
||||||
end
|
start
|
||||||
expiry
|
end
|
||||||
}
|
expiry
|
||||||
}
|
|
||||||
nodesConnection {
|
|
||||||
edges {
|
|
||||||
node {
|
|
||||||
...StakingNodeFields
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nodeData {
|
|
||||||
stakedTotal
|
|
||||||
totalNodes
|
|
||||||
inactiveNodes
|
|
||||||
uptime
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
${StakingNodeFieldsFragmentDoc}
|
nodesConnection {
|
||||||
`;
|
edges {
|
||||||
|
node {
|
||||||
|
...StakingNodeFields
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nodeData {
|
||||||
|
stakedTotal
|
||||||
|
totalNodes
|
||||||
|
inactiveNodes
|
||||||
|
uptime
|
||||||
|
}
|
||||||
|
}
|
||||||
|
${StakingNodeFieldsFragmentDoc}`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __useStakingQuery__
|
* __useStakingQuery__
|
||||||
@ -197,27 +99,14 @@ export const StakingDocument = gql`
|
|||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function useStakingQuery(
|
export function useStakingQuery(baseOptions: Apollo.QueryHookOptions<StakingQuery, StakingQueryVariables>) {
|
||||||
baseOptions: Apollo.QueryHookOptions<StakingQuery, StakingQueryVariables>
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
) {
|
return Apollo.useQuery<StakingQuery, StakingQueryVariables>(StakingDocument, options);
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
}
|
||||||
return Apollo.useQuery<StakingQuery, StakingQueryVariables>(
|
export function useStakingLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<StakingQuery, StakingQueryVariables>) {
|
||||||
StakingDocument,
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
options
|
return Apollo.useLazyQuery<StakingQuery, StakingQueryVariables>(StakingDocument, options);
|
||||||
);
|
}
|
||||||
}
|
|
||||||
export function useStakingLazyQuery(
|
|
||||||
baseOptions?: Apollo.LazyQueryHookOptions<StakingQuery, StakingQueryVariables>
|
|
||||||
) {
|
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
|
||||||
return Apollo.useLazyQuery<StakingQuery, StakingQueryVariables>(
|
|
||||||
StakingDocument,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
export type StakingQueryHookResult = ReturnType<typeof useStakingQuery>;
|
export type StakingQueryHookResult = ReturnType<typeof useStakingQuery>;
|
||||||
export type StakingLazyQueryHookResult = ReturnType<typeof useStakingLazyQuery>;
|
export type StakingLazyQueryHookResult = ReturnType<typeof useStakingLazyQuery>;
|
||||||
export type StakingQueryResult = Apollo.QueryResult<
|
export type StakingQueryResult = Apollo.QueryResult<StakingQuery, StakingQueryVariables>;
|
||||||
StakingQuery,
|
|
||||||
StakingQueryVariables
|
|
||||||
>;
|
|
@ -3,20 +3,19 @@ import * as Types from '@vegaprotocol/types';
|
|||||||
import { gql } from '@apollo/client';
|
import { gql } from '@apollo/client';
|
||||||
import * as Apollo from '@apollo/client';
|
import * as Apollo from '@apollo/client';
|
||||||
const defaultOptions = {} as const;
|
const defaultOptions = {} as const;
|
||||||
export type NodeDataQueryVariables = Types.Exact<{ [key: string]: never }>;
|
export type NodeDataQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||||
|
|
||||||
|
|
||||||
|
export type NodeDataQuery = { __typename?: 'Query', nodeData?: { __typename?: 'NodeData', stakedTotal: string } | null };
|
||||||
|
|
||||||
export type NodeDataQuery = {
|
|
||||||
__typename?: 'Query';
|
|
||||||
nodeData?: { __typename?: 'NodeData'; stakedTotal: string } | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const NodeDataDocument = gql`
|
export const NodeDataDocument = gql`
|
||||||
query NodeData {
|
query NodeData {
|
||||||
nodeData {
|
nodeData {
|
||||||
stakedTotal
|
stakedTotal
|
||||||
}
|
|
||||||
}
|
}
|
||||||
`;
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __useNodeDataQuery__
|
* __useNodeDataQuery__
|
||||||
@ -33,32 +32,14 @@ export const NodeDataDocument = gql`
|
|||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function useNodeDataQuery(
|
export function useNodeDataQuery(baseOptions?: Apollo.QueryHookOptions<NodeDataQuery, NodeDataQueryVariables>) {
|
||||||
baseOptions?: Apollo.QueryHookOptions<NodeDataQuery, NodeDataQueryVariables>
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
) {
|
return Apollo.useQuery<NodeDataQuery, NodeDataQueryVariables>(NodeDataDocument, options);
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
}
|
||||||
return Apollo.useQuery<NodeDataQuery, NodeDataQueryVariables>(
|
export function useNodeDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<NodeDataQuery, NodeDataQueryVariables>) {
|
||||||
NodeDataDocument,
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
options
|
return Apollo.useLazyQuery<NodeDataQuery, NodeDataQueryVariables>(NodeDataDocument, options);
|
||||||
);
|
}
|
||||||
}
|
|
||||||
export function useNodeDataLazyQuery(
|
|
||||||
baseOptions?: Apollo.LazyQueryHookOptions<
|
|
||||||
NodeDataQuery,
|
|
||||||
NodeDataQueryVariables
|
|
||||||
>
|
|
||||||
) {
|
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
|
||||||
return Apollo.useLazyQuery<NodeDataQuery, NodeDataQueryVariables>(
|
|
||||||
NodeDataDocument,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
export type NodeDataQueryHookResult = ReturnType<typeof useNodeDataQuery>;
|
export type NodeDataQueryHookResult = ReturnType<typeof useNodeDataQuery>;
|
||||||
export type NodeDataLazyQueryHookResult = ReturnType<
|
export type NodeDataLazyQueryHookResult = ReturnType<typeof useNodeDataLazyQuery>;
|
||||||
typeof useNodeDataLazyQuery
|
export type NodeDataQueryResult = Apollo.QueryResult<NodeDataQuery, NodeDataQueryVariables>;
|
||||||
>;
|
|
||||||
export type NodeDataQueryResult = Apollo.QueryResult<
|
|
||||||
NodeDataQuery,
|
|
||||||
NodeDataQueryVariables
|
|
||||||
>;
|
|
File diff suppressed because one or more lines are too long
@ -4,134 +4,60 @@ import { gql } from '@apollo/client';
|
|||||||
import { UpdateNetworkParameterFielsFragmentDoc } from '../../proposals-data-provider/__generated__/Proposals';
|
import { UpdateNetworkParameterFielsFragmentDoc } from '../../proposals-data-provider/__generated__/Proposals';
|
||||||
import * as Apollo from '@apollo/client';
|
import * as Apollo from '@apollo/client';
|
||||||
const defaultOptions = {} as const;
|
const defaultOptions = {} as const;
|
||||||
export type ProposalEventFieldsFragment = {
|
export type ProposalEventFieldsFragment = { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null };
|
||||||
__typename?: 'Proposal';
|
|
||||||
id?: string | null;
|
|
||||||
reference: string;
|
|
||||||
state: Types.ProposalState;
|
|
||||||
rejectionReason?: Types.ProposalRejectionReason | null;
|
|
||||||
errorDetails?: string | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ProposalEventSubscriptionVariables = Types.Exact<{
|
export type ProposalEventSubscriptionVariables = Types.Exact<{
|
||||||
partyId: Types.Scalars['ID'];
|
partyId: Types.Scalars['ID'];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type ProposalEventSubscription = {
|
|
||||||
__typename?: 'Subscription';
|
|
||||||
proposals: {
|
|
||||||
__typename?: 'Proposal';
|
|
||||||
id?: string | null;
|
|
||||||
reference: string;
|
|
||||||
state: Types.ProposalState;
|
|
||||||
rejectionReason?: Types.ProposalRejectionReason | null;
|
|
||||||
errorDetails?: string | null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export type UpdateNetworkParameterProposalFragment = {
|
export type ProposalEventSubscription = { __typename?: 'Subscription', proposals: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null } };
|
||||||
__typename?: 'Proposal';
|
|
||||||
id?: string | null;
|
|
||||||
state: Types.ProposalState;
|
|
||||||
datetime: any;
|
|
||||||
terms: {
|
|
||||||
__typename?: 'ProposalTerms';
|
|
||||||
enactmentDatetime?: any | null;
|
|
||||||
change:
|
|
||||||
| { __typename?: 'NewAsset' }
|
|
||||||
| { __typename?: 'NewFreeform' }
|
|
||||||
| { __typename?: 'NewMarket' }
|
|
||||||
| { __typename?: 'UpdateAsset' }
|
|
||||||
| { __typename?: 'UpdateMarket' }
|
|
||||||
| {
|
|
||||||
__typename?: 'UpdateNetworkParameter';
|
|
||||||
networkParameter: {
|
|
||||||
__typename?: 'NetworkParameter';
|
|
||||||
key: string;
|
|
||||||
value: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export type OnUpdateNetworkParametersSubscriptionVariables = Types.Exact<{
|
export type UpdateNetworkParameterProposalFragment = { __typename?: 'Proposal', id?: string | null, state: Types.ProposalState, datetime: any, terms: { __typename?: 'ProposalTerms', enactmentDatetime?: any | null, change: { __typename?: 'NewAsset' } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket' } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket' } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } } };
|
||||||
[key: string]: never;
|
|
||||||
}>;
|
|
||||||
|
|
||||||
export type OnUpdateNetworkParametersSubscription = {
|
export type OnUpdateNetworkParametersSubscriptionVariables = Types.Exact<{ [key: string]: never; }>;
|
||||||
__typename?: 'Subscription';
|
|
||||||
proposals: {
|
|
||||||
__typename?: 'Proposal';
|
export type OnUpdateNetworkParametersSubscription = { __typename?: 'Subscription', proposals: { __typename?: 'Proposal', id?: string | null, state: Types.ProposalState, datetime: any, terms: { __typename?: 'ProposalTerms', enactmentDatetime?: any | null, change: { __typename?: 'NewAsset' } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket' } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket' } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } } } };
|
||||||
id?: string | null;
|
|
||||||
state: Types.ProposalState;
|
|
||||||
datetime: any;
|
|
||||||
terms: {
|
|
||||||
__typename?: 'ProposalTerms';
|
|
||||||
enactmentDatetime?: any | null;
|
|
||||||
change:
|
|
||||||
| { __typename?: 'NewAsset' }
|
|
||||||
| { __typename?: 'NewFreeform' }
|
|
||||||
| { __typename?: 'NewMarket' }
|
|
||||||
| { __typename?: 'UpdateAsset' }
|
|
||||||
| { __typename?: 'UpdateMarket' }
|
|
||||||
| {
|
|
||||||
__typename?: 'UpdateNetworkParameter';
|
|
||||||
networkParameter: {
|
|
||||||
__typename?: 'NetworkParameter';
|
|
||||||
key: string;
|
|
||||||
value: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ProposalOfMarketQueryVariables = Types.Exact<{
|
export type ProposalOfMarketQueryVariables = Types.Exact<{
|
||||||
marketId: Types.Scalars['ID'];
|
marketId: Types.Scalars['ID'];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type ProposalOfMarketQuery = {
|
|
||||||
__typename?: 'Query';
|
export type ProposalOfMarketQuery = { __typename?: 'Query', proposal?: { __typename?: 'Proposal', id?: string | null, terms: { __typename?: 'ProposalTerms', enactmentDatetime?: any | null } } | null };
|
||||||
proposal?: {
|
|
||||||
__typename?: 'Proposal';
|
|
||||||
id?: string | null;
|
|
||||||
terms: { __typename?: 'ProposalTerms'; enactmentDatetime?: any | null };
|
|
||||||
} | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ProposalEventFieldsFragmentDoc = gql`
|
export const ProposalEventFieldsFragmentDoc = gql`
|
||||||
fragment ProposalEventFields on Proposal {
|
fragment ProposalEventFields on Proposal {
|
||||||
id
|
id
|
||||||
reference
|
reference
|
||||||
state
|
state
|
||||||
rejectionReason
|
rejectionReason
|
||||||
errorDetails
|
errorDetails
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
export const UpdateNetworkParameterProposalFragmentDoc = gql`
|
export const UpdateNetworkParameterProposalFragmentDoc = gql`
|
||||||
fragment UpdateNetworkParameterProposal on Proposal {
|
fragment UpdateNetworkParameterProposal on Proposal {
|
||||||
id
|
id
|
||||||
state
|
state
|
||||||
datetime
|
datetime
|
||||||
terms {
|
terms {
|
||||||
enactmentDatetime
|
enactmentDatetime
|
||||||
change {
|
change {
|
||||||
... on UpdateNetworkParameter {
|
... on UpdateNetworkParameter {
|
||||||
...UpdateNetworkParameterFiels
|
...UpdateNetworkParameterFiels
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
${UpdateNetworkParameterFielsFragmentDoc}
|
}
|
||||||
`;
|
${UpdateNetworkParameterFielsFragmentDoc}`;
|
||||||
export const ProposalEventDocument = gql`
|
export const ProposalEventDocument = gql`
|
||||||
subscription ProposalEvent($partyId: ID!) {
|
subscription ProposalEvent($partyId: ID!) {
|
||||||
proposals(partyId: $partyId) {
|
proposals(partyId: $partyId) {
|
||||||
...ProposalEventFields
|
...ProposalEventFields
|
||||||
}
|
|
||||||
}
|
}
|
||||||
${ProposalEventFieldsFragmentDoc}
|
}
|
||||||
`;
|
${ProposalEventFieldsFragmentDoc}`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __useProposalEventSubscription__
|
* __useProposalEventSubscription__
|
||||||
@ -149,31 +75,19 @@ export const ProposalEventDocument = gql`
|
|||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function useProposalEventSubscription(
|
export function useProposalEventSubscription(baseOptions: Apollo.SubscriptionHookOptions<ProposalEventSubscription, ProposalEventSubscriptionVariables>) {
|
||||||
baseOptions: Apollo.SubscriptionHookOptions<
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
ProposalEventSubscription,
|
return Apollo.useSubscription<ProposalEventSubscription, ProposalEventSubscriptionVariables>(ProposalEventDocument, options);
|
||||||
ProposalEventSubscriptionVariables
|
}
|
||||||
>
|
export type ProposalEventSubscriptionHookResult = ReturnType<typeof useProposalEventSubscription>;
|
||||||
) {
|
export type ProposalEventSubscriptionResult = Apollo.SubscriptionResult<ProposalEventSubscription>;
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
|
||||||
return Apollo.useSubscription<
|
|
||||||
ProposalEventSubscription,
|
|
||||||
ProposalEventSubscriptionVariables
|
|
||||||
>(ProposalEventDocument, options);
|
|
||||||
}
|
|
||||||
export type ProposalEventSubscriptionHookResult = ReturnType<
|
|
||||||
typeof useProposalEventSubscription
|
|
||||||
>;
|
|
||||||
export type ProposalEventSubscriptionResult =
|
|
||||||
Apollo.SubscriptionResult<ProposalEventSubscription>;
|
|
||||||
export const OnUpdateNetworkParametersDocument = gql`
|
export const OnUpdateNetworkParametersDocument = gql`
|
||||||
subscription OnUpdateNetworkParameters {
|
subscription OnUpdateNetworkParameters {
|
||||||
proposals {
|
proposals {
|
||||||
...UpdateNetworkParameterProposal
|
...UpdateNetworkParameterProposal
|
||||||
}
|
|
||||||
}
|
}
|
||||||
${UpdateNetworkParameterProposalFragmentDoc}
|
}
|
||||||
`;
|
${UpdateNetworkParameterProposalFragmentDoc}`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __useOnUpdateNetworkParametersSubscription__
|
* __useOnUpdateNetworkParametersSubscription__
|
||||||
@ -190,33 +104,22 @@ export const OnUpdateNetworkParametersDocument = gql`
|
|||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function useOnUpdateNetworkParametersSubscription(
|
export function useOnUpdateNetworkParametersSubscription(baseOptions?: Apollo.SubscriptionHookOptions<OnUpdateNetworkParametersSubscription, OnUpdateNetworkParametersSubscriptionVariables>) {
|
||||||
baseOptions?: Apollo.SubscriptionHookOptions<
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
OnUpdateNetworkParametersSubscription,
|
return Apollo.useSubscription<OnUpdateNetworkParametersSubscription, OnUpdateNetworkParametersSubscriptionVariables>(OnUpdateNetworkParametersDocument, options);
|
||||||
OnUpdateNetworkParametersSubscriptionVariables
|
|
||||||
>
|
|
||||||
) {
|
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
|
||||||
return Apollo.useSubscription<
|
|
||||||
OnUpdateNetworkParametersSubscription,
|
|
||||||
OnUpdateNetworkParametersSubscriptionVariables
|
|
||||||
>(OnUpdateNetworkParametersDocument, options);
|
|
||||||
}
|
|
||||||
export type OnUpdateNetworkParametersSubscriptionHookResult = ReturnType<
|
|
||||||
typeof useOnUpdateNetworkParametersSubscription
|
|
||||||
>;
|
|
||||||
export type OnUpdateNetworkParametersSubscriptionResult =
|
|
||||||
Apollo.SubscriptionResult<OnUpdateNetworkParametersSubscription>;
|
|
||||||
export const ProposalOfMarketDocument = gql`
|
|
||||||
query ProposalOfMarket($marketId: ID!) {
|
|
||||||
proposal(id: $marketId) {
|
|
||||||
id
|
|
||||||
terms {
|
|
||||||
enactmentDatetime
|
|
||||||
}
|
}
|
||||||
|
export type OnUpdateNetworkParametersSubscriptionHookResult = ReturnType<typeof useOnUpdateNetworkParametersSubscription>;
|
||||||
|
export type OnUpdateNetworkParametersSubscriptionResult = Apollo.SubscriptionResult<OnUpdateNetworkParametersSubscription>;
|
||||||
|
export const ProposalOfMarketDocument = gql`
|
||||||
|
query ProposalOfMarket($marketId: ID!) {
|
||||||
|
proposal(id: $marketId) {
|
||||||
|
id
|
||||||
|
terms {
|
||||||
|
enactmentDatetime
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __useProposalOfMarketQuery__
|
* __useProposalOfMarketQuery__
|
||||||
@ -234,37 +137,14 @@ export const ProposalOfMarketDocument = gql`
|
|||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function useProposalOfMarketQuery(
|
export function useProposalOfMarketQuery(baseOptions: Apollo.QueryHookOptions<ProposalOfMarketQuery, ProposalOfMarketQueryVariables>) {
|
||||||
baseOptions: Apollo.QueryHookOptions<
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
ProposalOfMarketQuery,
|
return Apollo.useQuery<ProposalOfMarketQuery, ProposalOfMarketQueryVariables>(ProposalOfMarketDocument, options);
|
||||||
ProposalOfMarketQueryVariables
|
}
|
||||||
>
|
export function useProposalOfMarketLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ProposalOfMarketQuery, ProposalOfMarketQueryVariables>) {
|
||||||
) {
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
return Apollo.useLazyQuery<ProposalOfMarketQuery, ProposalOfMarketQueryVariables>(ProposalOfMarketDocument, options);
|
||||||
return Apollo.useQuery<ProposalOfMarketQuery, ProposalOfMarketQueryVariables>(
|
}
|
||||||
ProposalOfMarketDocument,
|
export type ProposalOfMarketQueryHookResult = ReturnType<typeof useProposalOfMarketQuery>;
|
||||||
options
|
export type ProposalOfMarketLazyQueryHookResult = ReturnType<typeof useProposalOfMarketLazyQuery>;
|
||||||
);
|
export type ProposalOfMarketQueryResult = Apollo.QueryResult<ProposalOfMarketQuery, ProposalOfMarketQueryVariables>;
|
||||||
}
|
|
||||||
export function useProposalOfMarketLazyQuery(
|
|
||||||
baseOptions?: Apollo.LazyQueryHookOptions<
|
|
||||||
ProposalOfMarketQuery,
|
|
||||||
ProposalOfMarketQueryVariables
|
|
||||||
>
|
|
||||||
) {
|
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
|
||||||
return Apollo.useLazyQuery<
|
|
||||||
ProposalOfMarketQuery,
|
|
||||||
ProposalOfMarketQueryVariables
|
|
||||||
>(ProposalOfMarketDocument, options);
|
|
||||||
}
|
|
||||||
export type ProposalOfMarketQueryHookResult = ReturnType<
|
|
||||||
typeof useProposalOfMarketQuery
|
|
||||||
>;
|
|
||||||
export type ProposalOfMarketLazyQueryHookResult = ReturnType<
|
|
||||||
typeof useProposalOfMarketLazyQuery
|
|
||||||
>;
|
|
||||||
export type ProposalOfMarketQueryResult = Apollo.QueryResult<
|
|
||||||
ProposalOfMarketQuery,
|
|
||||||
ProposalOfMarketQueryVariables
|
|
||||||
>;
|
|
@ -3,42 +3,31 @@ import * as Types from '@vegaprotocol/types';
|
|||||||
import { gql } from '@apollo/client';
|
import { gql } from '@apollo/client';
|
||||||
import * as Apollo from '@apollo/client';
|
import * as Apollo from '@apollo/client';
|
||||||
const defaultOptions = {} as const;
|
const defaultOptions = {} as const;
|
||||||
export type VoteEventFieldsFragment = {
|
export type VoteEventFieldsFragment = { __typename?: 'ProposalVote', proposalId: string, vote: { __typename?: 'Vote', value: Types.VoteValue, datetime: any } };
|
||||||
__typename?: 'ProposalVote';
|
|
||||||
proposalId: string;
|
|
||||||
vote: { __typename?: 'Vote'; value: Types.VoteValue; datetime: any };
|
|
||||||
};
|
|
||||||
|
|
||||||
export type VoteEventSubscriptionVariables = Types.Exact<{
|
export type VoteEventSubscriptionVariables = Types.Exact<{
|
||||||
partyId: Types.Scalars['ID'];
|
partyId: Types.Scalars['ID'];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type VoteEventSubscription = {
|
|
||||||
__typename?: 'Subscription';
|
export type VoteEventSubscription = { __typename?: 'Subscription', votes: { __typename?: 'ProposalVote', proposalId: string, vote: { __typename?: 'Vote', value: Types.VoteValue, datetime: any } } };
|
||||||
votes: {
|
|
||||||
__typename?: 'ProposalVote';
|
|
||||||
proposalId: string;
|
|
||||||
vote: { __typename?: 'Vote'; value: Types.VoteValue; datetime: any };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const VoteEventFieldsFragmentDoc = gql`
|
export const VoteEventFieldsFragmentDoc = gql`
|
||||||
fragment VoteEventFields on ProposalVote {
|
fragment VoteEventFields on ProposalVote {
|
||||||
proposalId
|
proposalId
|
||||||
vote {
|
vote {
|
||||||
value
|
value
|
||||||
datetime
|
datetime
|
||||||
}
|
|
||||||
}
|
}
|
||||||
`;
|
}
|
||||||
|
`;
|
||||||
export const VoteEventDocument = gql`
|
export const VoteEventDocument = gql`
|
||||||
subscription VoteEvent($partyId: ID!) {
|
subscription VoteEvent($partyId: ID!) {
|
||||||
votes(partyId: $partyId) {
|
votes(partyId: $partyId) {
|
||||||
...VoteEventFields
|
...VoteEventFields
|
||||||
}
|
|
||||||
}
|
}
|
||||||
${VoteEventFieldsFragmentDoc}
|
}
|
||||||
`;
|
${VoteEventFieldsFragmentDoc}`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __useVoteEventSubscription__
|
* __useVoteEventSubscription__
|
||||||
@ -56,20 +45,9 @@ export const VoteEventDocument = gql`
|
|||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function useVoteEventSubscription(
|
export function useVoteEventSubscription(baseOptions: Apollo.SubscriptionHookOptions<VoteEventSubscription, VoteEventSubscriptionVariables>) {
|
||||||
baseOptions: Apollo.SubscriptionHookOptions<
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
VoteEventSubscription,
|
return Apollo.useSubscription<VoteEventSubscription, VoteEventSubscriptionVariables>(VoteEventDocument, options);
|
||||||
VoteEventSubscriptionVariables
|
}
|
||||||
>
|
export type VoteEventSubscriptionHookResult = ReturnType<typeof useVoteEventSubscription>;
|
||||||
) {
|
export type VoteEventSubscriptionResult = Apollo.SubscriptionResult<VoteEventSubscription>;
|
||||||
const options = { ...defaultOptions, ...baseOptions };
|
|
||||||
return Apollo.useSubscription<
|
|
||||||
VoteEventSubscription,
|
|
||||||
VoteEventSubscriptionVariables
|
|
||||||
>(VoteEventDocument, options);
|
|
||||||
}
|
|
||||||
export type VoteEventSubscriptionHookResult = ReturnType<
|
|
||||||
typeof useVoteEventSubscription
|
|
||||||
>;
|
|
||||||
export type VoteEventSubscriptionResult =
|
|
||||||
Apollo.SubscriptionResult<VoteEventSubscription>;
|
|
4
libs/types/src/__generated__/types.ts
generated
4
libs/types/src/__generated__/types.ts
generated
@ -1098,6 +1098,8 @@ export type InternalDataSourceKind = DataSourceSpecConfigurationTime;
|
|||||||
|
|
||||||
/** The interval for trade candles when subscribing via Vega GraphQL, default is I15M */
|
/** The interval for trade candles when subscribing via Vega GraphQL, default is I15M */
|
||||||
export enum Interval {
|
export enum Interval {
|
||||||
|
/** The block interval is not a fixed amount of time, rather it used to indicate grouping of events that occur in a single block. It is usually about a second. */
|
||||||
|
INTERVAL_BLOCK = 'INTERVAL_BLOCK',
|
||||||
/** 1 day interval */
|
/** 1 day interval */
|
||||||
INTERVAL_I1D = 'INTERVAL_I1D',
|
INTERVAL_I1D = 'INTERVAL_I1D',
|
||||||
/** 1 hour interval */
|
/** 1 hour interval */
|
||||||
@ -3805,6 +3807,8 @@ export type StakeLinking = {
|
|||||||
__typename?: 'StakeLinking';
|
__typename?: 'StakeLinking';
|
||||||
/** The amount linked or unlinked */
|
/** The amount linked or unlinked */
|
||||||
amount: Scalars['String'];
|
amount: Scalars['String'];
|
||||||
|
/** The (ethereum) block height of the link/unlink */
|
||||||
|
blockHeight: Scalars['String'];
|
||||||
/** The time at which the stake linking was fully processed by the Vega network, null until defined */
|
/** The time at which the stake linking was fully processed by the Vega network, null until defined */
|
||||||
finalizedAt?: Maybe<Scalars['Timestamp']>;
|
finalizedAt?: Maybe<Scalars['Timestamp']>;
|
||||||
id: Scalars['ID'];
|
id: Scalars['ID'];
|
||||||
|
@ -86,6 +86,7 @@ export const DepositStatusMapping: {
|
|||||||
export const IntervalMapping: {
|
export const IntervalMapping: {
|
||||||
[T in Interval]: string;
|
[T in Interval]: string;
|
||||||
} = {
|
} = {
|
||||||
|
INTERVAL_BLOCK: '1 block',
|
||||||
INTERVAL_I15M: 'I15M',
|
INTERVAL_I15M: 'I15M',
|
||||||
INTERVAL_I1D: 'I1D',
|
INTERVAL_I1D: 'I1D',
|
||||||
INTERVAL_I1H: 'I1H',
|
INTERVAL_I1H: 'I1H',
|
||||||
|
Loading…
Reference in New Issue
Block a user