Removing ocean.js and other dependancies

This commit is contained in:
Jamie Hewitt 2022-08-22 15:19:50 +03:00
parent 8da9852659
commit 510912d93c
3 changed files with 79 additions and 9401 deletions

9452
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "subgraph-fetch-price",
"description": "Ocean Protocol Proxy Server",
"name": "ocean-ens-proxy",
"description": "Ocean Protocol ENS Proxy Server",
"version": "0.0.0",
"author": "Ocean Protocol <devops@oceanprotocol.com>",
"license": "Apache-2.0",
@ -15,7 +15,6 @@
"test": "npm run test:format && npm run test:integration"
},
"dependencies": {
"@oceanprotocol/lib": "^1.1.8",
"ethers": "^5.7.0",
"next": "^12.2.5",
"urql": "^2.2.3"
@ -24,15 +23,12 @@
"@types/react": "^18.0.17",
"@typescript-eslint/eslint-plugin": "^5.28.0",
"@typescript-eslint/parser": "^5.29.0",
"chai": "^4.3.6",
"eslint": "^8.18.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"husky": "^7.0.0",
"mocha": "^10.0.0",
"prettier": "^2.7.1",
"pretty-quick": "^3.1.3",
"supertest": "^6.2.3",
"ts-node": "^10.8.1",
"typescript": "4.7.3"
}

View File

@ -1,4 +1,3 @@
import { ConfigHelper, Config, LoggerInstance } from '@oceanprotocol/lib'
import { ethers } from 'ethers'
import {
createClient,
@ -16,30 +15,21 @@ export async function getProvider(): Promise<any> {
return provider
}
async function createUrqlClient() {
const config = new ConfigHelper().getConfig(
1,
process.env.INFURA_PROJECT_ID
) as Config
const client = createClient({
url: `${config.subgraphUri}/subgraphs/name/oceanprotocol/ocean-subgraph`,
exchanges: [dedupExchange, fetchExchange]
})
return client
}
export async function fetchData(
query: TypedDocumentNode,
variables: any,
context: OperationContext
): Promise<any> {
try {
const client = await createUrqlClient()
const client = createClient({
url: 'https://v4.subgraph.mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph',
exchanges: [dedupExchange, fetchExchange]
})
const response = await client.query(query, variables, context).toPromise()
return response
} catch (error) {
LoggerInstance.error('Error fetchData: ', error.message)
console.error('Error fetchData: ', error)
}
return null
}