Skip to content

Commit

Permalink
feat: add decentralized subgraphs
Browse files Browse the repository at this point in the history
  • Loading branch information
Xeonus committed Jun 11, 2024
1 parent 2c09c64 commit 1e96560
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 37 deletions.
1 change: 1 addition & 0 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
REACT_APP_ALCHEMY_KEY: '${{ secrets.REACT_APP_ALCHEMY_KEY }}'
REACT_APP_ALCHEMY_URL: '${{ secrets.REACT_APP_ALCHEMY_URL }}'
REACT_APP_CG_KEY: '${{ secrets.REACT_APP_CG_KEY }}'
REACT_APP_PERSONAL_GRAPH_KEY: '${{ secrets.REACT_APP_PERSONAL_GRAPH_KEY }}'
strategy:
matrix:
node-version: [ 16.x ]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
REACT_APP_ALCHEMY_KEY: '${{ secrets.REACT_APP_ALCHEMY_KEY }}'
REACT_APP_ALCHEMY_URL: '${{ secrets.REACT_APP_ALCHEMY_URL }}'
REACT_APP_CG_KEY: '${{ secrets.REACT_APP_CG_KEY }}'
REACT_APP_PERSONAL_GRAPH_KEY: '${{ secrets.REACT_APP_PERSONAL_GRAPH_KEY }}'
strategy:
matrix:
node-version: [ 16.x ]
Expand Down
44 changes: 21 additions & 23 deletions src/apollo/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const healthClient = new ApolloClient({
});

