diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b63b8228359a..65590028360b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -116,6 +116,9 @@ importers: '@emotion/react': specifier: ^11.14.0 version: 11.14.0(@types/react@18.3.28)(react@18.3.1) + '@graphprotocol/address-book': + specifier: ^1.2.0 + version: 1.2.0 '@graphprotocol/contracts': specifier: ^7.3.0 version: 7.3.0 @@ -1408,6 +1411,9 @@ packages: '@formatjs/intl-localematcher@0.5.10': resolution: {integrity: sha512-af3qATX+m4Rnd9+wHcjJ4w2ijq+rAVP3CCinJQvFv1kgSu1W6jypUmvleJxcewdxmutM8dmIRZFxO/IQBZmP2Q==} + '@graphprotocol/address-book@1.2.0': + resolution: {integrity: sha512-eJgZ0b/BSe3tzXRbrIImjh63NfGwZ3BA71TESvDWE6tB84D6PqbZ7/E4cA1VLPQi3ge1DQ8I+LpypjDOjhKp2A==} + '@graphprotocol/contracts@7.3.0': resolution: {integrity: sha512-uEjgrBN4WCkJhSrUi5O64cNbU5OWI7iwy/03Er9n+J7o3WEspizpLJvSGXql8E0XtI0ygBaHBTwJfPo7SUphkg==} @@ -9086,6 +9092,8 @@ snapshots: dependencies: tslib: 2.8.1 + '@graphprotocol/address-book@1.2.0': {} + '@graphprotocol/contracts@7.3.0': {} '@graphql-typed-document-node/core@3.2.0(graphql@16.14.0)': @@ -10238,7 +10246,7 @@ snapshots: '@scure/bip32@1.7.0': dependencies: - '@noble/curves': 1.9.1 + '@noble/curves': 1.9.7 '@noble/hashes': 1.8.0 '@scure/base': 1.2.6 @@ -11075,6 +11083,11 @@ snapshots: typescript: 5.9.3 zod: 3.25.76 + abitype@1.2.4(typescript@5.9.3)(zod@3.25.76): + optionalDependencies: + typescript: 5.9.3 + zod: 3.25.76 + abitype@1.2.4(typescript@5.9.3)(zod@4.4.3): optionalDependencies: typescript: 5.9.3 @@ -14571,7 +14584,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.2.3(typescript@5.9.3)(zod@3.25.76) + abitype: 1.2.4(typescript@5.9.3)(zod@3.25.76) eventemitter3: 5.0.1 optionalDependencies: typescript: 5.9.3 diff --git a/website/package.json b/website/package.json index 4bef115036d8..577db38d2d1f 100644 --- a/website/package.json +++ b/website/package.json @@ -22,6 +22,7 @@ "@edgeandnode/gds": "^6.9.0", "@edgeandnode/go": "^10.5.1", "@emotion/react": "^11.14.0", + "@graphprotocol/address-book": "^1.2.0", "@graphprotocol/contracts": "^7.3.0", "@pinax/graph-networks-registry": "^0.7.1", "@react-hookz/web": "^25.2.0", diff --git a/website/src/contracts.tsx b/website/src/contracts.tsx index 6db3c4f2f04b..59a45e01fca4 100644 --- a/website/src/contracts.tsx +++ b/website/src/contracts.tsx @@ -1,3 +1,6 @@ +import HorizonAddresses from '@graphprotocol/address-book/horizon/addresses.json' +import IssuanceAddresses from '@graphprotocol/address-book/issuance/addresses.json' +import SubgraphServiceAddresses from '@graphprotocol/address-book/subgraph-service/addresses.json' import ContractAddresses from '@graphprotocol/contracts/addresses.json' import { getAddressLink } from '@edgeandnode/common' @@ -7,14 +10,38 @@ import { Table } from '@/components' import { useI18n } from '@/i18n' type ValueOf = T[keyof T] + +/** + * Legacy protocol contracts (Ethereum Mainnet, Sepolia) sourced from `@graphprotocol/contracts`. + * The new Horizon deployments on Arbitrum live in `@graphprotocol/address-book` (see below). + */ const contractsByNetworkId = ContractAddresses as Record> -export function ProtocolContractsTable({ networkId }: { networkId: number }) { +/** + * Horizon-era contracts (Arbitrum One, Arbitrum Sepolia) sourced from `@graphprotocol/address-book`. + * Each package file is keyed by chain ID, then by contract name. Reading straight from the package + * means new deployments are picked up automatically whenever the dependency is bumped. + */ +type AddressBookEntry = { address: string } +type AddressBook = Record> + +export const addressBookPackages = { + horizon: HorizonAddresses as AddressBook, + 'subgraph-service': SubgraphServiceAddresses as AddressBook, + issuance: IssuanceAddresses as AddressBook, +} + +export type AddressBookPackage = keyof typeof addressBookPackages + +/** Shared name + address table used by both the legacy and address-book sources. */ +function ContractsTable({ + networkId, + contracts, +}: { + networkId: number + contracts: { name: string; address: string }[] +}) { const { t } = useI18n() - const contracts = Object.entries(contractsByNetworkId[`${networkId}`] ?? {}).map(([name, contract]) => ({ - ...contract, - name, - })) return ( @@ -34,3 +61,22 @@ export function ProtocolContractsTable({ networkId }: { networkId: number }) {
) } + +/** Legacy protocol contracts for a given network, from `@graphprotocol/contracts`. */ +export function ProtocolContractsTable({ networkId }: { networkId: number }) { + const contracts = Object.entries(contractsByNetworkId[`${networkId}`] ?? {}).map(([name, contract]) => ({ + name, + address: contract.address, + })) + return +} + +/** Horizon-era contracts for a given network and package, from `@graphprotocol/address-book`. */ +export function HorizonContractsTable({ networkId, product }: { networkId: number; product: AddressBookPackage }) { + const contracts = Object.entries(addressBookPackages[product][`${networkId}`] ?? {}).map(([name, contract]) => ({ + name, + address: contract.address, + })) + if (contracts.length === 0) return null + return +} diff --git a/website/src/pages/en/contracts.mdx b/website/src/pages/en/contracts.mdx index d9b51ac8b3cb..c0cdb9a55630 100644 --- a/website/src/pages/en/contracts.mdx +++ b/website/src/pages/en/contracts.mdx @@ -2,28 +2,48 @@ title: Protocol Contracts --- -import { ProtocolContractsTable } from '@/contracts' +import { HorizonContractsTable, ProtocolContractsTable } from '@/contracts' -Below are the deployed contracts which power The Graph Network. Visit the official [contracts repository](https://github.com/graphprotocol/contracts) to learn more. +Below are the deployed contracts which power The Graph Network. The Arbitrum contracts are sourced directly from the [`@graphprotocol/address-book`](https://www.npmjs.com/package/@graphprotocol/address-book) package, so they stay current with each release. Visit the official [contracts repository](https://github.com/graphprotocol/contracts) to learn more. ## Arbitrum One This is the principal deployment of The Graph Network. - +### Horizon -## Ethereum Mainnet + -This was the original deployment of The Graph Network. Learn more about The Graph's scaling with Arbitrum. +### Subgraph Service - + + +### Issuance + + ## Arbitrum Sepolia This is the primary testnet for The Graph Network. Testnet is predominantly used by core developers and ecosystem participants for testing purposes. There are no guarantees of service or availability on The Graph's testnets. - +### Horizon + + + +### Subgraph Service + + + +### Issuance + + + +## Ethereum Mainnet + +This was the original deployment of The Graph Network. Learn more about The Graph's scaling with Arbitrum. + + -## Sepolia +## Ethereum Sepolia