diff --git a/package-lock.json b/package-lock.json index a5686f429..b64462b53 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,6 @@ "@portis/web3": "^4.0.4", "@sindresorhus/slugify": "^2.1.0", "@tippyjs/react": "^4.2.5", - "@urql/exchange-graphcache": "^4.1.4", "@urql/introspection": "^0.3.0", "@walletconnect/web3-provider": "^1.4.1", "axios": "^0.21.1", @@ -80,7 +79,7 @@ "@graphql-codegen/cli": "1.21.6", "@graphql-codegen/introspection": "1.18.2", "@graphql-codegen/typescript": "1.22.4", - "@graphql-codegen/typescript-operations": "1.18.3", + "@graphql-codegen/typescript-operations": "^1.18.3", "@graphql-codegen/typescript-react-apollo": "2.3.0", "@svgr/webpack": "^5.5.0", "@testing-library/jest-dom": "^5.12.0", @@ -8959,18 +8958,6 @@ "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" } }, - "node_modules/@urql/exchange-graphcache": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@urql/exchange-graphcache/-/exchange-graphcache-4.1.4.tgz", - "integrity": "sha512-B0U/Zyw6IRaQRC60qy3hhA7ev4NiFI9LYUyx8ZhivSnSplf+qyZuYOCvuQ8aJuNX332vOpC50A9Vzq/h3fp+Kw==", - "dependencies": { - "@urql/core": ">=2.1.4", - "wonka": "^4.0.14" - }, - "peerDependencies": { - "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" - } - }, "node_modules/@urql/introspection": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@urql/introspection/-/introspection-0.3.0.tgz", @@ -60731,15 +60718,6 @@ "wonka": "^4.0.14" } }, - "@urql/exchange-graphcache": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@urql/exchange-graphcache/-/exchange-graphcache-4.1.4.tgz", - "integrity": "sha512-B0U/Zyw6IRaQRC60qy3hhA7ev4NiFI9LYUyx8ZhivSnSplf+qyZuYOCvuQ8aJuNX332vOpC50A9Vzq/h3fp+Kw==", - "requires": { - "@urql/core": ">=2.1.4", - "wonka": "^4.0.14" - } - }, "@urql/introspection": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@urql/introspection/-/introspection-0.3.0.tgz", diff --git a/package.json b/package.json index cd83c3801..2d153611d 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,7 @@ "@graphql-codegen/cli": "1.21.6", "@graphql-codegen/introspection": "1.18.2", "@graphql-codegen/typescript": "1.22.4", - "@graphql-codegen/typescript-operations": "1.18.3", + "@graphql-codegen/typescript-operations": "^1.18.3", "@graphql-codegen/typescript-react-apollo": "2.3.0", "@svgr/webpack": "^5.5.0", "@testing-library/jest-dom": "^5.12.0", diff --git a/scripts/generate-graphql-schema.js b/scripts/generate-graphql-schema.js deleted file mode 100644 index 1f0e94ace..000000000 --- a/scripts/generate-graphql-schema.js +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env node -'use strict' - -const fs = require('fs') -const axios = require('axios') -const { getIntrospectionQuery } = require('graphql/utilities') -const { generateTypeScriptTypes } = require('graphql-schema-typescript') - -generateGraphSchema() - -async function generateGraphSchema() { - const query = JSON.stringify({ - query: getIntrospectionQuery({ descriptions: false }) - }) - const response = await axios.post( - 'https://subgraph.rinkeby.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph', - query - ) - // generateTypeScriptTypes(response.data.data, './src/@types/schema.json') - fs.writeFileSync('./src/@types/schema.json', JSON.stringify(response.data)) -} diff --git a/src/providers/UrqlProvider.tsx b/src/providers/UrqlProvider.tsx index 8baf32e6f..40129be4d 100644 --- a/src/providers/UrqlProvider.tsx +++ b/src/providers/UrqlProvider.tsx @@ -1,6 +1,4 @@ import { createClient, Provider, Client } from 'urql' -import { getIntrospectionQuery } from 'graphql' -import axios from 'axios' import React, { useState, useEffect, ReactNode, ReactElement } from 'react' import { useWeb3 } from './Web3' import { Logger } from '@oceanprotocol/lib' @@ -12,7 +10,6 @@ function createUrqlClient(subgraphUri: string) { const client = createClient({ url: `${subgraphUri}/subgraphs/name/oceanprotocol/ocean-subgraph` }) - generateGraphSchema(subgraphUri) return client } @@ -20,16 +17,6 @@ export function getUrqlClientInstance(): Client { return urqlClient } -async function generateGraphSchema(subgraphUri: string) { - const query = JSON.stringify({ - query: getIntrospectionQuery({ descriptions: false }) - }) - const response = await axios.post( - `${subgraphUri}/subgraphs/name/oceanprotocol/ocean-subgraph`, - query - ) -} - export default function UrqlClientProvider({ children }: { diff --git a/src/utils/subgraph.ts b/src/utils/subgraph.ts index 223640cc1..b485f5160 100644 --- a/src/utils/subgraph.ts +++ b/src/utils/subgraph.ts @@ -5,7 +5,7 @@ import { getOceanConfig } from './ocean' import web3 from 'web3' import { AssetsFreePrice } from '../@types/apollo/AssetsFreePrice' import { AssetPreviousOrder } from '../@types/apollo/AssetPreviousOrder' -// import {AssetsFreePrice} from '../@types/graph.types' +// import {AssetPreviousOrder} from '../@types/graph.types' export interface PriceList { [key: string]: string