export const blockClient = new ApolloClient({
uri: process.env.REACT_APP_BLOCKS_SUBGRAPH_URL,
uri: EthereumNetworkInfo.blockClientUri,
cache: new InMemoryCache(),
queryDeduplication: true,
defaultOptions: {
Expand All @@ -29,7 +29,7 @@ export const blockClient = new ApolloClient({

//Aura client
export const auraClient = new ApolloClient({
uri: 'https://graph.aura.finance/subgraphs/name/aura/aura-mainnet-v2-1',
uri: 'https://subgraph.satsuma-prod.com/cae76ab408ca/1xhub-ltd/aura-finance-mainnet/api',
cache: new InMemoryCache({
typePolicies: {
Token: {
Expand Down Expand Up @@ -58,7 +58,7 @@ export const auraClient = new ApolloClient({

//Aura client
export const auraArbitrumClient = new ApolloClient({
uri: 'https://graph.data.aura.finance/subgraphs/name/aura/aura-arbitrum',
uri: 'https://subgraph.satsuma-prod.com/cae76ab408ca/1xhub-ltd/aura-finance-arbitrum/api',
cache: new InMemoryCache({
typePolicies: {
Token: {
Expand Down Expand Up @@ -86,7 +86,7 @@ export const auraArbitrumClient = new ApolloClient({
});

export const auraOptimismClient = new ApolloClient({
uri: 'https://graph.data.aura.finance/subgraphs/name/aura/aura-optimism',
uri: 'https://subgraph.satsuma-prod.com/cae76ab408ca/1xhub-ltd/aura-finance-optimism/api',
cache: new InMemoryCache({
typePolicies: {
Token: {
Expand Down Expand Up @@ -114,7 +114,7 @@ export const auraOptimismClient = new ApolloClient({
});

export const auraPolygonClient = new ApolloClient({
uri: 'https://api.thegraph.com/subgraphs/name/aurafinance/aura-finance-polygon',
uri: 'https://subgraph.satsuma-prod.com/cae76ab408ca/1xhub-ltd/aura-finance-polygon/api',
cache: new InMemoryCache({
typePolicies: {
Token: {
Expand Down Expand Up @@ -142,7 +142,7 @@ export const auraPolygonClient = new ApolloClient({
});

export const auraPolygonZkEVMClient = new ApolloClient({
uri: 'https://subgraph.satsuma-prod.com/3c56113393d7/1xhub-ltd/aura-finance-zkevm/api',
uri: 'https://subgraph.satsuma-prod.com/cae76ab408ca/1xhub-ltd/aura-finance-zkevm/api',
cache: new InMemoryCache({
typePolicies: {
Token: {
Expand Down Expand Up @@ -170,7 +170,7 @@ export const auraPolygonZkEVMClient = new ApolloClient({
});

export const auraGnosisClient = new ApolloClient({
uri: 'https://api.thegraph.com/subgraphs/name/aurafinance/aura-finance-gnosis-chain',
uri: 'https://subgraph.satsuma-prod.com/cae76ab408ca/1xhub-ltd/aura-finance-gnosis/api',
cache: new InMemoryCache({
typePolicies: {
Token: {
Expand Down Expand Up @@ -198,7 +198,7 @@ export const auraGnosisClient = new ApolloClient({
});

export const auraBaseClient = new ApolloClient({
uri: 'https://api.thegraph.com/subgraphs/name/aurafinance/aura-finance-base',
uri: 'https://subgraph.satsuma-prod.com/cae76ab408ca/1xhub-ltd/aura-finance-base/api',
cache: new InMemoryCache({
typePolicies: {
Token: {
Expand Down Expand Up @@ -254,7 +254,7 @@ export const auraAvalancheClient = new ApolloClient({
});

export const client = new ApolloClient({
uri: 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-v2',
uri: EthereumNetworkInfo.clientUri,
cache: new InMemoryCache({
typePolicies: {
Token: {
Expand Down Expand Up @@ -282,7 +282,7 @@ export const client = new ApolloClient({
});

export const arbitrumClient = new ApolloClient({
uri: 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-arbitrum-v2',
uri: ArbitrumNetworkInfo.clientUri,
cache: new InMemoryCache({
typePolicies: {
Token: {
Expand Down Expand Up @@ -310,7 +310,7 @@ export const arbitrumClient = new ApolloClient({
})

export const arbitrumBlockClient = new ApolloClient({
uri: 'https://api.thegraph.com/subgraphs/name/ianlapham/arbitrum-one-blocks',
uri: ArbitrumNetworkInfo.blockClientUri,
cache: new InMemoryCache(),
queryDeduplication: true,
defaultOptions: {
Expand All @@ -325,7 +325,7 @@ export const arbitrumClient = new ApolloClient({
})

export const polygonClient = new ApolloClient({
uri: 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-prune-v2',
uri: PolygonNetworkInfo.clientUri,
cache: new InMemoryCache({
typePolicies: {
Token: {
Expand Down Expand Up @@ -353,7 +353,7 @@ export const arbitrumClient = new ApolloClient({
})

export const polygonBlockClient = new ApolloClient({
uri: 'https://api.thegraph.com/subgraphs/name/ianlapham/polygon-blocks',
uri: PolygonNetworkInfo.blockClientUri,
cache: new InMemoryCache(),
queryDeduplication: true,
defaultOptions: {
Expand All @@ -368,7 +368,7 @@ export const arbitrumClient = new ApolloClient({
})

export const gnosisClient = new ApolloClient({
uri: 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-gnosis-chain-v2',
uri: GnosisNetworkInfo.clientUri,
cache: new InMemoryCache({
typePolicies: {
Token: {
Expand Down Expand Up @@ -396,8 +396,7 @@ export const arbitrumClient = new ApolloClient({
})

export const polygonZKEVMClient = new ApolloClient({
//uri: 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2',
uri: 'https://api.studio.thegraph.com/query/24660/balancer-polygon-zk-v2/version/latest',
uri: PolygonZkEVMNetworkInfo.clientUri,
cache: new InMemoryCache({
typePolicies: {
Token: {
Expand Down Expand Up @@ -440,7 +439,7 @@ export const polygonZKEVMBlockClient = new ApolloClient({
})

export const gnosisBlockClient = new ApolloClient({
uri: 'https://api.thegraph.com/subgraphs/name/x0swapsubgraph/xdai-blocks',
uri: GnosisNetworkInfo.blockClientUri,
cache: new InMemoryCache(),
queryDeduplication: true,
defaultOptions: {
Expand All @@ -455,7 +454,7 @@ export const polygonZKEVMBlockClient = new ApolloClient({
})

export const optimismClient = new ApolloClient({
uri: 'https://api.thegraph.com/subgraphs/name/beethovenxfi/beethovenx-optimism',
uri: OptimismNetworkInfo.clientUri,
cache: new InMemoryCache({
typePolicies: {
Token: {
Expand Down Expand Up @@ -483,7 +482,7 @@ export const optimismClient = new ApolloClient({
})

export const optimismBlockClient = new ApolloClient({
uri: 'https://api.thegraph.com/subgraphs/name/beethovenxfi/optimism-blocks',
uri: OptimismNetworkInfo.blockClientUri,
cache: new InMemoryCache(),
queryDeduplication: true,
defaultOptions: {
Expand Down Expand Up @@ -513,8 +512,7 @@ export const baseBlockClient = new ApolloClient({
})

export const baseClient = new ApolloClient({
//uri: 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2',
uri: 'https://api.studio.thegraph.com/query/24660/balancer-base-v2/version/latest',
uri: BaseNetworkInfo.clientUri,
cache: new InMemoryCache({
typePolicies: {
Token: {
Expand Down Expand Up @@ -542,7 +540,7 @@ export const baseClient = new ApolloClient({
})

export const avalancheClient = new ApolloClient({
uri: 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-avalanche-v2-beta',
uri: AvalancheNetworkInfo.clientUri,
cache: new InMemoryCache({
typePolicies: {
Token: {
Expand Down Expand Up @@ -570,7 +568,7 @@ export const avalancheClient = new ApolloClient({
})

export const avalancheBlockClient = new ApolloClient({
uri: 'https://api.thegraph.com/subgraphs/name/iliaazhel/avalanche-blocks',
uri: AvalancheNetworkInfo.blockClientUri,
cache: new InMemoryCache(),
queryDeduplication: true,
defaultOptions: {
Expand Down
39 changes: 25 additions & 14 deletions src/constants/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export type NetworkInfo = {
balAddress: string
feeCollectorThreshold: number
decentralicedClientUri: string
blockClientUri: string
alchemyRPCUrl: string
alchemyKey: string
route: string
Expand All @@ -50,6 +51,8 @@ export type NetworkInfo = {
blurb?: string
}

const DECENTRALIZED_ENDPOINT = 'https://gateway-arbitrum.network.thegraph.com/api/' + PERSONAL_GRAPH_KEY + '/subgraphs/id/'

export const EthereumNetworkInfo: NetworkInfo = {
id: SupportedNetwork.ETHEREUM,
chainId: '1',
Expand All @@ -63,8 +66,9 @@ export const EthereumNetworkInfo: NetworkInfo = {
name: 'Ethereum',
startTimeStamp: 1619874000,
appUri: 'https://app.balancer.fi/#/',
clientUri: 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-v2',
decentralicedClientUri: 'https://gateway.thegraph.com/api/' + PERSONAL_GRAPH_KEY + '/subgraphs/id/GAWNgiGrA9eRce5gha9tWc7q5DPvN3fs5rSJ6tEULFNM',
clientUri: 'https://api.studio.thegraph.com/query/75376/balancer-v2/version/latest',
decentralicedClientUri: DECENTRALIZED_ENDPOINT + 'C4ayEZP2yTXRAB8vSaTrgN4m9anTe9Mdm2ViyiAuV9TV',
blockClientUri: DECENTRALIZED_ENDPOINT + '9A6bkprqEG2XsZUYJ5B2XXp6ymz9fNcn4tVPxMWDztYC',
alchemyRPCUrl: ALCHEMY_URL,
alchemyKey: ALCHEMY_KEY,
bgColor: BALANCER_PRIMARY_COLOR,
Expand All @@ -86,8 +90,9 @@ export const ArbitrumNetworkInfo: NetworkInfo = {
name: 'Arbitrum',
startTimeStamp: 1619874000,
appUri: 'https://app.balancer.fi/#/arbitrum/',
clientUri: 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-arbitrum-v2',
decentralicedClientUri: '',
clientUri: 'https://api.studio.thegraph.com/query/75376/balancer-arbitrum-v2/version/latest',
decentralicedClientUri: DECENTRALIZED_ENDPOINT + '/subgraphs/id/98cQDy6tufTJtshDCuhh9z2kWXsQWBHVh2bqnLHsGAeS',
blockClientUri: DECENTRALIZED_ENDPOINT + 'JBnWrv9pvBvSi2pUZzba3VweGBTde6s44QvsDABP47Gt',
alchemyRPCUrl: ALCHEMY_URL_ARBITRUM,
alchemyKey: ALCHEMY_KEY_ARBITRUM,
imageURL: ARBITRUM_LOGO_URL,
Expand All @@ -110,8 +115,9 @@ export const PolygonNetworkInfo: NetworkInfo = {
name: 'Polygon',
startTimeStamp: 1619874000,
appUri: 'https://app.balancer.fi/#/polygon/',
clientUri: 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-prune-v2',
decentralicedClientUri: '',
clientUri: 'https://api.studio.thegraph.com/query/75376/balancer-polygon-v2/version/latest',
decentralicedClientUri: DECENTRALIZED_ENDPOINT + '/subgraphs/id/H9oPAbXnobBRq1cB3HDmbZ1E8MWQyJYQjT1QDJMrdbNp',
blockClientUri: DECENTRALIZED_ENDPOINT + 'DMnXZnphMTkcFiK5NHm6LzwhJ7yUy7seVnZuNkNsXLHp',
alchemyRPCUrl: ALCHEMY_URL_POLYGON,
alchemyKey: ALCHEMY_KEY_POLYGON,
bgColor: '#8247e5',
Expand All @@ -134,8 +140,9 @@ export const GnosisNetworkInfo: NetworkInfo = {
name: 'Gnosis',
startTimeStamp: 1673807871,
appUri: 'https://app.balancer.fi/#/gnosis-chain/',
clientUri: 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-gnosis-chain-v2',
decentralicedClientUri: '',
clientUri: 'https://api.studio.thegraph.com/query/75376/balancer-gnosis-chain-v2/version/latest',
decentralicedClientUri: DECENTRALIZED_ENDPOINT + '/subgraphs/id/EJezH1Cp31QkKPaBDerhVPRWsKVZLrDfzjrLqpmv6cGg',
blockClientUri: DECENTRALIZED_ENDPOINT + '8ZD25Ff1efVjqHkGmPdgn7oevwe3FkSB7WFygyNEsAco',
alchemyRPCUrl: 'https://rpc.gnosis.gateway.fm',
alchemyKey: '',
bgColor: '#8247e5',
Expand All @@ -159,7 +166,8 @@ export const PolygonZkEVMNetworkInfo: NetworkInfo = {
startTimeStamp: 1685990897,
appUri: 'https://app.balancer.fi/#/zkevm/',
clientUri: 'https://api.studio.thegraph.com/query/24660/balancer-polygon-zk-v2/version/latest',
decentralicedClientUri: '',
decentralicedClientUri: 'https://api.studio.thegraph.com/query/24660/balancer-polygon-zk-v2/version/latest',
blockClientUri: '',
alchemyRPCUrl: ALCHEMY_URL_ZKEVM,
alchemyKey: ALCHEMY_KEY_ZKEVM,
bgColor: '#a176e8',
Expand All @@ -177,12 +185,13 @@ export const OptimismNetworkInfo: NetworkInfo = {
dbNetworkId: 'opt',
v3NetworkID: 'OPTIMISM',
balAddress: '0xf24bcf4d1e507740041c9cfd2dddb29585adce1e',
decentralicedClientUri: '',
route: 'optimism',
name: 'OΞ (Optimism)',
startTimeStamp: 1654034400,
appUri: 'https://op.beets.fi',
clientUri: 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-optimism-v2',
clientUri: 'https://api.studio.thegraph.com/query/75376/balancer-optimism-v2/version/latest',
decentralicedClientUri: '',
blockClientUri: DECENTRALIZED_ENDPOINT + 'E7PJSKBpyCmcx7HfW6NCpv7pWg43YfXhS4bGVCcx2Tfq',
alchemyKey: '',
alchemyRPCUrl: '',
feeCollectorThreshold: 1000,
Expand All @@ -207,7 +216,8 @@ export const BaseNetworkInfo: NetworkInfo = {
startTimeStamp: 1690495200,
appUri: 'https://app.balancer.fi/#/avalanche/',
clientUri: 'https://api.studio.thegraph.com/query/24660/balancer-base-v2/version/latest',
decentralicedClientUri: '',
decentralicedClientUri: DECENTRALIZED_ENDPOINT + '/subgraphs/id/98cQDy6tufTJtshDCuhh9z2kWXsQWBHVh2bqnLHsGAeS',
blockClientUri: '',
alchemyRPCUrl: 'https://base.publicnode.com',
alchemyKey: '',
bgColor: '#0030a6',
Expand All @@ -230,8 +240,9 @@ export const AvalancheNetworkInfo: NetworkInfo = {
name: 'Avalanche',
startTimeStamp: 1688229198,
appUri: 'https://app.balancer.fi/#/avalanche/',
clientUri: 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-avalanche-v2-beta',
decentralicedClientUri: '',
clientUri: 'https://api.studio.thegraph.com/query/75376/balancer-avalanche-v2/version/latest',
decentralicedClientUri: DECENTRALIZED_ENDPOINT + '/subgraphs/id/7asfmtQA1KYu6CP7YVm5kv4bGxVyfAHEiptt2HMFgkHu',
blockClientUri: DECENTRALIZED_ENDPOINT + '97YH6dMhGcXoTvVwDAML6GxYm9hBh7PCz6WPscUkrFhv',
alchemyRPCUrl: ' https://api.avax.network/ext/bc/C/rpc ',
alchemyKey: '',
bgColor: '#F01B36',
Expand Down

0 comments on commit 1e96560

Please sign in to comment.