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

View File

@ -1,4 +1,3 @@
import { ConfigHelper, Config, LoggerInstance } from '@oceanprotocol/lib'
import { ethers } from 'ethers' import { ethers } from 'ethers'
import { import {
createClient, createClient,
@ -16,30 +15,21 @@ export async function getProvider(): Promise<any> {
return provider 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( export async function fetchData(
query: TypedDocumentNode, query: TypedDocumentNode,
variables: any, variables: any,
context: OperationContext context: OperationContext
): Promise<any> { ): Promise<any> {
try { 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() const response = await client.query(query, variables, context).toPromise()
return response return response
} catch (error) { } catch (error) {
LoggerInstance.error('Error fetchData: ', error.message) console.error('Error fetchData: ', error)
} }
return null return null
} }