chore(explorer): update transfer status query to match latest preview
This commit is contained in:
parent
636b1f98db
commit
b01c67ced5
@ -1,16 +1,18 @@
|
||||
query ExplorerTransferVote($id: ID!) {
|
||||
query ExplorerTransferStatus($id: ID!) {
|
||||
transfer(id: $id) {
|
||||
reference
|
||||
timestamp
|
||||
status
|
||||
reason
|
||||
fromAccountType
|
||||
from
|
||||
to
|
||||
toAccountType
|
||||
asset {
|
||||
id
|
||||
transfer {
|
||||
reference
|
||||
timestamp
|
||||
status
|
||||
reason
|
||||
fromAccountType
|
||||
from
|
||||
to
|
||||
toAccountType
|
||||
asset {
|
||||
id
|
||||
}
|
||||
amount
|
||||
}
|
||||
amount
|
||||
}
|
||||
}
|
||||
|
@ -3,57 +3,59 @@ import * as Types from '@vegaprotocol/types';
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
const defaultOptions = {} as const;
|
||||
export type ExplorerTransferVoteQueryVariables = Types.Exact<{
|
||||
export type ExplorerTransferStatusQueryVariables = Types.Exact<{
|
||||
id: Types.Scalars['ID'];
|
||||
}>;
|
||||
|
||||
|
||||
export type ExplorerTransferVoteQuery = { __typename?: 'Query', transfer?: { __typename?: 'Transfer', reference?: string | null, timestamp: any, status: Types.TransferStatus, reason?: string | null, fromAccountType: Types.AccountType, from: string, to: string, toAccountType: Types.AccountType, amount: string, asset?: { __typename?: 'Asset', id: string } | null } | null };
|
||||
export type ExplorerTransferStatusQuery = { __typename?: 'Query', transfer?: { __typename?: 'TransferNode', transfer: { __typename?: 'Transfer', reference?: string | null, timestamp: any, status: Types.TransferStatus, reason?: string | null, fromAccountType: Types.AccountType, from: string, to: string, toAccountType: Types.AccountType, amount: string, asset?: { __typename?: 'Asset', id: string } | null } } | null };
|
||||
|
||||
|
||||
export const ExplorerTransferVoteDocument = gql`
|
||||
query ExplorerTransferVote($id: ID!) {
|
||||
export const ExplorerTransferStatusDocument = gql`
|
||||
query ExplorerTransferStatus($id: ID!) {
|
||||
transfer(id: $id) {
|
||||
reference
|
||||
timestamp
|
||||
status
|
||||
reason
|
||||
fromAccountType
|
||||
from
|
||||
to
|
||||
toAccountType
|
||||
asset {
|
||||
id
|
||||
transfer {
|
||||
reference
|
||||
timestamp
|
||||
status
|
||||
reason
|
||||
fromAccountType
|
||||
from
|
||||
to
|
||||
toAccountType
|
||||
asset {
|
||||
id
|
||||
}
|
||||
amount
|
||||
}
|
||||
amount
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useExplorerTransferVoteQuery__
|
||||
* __useExplorerTransferStatusQuery__
|
||||
*
|
||||
* To run a query within a React component, call `useExplorerTransferVoteQuery` and pass it any options that fit your needs.
|
||||
* When your component renders, `useExplorerTransferVoteQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
||||
* To run a query within a React component, call `useExplorerTransferStatusQuery` and pass it any options that fit your needs.
|
||||
* When your component renders, `useExplorerTransferStatusQuery` 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 } = useExplorerTransferVoteQuery({
|
||||
* const { data, loading, error } = useExplorerTransferStatusQuery({
|
||||
* variables: {
|
||||
* id: // value for 'id'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useExplorerTransferVoteQuery(baseOptions: Apollo.QueryHookOptions<ExplorerTransferVoteQuery, ExplorerTransferVoteQueryVariables>) {
|
||||
export function useExplorerTransferStatusQuery(baseOptions: Apollo.QueryHookOptions<ExplorerTransferStatusQuery, ExplorerTransferStatusQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useQuery<ExplorerTransferVoteQuery, ExplorerTransferVoteQueryVariables>(ExplorerTransferVoteDocument, options);
|
||||
return Apollo.useQuery<ExplorerTransferStatusQuery, ExplorerTransferStatusQueryVariables>(ExplorerTransferStatusDocument, options);
|
||||
}
|
||||
export function useExplorerTransferVoteLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ExplorerTransferVoteQuery, ExplorerTransferVoteQueryVariables>) {
|
||||
export function useExplorerTransferStatusLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ExplorerTransferStatusQuery, ExplorerTransferStatusQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useLazyQuery<ExplorerTransferVoteQuery, ExplorerTransferVoteQueryVariables>(ExplorerTransferVoteDocument, options);
|
||||
return Apollo.useLazyQuery<ExplorerTransferStatusQuery, ExplorerTransferStatusQueryVariables>(ExplorerTransferStatusDocument, options);
|
||||
}
|
||||
export type ExplorerTransferVoteQueryHookResult = ReturnType<typeof useExplorerTransferVoteQuery>;
|
||||
export type ExplorerTransferVoteLazyQueryHookResult = ReturnType<typeof useExplorerTransferVoteLazyQuery>;
|
||||
export type ExplorerTransferVoteQueryResult = Apollo.QueryResult<ExplorerTransferVoteQuery, ExplorerTransferVoteQueryVariables>;
|
||||
export type ExplorerTransferStatusQueryHookResult = ReturnType<typeof useExplorerTransferStatusQuery>;
|
||||
export type ExplorerTransferStatusLazyQueryHookResult = ReturnType<typeof useExplorerTransferStatusLazyQuery>;
|
||||
export type ExplorerTransferStatusQueryResult = Apollo.QueryResult<ExplorerTransferStatusQuery, ExplorerTransferStatusQueryVariables>;
|
@ -7,7 +7,7 @@ import {
|
||||
DistributionStrategy,
|
||||
} from '@vegaprotocol/types';
|
||||
import { VegaIcon, VegaIconNames } from '@vegaprotocol/ui-toolkit';
|
||||
|
||||
import { formatNumber } from '@vegaprotocol/utils';
|
||||
export type Metric = components['schemas']['vegaDispatchMetric'];
|
||||
export type Strategy = components['schemas']['vegaDispatchStrategy'];
|
||||
|
||||
@ -72,37 +72,44 @@ export function TransferRewards({ recurring }: TransferRewardsProps) {
|
||||
<div className={wrapperClasses}>
|
||||
<h2 className={headerClasses}>{getRewardTitle(entityScope)}</h2>
|
||||
<ul className="relative block rounded-lg py-6 text-left p-6">
|
||||
{entityScope && entityScopeIcons[entityScope] ? (
|
||||
<li>
|
||||
<strong>{t('Scope')}</strong>:{' '}
|
||||
<VegaIcon name={entityScopeIcons[entityScope]} />
|
||||
|
||||
{individualScope ? individualScopeLabels[individualScope] : null}
|
||||
{getScopeLabel(entityScope, teamScope)}
|
||||
</li>
|
||||
) : null}
|
||||
{metric && (
|
||||
<li>
|
||||
<strong>{t('Metric')}</strong>: {metricLabels[metric]}
|
||||
</li>
|
||||
)}
|
||||
|
||||
{assetForMetric ? (
|
||||
<li>
|
||||
<strong>{t('Asset')}</strong>:{' '}
|
||||
<AssetLink assetId={assetForMetric} />
|
||||
</li>
|
||||
) : null}
|
||||
<li>
|
||||
<strong>{t('Metric')}</strong>: {metricLabels[metric]}
|
||||
</li>
|
||||
{entityScope && entityScopeIcons[entityScope] ? (
|
||||
<li>
|
||||
<strong>{t('Scope')}</strong>:{' '}
|
||||
<VegaIcon name={entityScopeIcons[entityScope]} />
|
||||
{individualScope ? individualScopeLabels[individualScope] : null}
|
||||
</li>
|
||||
) : null}
|
||||
|
||||
{teamScope}
|
||||
|
||||
{lockPeriod && lockPeriod !== '0' ? (
|
||||
{lockPeriod ? (
|
||||
<li>
|
||||
<strong>{t('Lock')}</strong>: {lockPeriod}
|
||||
<strong>{t('Reward lock')}</strong>:
|
||||
{recurring.dispatchStrategy.lockPeriod}{' '}
|
||||
{recurring.dispatchStrategy.lockPeriod === '1'
|
||||
? t('epoch')
|
||||
: t('epochs')}
|
||||
</li>
|
||||
) : null}
|
||||
|
||||
{markets && markets.length > 0 ? (
|
||||
<li>
|
||||
<strong>{t('Markets in scope')}</strong>:
|
||||
<ul>
|
||||
<ul className="inline-block ml-1">
|
||||
{markets.map((m) => (
|
||||
<li key={m}>
|
||||
<li key={m} className="inline-block mr-2">
|
||||
<MarketLink id={m} />
|
||||
</li>
|
||||
))}
|
||||
@ -119,7 +126,10 @@ export function TransferRewards({ recurring }: TransferRewardsProps) {
|
||||
{windowLength && windowLength !== '0' ? (
|
||||
<li>
|
||||
<strong>{t('Window length')}</strong>:{' '}
|
||||
{recurring.dispatchStrategy.windowLength}
|
||||
{recurring.dispatchStrategy.windowLength}{' '}
|
||||
{recurring.dispatchStrategy.windowLength === '1'
|
||||
? t('epoch')
|
||||
: t('epochs')}
|
||||
</li>
|
||||
) : null}
|
||||
|
||||
@ -133,9 +143,11 @@ export function TransferRewards({ recurring }: TransferRewardsProps) {
|
||||
|
||||
{nTopPerformers && (
|
||||
<li>
|
||||
<strong>{t('Top performers')}</strong>: {nTopPerformers}
|
||||
<strong>{t('Elligible team members:')}</strong> top{' '}
|
||||
{`${formatNumber(Number(nTopPerformers) * 100, 0)}%`}
|
||||
</li>
|
||||
)}
|
||||
|
||||
{distributionStrategy &&
|
||||
distributionStrategy !== 'DISTRIBUTION_STRATEGY_UNSPECIFIED' && (
|
||||
<li>
|
||||
@ -146,13 +158,13 @@ export function TransferRewards({ recurring }: TransferRewardsProps) {
|
||||
</ul>
|
||||
<div className="px-6 pt-1 pb-5">
|
||||
{rankTable && rankTable.length > 0 ? (
|
||||
<table className="border-collapse border border-slate-400 ">
|
||||
<table className="border-collapse border border-gray-400 ">
|
||||
<thead>
|
||||
<tr>
|
||||
<th className="border border-slate-300 bg-slate-300 px-3">
|
||||
<th className="border border-gray-300 bg-gray-300 px-3">
|
||||
<strong>{t('Start rank')}</strong>
|
||||
</th>
|
||||
<th className="border border-slate-300 bg-slate-300 px-3">
|
||||
<th className="border border-gray-300 bg-gray-300 px-3">
|
||||
<strong>{t('Share of reward pool')}</strong>
|
||||
</th>
|
||||
</tr>
|
||||
@ -178,6 +190,22 @@ export function TransferRewards({ recurring }: TransferRewardsProps) {
|
||||
);
|
||||
}
|
||||
|
||||
export function getScopeLabel(
|
||||
scope: components['schemas']['vegaEntityScope'] | undefined,
|
||||
teamScope: readonly string[] | undefined
|
||||
): string {
|
||||
if (scope === 'ENTITY_SCOPE_TEAMS') {
|
||||
if (teamScope && teamScope.length !== 0) {
|
||||
return ` ${teamScope.length} teams`;
|
||||
} else {
|
||||
return t('All teams');
|
||||
}
|
||||
} else if (scope === 'ENTITY_SCOPE_INDIVIDUALS') {
|
||||
return t('Individuals');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
export function getRewardTitle(
|
||||
scope?: components['schemas']['vegaEntityScope']
|
||||
) {
|
||||
|
@ -25,7 +25,7 @@ export function TransferStatusView({ status, loading }: TransferStatusProps) {
|
||||
|
||||
return (
|
||||
<div className={wrapperClasses}>
|
||||
<h2 className={headerClasses}>{t('Transfer Status')}</h2>
|
||||
<h2 className={headerClasses}>{t('Status')}</h2>
|
||||
<div className="relative block rounded-lg py-6 text-center p-6">
|
||||
{loading ? (
|
||||
<div className="leading-10 mt-12">
|
||||
|
@ -2,7 +2,7 @@ import type { components } from '../../../../../types/explorer';
|
||||
import { TransferRepeat } from './blocks/transfer-repeat';
|
||||
import { TransferRewards } from './blocks/transfer-rewards';
|
||||
import { TransferParticipants } from './blocks/transfer-participants';
|
||||
import { useExplorerTransferVoteQuery } from './__generated__/Transfer';
|
||||
import { useExplorerTransferStatusQuery } from './__generated__/Transfer';
|
||||
import { TransferStatusView } from './blocks/transfer-status';
|
||||
import { TransferStatus } from '@vegaprotocol/types';
|
||||
|
||||
@ -33,13 +33,13 @@ export function TransferDetails({ transfer, from, id }: TransferDetailsProps) {
|
||||
|
||||
// Currently all this is passed in to TransferStatus, but the extra details
|
||||
// may be useful in the future.
|
||||
const { data, error, loading } = useExplorerTransferVoteQuery({
|
||||
const { data, error, loading } = useExplorerTransferStatusQuery({
|
||||
variables: { id },
|
||||
});
|
||||
|
||||
const status = error
|
||||
? TransferStatus.STATUS_REJECTED
|
||||
: data?.transfer?.status;
|
||||
: data?.transfer?.transfer.status;
|
||||
|
||||
return (
|
||||
<div className="flex flex-wrap">
|
||||
|
64
libs/types/src/__generated__/types.ts
generated
64
libs/types/src/__generated__/types.ts
generated
@ -14,6 +14,32 @@ export type Scalars = {
|
||||
Timestamp: any;
|
||||
};
|
||||
|
||||
/** Margins for a hypothetical position not related to any existing party */
|
||||
export type AbstractMarginLevels = {
|
||||
__typename?: 'AbstractMarginLevels';
|
||||
/** Asset for the current margins */
|
||||
asset: Asset;
|
||||
/**
|
||||
* If the margin of the party is greater than this level, then collateral will be released from the margin account into
|
||||
* the general account of the party for the given asset.
|
||||
*/
|
||||
collateralReleaseLevel: Scalars['String'];
|
||||
/** This is the minimum margin required for a party to place a new order on the network, expressed as unsigned integer */
|
||||
initialLevel: Scalars['String'];
|
||||
/** Minimal margin for the position to be maintained in the network (unsigned integer) */
|
||||
maintenanceLevel: Scalars['String'];
|
||||
/** Margin factor, only relevant for isolated margin mode, else 0 */
|
||||
marginFactor: Scalars['String'];
|
||||
/** Margin mode of the party, cross margin or isolated margin */
|
||||
marginMode: MarginMode;
|
||||
/** Market in which the margin is required for this party */
|
||||
market: Market;
|
||||
/** When in isolated margin, the required order margin level, otherwise, 0 */
|
||||
orderMarginLevel: Scalars['String'];
|
||||
/** If the margin is between maintenance and search, the network will initiate a collateral search, expressed as unsigned integer */
|
||||
searchLevel: Scalars['String'];
|
||||
};
|
||||
|
||||
/** An account record */
|
||||
export type AccountBalance = {
|
||||
__typename?: 'AccountBalance';
|
||||
@ -359,6 +385,8 @@ export enum AuctionTrigger {
|
||||
|
||||
export type BatchProposal = {
|
||||
__typename?: 'BatchProposal';
|
||||
/** Terms of all the proposals in the batch */
|
||||
batchTerms?: Maybe<BatchProposalTerms>;
|
||||
/** RFC3339Nano time and date when the proposal reached the network */
|
||||
datetime: Scalars['Timestamp'];
|
||||
/** Details of the rejection reason */
|
||||
@ -389,10 +417,10 @@ export type BatchProposal = {
|
||||
votes: ProposalVotes;
|
||||
};
|
||||
|
||||
/** The rationale for the proposal */
|
||||
/** The terms for the batch proposal */
|
||||
export type BatchProposalTerms = {
|
||||
__typename?: 'BatchProposalTerms';
|
||||
/** Actual changes being introduced by the proposal - actions the proposal triggers if passed and enacted. */
|
||||
/** Actual changes being introduced by the batch proposal - actions the proposal triggers if passed and enacted. */
|
||||
changes: Array<Maybe<BatchProposalTermsChange>>;
|
||||
/**
|
||||
* RFC3339Nano time and date when voting closes for this proposal.
|
||||
@ -531,6 +559,22 @@ export type CompositePriceConfiguration = {
|
||||
decayWeight: Scalars['String'];
|
||||
};
|
||||
|
||||
export type CompositePriceSource = {
|
||||
__typename?: 'CompositePriceSource';
|
||||
/** The source of the price */
|
||||
PriceSource: Scalars['String'];
|
||||
/** The last time the price source was updated in RFC3339Nano */
|
||||
lastUpdated: Scalars['Timestamp'];
|
||||
/** The current value of the composite source price */
|
||||
price: Scalars['String'];
|
||||
};
|
||||
|
||||
export type CompositePriceState = {
|
||||
__typename?: 'CompositePriceState';
|
||||
/** Underlying state of the composite price */
|
||||
priceSources?: Maybe<Array<CompositePriceSource>>;
|
||||
};
|
||||
|
||||
export enum CompositePriceType {
|
||||
/** Composite price is set to the last trade (legacy) */
|
||||
COMPOSITE_PRICE_TYPE_LAST_TRADE = 'COMPOSITE_PRICE_TYPE_LAST_TRADE',
|
||||
@ -2165,9 +2209,9 @@ export type MarginEdge = {
|
||||
export type MarginEstimate = {
|
||||
__typename?: 'MarginEstimate';
|
||||
/** Margin level estimate assuming no slippage */
|
||||
bestCase: MarginLevels;
|
||||
bestCase: AbstractMarginLevels;
|
||||
/** Margin level estimate assuming slippage cap is applied */
|
||||
worstCase: MarginLevels;
|
||||
worstCase: AbstractMarginLevels;
|
||||
};
|
||||
|
||||
/** Margins for a given a party */
|
||||
@ -2439,6 +2483,8 @@ export type MarketData = {
|
||||
liquidityProviderSla?: Maybe<Array<LiquidityProviderSLA>>;
|
||||
/** The mark price (an unsigned integer) */
|
||||
markPrice: Scalars['String'];
|
||||
/** State of the underlying internal composite price */
|
||||
markPriceState?: Maybe<CompositePriceState>;
|
||||
/** The methodology used for the calculation of the mark price */
|
||||
markPriceType: CompositePriceType;
|
||||
/** Market of the associated mark price */
|
||||
@ -3053,6 +3099,8 @@ export type ObservableMarketData = {
|
||||
liquidityProviderSla?: Maybe<Array<ObservableLiquidityProviderSLA>>;
|
||||
/** The mark price (an unsigned integer) */
|
||||
markPrice: Scalars['String'];
|
||||
/** State of the underlying internal composite price */
|
||||
markPriceState?: Maybe<CompositePriceState>;
|
||||
/** The methodology used to calculated mark price */
|
||||
markPriceType: CompositePriceType;
|
||||
/** The market growth factor for the last market time window */
|
||||
@ -4021,6 +4069,8 @@ export type PerpetualData = {
|
||||
fundingRate?: Maybe<Scalars['String']>;
|
||||
/** Internal composite price used as input to the internal VWAP */
|
||||
internalCompositePrice: Scalars['String'];
|
||||
/** The internal state of the underlying internal composite price */
|
||||
internalCompositePriceState?: Maybe<CompositePriceState>;
|
||||
/** The methodology used to calculated internal composite price for perpetual markets */
|
||||
internalCompositePriceType: CompositePriceType;
|
||||
/** Time-weighted average price calculated from data points for this period from the internal data source. */
|
||||
@ -4031,6 +4081,8 @@ export type PerpetualData = {
|
||||
seqNum: Scalars['Int'];
|
||||
/** Time at which the funding period started */
|
||||
startTime: Scalars['Timestamp'];
|
||||
/** The last value from the external oracle */
|
||||
underlyingIndexPrice: Scalars['String'];
|
||||
};
|
||||
|
||||
export type PerpetualProduct = {
|
||||
@ -4328,7 +4380,7 @@ export type ProposalDetail = {
|
||||
__typename?: 'ProposalDetail';
|
||||
/** Batch proposal ID that is provided by Vega once proposal reaches the network */
|
||||
batchId?: Maybe<Scalars['ID']>;
|
||||
/** Terms of the proposal for a batch proposal */
|
||||
/** Terms of all the proposals in the batch */
|
||||
batchTerms?: Maybe<BatchProposalTerms>;
|
||||
/** RFC3339Nano time and date when the proposal reached the Vega network */
|
||||
datetime: Scalars['Timestamp'];
|
||||
@ -4354,7 +4406,7 @@ export type ProposalDetail = {
|
||||
requiredParticipation: Scalars['String'];
|
||||
/** State of the proposal */
|
||||
state: ProposalState;
|
||||
/** Terms of the proposal for proposal */
|
||||
/** Terms of the proposal */
|
||||
terms?: Maybe<ProposalTerms>;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user