mirror of
https://github.com/oceanprotocol/ens-proxy.git
synced 2024-12-02 05:57:34 +01:00
Removing ./pages directory
This commit is contained in:
parent
043b524219
commit
fe464e605c
@ -1,35 +0,0 @@
|
|||||||
import { ethers } from 'ethers'
|
|
||||||
import {
|
|
||||||
createClient,
|
|
||||||
dedupExchange,
|
|
||||||
TypedDocumentNode,
|
|
||||||
OperationContext,
|
|
||||||
fetchExchange
|
|
||||||
} from 'urql'
|
|
||||||
|
|
||||||
export async function getProvider(): Promise<any> {
|
|
||||||
const provider = new ethers.providers.InfuraProvider(
|
|
||||||
'homestead',
|
|
||||||
process.env.INFURA_PROJECT_ID
|
|
||||||
)
|
|
||||||
return provider
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function fetchData(
|
|
||||||
query: TypedDocumentNode,
|
|
||||||
variables: any,
|
|
||||||
context: OperationContext
|
|
||||||
): Promise<any> {
|
|
||||||
try {
|
|
||||||
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) {
|
|
||||||
console.error('Error fetchData: ', error)
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user