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:
parent
3ad213c444
commit
9ef93f5059
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user