Skip to content

Commit 919c828

Browse files
authored
Merge pull request #341 from gnosischain/develop
fix: indexer for receiver address. chore: linter, remove subgraph
2 parents efd2ef2 + 71ee913 commit 919c828

File tree

141 files changed

+6576
-13695
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+6576
-13695
lines changed

.devcontainer/devcontainer.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "Unified Bridge (Node 22 + Claude Code)",
3+
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm",
4+
"remoteUser": "node",
5+
"features": {
6+
"ghcr.io/devcontainers/features/git:1": {
7+
"version": "latest"
8+
},
9+
"ghcr.io/devcontainers/features/github-cli:1": {
10+
"version": "latest"
11+
}
12+
},
13+
"remoteEnv": {
14+
"PATH": "/home/node/.local/bin:${containerEnv:PATH}"
15+
},
16+
"postCreateCommand": "bash .devcontainer/post-create.sh",
17+
"customizations": {
18+
"vscode": {
19+
"extensions": [
20+
"dbaeumer.vscode-eslint",
21+
"esbenp.prettier-vscode"
22+
]
23+
}
24+
},
25+
"forwardPorts": [3000],
26+
"portsAttributes": {
27+
"3000": {
28+
"label": "Next.js (pnpm app:dev)",
29+
"onAutoForward": "notify"
30+
}
31+
}
32+
}

.devcontainer/post-create.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
cd "$ROOT"
6+
7+
# Claude Code — optional; Docker proxies / offline builds often block claude.ai.
8+
if curl -fsSL https://claude.ai/install.sh | bash -s stable; then
9+
echo "Claude Code installed. Run 'claude' to sign in."
10+
else
11+
echo "Warning: Claude Code install failed (network/proxy). You can install it later inside the container." >&2
12+
fi
13+
14+
# Avoid `corepack enable` as non-root: it tries to symlink into /usr/local/bin and often exits EACCES.
15+
corepack prepare pnpm@9.6.0 --activate || npm install -g pnpm@9.6.0
16+
17+
pnpm install --frozen-lockfile
18+
19+
if ! grep -q '\.local/bin' ~/.bashrc 2>/dev/null; then
20+
printf '\nexport PATH="$HOME/.local/bin:$PATH"\n' >> ~/.bashrc
21+
fi
22+
23+
echo "Dev container setup finished."

.github/workflows/bridge-explorer-develop-staging.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,6 @@ jobs:
112112
"NEXT_PUBLIC_RPC_GNOSIS=${{ secrets.DEV_RPC_GNOSIS }}"
113113
"NEXT_PUBLIC_WALLET_CONNECT_DAPP_URL=${{ secrets.WALLET_CONNECT_URL }}"
114114
"NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=${{ secrets.WALLET_CONNECT_PROJECT_ID }}"
115-
"NEXT_PUBLIC_SUBGRAPH_ENVIRONMENT=development"
116-
"NEXT_PUBLIC_SUBGRAPH_ACCESS_ID=${{ secrets.GRAPH_ORG }}"
117-
"NEXT_PUBLIC_SUBGRAPH_CHAINS_RESOURCE_IDS=100:version/latest,1:version/latest"
118115
"NEXT_PUBLIC_ALCHEMY_API_KEY=${{ secrets.DEV_NEXT_PUBLIC_ALCHEMY_API_KEY }}"
119116
"NEXT_PUBLIC_ENVIO_INDEXER_URL=${{ secrets.DEV_ENVIO_INDEXER_URL }}"
120117
"NEXT_PUBLIC_INDEXER_BACKEND=${{ secrets.DEV_INDEXER_BACKEND }}"
@@ -138,9 +135,6 @@ jobs:
138135
"NEXT_PUBLIC_RPC_GNOSIS=${{ secrets.PROD_RPC_GNOSIS }}"
139136
"NEXT_PUBLIC_WALLET_CONNECT_DAPP_URL=${{ secrets.WALLET_CONNECT_URL }}"
140137
"NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=${{ secrets.WALLET_CONNECT_PROJECT_ID }}"
141-
"NEXT_PUBLIC_SUBGRAPH_ENVIRONMENT=production"
142-
"NEXT_PUBLIC_SUBGRAPH_ACCESS_ID=${{ secrets.THEGRAPH_READ_API_KEY }}"
143-
"NEXT_PUBLIC_SUBGRAPH_CHAINS_RESOURCE_IDS=100:2ths6FTZhCBggnyakh7PL5KH91zjRv8xPNfzaCRKogJ,1:9W7Ye5xFfefNYDxXD4StqAuj7TU8eLq5PLmuPUnhFbeQ"
144138
"NEXT_PUBLIC_ALCHEMY_API_KEY=${{ secrets.PROD_NEXT_PUBLIC_ALCHEMY_API_KEY }}"
145139
"NEXT_PUBLIC_ENVIO_INDEXER_URL=${{ secrets.PROD_ENVIO_INDEXER_URL }}"
146140
"NEXT_PUBLIC_INDEXER_BACKEND=${{ secrets.PROD_INDEXER_BACKEND }}"

