From fb667cd2eaab2f332e23710fe625e15ded76dc53 Mon Sep 17 00:00:00 2001 From: Alexey Samosadov Date: Sun, 8 Feb 2026 03:09:17 +0300 Subject: [PATCH] feat(indexer): add separate providers folder for testnet Add providers-testnet folder and update indexer to use environment-based folder selection for provider metadata. Changes: - New providers-testnet/ folder with _example.json and README.md - Updated aggregate-providers.ts to support PROVIDERS_DIR env var - Updated bootstrap.sh to set PROVIDERS_DIR based on deployment environment Closes #5 --- atp-indexer/bootstrap.sh | 8 +++++ atp-indexer/scripts/aggregate-providers.ts | 7 +++- providers-testnet/README.md | 40 ++++++++++++++++++++++ providers-testnet/_example.json | 10 ++++++ 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 providers-testnet/README.md create mode 100644 providers-testnet/_example.json diff --git a/atp-indexer/bootstrap.sh b/atp-indexer/bootstrap.sh index 1b2e9395d..a4449602f 100755 --- a/atp-indexer/bootstrap.sh +++ b/atp-indexer/bootstrap.sh @@ -325,6 +325,14 @@ function deploy() { fi yarn install --frozen-lockfile + + # Use providers-testnet folder for testnet, providers for prod + if [ "$infra_environment" = "testnet" ]; then + export PROVIDERS_DIR="providers-testnet" + else + export PROVIDERS_DIR="providers" + fi + log_step "Using providers directory: $PROVIDERS_DIR" yarn bootstrap # Load contract addresses from environment variables or JSON file diff --git a/atp-indexer/scripts/aggregate-providers.ts b/atp-indexer/scripts/aggregate-providers.ts index 7605509b4..175a8b76b 100644 --- a/atp-indexer/scripts/aggregate-providers.ts +++ b/atp-indexer/scripts/aggregate-providers.ts @@ -103,10 +103,15 @@ function normalizeProvider(metadata: any, filename: string): ProviderMetadata | * Aggregate all provider metadata files into a single JSON file */ function aggregateProviders() { - const providersDir = join(__dirname, '../../providers'); + // Allow overriding the providers directory via environment variable + // Defaults to 'providers' for production + const providersFolderName = process.env.PROVIDERS_DIR || 'providers'; + const providersDir = join(__dirname, '../..', providersFolderName); const outputDir = join(__dirname, '../src/api/data'); const outputFile = join(outputDir, 'providers.json'); + console.log(`Using providers directory: ${providersDir}`); + const providerMap = new Map(); let skippedCount = 0; let duplicateCount = 0; diff --git a/providers-testnet/README.md b/providers-testnet/README.md new file mode 100644 index 000000000..6f7f686f0 --- /dev/null +++ b/providers-testnet/README.md @@ -0,0 +1,40 @@ +# Providers (Testnet) + +Provider metadata for the **testnet** staking dashboard deployment. + +> **Note:** This folder is used for testnet deployments. For production providers, see the `providers/` folder. + +## File Structure + +File name format: `{providerId}-{provider-name}.json` + +Example: `1-aztec-foundation.json` + +```json +{ + "providerId": 1, + "providerName": "Aztec Foundation", + "providerDescription": "Brief description of the provider", + "providerEmail": "contact@provider.com", + "providerWebsite": "https://provider.com", + "providerLogoUrl": "https://provider.com/logo.png", + "discordUsername": "username", + "providerSelfStake": ["0x1234...", "0x5678..."] +} +``` + +## Adding a Provider + +1. Copy `_example.json` to `{providerId}-{provider-name}.json` +2. Fill in your details +3. Submit a pull request + +## Rules + +**Required:** `providerId` must match on-chain registration and be unique. + +**Optional:** All other fields are optional. Invalid or missing fields will display as empty on the dashboard. + +**Self-stake:** `providerSelfStake` is an optional array of attester addresses for sequencers the provider directly stakes. Omit this field if empty. + +**Duplicates:** If multiple files have the same `providerId`, only the first file (alphabetically) will be used. diff --git a/providers-testnet/_example.json b/providers-testnet/_example.json new file mode 100644 index 000000000..f356992d5 --- /dev/null +++ b/providers-testnet/_example.json @@ -0,0 +1,10 @@ +{ + "providerId": 0, + "providerName": "", + "providerDescription": "", + "providerEmail": "", + "providerWebsite": "", + "providerLogoUrl": "", + "discordUsername": "", + "providerSelfStake": ["0x..."] +} \ No newline at end of file