1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

catch and cancelled queries from unsupported networks

This commit is contained in:
EnzoVezzaro 2022-10-14 06:51:19 -04:00
parent 3ad213c444
commit 9ef93f5059

View File

@ -5,6 +5,7 @@ import { getOceanConfig } from './ocean'
import { AssetPreviousOrder } from '../@types/subgraph/AssetPreviousOrder' import { AssetPreviousOrder } from '../@types/subgraph/AssetPreviousOrder'
import { OrdersData_orders as OrdersData } from '../@types/subgraph/OrdersData' import { OrdersData_orders as OrdersData } from '../@types/subgraph/OrdersData'
import { OpcFeesQuery as OpcFeesData } from '../@types/subgraph/OpcFeesQuery' import { OpcFeesQuery as OpcFeesData } from '../@types/subgraph/OpcFeesQuery'
import { chainIdsSupported } from 'app.config'
const PreviousOrderQuery = gql` const PreviousOrderQuery = gql`
query AssetPreviousOrder($id: String!, $account: String!) { query AssetPreviousOrder($id: String!, $account: String!) {
@ -76,6 +77,12 @@ export function getSubgraphUri(chainId: number): string {
export function getQueryContext(chainId: number): OperationContext { export function getQueryContext(chainId: number): OperationContext {
try { try {
const isNetworkSupported = chainIdsSupported.includes(chainId)
if (!isNetworkSupported)
throw Object.assign(
new Error('network not supported, query context cancelled')
)
const queryContext: OperationContext = { const queryContext: OperationContext = {
url: `${getSubgraphUri( url: `${getSubgraphUri(
Number(chainId) Number(chainId)