From 120af82e18acda87b71c9a18b1d49ac4b1342769 Mon Sep 17 00:00:00 2001 From: EnzoVezzaro Date: Thu, 20 Oct 2022 08:16:37 -0400 Subject: [PATCH] cleanup subgraph.ts code --- src/@utils/subgraph.ts | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/@utils/subgraph.ts b/src/@utils/subgraph.ts index 7903ac8d2..ed98c5d98 100644 --- a/src/@utils/subgraph.ts +++ b/src/@utils/subgraph.ts @@ -2,24 +2,9 @@ import { gql, OperationResult, TypedDocumentNode, OperationContext } from 'urql' import { LoggerInstance } from '@oceanprotocol/lib' import { getUrqlClientInstance } from '@context/UrqlProvider' import { getOceanConfig } from './ocean' -import { AssetPreviousOrder } from '../@types/subgraph/AssetPreviousOrder' import { OrdersData_orders as OrdersData } from '../@types/subgraph/OrdersData' import { OpcFeesQuery as OpcFeesData } from '../@types/subgraph/OpcFeesQuery' -import { chainIdsSupported } from 'app.config' - -const PreviousOrderQuery = gql` - query AssetPreviousOrder($id: String!, $account: String!) { - orders( - first: 1 - where: { datatoken: $id, payer: $account } - orderBy: createdTimestamp - orderDirection: desc - ) { - createdTimestamp - tx - } - } -` +import appConfig from 'app.config' const UserTokenOrders = gql` query OrdersData($user: String!) { @@ -77,8 +62,7 @@ export function getSubgraphUri(chainId: number): string { export function getQueryContext(chainId: number): OperationContext { try { - const isNetworkSupported = chainIdsSupported.includes(chainId) - if (!isNetworkSupported) + if (!appConfig.chainIdsSupported.includes(chainId)) throw Object.assign( new Error('network not supported, query context cancelled') )