Skip to content

Commit

Permalink
Update subgraph endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
boyuan-chen committed May 16, 2024
1 parent 06c9f2c commit 0d94bc3
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 251 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ packages/boba/gateway/public/env.js
/packages/boba/subgraph/L2/build
/packages/boba/subgraph/L1/generated
/packages/boba/subgraph/L2/generated
/packages/boba/subgraph/L1/rollup/generated
/packages/boba/subgraph/L1/rollup/subgraph.yaml
/packages/boba/subgraph/L1/rollup/yarn.lock

# api
env-mainnet.yml
Expand All @@ -81,3 +84,4 @@ packages/boba/contracts/coverage/

packages/boba/account-abstraction/deployments/hardhat/
packages/boba/bundler_sdk/coverage/

21 changes: 0 additions & 21 deletions packages/boba/subgraph/L1/rollup/config/bobaavax.json

This file was deleted.

21 changes: 0 additions & 21 deletions packages/boba/subgraph/L1/rollup/config/bobabase.json

This file was deleted.

21 changes: 0 additions & 21 deletions packages/boba/subgraph/L1/rollup/config/bobabeam.json

This file was deleted.

21 changes: 0 additions & 21 deletions packages/boba/subgraph/L1/rollup/config/bobaopera.json

This file was deleted.

21 changes: 0 additions & 21 deletions packages/boba/subgraph/L1/rollup/config/bobaoperatestnet.json

This file was deleted.

21 changes: 0 additions & 21 deletions packages/boba/subgraph/L1/rollup/config/fuji.json

This file was deleted.