.github/workflows/publish-ghcr-image-release.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ jobs:
8787
"NEXT_PUBLIC_RPC_GNOSIS=${{ secrets.PROD_RPC_GNOSIS }}"
8888
"NEXT_PUBLIC_WALLET_CONNECT_DAPP_URL=${{ secrets.WALLET_CONNECT_URL }}"
8989
"NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=${{ secrets.WALLET_CONNECT_PROJECT_ID }}"
90-
"NEXT_PUBLIC_SUBGRAPH_ENVIRONMENT=production"
91-
"NEXT_PUBLIC_SUBGRAPH_ACCESS_ID=${{ secrets.THEGRAPH_READ_API_KEY }}"
92-
"NEXT_PUBLIC_SUBGRAPH_CHAINS_RESOURCE_IDS=100:2ths6FTZhCBggnyakh7PL5KH91zjRv8xPNfzaCRKogJ,1:9W7Ye5xFfefNYDxXD4StqAuj7TU8eLq5PLmuPUnhFbeQ"
9390
"NEXT_PUBLIC_ALCHEMY_API_KEY=${{ secrets.PROD_NEXT_PUBLIC_ALCHEMY_API_KEY }}"
9491
"NEXT_PUBLIC_ENVIO_INDEXER_URL=${{ secrets.PROD_ENVIO_INDEXER_URL }}"
9592
"NEXT_PUBLIC_INDEXER_BACKEND=${{ secrets.PROD_INDEXER_BACKEND }}"

.github/workflows/thegraph_dev_deploy.yml

Lines changed: 0 additions & 93 deletions
This file was deleted.

.github/workflows/thegraph_prod_deploy.yml

Lines changed: 0 additions & 103 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.local
22
.env
33
.env.local
4-
node_modules
4+
node_modules
5+
settings.local.json
6+
.pnpm-store

CLAUDE.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Overview
6+
7+
This is a monorepo for the **Gnosis Bridge Monitor** — a real-time bridge transaction explorer for Gnosis Chain. It includes:
8+
- `/app` — Next.js frontend (bridge explorer UI)
9+
- `/envio-indexer` — Envio blockchain indexer (real-time event indexing via GraphQL)
10+
- `/alerts` — Slack alert system for validator balances and bridge limits
11+
- `/tests` — Test plans and records
12+
13+
## Common Commands
14+
15+
All commands run from the repo root using pnpm workspaces, or from within the package directory.
16+
17+
### Frontend (`/app`)
18+
```bash
19+
pnpm app:dev # Start Next.js dev server
20+
pnpm app:build # Production build
21+
pnpm app:lint # Lint (ESLint + Prettier)
22+
pnpm app:lint:fix # Auto-fix lint issues
23+
cd app && pnpm typechain # Regenerate TypeChain types from ABIs
24+
```
25+
26+
### Indexer (`/envio-indexer`)
27+
```bash
28+
pnpm indexer:dev # Start indexer in dev mode
29+
pnpm indexer:codegen # Regenerate types from config.yaml
30+
cd envio-indexer && pnpm mocha # Run indexer tests
31+
```
32+
33+
### Alerts (`/alerts`)
34+
```bash
35+
cd alerts && pnpm dev # Run alerts service with ts-node
36+
cd alerts && pnpm build # Compile TypeScript
37+
```
38+
39+
## Architecture
40+
41+
### Frontend (`/app/src/`)
42+
43+
**Tech stack:** Next.js 15 + React 18, Ethers.js v5 (legacy) + Viem v2 (modern), Web3Onboard v2 (wallet), Styled Components, SWR (data fetching), TypeChain (contract types).
44+
45+
**Key structural patterns:**
46+
- Pages in `/app/pages/bridge-explorer/` — each route has a corresponding `pagePartials/` folder for page-specific components
47+
- `NextPageWithLayout` pattern for per-page layouts; `SingleColumnLayout` is the default
48+
- Provider tree in `_app.tsx`: `Web3ConnectionProvider` (dynamic/no-SSR) → `ThemeProvider``TransactionNotificationProvider``TokenListProvider``ValidatorsProvider`
49+
- Contract ABIs live in `src/abis/` and generate TypeChain types via `pnpm typechain`
50+
- Bridge and chain configuration is centralized in `src/constants/` (bridges, validators, chains, contracts)
51+
52+
**Bridge types supported:**
53+
- XDAI Bridge: native token bridge (DAI/USDS)
54+
- OmniBridge (AMB): multi-token bridge (USDC, USDT, ERC-20s)
55+
- USDC Transmuter: handles USDC variant bridging
56+
57+
### Indexer (`/envio-indexer/`)
58+
59+
**Tech stack:** Envio v2, Viem, TypeScript, Mocha/Chai for tests.
60+
61+
The indexer tracks bridge transaction lifecycle via on-chain events:
62+
1. `UserRequestForSignature` — bridge initiated
63+
2. `SignedForUserRequest` — validator signed
64+
3. `CollectedSignatures` — threshold reached
65+
4. `AffirmationCompleted` — executed on destination
66+
67+
Configuration is in `config.yaml` (networks, contract addresses, event signatures, start blocks). The `schema.graphql` defines the GraphQL API consumed by the frontend. Run `pnpm indexer:codegen` after changing either file.
68+
69+
Generated code lives in `generated/` — do not edit manually.
70+
71+
### Data Flow
72+
73+
Frontend (`SWR` hooks) → Envio GraphQL API (`NEXT_PUBLIC_ENVIO_INDEXER_URL`) → Indexed on-chain events → Bridge contracts on Ethereum (chain 1) and Gnosis Chain (chain 100).
74+
75+
## Environment Setup
76+
77+
Copy and fill `.env.example` files:
78+
- `app/.env.local` — requires RPC URLs, WalletConnect project ID, Envio indexer GraphQL URL
79+
- `alerts/.env` — requires Slack token/channel, RPC URLs, subgraph URLs
80+
81+
Node version is pinned in `.nvmrc` (v22.11.0). Use `nvm use` before installing.
82+
83+
## Git Workflow
84+
85+
- Feature branches are created from `develop`
86+
- PRs target `develop` → promoted to `staging``main` (production)
87+
- Conventional Commits are enforced via commitlint (pre-commit hook)
88+
- Pre-commit hooks (Husky + lint-staged) run ESLint fix, Prettier, and `tsc` on staged files

0 commit comments

Comments
 (0)