Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(thegraph): migrate to TheGraph Studio #1402

Merged
merged 8 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/payment-detection/codegen-near.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
overwrite: true
schema: 'https://api.thegraph.com/subgraphs/name/requestnetwork/request-payments-near-testnet'
schema: 'https://api.studio.thegraph.com/query/67444/request-payments-near-testnet/version/latest'
documents: src/thegraph/queries/near/*.graphql
generates:
src/thegraph/generated/graphql-near.ts:
Expand Down
2 changes: 1 addition & 1 deletion packages/payment-detection/codegen.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
overwrite: true
schema: 'https://api.thegraph.com/subgraphs/name/requestnetwork/request-payments-goerli'
schema: 'https://api.studio.thegraph.com/query/67444/request-payments-sepolia/version/latest'
documents: src/thegraph/queries/*.graphql
generates:
src/thegraph/generated/graphql.ts:
Expand Down
18 changes: 11 additions & 7 deletions packages/payment-detection/src/thegraph/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import { Block_Height, Maybe, getSdk } from './generated/graphql';
import { getSdk as getNearSdk } from './generated/graphql-near';
import { RequestConfig } from 'graphql-request/src/types';

const HOSTED_THE_GRAPH_URL =
'https://api.thegraph.com/subgraphs/name/requestnetwork/request-payments-';
const THE_GRAPH_STUDIO_URL =
'https://api.studio.thegraph.com/query/67444/request-payments-$NETWORK/version/latest';

const STUDIO_THE_GRAPH_URL = 'https://api.studio.thegraph.com/query/35843/request-payments-';
const THE_GRAPH_STUDIO_URL_RF =
'https://api.studio.thegraph.com/query/35843/request-payments-$NETWORK/version/latest';

const THE_GRAPH_URL_MANTLE_TESTNET =
'https://graph.testnet.mantle.xyz/subgraphs/name/requestnetwork/request-payments-mantle-testnet';
Expand Down Expand Up @@ -96,14 +97,17 @@ export const defaultGetTheGraphClient = (
return network === 'private'
? undefined
: NearChains.isChainSupported(network)
? getTheGraphNearClient(`${HOSTED_THE_GRAPH_URL}${network.replace('aurora', 'near')}`, options)
? getTheGraphNearClient(
`${THE_GRAPH_STUDIO_URL.replace('$NETWORK', network.replace('aurora', 'near'))}`,
options,
)
: network === 'mantle'
? getTheGraphEvmClient(THE_GRAPH_URL_MANTLE, options)
: network === 'mantle-testnet'
? getTheGraphEvmClient(THE_GRAPH_URL_MANTLE_TESTNET, options)
: network === 'core'
? getTheGraphEvmClient(THE_GRAPH_URL_CORE, options)
: network === 'zksyncera' || network === 'base'
? getTheGraphEvmClient(`${STUDIO_THE_GRAPH_URL}${network}/version/latest`, options)
: getTheGraphEvmClient(`${HOSTED_THE_GRAPH_URL}${network}`, options);
: ['mainnet', 'xdai'].includes(network)
? getTheGraphEvmClient(`${THE_GRAPH_STUDIO_URL_RF.replace('$NETWORK', network)}`, options)
alexandre-abrioux marked this conversation as resolved.
Show resolved Hide resolved
: getTheGraphEvmClient(`${THE_GRAPH_STUDIO_URL.replace('$NETWORK', network)}`, options);
};
Original file line number Diff line number Diff line change
@@ -1 +1 @@
schema: https://api.thegraph.com/subgraphs/name/requestnetwork/request-payments-goerli
schema: https://api.studio.thegraph.com/query/67444/request-payments-sepolia/version/latest
Original file line number Diff line number Diff line change
@@ -1 +1 @@
schema: https://api.thegraph.com/subgraphs/name/requestnetwork/request-payments-near-testnet
schema: https://api.studio.thegraph.com/query/67444/request-payments-near-testnet/version/latest
2 changes: 1 addition & 1 deletion packages/toolbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ It will suggest pairs of currencies:

- With a Chainlink price feed oracle (according to [a cached JSON](https://cl-docs-addresses.web.app/addresses.json]))
- If they exist in Currency Manager (cf. [../currency/src/erc20/networks]())
- If they are not already added to the Chainlink Aggregation Path contract, as reported by the Price Aggregators subgraph ([Example for BSC](https://thegraph.com/hosted-service/subgraph/requestnetwork/price-aggregators-bsc))
- If they are not already added to the Chainlink Aggregation Path contract, as reported by the Price Aggregators subgraph ([Example for BSC](https://thegraph.com/explorer/subgraphs/H4knum5YFFtgpWjYDV6xqjkPZprtm7S9jv4UsdnTS1hD?view=Overview&chain=arbitrum-one))
alexandre-abrioux marked this conversation as resolved.
Show resolved Hide resolved

The following commands are also available:

Expand Down