34 changes: 3 additions & 31 deletions packages/boba/subgraph/L1/rollup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,13 @@
"scripts": {
"codegen": "graph codegen",
"build": "graph build",
"prepare:bobabase:rollup": "mustache config/bobabase.json subgraph.template.rollup.yaml > subgraph.yaml",
"prepare:bobabeam:rollup": "mustache config/bobabeam.json subgraph.template.rollup.yaml > subgraph.yaml",
"prepare:bobaoperatestnet:rollup": "mustache config/bobaoperatestnet.json subgraph.template.rollup.yaml > subgraph.yaml",
"prepare:bobaopera:rollup": "mustache config/bobaopera.json subgraph.template.rollup.yaml > subgraph.yaml",
"prepare:fuji:rollup": "mustache config/fuji.json subgraph.template.rollup.yaml > subgraph.yaml",
"prepare:bobaavax:rollup": "mustache config/bobaavax.json subgraph.template.rollup.yaml > subgraph.yaml",
"prepare:bobabnbtestnet:rollup": "mustache config/bobabnbtestnet.json subgraph.template.rollup.yaml > subgraph.yaml",
"prepare:bobabnb:rollup": "mustache config/bobabnb.json subgraph.template.rollup.yaml > subgraph.yaml",
"prepare:bobabase:addressManager": "mustache config/bobabase.json subgraph.template.addressManager.yaml > subgraph.yaml",
"prepare:bobabeam:addressManager": "mustache config/bobabeam.json subgraph.template.addressManager.yaml > subgraph.yaml",
"prepare:bobaoperatestnet:addressManager": "mustache config/bobaoperatestnet.json subgraph.template.addressManager.yaml > subgraph.yaml",
"prepare:bobaopera:addressManager": "mustache config/bobaopera.json subgraph.template.addressManager.yaml > subgraph.yaml",
"prepare:fuji:addressManager": "mustache config/fuji.json subgraph.template.addressManager.yaml > subgraph.yaml",
"prepare:bobaavax:addressManager": "mustache config/bobaavax.json subgraph.template.addressManager.yaml > subgraph.yaml",
"prepare:bobabnbtestnet:addressManager": "mustache config/bobabnbtestnet.json subgraph.template.addressManager.yaml > subgraph.yaml",
"prepare:bobabnb:addressManager": "mustache config/bobabnb.json subgraph.template.addressManager.yaml > subgraph.yaml",
"deploy:subgraph:bobabase:rollup": "graph deploy --product hosted-service bobanetwork/bobabase-rollup",
"deploy:subgraph:bobabeam:rollup": "graph deploy --product hosted-service bobanetwork/bobabeam-rollup",
"deploy:subgraph:bobabnbtestnet:rollup": "graph deploy --product hosted-service bobanetwork/bobabnb-tn-rollup",
"deploy:subgraph:bobabnb:rollup": "graph deploy --product hosted-service bobanetwork/bobabnb-rollup",
"deploy:subgraph:bobaoperatestnet:rollup": "graph deploy --product hosted-service bobanetwork/bobaopera-tn-rollup",
"deploy:subgraph:bobaopera:rollup": "graph deploy --product hosted-service bobanetwork/bobaopera-rollup",
"deploy:subgraph:fuji:rollup": "graph deploy --product hosted-service bobanetwork/bobafuji-rollup",
"deploy:subgraph:bobaavax:rollup": "graph deploy --product hosted-service bobanetwork/bobaavax-rollup",
"deploy:subgraph:bobabase:addressManager": "graph deploy --product hosted-service bobanetwork/bobabase-address-manager",
"deploy:subgraph:bobabeam:addressManager": "graph deploy --product hosted-service bobanetwork/bobabeam-address-manager",
"deploy:subgraph:bobaoperatestnet:addressManager": "graph deploy --product hosted-service bobanetwork/bobaopera-tn-address-manager",
"deploy:subgraph:bobaopera:addressManager": "graph deploy --product hosted-service bobanetwork/bobaopera-address-manager",
"deploy:subgraph:fuji:addressManager": "graph deploy --product hosted-service bobanetwork/bobafuji-address-manager",
"deploy:subgraph:bobaavax:addressManager": "graph deploy --product hosted-service bobanetwork/bobaavax-address-manager",
"deploy:subgraph:bobabnbtestnet:addressManager": "graph deploy --product hosted-service bobanetwork/bobabnb-tn-address-manager",
"deploy:subgraph:bobabnb:addressManager": "graph deploy --product hosted-service bobanetwork/bobabnb-address-manager"
"deploy:subgraph:bobabnbtestnet:rollup": "graph deploy --studio boba-bnb-testnet-rollup",
"deploy:subgraph:bobabnb:rollup": "graph deploy --studio boba-bnb-rollup"
},
"devDependencies": {
"@graphprotocol/graph-cli": "^0.29.0",
"@graphprotocol/graph-cli": "0.71.2",
"@graphprotocol/graph-ts": "^0.26.0"
},
"dependencies": {
Expand Down

This file was deleted.

20 changes: 20 additions & 0 deletions packages/boba/subgraph/L1/rollup/subgraph.template.rollup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@ specVersion: 0.0.2
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum
name: Lib_AddressManager
network: {{network}}
source:
address: '{{contracts.Lib_AddressManager.address}}'
abi: Lib_AddressManager
startBlock: {{ contracts.Lib_AddressManager.startBlock }}
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
entities:
- Lib_AddressManager
abis:
- name: Lib_AddressManager
file: ./abis/Lib_AddressManager.json
eventHandlers:
- event: AddressSet(indexed string,address,address)
handler: handleAddressSet
file: ./src/Lib_AddressManagermapping.ts
- kind: ethereum
name: L1CrossDomainMessenger
network: {{network}}
Expand Down
3 changes: 3 additions & 0 deletions packages/sdk/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# optional
# This is the API key for Boba Team to access the Graph API
THE_GRAPH_API_KEY=
1 change: 1 addition & 0 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"dependencies": {
"@bobanetwork/core_contracts": "0.5.13",
"@eth-optimism/core-utils": "0.8.1",
"dotenv": "8.6.0",
"lodash": "^4.17.21",
"merkletreejs": "^0.2.27",
"node-fetch": "^2.6.7",
Expand Down
69 changes: 12 additions & 57 deletions packages/sdk/src/utils/graph.ts
Original file line number Diff line number Diff line change
@@ -1,74 +1,29 @@
import { ethers } from 'ethers'
import fetch from 'node-fetch'

// eslint-disable-next-line @typescript-eslint/no-var-requires
require('dotenv').config()

export const WHITELIST_CHAIN_ID: Array<number> = [
1287, 1284, 4002, 250, 43113, 43114, 97, 56,
]

const THE_GRAPH_API_KEY = process.env.THE_GRAPH_API_KEY

export const GRAPH_API_URL: any = {
// Bobabase
1287: {
rollup:
'https://api.thegraph.com/subgraphs/name/bobanetwork/bobabase-rollup',
// The process of syncing Lib_addressManager is super slow
addressManager:
'https://api.thegraph.com/subgraphs/name/bobanetwork/bobabase-address-manager',
},
// Bobabeam
1284: {
rollup:
'https://api.thegraph.com/subgraphs/name/bobanetwork/bobabeam-rollup',
// The process of syncing Lib_addressManager is super slow
addressManager:
'https://api.thegraph.com/subgraphs/name/bobanetwork/bobabeam-address-manager',
},
// Bobaopera testnet
4002: {
rollup:
'https://api.thegraph.com/subgraphs/name/bobanetwork/bobaopera-tn-rollup',
// The process of syncing Lib_addressManager is super slow
addressManager:
'https://api.thegraph.com/subgraphs/name/bobanetwork/bobaopera-tn-address-manager',
},
// Bobaopera
250: {
rollup:
'https://api.thegraph.com/subgraphs/name/bobanetwork/bobaopera-rollup',
// The process of syncing Lib_addressManager is super slow
addressManager:
'https://api.thegraph.com/subgraphs/name/bobanetwork/bobaopera-address-manager',
},
// Avalanche Testnet (fuji)
43113: {
rollup:
'https://api.thegraph.com/subgraphs/name/bobanetwork/bobafuji-rollup',
// The process of syncing Lib_addressManager is super slow
addressManager:
'https://api.thegraph.com/subgraphs/name/bobanetwork/bobafuji-address-manager',
},
// Avalanche Mainnet
43114: {
rollup:
'https://api.thegraph.com/subgraphs/name/bobanetwork/bobaavax-rollup',
// The process of syncing Lib_addressManager is super slow
addressManager:
'https://api.thegraph.com/subgraphs/name/bobanetwork/bobaavax-address-manager',
},
// BNB Testnet
97: {
rollup:
'https://api.thegraph.com/subgraphs/name/bobanetwork/bobabnb-tn-rollup',
// The process of syncing Lib_addressManager is super slow
addressManager:
'https://api.thegraph.com/subgraphs/name/bobanetwork/bobabnb-tn-address-manager',
typeof THE_GRAPH_API_KEY !== 'undefined'
? `https://gateway-arbitrum.network.thegraph.com/api/${THE_GRAPH_API_KEY}/subgraphs/id/DzAc9upeBtED6hAKBCkEUYmVTc5kSd2Cfg3Bw63fd8B4`
: 'https://api.studio.thegraph.com/query/35866/boba-bnb-testnet-rollup/version/latest',
},
// BNB Mainnet
56: {
rollup:
'https://api.thegraph.com/subgraphs/name/bobanetwork/bobabnb-rollup',
// The process of syncing Lib_addressManager is super slow
addressManager:
'https://api.thegraph.com/subgraphs/name/bobanetwork/bobabnb-address-manager',
typeof THE_GRAPH_API_KEY !== 'undefined'
? `https://gateway-arbitrum.network.thegraph.com/api/${THE_GRAPH_API_KEY}/deployments/id/QmWfzcJBxFaEJ2c5n6ZxjERhmwNpkncrZQnzEyGiKiSFpF`
: `https://api.studio.thegraph.com/query/35866/boba-bnb-rollup/version/latest`,
},
}

Expand Down Expand Up @@ -280,7 +235,7 @@ export const getAddressSetEventsFromGraph = async (
if (!GRAPH_API_URL[chainID]) {
return []
}
const response = await fetch(GRAPH_API_URL[chainID].addressManager, {
const response = await fetch(GRAPH_API_URL[chainID].rollup, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
Loading

0 comments on commit 0d94bc3

Please sign in to comment.