Feat/migrate libs (#1266)
* feat: add new generator with config * feat: split off gql queries to separate files for the new generator * fix: delete dummy schema * feat: add generated queries with new codegen * fix: regenerate from scratch and remove duplicates * fix: libs and app gen folders * fix: remove more duplicate queries * fix: add generated files to be ignored by the formatter * fix: format * feat: migrate assets to use new code generator * fix: generated imports * fix: lint * fix: accounts export * fix: more imports * fix: add type alias for new type system and regenerate * fix: format * fix: export * fix: format * fix: delete leftover file from merge * chore: migrate candles-chart lib * fix: remove redundant asset files * chore: migrate accounts * chore: update glob * chore: add cleanup to fix-imports to support type migrations for now * fix: imports * fix: update market types * fix: type import paths * fix: format * fix: import * fix: types in e2e tests * fix: format * fix: lint
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import merge from 'lodash/merge';
|
||||
import type { Accounts } from '@vegaprotocol/accounts';
|
||||
import type { AccountsQuery } from '@vegaprotocol/accounts';
|
||||
import { AccountType } from '@vegaprotocol/types';
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
|
||||
export const generateAccounts = (
|
||||
override?: PartialDeep<Accounts>
|
||||
): Accounts => {
|
||||
const defaultAccounts: Accounts = {
|
||||
override?: PartialDeep<AccountsQuery>
|
||||
): AccountsQuery => {
|
||||
const defaultAccounts: AccountsQuery = {
|
||||
party: {
|
||||
__typename: 'Party',
|
||||
id: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import merge from 'lodash/merge';
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
import type {
|
||||
Candles,
|
||||
Candles_market_candles,
|
||||
CandlesQuery,
|
||||
CandleFieldsFragment,
|
||||
} from '@vegaprotocol/candles-chart';
|
||||
|
||||
export const generateCandles = (override?: PartialDeep<Candles>): Candles => {
|
||||
const candles: Candles_market_candles[] = [
|
||||
export const generateCandles = (
|
||||
override?: PartialDeep<CandlesQuery>
|
||||
): CandlesQuery => {
|
||||
const candles: CandleFieldsFragment[] = [
|
||||
{
|
||||
datetime: '2022-04-06T09:15:00Z',
|
||||
high: '17481092',
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
import merge from 'lodash/merge';
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
import type {
|
||||
Chart,
|
||||
Chart_market_data_priceMonitoringBounds,
|
||||
} from '@vegaprotocol/candles-chart';
|
||||
import type { ChartQuery } from '@vegaprotocol/candles-chart';
|
||||
import type { Schema } from '@vegaprotocol/types';
|
||||
|
||||
export const generateChart = (override?: PartialDeep<Chart>): Chart => {
|
||||
const priceMonitoringBound: Chart_market_data_priceMonitoringBounds = {
|
||||
export const generateChart = (
|
||||
override?: PartialDeep<ChartQuery>
|
||||
): ChartQuery => {
|
||||
const priceMonitoringBound: Schema.PriceMonitoringBounds = {
|
||||
minValidPrice: '16256291',
|
||||
maxValidPrice: '18296869',
|
||||
referencePrice: '17247489',
|
||||
trigger: {
|
||||
__typename: 'PriceMonitoringTrigger',
|
||||
auctionExtensionSecs: 1,
|
||||
horizonSecs: 0,
|
||||
probability: 0,
|
||||
},
|
||||
__typename: 'PriceMonitoringBounds',
|
||||
};
|
||||
const defaultResult = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -3,7 +3,11 @@ fragment AccountFields on Account {
|
||||
balance
|
||||
market {
|
||||
id
|
||||
name
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
asset {
|
||||
id
|
||||
@@ -15,20 +19,14 @@ fragment AccountFields on Account {
|
||||
query Accounts($partyId: ID!) {
|
||||
party(id: $partyId) {
|
||||
id
|
||||
accountsConnection {
|
||||
edges {
|
||||
node {
|
||||
type
|
||||
balance
|
||||
}
|
||||
}
|
||||
accounts {
|
||||
...AccountFields
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
subscription AccountSubscribe($partyId: ID!) {
|
||||
subscription AccountEvents($partyId: ID!) {
|
||||
accounts(partyId: $partyId) {
|
||||
type
|
||||
balance
|
||||
...AccountFields
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @generated
|
||||
// This file was automatically generated and should not be edited.
|
||||
|
||||
import { AccountType } from "@vegaprotocol/types";
|
||||
|
||||
// ====================================================
|
||||
// GraphQL fragment: AccountFields
|
||||
// ====================================================
|
||||
|
||||
export interface AccountFields_market_tradableInstrument_instrument {
|
||||
__typename: "Instrument";
|
||||
/**
|
||||
* Full and fairly descriptive name for the instrument
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface AccountFields_market_tradableInstrument {
|
||||
__typename: "TradableInstrument";
|
||||
/**
|
||||
* An instance of, or reference to, a fully specified instrument.
|
||||
*/
|
||||
instrument: AccountFields_market_tradableInstrument_instrument;
|
||||
}
|
||||
|
||||
export interface AccountFields_market {
|
||||
__typename: "Market";
|
||||
/**
|
||||
* Market ID
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* An instance of, or reference to, a tradable instrument.
|
||||
*/
|
||||
tradableInstrument: AccountFields_market_tradableInstrument;
|
||||
}
|
||||
|
||||
export interface AccountFields_asset {
|
||||
__typename: "Asset";
|
||||
/**
|
||||
* The ID of the asset
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The symbol of the asset (e.g: GBP)
|
||||
*/
|
||||
symbol: string;
|
||||
/**
|
||||
* The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18
|
||||
*/
|
||||
decimals: number;
|
||||
}
|
||||
|
||||
export interface AccountFields {
|
||||
__typename: "Account";
|
||||
/**
|
||||
* Account type (General, Margin, etc)
|
||||
*/
|
||||
type: AccountType;
|
||||
/**
|
||||
* Balance as string - current account balance (approx. as balances can be updated several times per second)
|
||||
*/
|
||||
balance: string;
|
||||
/**
|
||||
* Market (only relevant to margin accounts)
|
||||
*/
|
||||
market: AccountFields_market | null;
|
||||
/**
|
||||
* Asset, the 'currency'
|
||||
*/
|
||||
asset: AccountFields_asset;
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @generated
|
||||
// This file was automatically generated and should not be edited.
|
||||
|
||||
import { AccountType } from "@vegaprotocol/types";
|
||||
|
||||
// ====================================================
|
||||
// GraphQL subscription operation: AccountSubscribe
|
||||
// ====================================================
|
||||
|
||||
export interface AccountSubscribe_accounts_market_tradableInstrument_instrument {
|
||||
__typename: "Instrument";
|
||||
/**
|
||||
* Full and fairly descriptive name for the instrument
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface AccountSubscribe_accounts_market_tradableInstrument {
|
||||
__typename: "TradableInstrument";
|
||||
/**
|
||||
* An instance of, or reference to, a fully specified instrument.
|
||||
*/
|
||||
instrument: AccountSubscribe_accounts_market_tradableInstrument_instrument;
|
||||
}
|
||||
|
||||
export interface AccountSubscribe_accounts_market {
|
||||
__typename: "Market";
|
||||
/**
|
||||
* Market ID
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* An instance of, or reference to, a tradable instrument.
|
||||
*/
|
||||
tradableInstrument: AccountSubscribe_accounts_market_tradableInstrument;
|
||||
}
|
||||
|
||||
export interface AccountSubscribe_accounts_asset {
|
||||
__typename: "Asset";
|
||||
/**
|
||||
* The ID of the asset
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The symbol of the asset (e.g: GBP)
|
||||
*/
|
||||
symbol: string;
|
||||
/**
|
||||
* The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18
|
||||
*/
|
||||
decimals: number;
|
||||
}
|
||||
|
||||
export interface AccountSubscribe_accounts {
|
||||
__typename: "Account";
|
||||
/**
|
||||
* Account type (General, Margin, etc)
|
||||
*/
|
||||
type: AccountType;
|
||||
/**
|
||||
* Balance as string - current account balance (approx. as balances can be updated several times per second)
|
||||
*/
|
||||
balance: string;
|
||||
/**
|
||||
* Market (only relevant to margin accounts)
|
||||
*/
|
||||
market: AccountSubscribe_accounts_market | null;
|
||||
/**
|
||||
* Asset, the 'currency'
|
||||
*/
|
||||
asset: AccountSubscribe_accounts_asset;
|
||||
}
|
||||
|
||||
export interface AccountSubscribe {
|
||||
/**
|
||||
* Subscribe to the accounts updates
|
||||
*/
|
||||
accounts: AccountSubscribe_accounts;
|
||||
}
|
||||
|
||||
export interface AccountSubscribeVariables {
|
||||
partyId: string;
|
||||
}
|
||||
+100
-89
@@ -1,97 +1,108 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @generated
|
||||
// This file was automatically generated and should not be edited.
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { AccountType } from "@vegaprotocol/types";
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
const defaultOptions = {} as const;
|
||||
export type AccountFieldsFragment = { __typename?: 'Account', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string } } } | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } };
|
||||
|
||||
// ====================================================
|
||||
// GraphQL query operation: Accounts
|
||||
// ====================================================
|
||||
export type AccountsQueryVariables = Types.Exact<{
|
||||
partyId: Types.Scalars['ID'];
|
||||
}>;
|
||||
|
||||
export interface Accounts_party_accounts_market_tradableInstrument_instrument {
|
||||
__typename: "Instrument";
|
||||
/**
|
||||
* Full and fairly descriptive name for the instrument
|
||||
*/
|
||||
name: string;
|
||||
|
||||
export type AccountsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string } } } | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } }> | null } | null };
|
||||
|
||||
export type AccountEventsSubscriptionVariables = Types.Exact<{
|
||||
partyId: Types.Scalars['ID'];
|
||||
}>;
|
||||
|
||||
|
||||
export type AccountEventsSubscription = { __typename?: 'Subscription', accounts: { __typename?: 'Account', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string } } } | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } } };
|
||||
|
||||
export const AccountFieldsFragmentDoc = gql`
|
||||
fragment AccountFields on Account {
|
||||
type
|
||||
balance
|
||||
market {
|
||||
id
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
asset {
|
||||
id
|
||||
symbol
|
||||
decimals
|
||||
}
|
||||
}
|
||||
|
||||
export interface Accounts_party_accounts_market_tradableInstrument {
|
||||
__typename: "TradableInstrument";
|
||||
/**
|
||||
* An instance of, or reference to, a fully specified instrument.
|
||||
*/
|
||||
instrument: Accounts_party_accounts_market_tradableInstrument_instrument;
|
||||
`;
|
||||
export const AccountsDocument = gql`
|
||||
query Accounts($partyId: ID!) {
|
||||
party(id: $partyId) {
|
||||
id
|
||||
accounts {
|
||||
...AccountFields
|
||||
}
|
||||
}
|
||||
}
|
||||
${AccountFieldsFragmentDoc}`;
|
||||
|
||||
export interface Accounts_party_accounts_market {
|
||||
__typename: "Market";
|
||||
/**
|
||||
* Market ID
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* An instance of, or reference to, a tradable instrument.
|
||||
*/
|
||||
tradableInstrument: Accounts_party_accounts_market_tradableInstrument;
|
||||
/**
|
||||
* __useAccountsQuery__
|
||||
*
|
||||
* To run a query within a React component, call `useAccountsQuery` and pass it any options that fit your needs.
|
||||
* When your component renders, `useAccountsQuery` 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 } = useAccountsQuery({
|
||||
* variables: {
|
||||
* partyId: // value for 'partyId'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useAccountsQuery(baseOptions: Apollo.QueryHookOptions<AccountsQuery, AccountsQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useQuery<AccountsQuery, AccountsQueryVariables>(AccountsDocument, options);
|
||||
}
|
||||
export function useAccountsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<AccountsQuery, AccountsQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useLazyQuery<AccountsQuery, AccountsQueryVariables>(AccountsDocument, options);
|
||||
}
|
||||
export type AccountsQueryHookResult = ReturnType<typeof useAccountsQuery>;
|
||||
export type AccountsLazyQueryHookResult = ReturnType<typeof useAccountsLazyQuery>;
|
||||
export type AccountsQueryResult = Apollo.QueryResult<AccountsQuery, AccountsQueryVariables>;
|
||||
export const AccountEventsDocument = gql`
|
||||
subscription AccountEvents($partyId: ID!) {
|
||||
accounts(partyId: $partyId) {
|
||||
...AccountFields
|
||||
}
|
||||
}
|
||||
${AccountFieldsFragmentDoc}`;
|
||||
|
||||
export interface Accounts_party_accounts_asset {
|
||||
__typename: "Asset";
|
||||
/**
|
||||
* The ID of the asset
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The symbol of the asset (e.g: GBP)
|
||||
*/
|
||||
symbol: string;
|
||||
/**
|
||||
* The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18
|
||||
*/
|
||||
decimals: number;
|
||||
}
|
||||
|
||||
export interface Accounts_party_accounts {
|
||||
__typename: "Account";
|
||||
/**
|
||||
* Account type (General, Margin, etc)
|
||||
*/
|
||||
type: AccountType;
|
||||
/**
|
||||
* Balance as string - current account balance (approx. as balances can be updated several times per second)
|
||||
*/
|
||||
balance: string;
|
||||
/**
|
||||
* Market (only relevant to margin accounts)
|
||||
*/
|
||||
market: Accounts_party_accounts_market | null;
|
||||
/**
|
||||
* Asset, the 'currency'
|
||||
*/
|
||||
asset: Accounts_party_accounts_asset;
|
||||
}
|
||||
|
||||
export interface Accounts_party {
|
||||
__typename: "Party";
|
||||
/**
|
||||
* Party identifier
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Collateral accounts relating to a party
|
||||
*/
|
||||
accounts: Accounts_party_accounts[] | null;
|
||||
}
|
||||
|
||||
export interface Accounts {
|
||||
/**
|
||||
* An entity that is trading on the Vega network
|
||||
*/
|
||||
party: Accounts_party | null;
|
||||
}
|
||||
|
||||
export interface AccountsVariables {
|
||||
partyId: string;
|
||||
}
|
||||
/**
|
||||
* __useAccountEventsSubscription__
|
||||
*
|
||||
* To run a query within a React component, call `useAccountEventsSubscription` and pass it any options that fit your needs.
|
||||
* When your component renders, `useAccountEventsSubscription` 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 subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
||||
*
|
||||
* @example
|
||||
* const { data, loading, error } = useAccountEventsSubscription({
|
||||
* variables: {
|
||||
* partyId: // value for 'partyId'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useAccountEventsSubscription(baseOptions: Apollo.SubscriptionHookOptions<AccountEventsSubscription, AccountEventsSubscriptionVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useSubscription<AccountEventsSubscription, AccountEventsSubscriptionVariables>(AccountEventsDocument, options);
|
||||
}
|
||||
export type AccountEventsSubscriptionHookResult = ReturnType<typeof useAccountEventsSubscription>;
|
||||
export type AccountEventsSubscriptionResult = Apollo.SubscriptionResult<AccountEventsSubscription>;
|
||||
@@ -1,110 +0,0 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
const defaultOptions = {} as const;
|
||||
export type AccountFieldsFragment = { __typename?: 'Account', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string, name: string } | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } };
|
||||
|
||||
export type AccountsQueryVariables = Types.Exact<{
|
||||
partyId: Types.Scalars['ID'];
|
||||
}>;
|
||||
|
||||
|
||||
export type AccountsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, accountsConnection: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'Account', type: Types.AccountType, balance: string } } | null> | null } } | null };
|
||||
|
||||
export type AccountSubscribeSubscriptionVariables = Types.Exact<{
|
||||
partyId: Types.Scalars['ID'];
|
||||
}>;
|
||||
|
||||
|
||||
export type AccountSubscribeSubscription = { __typename?: 'Subscription', accounts: { __typename?: 'Account', type: Types.AccountType, balance: string } };
|
||||
|
||||
export const AccountFieldsFragmentDoc = gql`
|
||||
fragment AccountFields on Account {
|
||||
type
|
||||
balance
|
||||
market {
|
||||
id
|
||||
name
|
||||
}
|
||||
asset {
|
||||
id
|
||||
symbol
|
||||
decimals
|
||||
}
|
||||
}
|
||||
`;
|
||||
export const AccountsDocument = gql`
|
||||
query Accounts($partyId: ID!) {
|
||||
party(id: $partyId) {
|
||||
id
|
||||
accountsConnection {
|
||||
edges {
|
||||
node {
|
||||
type
|
||||
balance
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useAccountsQuery__
|
||||
*
|
||||
* To run a query within a React component, call `useAccountsQuery` and pass it any options that fit your needs.
|
||||
* When your component renders, `useAccountsQuery` 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 } = useAccountsQuery({
|
||||
* variables: {
|
||||
* partyId: // value for 'partyId'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useAccountsQuery(baseOptions: Apollo.QueryHookOptions<AccountsQuery, AccountsQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useQuery<AccountsQuery, AccountsQueryVariables>(AccountsDocument, options);
|
||||
}
|
||||
export function useAccountsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<AccountsQuery, AccountsQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useLazyQuery<AccountsQuery, AccountsQueryVariables>(AccountsDocument, options);
|
||||
}
|
||||
export type AccountsQueryHookResult = ReturnType<typeof useAccountsQuery>;
|
||||
export type AccountsLazyQueryHookResult = ReturnType<typeof useAccountsLazyQuery>;
|
||||
export type AccountsQueryResult = Apollo.QueryResult<AccountsQuery, AccountsQueryVariables>;
|
||||
export const AccountSubscribeDocument = gql`
|
||||
subscription AccountSubscribe($partyId: ID!) {
|
||||
accounts(partyId: $partyId) {
|
||||
type
|
||||
balance
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useAccountSubscribeSubscription__
|
||||
*
|
||||
* To run a query within a React component, call `useAccountSubscribeSubscription` and pass it any options that fit your needs.
|
||||
* When your component renders, `useAccountSubscribeSubscription` 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 subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
||||
*
|
||||
* @example
|
||||
* const { data, loading, error } = useAccountSubscribeSubscription({
|
||||
* variables: {
|
||||
* partyId: // value for 'partyId'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useAccountSubscribeSubscription(baseOptions: Apollo.SubscriptionHookOptions<AccountSubscribeSubscription, AccountSubscribeSubscriptionVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useSubscription<AccountSubscribeSubscription, AccountSubscribeSubscriptionVariables>(AccountSubscribeDocument, options);
|
||||
}
|
||||
export type AccountSubscribeSubscriptionHookResult = ReturnType<typeof useAccountSubscribeSubscription>;
|
||||
export type AccountSubscribeSubscriptionResult = Apollo.SubscriptionResult<AccountSubscribeSubscription>;
|
||||
@@ -1,64 +1,21 @@
|
||||
import produce from 'immer';
|
||||
import { gql } from '@apollo/client';
|
||||
import {
|
||||
AccountsDocument,
|
||||
AccountEventsDocument,
|
||||
} from './__generated__/Accounts';
|
||||
import type {
|
||||
Accounts,
|
||||
Accounts_party_accounts,
|
||||
AccountFieldsFragment,
|
||||
AccountsQuery,
|
||||
AccountEventsSubscription,
|
||||
} from './__generated__/Accounts';
|
||||
import { makeDataProvider } from '@vegaprotocol/react-helpers';
|
||||
|
||||
import type {
|
||||
AccountSubscribe,
|
||||
AccountSubscribe_accounts,
|
||||
} from './__generated__/AccountSubscribe';
|
||||
|
||||
const ACCOUNTS_FRAGMENT = gql`
|
||||
fragment AccountFields on Account {
|
||||
type
|
||||
balance
|
||||
market {
|
||||
id
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
asset {
|
||||
id
|
||||
symbol
|
||||
decimals
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const ACCOUNTS_QUERY = gql`
|
||||
${ACCOUNTS_FRAGMENT}
|
||||
query Accounts($partyId: ID!) {
|
||||
party(id: $partyId) {
|
||||
id
|
||||
accounts {
|
||||
...AccountFields
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const ACCOUNTS_SUB = gql`
|
||||
${ACCOUNTS_FRAGMENT}
|
||||
subscription AccountSubscribe($partyId: ID!) {
|
||||
accounts(partyId: $partyId) {
|
||||
...AccountFields
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const getId = (
|
||||
data: Accounts_party_accounts | AccountSubscribe_accounts
|
||||
) => `${data.type}-${data.asset.symbol}-${data.market?.id ?? 'null'}`;
|
||||
export const getId = (data: AccountFieldsFragment) =>
|
||||
`${data.type}-${data.asset.symbol}-${data.market?.id ?? 'null'}`;
|
||||
|
||||
const update = (
|
||||
data: Accounts_party_accounts[],
|
||||
delta: AccountSubscribe_accounts
|
||||
data: AccountFieldsFragment[],
|
||||
delta: AccountFieldsFragment
|
||||
) => {
|
||||
return produce(data, (draft) => {
|
||||
const id = getId(delta);
|
||||
@@ -71,20 +28,24 @@ const update = (
|
||||
});
|
||||
};
|
||||
|
||||
const getData = (responseData: Accounts): Accounts_party_accounts[] | null =>
|
||||
responseData.party ? responseData.party.accounts : null;
|
||||
const getData = (
|
||||
responseData: AccountsQuery
|
||||
): AccountFieldsFragment[] | null => {
|
||||
return responseData.party?.accounts ?? null;
|
||||
};
|
||||
|
||||
const getDelta = (
|
||||
subscriptionData: AccountSubscribe
|
||||
): AccountSubscribe_accounts => subscriptionData.accounts;
|
||||
subscriptionData: AccountEventsSubscription
|
||||
): AccountFieldsFragment => subscriptionData.accounts;
|
||||
|
||||
export const accountsDataProvider = makeDataProvider<
|
||||
Accounts,
|
||||
Accounts_party_accounts[],
|
||||
AccountSubscribe,
|
||||
AccountSubscribe_accounts
|
||||
AccountsQuery,
|
||||
AccountFieldsFragment[],
|
||||
AccountEventsSubscription,
|
||||
AccountFieldsFragment
|
||||
>({
|
||||
query: ACCOUNTS_QUERY,
|
||||
subscriptionQuery: ACCOUNTS_SUB,
|
||||
query: AccountsDocument,
|
||||
subscriptionQuery: AccountEventsDocument,
|
||||
update,
|
||||
getData,
|
||||
getDelta,
|
||||
|
||||
@@ -3,8 +3,7 @@ import { produce } from 'immer';
|
||||
import merge from 'lodash/merge';
|
||||
import { AsyncRenderer } from '@vegaprotocol/ui-toolkit';
|
||||
import { useDataProvider, addSummaryRows } from '@vegaprotocol/react-helpers';
|
||||
import type { AccountSubscribe_accounts } from './__generated__/AccountSubscribe';
|
||||
import type { Accounts_party_accounts } from './__generated__/Accounts';
|
||||
import type { AccountFieldsFragment } from './__generated__/Accounts';
|
||||
|
||||
import type { AgGridReact } from 'ag-grid-react';
|
||||
import {
|
||||
@@ -22,17 +21,17 @@ export const AccountsManager = ({ partyId }: AccountsManagerProps) => {
|
||||
const gridRef = useRef<AgGridReact | null>(null);
|
||||
const variables = useMemo(() => ({ partyId }), [partyId]);
|
||||
const update = useCallback(
|
||||
({ delta }: { delta: AccountSubscribe_accounts }) => {
|
||||
const update: Accounts_party_accounts[] = [];
|
||||
const add: Accounts_party_accounts[] = [];
|
||||
({ delta }: { delta: AccountFieldsFragment }) => {
|
||||
const update: AccountFieldsFragment[] = [];
|
||||
const add: AccountFieldsFragment[] = [];
|
||||
if (!gridRef.current?.api) {
|
||||
return false;
|
||||
}
|
||||
const rowNode = gridRef.current.api.getRowNode(getId(delta));
|
||||
if (rowNode) {
|
||||
const updatedData = produce<Accounts_party_accounts>(
|
||||
const updatedData = produce<AccountFieldsFragment>(
|
||||
rowNode.data,
|
||||
(draft: Accounts_party_accounts) => {
|
||||
(draft: AccountFieldsFragment) => {
|
||||
merge(draft, delta);
|
||||
}
|
||||
);
|
||||
@@ -62,8 +61,8 @@ export const AccountsManager = ({ partyId }: AccountsManagerProps) => {
|
||||
[gridRef]
|
||||
);
|
||||
const { data, error, loading } = useDataProvider<
|
||||
Accounts_party_accounts[],
|
||||
AccountSubscribe_accounts
|
||||
AccountFieldsFragment[],
|
||||
AccountFieldsFragment
|
||||
>({ dataProvider: accountsDataProvider, update, variables });
|
||||
return (
|
||||
<AsyncRenderer loading={loading} error={error} data={data}>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import AccountsTable from './accounts-table';
|
||||
import { act, render, screen, waitFor } from '@testing-library/react';
|
||||
import type { Accounts_party_accounts } from './__generated__/Accounts';
|
||||
import type { AccountFieldsFragment } from './__generated__/Accounts';
|
||||
import { AccountType } from '@vegaprotocol/types';
|
||||
|
||||
const singleRow: Accounts_party_accounts = {
|
||||
const singleRow: AccountFieldsFragment = {
|
||||
__typename: 'Account',
|
||||
type: AccountType.ACCOUNT_TYPE_MARGIN,
|
||||
balance: '125600000',
|
||||
|
||||
@@ -14,22 +14,22 @@ import type { SummaryRow } from '@vegaprotocol/react-helpers';
|
||||
import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit';
|
||||
import { AgGridColumn } from 'ag-grid-react';
|
||||
import type { AgGridReact } from 'ag-grid-react';
|
||||
import type { Accounts_party_accounts } from './__generated__/Accounts';
|
||||
import type { AccountFieldsFragment } from './__generated__/Accounts';
|
||||
import { getId } from './accounts-data-provider';
|
||||
import { useAssetDetailsDialogStore } from '@vegaprotocol/assets';
|
||||
import type { AccountType } from '@vegaprotocol/types';
|
||||
import { AccountTypeMapping } from '@vegaprotocol/types';
|
||||
|
||||
interface AccountsTableProps {
|
||||
data: Accounts_party_accounts[] | null;
|
||||
data: AccountFieldsFragment[] | null;
|
||||
}
|
||||
|
||||
interface AccountsTableValueFormatterParams extends ValueFormatterParams {
|
||||
data: Accounts_party_accounts;
|
||||
data: AccountFieldsFragment;
|
||||
}
|
||||
|
||||
export const getGroupId = (
|
||||
data: Accounts_party_accounts & SummaryRow,
|
||||
data: AccountFieldsFragment & SummaryRow,
|
||||
columnApi: ColumnApi
|
||||
) => {
|
||||
if (data.__summaryRow) {
|
||||
@@ -44,9 +44,9 @@ export const getGroupId = (
|
||||
};
|
||||
|
||||
export const getGroupSummaryRow = (
|
||||
data: Accounts_party_accounts[],
|
||||
data: AccountFieldsFragment[],
|
||||
columnApi: ColumnApi
|
||||
): Partial<Accounts_party_accounts & SummaryRow> | null => {
|
||||
): Partial<AccountFieldsFragment & SummaryRow> | null => {
|
||||
if (!data.length) {
|
||||
return null;
|
||||
}
|
||||
@@ -67,8 +67,8 @@ export const getGroupSummaryRow = (
|
||||
const comparator = (
|
||||
valueA: string,
|
||||
valueB: string,
|
||||
nodeA: { data: Accounts_party_accounts & SummaryRow },
|
||||
nodeB: { data: Accounts_party_accounts & SummaryRow },
|
||||
nodeA: { data: AccountFieldsFragment & SummaryRow },
|
||||
nodeB: { data: AccountFieldsFragment & SummaryRow },
|
||||
isInverted: boolean
|
||||
) => {
|
||||
if (valueA < valueB) {
|
||||
|
||||
@@ -3,8 +3,7 @@ import {
|
||||
addDecimalsFormatNumber,
|
||||
useDataProvider,
|
||||
} from '@vegaprotocol/react-helpers';
|
||||
import type { AccountSubscribe_accounts } from './__generated__/AccountSubscribe';
|
||||
import type { Accounts_party_accounts } from './__generated__/Accounts';
|
||||
import type { AccountFieldsFragment } from './__generated__/Accounts';
|
||||
|
||||
import { accountsDataProvider } from './accounts-data-provider';
|
||||
|
||||
@@ -16,8 +15,8 @@ interface AssetBalanceProps {
|
||||
export const AssetBalance = ({ partyId, assetSymbol }: AssetBalanceProps) => {
|
||||
const variables = useMemo(() => ({ partyId }), [partyId]);
|
||||
const { data } = useDataProvider<
|
||||
Accounts_party_accounts[],
|
||||
AccountSubscribe_accounts
|
||||
AccountFieldsFragment[],
|
||||
AccountFieldsFragment
|
||||
>({
|
||||
dataProvider: accountsDataProvider,
|
||||
variables,
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
export * from './__generated__/Accounts';
|
||||
export * from './__generated__/AccountFields';
|
||||
export * from './__generated__/AccountSubscribe';
|
||||
export * from './accounts-container';
|
||||
export * from './accounts-data-provider';
|
||||
export * from './accounts-manager';
|
||||
|
||||
Generated
+1
-1
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
@@ -1,80 +0,0 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @generated
|
||||
// This file was automatically generated and should not be edited.
|
||||
|
||||
// ====================================================
|
||||
// GraphQL query operation: AssetsConnection
|
||||
// ====================================================
|
||||
|
||||
export interface AssetsConnection_assetsConnection_edges_node_source_BuiltinAsset {
|
||||
__typename: "BuiltinAsset";
|
||||
}
|
||||
|
||||
export interface AssetsConnection_assetsConnection_edges_node_source_ERC20 {
|
||||
__typename: "ERC20";
|
||||
/**
|
||||
* The address of the ERC20 contract
|
||||
*/
|
||||
contractAddress: string;
|
||||
/**
|
||||
* The lifetime limits deposit per address
|
||||
* Note: this is a temporary measure for alpha mainnet
|
||||
*/
|
||||
lifetimeLimit: string;
|
||||
/**
|
||||
* The maximum allowed per withdrawal
|
||||
* Note: this is a temporary measure for alpha mainnet
|
||||
*/
|
||||
withdrawThreshold: string;
|
||||
}
|
||||
|
||||
export type AssetsConnection_assetsConnection_edges_node_source = AssetsConnection_assetsConnection_edges_node_source_BuiltinAsset | AssetsConnection_assetsConnection_edges_node_source_ERC20;
|
||||
|
||||
export interface AssetsConnection_assetsConnection_edges_node {
|
||||
__typename: "Asset";
|
||||
/**
|
||||
* The ID of the asset
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The full name of the asset (e.g: Great British Pound)
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The symbol of the asset (e.g: GBP)
|
||||
*/
|
||||
symbol: string;
|
||||
/**
|
||||
* The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18
|
||||
*/
|
||||
decimals: number;
|
||||
/**
|
||||
* The minimum economically meaningful amount in the asset
|
||||
*/
|
||||
quantum: string;
|
||||
/**
|
||||
* The origin source of the asset (e.g: an ERC20 asset)
|
||||
*/
|
||||
source: AssetsConnection_assetsConnection_edges_node_source;
|
||||
}
|
||||
|
||||
export interface AssetsConnection_assetsConnection_edges {
|
||||
__typename: "AssetEdge";
|
||||
node: AssetsConnection_assetsConnection_edges_node;
|
||||
}
|
||||
|
||||
export interface AssetsConnection_assetsConnection {
|
||||
__typename: "AssetsConnection";
|
||||
/**
|
||||
* The assets
|
||||
*/
|
||||
edges: (AssetsConnection_assetsConnection_edges | null)[] | null;
|
||||
}
|
||||
|
||||
export interface AssetsConnection {
|
||||
/**
|
||||
* The list of all assets in use in the Vega network or the specified asset if ID is provided
|
||||
*/
|
||||
assetsConnection: AssetsConnection_assetsConnection;
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
import { MockedProvider } from '@apollo/react-testing';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import {
|
||||
AssetDetailsDialog,
|
||||
ASSETS_CONNECTION_QUERY,
|
||||
} from './asset-details-dialog';
|
||||
import { AssetDetailsDialog } from './asset-details-dialog';
|
||||
import { AssetsConnectionDocument } from './__generated__/Assets';
|
||||
|
||||
const mockedData = {
|
||||
data: {
|
||||
@@ -275,7 +273,7 @@ const mockedData = {
|
||||
const mocks = [
|
||||
{
|
||||
request: {
|
||||
query: ASSETS_CONNECTION_QUERY,
|
||||
query: AssetsConnectionDocument,
|
||||
variables: {},
|
||||
},
|
||||
result: mockedData,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { gql, useQuery } from '@apollo/client';
|
||||
import { t } from '@vegaprotocol/react-helpers';
|
||||
import type { Asset } from '@vegaprotocol/react-helpers';
|
||||
import {
|
||||
@@ -10,10 +9,8 @@ import {
|
||||
Splash,
|
||||
Tooltip,
|
||||
} from '@vegaprotocol/ui-toolkit';
|
||||
import type {
|
||||
AssetsConnection,
|
||||
AssetsConnection_assetsConnection_edges_node_source_ERC20,
|
||||
} from './__generated__/AssetsConnection';
|
||||
import { useAssetsConnectionQuery } from './__generated__/Assets';
|
||||
import type { Schema } from '@vegaprotocol/types';
|
||||
import create from 'zustand';
|
||||
|
||||
export type AssetDetailsDialogStore = {
|
||||
@@ -43,29 +40,6 @@ type AssetDetails = {
|
||||
tooltip: string;
|
||||
}[];
|
||||
|
||||
export const ASSETS_CONNECTION_QUERY = gql`
|
||||
query AssetsConnection {
|
||||
assetsConnection {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
name
|
||||
symbol
|
||||
decimals
|
||||
quantum
|
||||
source {
|
||||
... on ERC20 {
|
||||
contractAddress
|
||||
lifetimeLimit
|
||||
withdrawThreshold
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export interface AssetDetailsDialogProps {
|
||||
assetSymbol: string | Asset;
|
||||
open: boolean;
|
||||
@@ -77,7 +51,7 @@ export const AssetDetailsDialog = ({
|
||||
open,
|
||||
onChange,
|
||||
}: AssetDetailsDialogProps) => {
|
||||
const { data } = useQuery<AssetsConnection>(ASSETS_CONNECTION_QUERY);
|
||||
const { data } = useAssetsConnectionQuery();
|
||||
const symbol =
|
||||
typeof assetSymbol === 'string' ? assetSymbol : assetSymbol.symbol;
|
||||
const asset = data?.assetsConnection.edges?.find(
|
||||
@@ -114,10 +88,7 @@ export const AssetDetailsDialog = ({
|
||||
{
|
||||
key: 'contractaddress',
|
||||
label: t('Contract address'),
|
||||
value: (
|
||||
asset.node
|
||||
.source as AssetsConnection_assetsConnection_edges_node_source_ERC20
|
||||
).contractAddress,
|
||||
value: (asset.node.source as Schema.ERC20).contractAddress,
|
||||
tooltip: t(
|
||||
'The address of the contract for the token, on the ethereum network'
|
||||
),
|
||||
@@ -125,10 +96,7 @@ export const AssetDetailsDialog = ({
|
||||
{
|
||||
key: 'withdrawalthreshold',
|
||||
label: t('Withdrawal threshold'),
|
||||
value: (
|
||||
asset.node
|
||||
.source as AssetsConnection_assetsConnection_edges_node_source_ERC20
|
||||
).withdrawThreshold,
|
||||
value: (asset.node.source as Schema.ERC20).withdrawThreshold,
|
||||
tooltip: t(
|
||||
'The maximum allowed per withdraw note: this is a temporary measure for restricted mainnet'
|
||||
),
|
||||
@@ -136,10 +104,7 @@ export const AssetDetailsDialog = ({
|
||||
{
|
||||
key: 'lifetimelimit',
|
||||
label: t('Lifetime limit'),
|
||||
value: (
|
||||
asset.node
|
||||
.source as AssetsConnection_assetsConnection_edges_node_source_ERC20
|
||||
).lifetimeLimit,
|
||||
value: (asset.node.source as Schema.ERC20).lifetimeLimit,
|
||||
tooltip: t(
|
||||
'The lifetime limits deposit per address note: this is a temporary measure for restricted mainnet'
|
||||
),
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from './__generated__/AssetsConnection';
|
||||
export * from './__generated__/Assets';
|
||||
export * from './asset-details-dialog';
|
||||
|
||||
@@ -24,7 +24,7 @@ query Candles($marketId: ID!, $interval: Interval!, $since: String!) {
|
||||
}
|
||||
}
|
||||
|
||||
subscription CandlesSub($marketId: ID!, $interval: Interval!) {
|
||||
subscription CandlesEvents($marketId: ID!, $interval: Interval!) {
|
||||
candles(marketId: $marketId, interval: $interval) {
|
||||
...CandleFields
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @generated
|
||||
// This file was automatically generated and should not be edited.
|
||||
|
||||
// ====================================================
|
||||
// GraphQL fragment: CandleFields
|
||||
// ====================================================
|
||||
|
||||
export interface CandleFields {
|
||||
__typename: "Candle";
|
||||
/**
|
||||
* RFC3339Nano formatted date and time for the candle
|
||||
*/
|
||||
datetime: string;
|
||||
/**
|
||||
* High price (uint64)
|
||||
*/
|
||||
high: string;
|
||||
/**
|
||||
* Low price (uint64)
|
||||
*/
|
||||
low: string;
|
||||
/**
|
||||
* Open price (uint64)
|
||||
*/
|
||||
open: string;
|
||||
/**
|
||||
* Close price (uint64)
|
||||
*/
|
||||
close: string;
|
||||
/**
|
||||
* Volume price (uint64)
|
||||
*/
|
||||
volume: string;
|
||||
}
|
||||
+105
-100
@@ -1,108 +1,113 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @generated
|
||||
// This file was automatically generated and should not be edited.
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { Interval } from "@vegaprotocol/types";
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
const defaultOptions = {} as const;
|
||||
export type CandleFieldsFragment = { __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string };
|
||||
|
||||
// ====================================================
|
||||
// GraphQL query operation: Candles
|
||||
// ====================================================
|
||||
export type CandlesQueryVariables = Types.Exact<{
|
||||
marketId: Types.Scalars['ID'];
|
||||
interval: Types.Interval;
|
||||
since: Types.Scalars['String'];
|
||||
}>;
|
||||
|
||||
export interface Candles_market_tradableInstrument_instrument {
|
||||
__typename: "Instrument";
|
||||
/**
|
||||
* Uniquely identify an instrument across all instruments available on Vega (string)
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Full and fairly descriptive name for the instrument
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
|
||||
*/
|
||||
code: string;
|
||||
|
||||
export type CandlesQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string } }, candles?: Array<{ __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string } | null> | null } | null };
|
||||
|
||||
export type CandlesEventsSubscriptionVariables = Types.Exact<{
|
||||
marketId: Types.Scalars['ID'];
|
||||
interval: Types.Interval;
|
||||
}>;
|
||||
|
||||
|
||||
export type CandlesEventsSubscription = { __typename?: 'Subscription', candles: { __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string } };
|
||||
|
||||
export const CandleFieldsFragmentDoc = gql`
|
||||
fragment CandleFields on Candle {
|
||||
datetime
|
||||
high
|
||||
low
|
||||
open
|
||||
close
|
||||
volume
|
||||
}
|
||||
|
||||
export interface Candles_market_tradableInstrument {
|
||||
__typename: "TradableInstrument";
|
||||
/**
|
||||
* An instance of, or reference to, a fully specified instrument.
|
||||
*/
|
||||
instrument: Candles_market_tradableInstrument_instrument;
|
||||
`;
|
||||
export const CandlesDocument = gql`
|
||||
query Candles($marketId: ID!, $interval: Interval!, $since: String!) {
|
||||
market(id: $marketId) {
|
||||
id
|
||||
decimalPlaces
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
id
|
||||
name
|
||||
code
|
||||
}
|
||||
}
|
||||
candles(interval: $interval, since: $since) {
|
||||
...CandleFields
|
||||
}
|
||||
}
|
||||
}
|
||||
${CandleFieldsFragmentDoc}`;
|
||||
|
||||
export interface Candles_market_candles {
|
||||
__typename: "Candle";
|
||||
/**
|
||||
* RFC3339Nano formatted date and time for the candle
|
||||
*/
|
||||
datetime: string;
|
||||
/**
|
||||
* High price (uint64)
|
||||
*/
|
||||
high: string;
|
||||
/**
|
||||
* Low price (uint64)
|
||||
*/
|
||||
low: string;
|
||||
/**
|
||||
* Open price (uint64)
|
||||
*/
|
||||
open: string;
|
||||
/**
|
||||
* Close price (uint64)
|
||||
*/
|
||||
close: string;
|
||||
/**
|
||||
* Volume price (uint64)
|
||||
*/
|
||||
volume: string;
|
||||
/**
|
||||
* __useCandlesQuery__
|
||||
*
|
||||
* To run a query within a React component, call `useCandlesQuery` and pass it any options that fit your needs.
|
||||
* When your component renders, `useCandlesQuery` 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 } = useCandlesQuery({
|
||||
* variables: {
|
||||
* marketId: // value for 'marketId'
|
||||
* interval: // value for 'interval'
|
||||
* since: // value for 'since'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useCandlesQuery(baseOptions: Apollo.QueryHookOptions<CandlesQuery, CandlesQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useQuery<CandlesQuery, CandlesQueryVariables>(CandlesDocument, options);
|
||||
}
|
||||
export function useCandlesLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<CandlesQuery, CandlesQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useLazyQuery<CandlesQuery, CandlesQueryVariables>(CandlesDocument, options);
|
||||
}
|
||||
export type CandlesQueryHookResult = ReturnType<typeof useCandlesQuery>;
|
||||
export type CandlesLazyQueryHookResult = ReturnType<typeof useCandlesLazyQuery>;
|
||||
export type CandlesQueryResult = Apollo.QueryResult<CandlesQuery, CandlesQueryVariables>;
|
||||
export const CandlesEventsDocument = gql`
|
||||
subscription CandlesEvents($marketId: ID!, $interval: Interval!) {
|
||||
candles(marketId: $marketId, interval: $interval) {
|
||||
...CandleFields
|
||||
}
|
||||
}
|
||||
${CandleFieldsFragmentDoc}`;
|
||||
|
||||
export interface Candles_market {
|
||||
__typename: "Market";
|
||||
/**
|
||||
* Market ID
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
|
||||
* number denominated in the currency of the market. (uint64)
|
||||
*
|
||||
* Examples:
|
||||
* Currency Balance decimalPlaces Real Balance
|
||||
* GBP 100 0 GBP 100
|
||||
* GBP 100 2 GBP 1.00
|
||||
* GBP 100 4 GBP 0.01
|
||||
* GBP 1 4 GBP 0.0001 ( 0.01p )
|
||||
*
|
||||
* GBX (pence) 100 0 GBP 1.00 (100p )
|
||||
* GBX (pence) 100 2 GBP 0.01 ( 1p )
|
||||
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )
|
||||
* GBX (pence) 1 4 GBP 0.000001 ( 0.0001p)
|
||||
*/
|
||||
decimalPlaces: number;
|
||||
/**
|
||||
* An instance of, or reference to, a tradable instrument.
|
||||
*/
|
||||
tradableInstrument: Candles_market_tradableInstrument;
|
||||
/**
|
||||
* Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters
|
||||
*/
|
||||
candles: (Candles_market_candles | null)[] | null;
|
||||
}
|
||||
|
||||
export interface Candles {
|
||||
/**
|
||||
* An instrument that is trading on the Vega network
|
||||
*/
|
||||
market: Candles_market | null;
|
||||
}
|
||||
|
||||
export interface CandlesVariables {
|
||||
marketId: string;
|
||||
interval: Interval;
|
||||
since: string;
|
||||
}
|
||||
/**
|
||||
* __useCandlesEventsSubscription__
|
||||
*
|
||||
* To run a query within a React component, call `useCandlesEventsSubscription` and pass it any options that fit your needs.
|
||||
* When your component renders, `useCandlesEventsSubscription` 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 subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
||||
*
|
||||
* @example
|
||||
* const { data, loading, error } = useCandlesEventsSubscription({
|
||||
* variables: {
|
||||
* marketId: // value for 'marketId'
|
||||
* interval: // value for 'interval'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useCandlesEventsSubscription(baseOptions: Apollo.SubscriptionHookOptions<CandlesEventsSubscription, CandlesEventsSubscriptionVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useSubscription<CandlesEventsSubscription, CandlesEventsSubscriptionVariables>(CandlesEventsDocument, options);
|
||||
}
|
||||
export type CandlesEventsSubscriptionHookResult = ReturnType<typeof useCandlesEventsSubscription>;
|
||||
export type CandlesEventsSubscriptionResult = Apollo.SubscriptionResult<CandlesEventsSubscription>;
|
||||
@@ -1,50 +0,0 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @generated
|
||||
// This file was automatically generated and should not be edited.
|
||||
|
||||
import { Interval } from "@vegaprotocol/types";
|
||||
|
||||
// ====================================================
|
||||
// GraphQL subscription operation: CandlesSub
|
||||
// ====================================================
|
||||
|
||||
export interface CandlesSub_candles {
|
||||
__typename: "Candle";
|
||||
/**
|
||||
* RFC3339Nano formatted date and time for the candle
|
||||
*/
|
||||
datetime: string;
|
||||
/**
|
||||
* High price (uint64)
|
||||
*/
|
||||
high: string;
|
||||
/**
|
||||
* Low price (uint64)
|
||||
*/
|
||||
low: string;
|
||||
/**
|
||||
* Open price (uint64)
|
||||
*/
|
||||
open: string;
|
||||
/**
|
||||
* Close price (uint64)
|
||||
*/
|
||||
close: string;
|
||||
/**
|
||||
* Volume price (uint64)
|
||||
*/
|
||||
volume: string;
|
||||
}
|
||||
|
||||
export interface CandlesSub {
|
||||
/**
|
||||
* Subscribe to the candles updates
|
||||
*/
|
||||
candles: CandlesSub_candles;
|
||||
}
|
||||
|
||||
export interface CandlesSubVariables {
|
||||
marketId: string;
|
||||
interval: Interval;
|
||||
}
|
||||
+51
-64
@@ -1,68 +1,55 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @generated
|
||||
// This file was automatically generated and should not be edited.
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
// ====================================================
|
||||
// GraphQL query operation: Chart
|
||||
// ====================================================
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
const defaultOptions = {} as const;
|
||||
export type ChartQueryVariables = Types.Exact<{
|
||||
marketId: Types.Scalars['ID'];
|
||||
}>;
|
||||
|
||||
export interface Chart_market_data_priceMonitoringBounds {
|
||||
__typename: "PriceMonitoringBounds";
|
||||
/**
|
||||
* Minimum price that isn't currently breaching the specified price monitoring trigger
|
||||
*/
|
||||
minValidPrice: string;
|
||||
/**
|
||||
* Maximum price that isn't currently breaching the specified price monitoring trigger
|
||||
*/
|
||||
maxValidPrice: string;
|
||||
/**
|
||||
* Reference price used to calculate the valid price range
|
||||
*/
|
||||
referencePrice: string;
|
||||
|
||||
export type ChartQuery = { __typename?: 'Query', market?: { __typename?: 'Market', decimalPlaces: number, data?: { __typename?: 'MarketData', priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string }> | null } | null } | null };
|
||||
|
||||
|
||||
export const ChartDocument = gql`
|
||||
query Chart($marketId: ID!) {
|
||||
market(id: $marketId) {
|
||||
decimalPlaces
|
||||
data {
|
||||
priceMonitoringBounds {
|
||||
minValidPrice
|
||||
maxValidPrice
|
||||
referencePrice
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export interface Chart_market_data {
|
||||
__typename: "MarketData";
|
||||
/**
|
||||
* a list of valid price ranges per associated trigger
|
||||
*/
|
||||
priceMonitoringBounds: Chart_market_data_priceMonitoringBounds[] | null;
|
||||
}
|
||||
|
||||
export interface Chart_market {
|
||||
__typename: "Market";
|
||||
/**
|
||||
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
|
||||
* number denominated in the currency of the market. (uint64)
|
||||
*
|
||||
* Examples:
|
||||
* Currency Balance decimalPlaces Real Balance
|
||||
* GBP 100 0 GBP 100
|
||||
* GBP 100 2 GBP 1.00
|
||||
* GBP 100 4 GBP 0.01
|
||||
* GBP 1 4 GBP 0.0001 ( 0.01p )
|
||||
*
|
||||
* GBX (pence) 100 0 GBP 1.00 (100p )
|
||||
* GBX (pence) 100 2 GBP 0.01 ( 1p )
|
||||
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )
|
||||
* GBX (pence) 1 4 GBP 0.000001 ( 0.0001p)
|
||||
*/
|
||||
decimalPlaces: number;
|
||||
/**
|
||||
* marketData for the given market
|
||||
*/
|
||||
data: Chart_market_data | null;
|
||||
}
|
||||
|
||||
export interface Chart {
|
||||
/**
|
||||
* An instrument that is trading on the Vega network
|
||||
*/
|
||||
market: Chart_market | null;
|
||||
}
|
||||
|
||||
export interface ChartVariables {
|
||||
marketId: string;
|
||||
}
|
||||
/**
|
||||
* __useChartQuery__
|
||||
*
|
||||
* To run a query within a React component, call `useChartQuery` and pass it any options that fit your needs.
|
||||
* When your component renders, `useChartQuery` 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 } = useChartQuery({
|
||||
* variables: {
|
||||
* marketId: // value for 'marketId'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useChartQuery(baseOptions: Apollo.QueryHookOptions<ChartQuery, ChartQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useQuery<ChartQuery, ChartQueryVariables>(ChartDocument, options);
|
||||
}
|
||||
export function useChartLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ChartQuery, ChartQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useLazyQuery<ChartQuery, ChartQueryVariables>(ChartDocument, options);
|
||||
}
|
||||
export type ChartQueryHookResult = ReturnType<typeof useChartQuery>;
|
||||
export type ChartLazyQueryHookResult = ReturnType<typeof useChartLazyQuery>;
|
||||
export type ChartQueryResult = Apollo.QueryResult<ChartQuery, ChartQueryVariables>;
|
||||
@@ -1,113 +0,0 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
const defaultOptions = {} as const;
|
||||
export type CandleFieldsFragment = { __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string };
|
||||
|
||||
export type CandlesQueryVariables = Types.Exact<{
|
||||
marketId: Types.Scalars['ID'];
|
||||
interval: Types.Interval;
|
||||
since: Types.Scalars['String'];
|
||||
}>;
|
||||
|
||||
|
||||
export type CandlesQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string } }, candles?: Array<{ __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string } | null> | null } | null };
|
||||
|
||||
export type CandlesSubSubscriptionVariables = Types.Exact<{
|
||||
marketId: Types.Scalars['ID'];
|
||||
interval: Types.Interval;
|
||||
}>;
|
||||
|
||||
|
||||
export type CandlesSubSubscription = { __typename?: 'Subscription', candles: { __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string } };
|
||||
|
||||
export const CandleFieldsFragmentDoc = gql`
|
||||
fragment CandleFields on Candle {
|
||||
datetime
|
||||
high
|
||||
low
|
||||
open
|
||||
close
|
||||
volume
|
||||
}
|
||||
`;
|
||||
export const CandlesDocument = gql`
|
||||
query Candles($marketId: ID!, $interval: Interval!, $since: String!) {
|
||||
market(id: $marketId) {
|
||||
id
|
||||
decimalPlaces
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
id
|
||||
name
|
||||
code
|
||||
}
|
||||
}
|
||||
candles(interval: $interval, since: $since) {
|
||||
...CandleFields
|
||||
}
|
||||
}
|
||||
}
|
||||
${CandleFieldsFragmentDoc}`;
|
||||
|
||||
/**
|
||||
* __useCandlesQuery__
|
||||
*
|
||||
* To run a query within a React component, call `useCandlesQuery` and pass it any options that fit your needs.
|
||||
* When your component renders, `useCandlesQuery` 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 } = useCandlesQuery({
|
||||
* variables: {
|
||||
* marketId: // value for 'marketId'
|
||||
* interval: // value for 'interval'
|
||||
* since: // value for 'since'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useCandlesQuery(baseOptions: Apollo.QueryHookOptions<CandlesQuery, CandlesQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useQuery<CandlesQuery, CandlesQueryVariables>(CandlesDocument, options);
|
||||
}
|
||||
export function useCandlesLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<CandlesQuery, CandlesQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useLazyQuery<CandlesQuery, CandlesQueryVariables>(CandlesDocument, options);
|
||||
}
|
||||
export type CandlesQueryHookResult = ReturnType<typeof useCandlesQuery>;
|
||||
export type CandlesLazyQueryHookResult = ReturnType<typeof useCandlesLazyQuery>;
|
||||
export type CandlesQueryResult = Apollo.QueryResult<CandlesQuery, CandlesQueryVariables>;
|
||||
export const CandlesSubDocument = gql`
|
||||
subscription CandlesSub($marketId: ID!, $interval: Interval!) {
|
||||
candles(marketId: $marketId, interval: $interval) {
|
||||
...CandleFields
|
||||
}
|
||||
}
|
||||
${CandleFieldsFragmentDoc}`;
|
||||
|
||||
/**
|
||||
* __useCandlesSubSubscription__
|
||||
*
|
||||
* To run a query within a React component, call `useCandlesSubSubscription` and pass it any options that fit your needs.
|
||||
* When your component renders, `useCandlesSubSubscription` 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 subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
||||
*
|
||||
* @example
|
||||
* const { data, loading, error } = useCandlesSubSubscription({
|
||||
* variables: {
|
||||
* marketId: // value for 'marketId'
|
||||
* interval: // value for 'interval'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useCandlesSubSubscription(baseOptions: Apollo.SubscriptionHookOptions<CandlesSubSubscription, CandlesSubSubscriptionVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useSubscription<CandlesSubSubscription, CandlesSubSubscriptionVariables>(CandlesSubDocument, options);
|
||||
}
|
||||
export type CandlesSubSubscriptionHookResult = ReturnType<typeof useCandlesSubSubscription>;
|
||||
export type CandlesSubSubscriptionResult = Apollo.SubscriptionResult<CandlesSubSubscription>;
|
||||
@@ -1,55 +0,0 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
const defaultOptions = {} as const;
|
||||
export type ChartQueryVariables = Types.Exact<{
|
||||
marketId: Types.Scalars['ID'];
|
||||
}>;
|
||||
|
||||
|
||||
export type ChartQuery = { __typename?: 'Query', market?: { __typename?: 'Market', decimalPlaces: number, data?: { __typename?: 'MarketData', priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string }> | null } | null } | null };
|
||||
|
||||
|
||||
export const ChartDocument = gql`
|
||||
query Chart($marketId: ID!) {
|
||||
market(id: $marketId) {
|
||||
decimalPlaces
|
||||
data {
|
||||
priceMonitoringBounds {
|
||||
minValidPrice
|
||||
maxValidPrice
|
||||
referencePrice
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useChartQuery__
|
||||
*
|
||||
* To run a query within a React component, call `useChartQuery` and pass it any options that fit your needs.
|
||||
* When your component renders, `useChartQuery` 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 } = useChartQuery({
|
||||
* variables: {
|
||||
* marketId: // value for 'marketId'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useChartQuery(baseOptions: Apollo.QueryHookOptions<ChartQuery, ChartQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useQuery<ChartQuery, ChartQueryVariables>(ChartDocument, options);
|
||||
}
|
||||
export function useChartLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ChartQuery, ChartQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useLazyQuery<ChartQuery, ChartQueryVariables>(ChartDocument, options);
|
||||
}
|
||||
export type ChartQueryHookResult = ReturnType<typeof useChartQuery>;
|
||||
export type ChartLazyQueryHookResult = ReturnType<typeof useChartLazyQuery>;
|
||||
export type ChartQueryResult = Apollo.QueryResult<ChartQuery, ChartQueryVariables>;
|
||||
@@ -1,16 +1,21 @@
|
||||
import type { ApolloClient } from '@apollo/client';
|
||||
import { gql } from '@apollo/client';
|
||||
import type { Candle, DataSource } from 'pennant';
|
||||
import { Interval as PennantInterval } from 'pennant';
|
||||
|
||||
import { addDecimal } from '@vegaprotocol/react-helpers';
|
||||
import type { Chart, ChartVariables } from './__generated__/Chart';
|
||||
import type { Candles, CandlesVariables } from './__generated__/Candles';
|
||||
import type { CandleFields } from './__generated__/CandleFields';
|
||||
import { ChartDocument } from './__generated__/Chart';
|
||||
import type { ChartQuery, ChartQueryVariables } from './__generated__/Chart';
|
||||
import {
|
||||
CandlesDocument,
|
||||
CandlesEventsDocument,
|
||||
} from './__generated__/Candles';
|
||||
import type {
|
||||
CandlesSub,
|
||||
CandlesSubVariables,
|
||||
} from './__generated__/CandlesSub';
|
||||
CandlesQuery,
|
||||
CandlesQueryVariables,
|
||||
CandleFieldsFragment,
|
||||
CandlesEventsSubscription,
|
||||
CandlesEventsSubscriptionVariables,
|
||||
} from './__generated__/Candles';
|
||||
import type { Subscription } from 'zen-observable-ts';
|
||||
import { Interval } from '@vegaprotocol/types';
|
||||
|
||||
@@ -23,61 +28,6 @@ const INTERVAL_TO_PENNANT_MAP = {
|
||||
[PennantInterval.I1D]: Interval.INTERVAL_I1D,
|
||||
};
|
||||
|
||||
export const CANDLE_FRAGMENT = gql`
|
||||
fragment CandleFields on Candle {
|
||||
datetime
|
||||
high
|
||||
low
|
||||
open
|
||||
close
|
||||
volume
|
||||
}
|
||||
`;
|
||||
|
||||
export const CANDLES_QUERY = gql`
|
||||
${CANDLE_FRAGMENT}
|
||||
query Candles($marketId: ID!, $interval: Interval!, $since: String!) {
|
||||
market(id: $marketId) {
|
||||
id
|
||||
decimalPlaces
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
id
|
||||
name
|
||||
code
|
||||
}
|
||||
}
|
||||
candles(interval: $interval, since: $since) {
|
||||
...CandleFields
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const CANDLES_SUB = gql`
|
||||
${CANDLE_FRAGMENT}
|
||||
subscription CandlesSub($marketId: ID!, $interval: Interval!) {
|
||||
candles(marketId: $marketId, interval: $interval) {
|
||||
...CandleFields
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const CHART_QUERY = gql`
|
||||
query Chart($marketId: ID!) {
|
||||
market(id: $marketId) {
|
||||
decimalPlaces
|
||||
data {
|
||||
priceMonitoringBounds {
|
||||
minValidPrice
|
||||
maxValidPrice
|
||||
referencePrice
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const defaultConfig = {
|
||||
decimalPlaces: 5,
|
||||
supportedIntervals: [
|
||||
@@ -131,13 +81,15 @@ export class VegaDataSource implements DataSource {
|
||||
*/
|
||||
async onReady() {
|
||||
try {
|
||||
const { data } = await this.client.query<Chart, ChartVariables>({
|
||||
query: CHART_QUERY,
|
||||
variables: {
|
||||
marketId: this.marketId,
|
||||
},
|
||||
fetchPolicy: 'no-cache',
|
||||
});
|
||||
const { data } = await this.client.query<ChartQuery, ChartQueryVariables>(
|
||||
{
|
||||
query: ChartDocument,
|
||||
variables: {
|
||||
marketId: this.marketId,
|
||||
},
|
||||
fetchPolicy: 'no-cache',
|
||||
}
|
||||
);
|
||||
|
||||
if (data && data.market && data.market.data) {
|
||||
this._decimalPlaces = data.market.decimalPlaces;
|
||||
@@ -178,8 +130,11 @@ export class VegaDataSource implements DataSource {
|
||||
*/
|
||||
async query(interval: PennantInterval, from: string) {
|
||||
try {
|
||||
const { data } = await this.client.query<Candles, CandlesVariables>({
|
||||
query: CANDLES_QUERY,
|
||||
const { data } = await this.client.query<
|
||||
CandlesQuery,
|
||||
CandlesQueryVariables
|
||||
>({
|
||||
query: CandlesDocument,
|
||||
variables: {
|
||||
marketId: this.marketId,
|
||||
interval: INTERVAL_TO_PENNANT_MAP[interval],
|
||||
@@ -192,7 +147,7 @@ export class VegaDataSource implements DataSource {
|
||||
const decimalPlaces = data.market.decimalPlaces;
|
||||
|
||||
const candles = data.market.candles
|
||||
.filter((d): d is CandleFields => d !== null)
|
||||
.filter((d): d is CandleFieldsFragment => d !== null)
|
||||
.map((d) => parseCandle(d, decimalPlaces));
|
||||
|
||||
return candles;
|
||||
@@ -211,8 +166,11 @@ export class VegaDataSource implements DataSource {
|
||||
interval: PennantInterval,
|
||||
onSubscriptionData: (data: Candle) => void
|
||||
) {
|
||||
const res = this.client.subscribe<CandlesSub, CandlesSubVariables>({
|
||||
query: CANDLES_SUB,
|
||||
const res = this.client.subscribe<
|
||||
CandlesEventsSubscription,
|
||||
CandlesEventsSubscriptionVariables
|
||||
>({
|
||||
query: CandlesEventsDocument,
|
||||
variables: {
|
||||
marketId: this.marketId,
|
||||
interval: INTERVAL_TO_PENNANT_MAP[interval],
|
||||
@@ -236,7 +194,10 @@ export class VegaDataSource implements DataSource {
|
||||
}
|
||||
}
|
||||
|
||||
function parseCandle(candle: CandleFields, decimalPlaces: number): Candle {
|
||||
function parseCandle(
|
||||
candle: CandleFieldsFragment,
|
||||
decimalPlaces: number
|
||||
): Candle {
|
||||
return {
|
||||
date: new Date(candle.datetime),
|
||||
high: Number(addDecimal(candle.high, decimalPlaces)),
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
export * from './__generated__/CandleFields';
|
||||
export * from './__generated__/Candles';
|
||||
export * from './__generated__/CandlesSub';
|
||||
export * from './__generated__/Chart';
|
||||
export * from './candles-chart';
|
||||
export * from './data-source';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
+2
-2
@@ -462,14 +462,14 @@ export interface MarketInfoQuery_market {
|
||||
/**
|
||||
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
|
||||
* number denominated in the currency of the market. (uint64)
|
||||
*
|
||||
*
|
||||
* Examples:
|
||||
* Currency Balance decimalPlaces Real Balance
|
||||
* GBP 100 0 GBP 100
|
||||
* GBP 100 2 GBP 1.00
|
||||
* GBP 100 4 GBP 0.01
|
||||
* GBP 1 4 GBP 0.0001 ( 0.01p )
|
||||
*
|
||||
*
|
||||
* GBX (pence) 100 0 GBP 1.00 (100p )
|
||||
* GBX (pence) 100 2 GBP 0.01 ( 1p )
|
||||
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { AccountType, MarketTradingMode } from '@vegaprotocol/types';
|
||||
import type { Accounts } from '@vegaprotocol/accounts';
|
||||
import type { AccountsQuery } from '@vegaprotocol/accounts';
|
||||
import type { Positions } from './__generated__/Positions';
|
||||
import { getMetrics } from './positions-data-providers';
|
||||
|
||||
const accounts: Accounts = {
|
||||
const accounts: AccountsQuery = {
|
||||
party: {
|
||||
__typename: 'Party',
|
||||
id: '02eceaba4df2bef76ea10caf728d8a099a2aa846cced25737cccaa9812342f65',
|
||||
|
||||
@@ -2,7 +2,7 @@ import { gql } from '@apollo/client';
|
||||
import produce from 'immer';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import sortBy from 'lodash/sortBy';
|
||||
import type { Accounts_party_accounts } from '@vegaprotocol/accounts';
|
||||
import type { AccountFieldsFragment } from '@vegaprotocol/accounts';
|
||||
import { accountsDataProvider } from '@vegaprotocol/accounts';
|
||||
import { toBigNum } from '@vegaprotocol/react-helpers';
|
||||
import type { Positions, Positions_party } from './__generated__/Positions';
|
||||
@@ -117,7 +117,7 @@ export const POSITIONS_SUBSCRIPTION = gql`
|
||||
|
||||
export const getMetrics = (
|
||||
data: Positions_party | null,
|
||||
accounts: Accounts_party_accounts[] | null
|
||||
accounts: AccountFieldsFragment[] | null
|
||||
): Position[] => {
|
||||
if (!data || !data?.positionsConnection.edges) {
|
||||
return [];
|
||||
@@ -272,7 +272,7 @@ export const positionsMetricsDataProvider = makeDerivedDataProvider<Position[]>(
|
||||
return sortBy(
|
||||
getMetrics(
|
||||
positions as Positions_party | null,
|
||||
accounts as Accounts_party_accounts[] | null
|
||||
accounts as AccountFieldsFragment[] | null
|
||||
),
|
||||
'updatedAt'
|
||||
).reverse();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -11,6 +11,12 @@ module.exports = {
|
||||
'../../apps/token/client.graphql',
|
||||
'../../apps/trading/client.graphql',
|
||||
],
|
||||
excludes: ['**/generic-data-provider.ts', '**/__generated___/*'],
|
||||
excludes: [
|
||||
'**/generic-data-provider.ts',
|
||||
'**/__generated___/*',
|
||||
'../../libs/accounts/**',
|
||||
'../../libs/assets/**',
|
||||
'../../libs/candles-chart/**',
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -9,21 +9,21 @@ config:
|
||||
generates:
|
||||
libs/types/src/__generated__/types.ts:
|
||||
- typescript
|
||||
libs/**/__generated__:
|
||||
libs/**:
|
||||
preset: near-operation-file
|
||||
presetConfig:
|
||||
folder: __generated___
|
||||
extension: .ts
|
||||
baseTypesPath: ~@vegaprotocol/types/types
|
||||
baseTypesPath: ~@vegaprotocol/types
|
||||
plugins:
|
||||
- typescript-operations
|
||||
- typescript-react-apollo
|
||||
apps/**/__generated__:
|
||||
apps/**:
|
||||
preset: near-operation-file
|
||||
presetConfig:
|
||||
folder: __generated___
|
||||
extension: .ts
|
||||
baseTypesPath: ~@vegaprotocol/types/types
|
||||
baseTypesPath: ~@vegaprotocol/types
|
||||
plugins:
|
||||
- typescript-operations
|
||||
- typescript-react-apollo
|
||||
|
||||
@@ -1,6 +1,66 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const glob = require('glob');
|
||||
const replace = require('replace-in-file');
|
||||
replace({
|
||||
files: '{apps,libs}/**/__generated__/*.ts',
|
||||
from: /"[^"]*\/types\/src\/__generated__\/globalTypes"/g,
|
||||
to: '"@vegaprotocol/types"',
|
||||
const apolloConfig = require('./apollo.config');
|
||||
|
||||
Promise.all([
|
||||
replace({
|
||||
files: '{apps,libs}/**/__generated__/*.ts',
|
||||
from: /"[^"]*\/types\/src\/__generated__\/globalTypes"/g,
|
||||
to: '"@vegaprotocol/types"',
|
||||
}),
|
||||
replace({
|
||||
files: '{apps,libs}/**/__generated___/*.ts',
|
||||
from: 'import * as Types',
|
||||
to: 'import { Schema as Types }',
|
||||
}),
|
||||
replace({
|
||||
files: '{apps,libs}/**/__generated__/*.ts',
|
||||
from: 'import * as Types',
|
||||
to: 'import { Schema as Types }',
|
||||
}),
|
||||
]).then(() => {
|
||||
// @TODO: remove this temporary cleanup ugliness below once all libs and apps are migrated from the old apollo codegen
|
||||
const MIGRATED_TO_NEW_CODEGEN = apolloConfig.client.excludes.reduce(
|
||||
(acc, ignoredPath) => {
|
||||
if (
|
||||
ignoredPath.startsWith('../../libs/') ||
|
||||
ignoredPath.startsWith('../../apps/')
|
||||
) {
|
||||
acc.push(path.join(__dirname, ignoredPath.replace('/**', '')));
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
// @TODO: remove also
|
||||
MIGRATED_TO_NEW_CODEGEN.forEach((packagePath) => {
|
||||
glob(path.join(packagePath, '**', '__generated___'), (err, matches) => {
|
||||
matches.forEach((match) => {
|
||||
console.log(`Handling ${match}...`);
|
||||
const oldTypesFolder = match.replace('__generated___', '__generated__');
|
||||
if (fs.existsSync(oldTypesFolder)) {
|
||||
console.log(`Found ${oldTypesFolder}...`);
|
||||
try {
|
||||
fs.rmSync(oldTypesFolder, {
|
||||
force: true,
|
||||
recursive: true,
|
||||
});
|
||||
console.log(`Removed ${oldTypesFolder}...`);
|
||||
} catch (err) {
|
||||
console.error(`Error removing ${oldTypesFolder}.`);
|
||||
}
|
||||
|
||||
try {
|
||||
fs.renameSync(match, oldTypesFolder);
|
||||
console.log(`Renamed ${match} to ${oldTypesFolder}...`);
|
||||
} catch (err) {
|
||||
console.error(`Error renaming ${match} to ${oldTypesFolder}.`);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as Types from '@vegaprotocol/types/types';
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
|
||||
@@ -20,7 +20,7 @@ import type {
|
||||
} from './__generated__/WithdrawalEvent';
|
||||
import { WITHDRAWAL_BUS_EVENT_SUB } from './use-withdrawals';
|
||||
import { WithdrawalStatus } from '@vegaprotocol/types';
|
||||
import { AssetStatus } from '@vegaprotocol/types/types';
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
|
||||
function setup(
|
||||
vegaWalletContext: Partial<VegaWalletContextShape>,
|
||||
@@ -74,7 +74,7 @@ beforeEach(() => {
|
||||
name: 'asset-name',
|
||||
symbol: 'asset-symbol',
|
||||
decimals: 2,
|
||||
status: AssetStatus.STATUS_ENABLED,
|
||||
status: Schema.AssetStatus.STATUS_ENABLED,
|
||||
source: {
|
||||
__typename: 'ERC20',
|
||||
contractAddress: '0x123',
|
||||
|
||||
+1
-1
@@ -153,7 +153,7 @@
|
||||
"eslint-plugin-react-hooks": "4.6.0",
|
||||
"eslint-plugin-unicorn": "^41.0.0",
|
||||
"faker": "^5.5.3",
|
||||
"glob": "^8.0.1",
|
||||
"glob": "^8.0.3",
|
||||
"husky": "^7.0.4",
|
||||
"jest": "27.5.1",
|
||||
"jest-canvas-mock": "^2.3.1",
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
],
|
||||
"@vegaprotocol/trades": ["libs/trades/src/index.ts"],
|
||||
"@vegaprotocol/types": ["libs/types/src/index.ts"],
|
||||
"@vegaprotocol/types/types": ["libs/types/src/__generated__/types.ts"],
|
||||
"@vegaprotocol/ui-toolkit": ["libs/ui-toolkit/src/index.ts"],
|
||||
"@vegaprotocol/wallet": ["libs/wallet/src/index.ts"],
|
||||
"@vegaprotocol/web3": ["libs/web3/src/index.ts"],
|
||||
|
||||
@@ -13280,7 +13280,7 @@ glob@^7.0.0, glob@^7.1.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, gl
|
||||
once "^1.3.0"
|
||||
path-is-absolute "^1.0.0"
|
||||
|
||||
glob@^8.0.0, glob@^8.0.1:
|
||||
glob@^8.0.0, glob@^8.0.3:
|
||||
version "8.0.3"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e"
|
||||
integrity sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==
|
||||
|
||||
Reference in New Issue
Block a user