From 56727257540fc594feb6c44bf4e35c4c8fc6001e Mon Sep 17 00:00:00 2001 From: Madalina Raicu Date: Tue, 4 Oct 2022 15:30:21 +0100 Subject: [PATCH] fix: #1537 fix generated types in LP and deposits --- .../__generated__/AddSignerBundle.ts | 45 +++++++ .../__generated__/RemoveSignerBundle.ts | 48 ++++++++ .../src/lib/__generated__/DepositAsset.ts | 72 ----------- libs/deposits/src/lib/__generated__/index.ts | 2 - .../src/lib/__generated___/Deposit.ts | 112 ------------------ .../src/utils/__generated___/Node.ts | 80 ------------- .../src/lib/liquidity-data-provider.ts | 104 +--------------- 7 files changed, 95 insertions(+), 368 deletions(-) create mode 100644 apps/multisig-signer/src/app/components/add-signer-form/__generated__/AddSignerBundle.ts create mode 100644 apps/multisig-signer/src/app/components/remove-signer-form/__generated__/RemoveSignerBundle.ts delete mode 100644 libs/deposits/src/lib/__generated__/DepositAsset.ts delete mode 100644 libs/deposits/src/lib/__generated__/index.ts delete mode 100644 libs/deposits/src/lib/__generated___/Deposit.ts delete mode 100644 libs/environment/src/utils/__generated___/Node.ts diff --git a/apps/multisig-signer/src/app/components/add-signer-form/__generated__/AddSignerBundle.ts b/apps/multisig-signer/src/app/components/add-signer-form/__generated__/AddSignerBundle.ts new file mode 100644 index 000000000..cd1a623a3 --- /dev/null +++ b/apps/multisig-signer/src/app/components/add-signer-form/__generated__/AddSignerBundle.ts @@ -0,0 +1,45 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +// ==================================================== +// GraphQL query operation: AddSignerBundle +// ==================================================== + +export interface AddSignerBundle_erc20MultiSigSignerAddedBundles_edges_node { + __typename: "ERC20MultiSigSignerAddedBundle"; + /** + * The ethereum address of the signer to be added + */ + newSigner: string; + /** + * The nonce used in the signing operation + */ + nonce: string; + /** + * The bundle of signatures from current validators to sign in the new signer + */ + signatures: string; +} + +export interface AddSignerBundle_erc20MultiSigSignerAddedBundles_edges { + __typename: "ERC20MultiSigSignerAddedBundleEdge"; + node: AddSignerBundle_erc20MultiSigSignerAddedBundles_edges_node; +} + +export interface AddSignerBundle_erc20MultiSigSignerAddedBundles { + __typename: "ERC20MultiSigSignerAddedConnection"; + edges: (AddSignerBundle_erc20MultiSigSignerAddedBundles_edges | null)[] | null; +} + +export interface AddSignerBundle { + /** + * Get the signature bundle to add a particular validator to the signer list of the multisig contract + */ + erc20MultiSigSignerAddedBundles: AddSignerBundle_erc20MultiSigSignerAddedBundles; +} + +export interface AddSignerBundleVariables { + nodeId: string; +} diff --git a/apps/multisig-signer/src/app/components/remove-signer-form/__generated__/RemoveSignerBundle.ts b/apps/multisig-signer/src/app/components/remove-signer-form/__generated__/RemoveSignerBundle.ts new file mode 100644 index 000000000..833b8db58 --- /dev/null +++ b/apps/multisig-signer/src/app/components/remove-signer-form/__generated__/RemoveSignerBundle.ts @@ -0,0 +1,48 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +// ==================================================== +// GraphQL query operation: RemoveSignerBundle +// ==================================================== + +export interface RemoveSignerBundle_erc20MultiSigSignerRemovedBundles_edges_node { + __typename: "ERC20MultiSigSignerRemovedBundle"; + /** + * The ethereum address of the signer to be removed + */ + oldSigner: string; + /** + * The nonce used in the signing operation + */ + nonce: string; + /** + * The bundle of signatures from current validators to sign in the new signer + */ + signatures: string; +} + +export interface RemoveSignerBundle_erc20MultiSigSignerRemovedBundles_edges { + __typename: "ERC20MultiSigSignerRemovedBundleEdge"; + node: RemoveSignerBundle_erc20MultiSigSignerRemovedBundles_edges_node; +} + +export interface RemoveSignerBundle_erc20MultiSigSignerRemovedBundles { + __typename: "ERC20MultiSigSignerRemovedConnection"; + /** + * The list of signer bundles for that validator + */ + edges: (RemoveSignerBundle_erc20MultiSigSignerRemovedBundles_edges | null)[] | null; +} + +export interface RemoveSignerBundle { + /** + * Get the signatures bundle to remove a particular validator from signer list of the multisig contract + */ + erc20MultiSigSignerRemovedBundles: RemoveSignerBundle_erc20MultiSigSignerRemovedBundles; +} + +export interface RemoveSignerBundleVariables { + nodeId: string; +} diff --git a/libs/deposits/src/lib/__generated__/DepositAsset.ts b/libs/deposits/src/lib/__generated__/DepositAsset.ts deleted file mode 100644 index 5113e5c4e..000000000 --- a/libs/deposits/src/lib/__generated__/DepositAsset.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -import { AssetStatus } from "@vegaprotocol/types"; - -// ==================================================== -// GraphQL query operation: DepositAsset -// ==================================================== - -export interface DepositAsset_assetsConnection_edges_node_source_BuiltinAsset { - __typename: "BuiltinAsset"; -} - -export interface DepositAsset_assetsConnection_edges_node_source_ERC20 { - __typename: "ERC20"; - /** - * The address of the ERC20 contract - */ - contractAddress: string; -} - -export type DepositAsset_assetsConnection_edges_node_source = DepositAsset_assetsConnection_edges_node_source_BuiltinAsset | DepositAsset_assetsConnection_edges_node_source_ERC20; - -export interface DepositAsset_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 status of the asset in the Vega network - */ - status: AssetStatus; - /** - * The origin source of the asset (e.g: an ERC20 asset) - */ - source: DepositAsset_assetsConnection_edges_node_source; -} - -export interface DepositAsset_assetsConnection_edges { - __typename: "AssetEdge"; - node: DepositAsset_assetsConnection_edges_node; -} - -export interface DepositAsset_assetsConnection { - __typename: "AssetsConnection"; - /** - * The assets - */ - edges: (DepositAsset_assetsConnection_edges | null)[] | null; -} - -export interface DepositAsset { - /** - * The list of all assets in use in the Vega network or the specified asset if ID is provided - */ - assetsConnection: DepositAsset_assetsConnection; -} diff --git a/libs/deposits/src/lib/__generated__/index.ts b/libs/deposits/src/lib/__generated__/index.ts deleted file mode 100644 index 28bd955ea..000000000 --- a/libs/deposits/src/lib/__generated__/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './Deposit'; -export * from './DepositAsset'; diff --git a/libs/deposits/src/lib/__generated___/Deposit.ts b/libs/deposits/src/lib/__generated___/Deposit.ts deleted file mode 100644 index 2d06ea49a..000000000 --- a/libs/deposits/src/lib/__generated___/Deposit.ts +++ /dev/null @@ -1,112 +0,0 @@ -import { Schema as Types } from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type DepositFieldsFragment = { __typename?: 'Deposit', id: string, status: Types.DepositStatus, amount: string, createdTimestamp: string, creditedTimestamp?: string | null, txHash?: string | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } }; - -export type DepositsQueryVariables = Types.Exact<{ - partyId: Types.Scalars['ID']; -}>; - - -export type DepositsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, depositsConnection?: { __typename?: 'DepositsConnection', edges?: Array<{ __typename?: 'DepositEdge', node: { __typename?: 'Deposit', id: string, status: Types.DepositStatus, amount: string, createdTimestamp: string, creditedTimestamp?: string | null, txHash?: string | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } } } | null> | null } | null } | null }; - -export type DepositEventSubscriptionVariables = Types.Exact<{ - partyId: Types.Scalars['ID']; -}>; - - -export type DepositEventSubscription = { __typename?: 'Subscription', busEvents?: Array<{ __typename?: 'BusEvent', event: { __typename?: 'Account' } | { __typename?: 'Asset' } | { __typename?: 'AuctionEvent' } | { __typename?: 'Deposit', id: string, status: Types.DepositStatus, amount: string, createdTimestamp: string, creditedTimestamp?: string | null, txHash?: string | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } } | { __typename?: 'LiquidityProvision' } | { __typename?: 'LossSocialization' } | { __typename?: 'MarginLevels' } | { __typename?: 'Market' } | { __typename?: 'MarketData' } | { __typename?: 'MarketEvent' } | { __typename?: 'MarketTick' } | { __typename?: 'NodeSignature' } | { __typename?: 'OracleSpec' } | { __typename?: 'Order' } | { __typename?: 'Party' } | { __typename?: 'PositionResolution' } | { __typename?: 'Proposal' } | { __typename?: 'RiskFactor' } | { __typename?: 'SettleDistressed' } | { __typename?: 'SettlePosition' } | { __typename?: 'TimeUpdate' } | { __typename?: 'Trade' } | { __typename?: 'TransferResponses' } | { __typename?: 'Vote' } | { __typename?: 'Withdrawal' } }> | null }; - -export const DepositFieldsFragmentDoc = gql` - fragment DepositFields on Deposit { - id - status - amount - asset { - id - symbol - decimals - } - createdTimestamp - creditedTimestamp - txHash -} - `; -export const DepositsDocument = gql` - query Deposits($partyId: ID!) { - party(id: $partyId) { - id - depositsConnection { - edges { - node { - ...DepositFields - } - } - } - } -} - ${DepositFieldsFragmentDoc}`; - -/** - * __useDepositsQuery__ - * - * To run a query within a React component, call `useDepositsQuery` and pass it any options that fit your needs. - * When your component renders, `useDepositsQuery` 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 } = useDepositsQuery({ - * variables: { - * partyId: // value for 'partyId' - * }, - * }); - */ -export function useDepositsQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(DepositsDocument, options); - } -export function useDepositsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(DepositsDocument, options); - } -export type DepositsQueryHookResult = ReturnType; -export type DepositsLazyQueryHookResult = ReturnType; -export type DepositsQueryResult = Apollo.QueryResult; -export const DepositEventDocument = gql` - subscription DepositEvent($partyId: ID!) { - busEvents(partyId: $partyId, batchSize: 0, types: [Deposit]) { - event { - ... on Deposit { - ...DepositFields - } - } - } -} - ${DepositFieldsFragmentDoc}`; - -/** - * __useDepositEventSubscription__ - * - * To run a query within a React component, call `useDepositEventSubscription` and pass it any options that fit your needs. - * When your component renders, `useDepositEventSubscription` 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 } = useDepositEventSubscription({ - * variables: { - * partyId: // value for 'partyId' - * }, - * }); - */ -export function useDepositEventSubscription(baseOptions: Apollo.SubscriptionHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useSubscription(DepositEventDocument, options); - } -export type DepositEventSubscriptionHookResult = ReturnType; -export type DepositEventSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/environment/src/utils/__generated___/Node.ts b/libs/environment/src/utils/__generated___/Node.ts deleted file mode 100644 index 1961baca9..000000000 --- a/libs/environment/src/utils/__generated___/Node.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { Schema as Types } from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type StatisticsQueryVariables = Types.Exact<{ [key: string]: never; }>; - - -export type StatisticsQuery = { __typename?: 'Query', statistics: { __typename?: 'Statistics', chainId: string, blockHeight: string } }; - -export type BlockTimeSubscriptionVariables = Types.Exact<{ [key: string]: never; }>; - - -export type BlockTimeSubscription = { __typename?: 'Subscription', busEvents?: Array<{ __typename?: 'BusEvent', id: string }> | null }; - - -export const StatisticsDocument = gql` - query Statistics { - statistics { - chainId - blockHeight - } -} - `; - -/** - * __useStatisticsQuery__ - * - * To run a query within a React component, call `useStatisticsQuery` and pass it any options that fit your needs. - * When your component renders, `useStatisticsQuery` 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 } = useStatisticsQuery({ - * variables: { - * }, - * }); - */ -export function useStatisticsQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(StatisticsDocument, options); - } -export function useStatisticsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(StatisticsDocument, options); - } -export type StatisticsQueryHookResult = ReturnType; -export type StatisticsLazyQueryHookResult = ReturnType; -export type StatisticsQueryResult = Apollo.QueryResult; -export const BlockTimeDocument = gql` - subscription BlockTime { - busEvents(types: TimeUpdate, batchSize: 1) { - id - } -} - `; - -/** - * __useBlockTimeSubscription__ - * - * To run a query within a React component, call `useBlockTimeSubscription` and pass it any options that fit your needs. - * When your component renders, `useBlockTimeSubscription` 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 } = useBlockTimeSubscription({ - * variables: { - * }, - * }); - */ -export function useBlockTimeSubscription(baseOptions?: Apollo.SubscriptionHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useSubscription(BlockTimeDocument, options); - } -export type BlockTimeSubscriptionHookResult = ReturnType; -export type BlockTimeSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/liquidity/src/lib/liquidity-data-provider.ts b/libs/liquidity/src/lib/liquidity-data-provider.ts index 725608166..087c74a9e 100644 --- a/libs/liquidity/src/lib/liquidity-data-provider.ts +++ b/libs/liquidity/src/lib/liquidity-data-provider.ts @@ -6,10 +6,8 @@ import type { LiquidityProvisionsSubscription, MarketLiquidityQuery, } from './__generated___/MarketLiquidity'; -import { - MarketLiquidityDocument, - LiquidityProvisionsDocument, -} from './__generated___/MarketLiquidity'; +import { LiquidityProvisionsDocument } from './__generated___/MarketLiquidity'; +import { MarketLiquidityDocument } from './__generated___/MarketLiquidity'; export function isLpFragment( lp: @@ -99,101 +97,3 @@ export const marketLiquidityDataProvider = makeDataProvider< return delta; }, }); - -// export const marketLiquidityDataProvider = makeDataProvider< -// MarketLiquidityQuery, -// never>){ -// query: MarketLiquidityDocument -// } - -// export const liquidityProviderFeeShareDataProvider = makeDataProvider< -// MarketLiquidityQuery, - -// export const useLiquidityProvision = ({ -// marketId, -// partyId, -// }: { -// partyId?: string; -// marketId?: string; -// }) => { -// const { param: stakeToCcySiskas } = useNetworkParam( -// NetworkParams.market_liquidity_stakeToCcySiskas -// ); -// const stakeToCcySiska = stakeToCcySiskas && stakeToCcySiskas[0]; -// const { data, loading, error } = useMarketLiquidityQuery({ -// variables: { marketId: marketId || '' }, -// }); -// const liquidityData: LiquidityData = getLiquidityData( -// data, -// partyId, -// stakeToCcySiska -// ); -// return { data: liquidityData, loading, error }; -// }; - -// function getLiquidityData( -// data: MarketLiquidityQuery | undefined, -// partyId: string | undefined, -// stakeToCcySiska: string -// ) { -// const liquidityProviders = ( -// data?.market?.data?.liquidityProviderFeeShare || [] -// ) -// ?.filter((p) => !partyId || p.party.id === partyId) // if partyId is provided, filter out other parties -// .map((provider) => { -// const liquidityProvisionConnection = -// data?.market?.liquidityProvisionsConnection?.edges?.find( -// (e) => e?.node.party.id === provider.party.id -// ); -// const balance = -// liquidityProvisionConnection?.node?.party.accountsConnection?.edges?.reduce( -// (acc, e) => { -// return e?.node.type === AccountType.ACCOUNT_TYPE_BOND // just an extra check to make sure we only use bond accounts -// ? acc.plus(new BigNumber(e?.node.balance ?? 0)) -// : acc; -// }, -// new BigNumber(0) -// ); -// const obligation = -// stakeToCcySiska && -// new BigNumber(stakeToCcySiska) -// .times(liquidityProvisionConnection?.node?.commitmentAmount ?? 1) -// .toString(); -// const supplied = -// stakeToCcySiska && -// new BigNumber(stakeToCcySiska).times(balance ?? 1).toString(); -// return { -// party: provider.party.id, -// createdAt: liquidityProvisionConnection?.node?.createdAt, -// updatedAt: liquidityProvisionConnection?.node?.updatedAt, -// commitmentAmount: liquidityProvisionConnection?.node?.commitmentAmount, -// fee: liquidityProvisionConnection?.node?.fee, -// status: liquidityProvisionConnection?.node?.status, -// equityLikeShare: provider.equityLikeShare, -// averageEntryValuation: provider.averageEntryValuation, -// obligation, -// supplied, -// }; -// }); -// const liquidityData: LiquidityData = { -// liquidityProviders, -// suppliedStake: data?.market?.data?.suppliedStake, -// targetStake: data?.market?.data?.targetStake, -// decimalPlaces: data?.market?.decimalPlaces, -// positionDecimalPlaces: data?.market?.positionDecimalPlaces, -// code: data?.market?.tradableInstrument.instrument.code, -// name: data?.market?.tradableInstrument.instrument.name, -// assetDecimalPlaces: -// data?.market?.tradableInstrument.instrument.product.settlementAsset -// .decimals, -// symbol: -// data?.market?.tradableInstrument.instrument.product.settlementAsset -// .symbol, -// }; -// return liquidityData; -// } - -// export const lpDataProvider = makeDerivedDataProvider( -// [liquidityDataProvider], -// (parts) => parts[0] -// );