From 9ef93f505900cf97bab0437f3d0f012e6c65c620 Mon Sep 17 00:00:00 2001 From: EnzoVezzaro Date: Fri, 14 Oct 2022 06:51:19 -0400 Subject: [PATCH] catch and cancelled queries from unsupported networks --- src/@utils/subgraph.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/@utils/subgraph.ts b/src/@utils/subgraph.ts index c8ac601f9..7903ac8d2 100644 --- a/src/@utils/subgraph.ts +++ b/src/@utils/subgraph.ts @@ -5,6 +5,7 @@ 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!) { @@ -76,6 +77,12 @@ export function getSubgraphUri(chainId: number): string { export function getQueryContext(chainId: number): OperationContext { try { + const isNetworkSupported = chainIdsSupported.includes(chainId) + if (!isNetworkSupported) + throw Object.assign( + new Error('network not supported, query context cancelled') + ) + const queryContext: OperationContext = { url: `${getSubgraphUri( Number(chainId)