Co-authored-by:

This commit is contained in:
defiQUG
2026-06-01 22:26:06 -07:00
parent c67a4d9f35
commit d3ccbb2145
24 changed files with 38 additions and 42 deletions

View File

@@ -41,8 +41,8 @@ The Token Aggregation Service has been extended with:
### Step 1: Database Migrations
```bash
psql $DATABASE_URL -f explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql
psql $DATABASE_URL -f explorer-monorepo/backend/database/migrations/0012_admin_config_schema.up.sql
psql $DATABASE_URL -f ~/projects/explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql
psql $DATABASE_URL -f ~/projects/explorer-monorepo/backend/database/migrations/0012_admin_config_schema.up.sql
```
### Step 2: Deploy to Proxmox

View File

@@ -44,8 +44,8 @@ All components of the Token Aggregation Service have been successfully implement
-`scripts/setup.sh` - Setup script
### Database Files
-`explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql`
-`explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.down.sql`
-`~/projects/explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql`
-`~/projects/explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.down.sql`
### Documentation Files
-`README.md` - Main documentation

View File

@@ -10,7 +10,7 @@ The Token Aggregation Service has been fully implemented according to the plan.
## ✅ Completed Components
### 1. Database Schema
- ✅ Migration file: `explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql`
- ✅ Migration file: `~/projects/explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql`
- ✅ Down migration: `0011_token_aggregation_schema.down.sql`
- ✅ Tables created:
- `token_market_data` - Market metrics per token
@@ -87,7 +87,7 @@ The Token Aggregation Service has been fully implemented according to the plan.
Run the migration in the explorer database:
```bash
# Navigate to explorer backend
cd explorer-monorepo/backend
cd ~/projects/explorer-monorepo/backend
# Run migration (method depends on your migration tool)
# The migration file is at:

View File

@@ -82,8 +82,8 @@ Ensure all frontend files listed above are created.
### 2. Run Database Migrations
```bash
psql $DATABASE_URL -f explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql
psql $DATABASE_URL -f explorer-monorepo/backend/database/migrations/0012_admin_config_schema.up.sql
psql $DATABASE_URL -f ~/projects/explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql
psql $DATABASE_URL -f ~/projects/explorer-monorepo/backend/database/migrations/0012_admin_config_schema.up.sql
```
### 3. Deploy to Proxmox

View File

@@ -90,8 +90,8 @@ Run the migration in your database:
```bash
# From your database host
psql $DATABASE_URL -f explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql
psql $DATABASE_URL -f explorer-monorepo/backend/database/migrations/0012_admin_config_schema.up.sql
psql $DATABASE_URL -f ~/projects/explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql
psql $DATABASE_URL -f ~/projects/explorer-monorepo/backend/database/migrations/0012_admin_config_schema.up.sql
```
### Create Admin User

View File

@@ -32,7 +32,7 @@ Use `https://rpc-http-pub.d-bis.org` only for external/public-only deployments.
### 3. Run Database Migration
```bash
# Navigate to explorer backend and run migration
cd ../../explorer-monorepo/backend
cd ~/projects/explorer-monorepo/backend
# Run migration 0011_token_aggregation_schema.up.sql
```

View File

@@ -33,8 +33,8 @@ nano .env # Edit with your database URL and settings
Or manually:
```bash
psql $DATABASE_URL -f ../../explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql
psql $DATABASE_URL -f ../../explorer-monorepo/backend/database/migrations/0012_admin_config_schema.up.sql
psql $DATABASE_URL -f ~/projects/explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql
psql $DATABASE_URL -f ~/projects/explorer-monorepo/backend/database/migrations/0012_admin_config_schema.up.sql
```
### 3. Create Admin User

View File

@@ -4,7 +4,7 @@ A comprehensive token aggregation service that indexes token info, volume, liqui
**REST API reference:** [docs/REST_API_REFERENCE.md](docs/REST_API_REFERENCE.md) — tokens, pools, prices, volume, OHLCV for dApps and MetaMask Snap discovery.
**Chain 138 Snap:** The MetaMask Chain 138 Snap (companion site at e.g. https://explorer.d-bis.org/snap/) calls this service for market data, swap quotes, and bridge routes. If the Snap is built with `GATSBY_SNAP_API_BASE_URL=https://explorer.d-bis.org`, then explorer.d-bis.org must serve this API (e.g. proxy `/api/v1/*` to this service). Otherwise build the Snap site with `GATSBY_SNAP_API_BASE_URL` set to this services public URL. See [metamask-integration/chain138-snap/docs/CHAIN138_SNAP_TROUBLESHOOTING.md](../../../metamask-integration/chain138-snap/docs/CHAIN138_SNAP_TROUBLESHOOTING.md). **CORS:** The service uses `cors()` (all origins allowed by default) so MetaMask Snap and browser clients can fetch token list and networks.
**Chain 138 Snap:** The MetaMask Chain 138 Snap (companion site at e.g. https://explorer.d-bis.org/snap/) calls this service for market data, swap quotes, and bridge routes. If the Snap is built with `GATSBY_SNAP_API_BASE_URL=https://explorer.d-bis.org`, then explorer.d-bis.org must serve this API (e.g. proxy `/api/v1/*` to this service). Otherwise build the Snap site with `GATSBY_SNAP_API_BASE_URL` set to this services public URL. See [metamask-integration/chain138-snap/docs/CHAIN138_SNAP_TROUBLESHOOTING.md](~/projects/metamask-integration/chain138-snap/docs/CHAIN138_SNAP_TROUBLESHOOTING.md). **CORS:** The service uses `cors()` (all origins allowed by default) so MetaMask Snap and browser clients can fetch token list and networks.
## Features
@@ -97,7 +97,7 @@ The MetaMask Snap bridge dialog always shows the Trustless (Lockbox) route when
5. Run database migrations:
```bash
# Ensure the migration has been run in the explorer database
# Migration file: explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql
# Migration file: ~/projects/explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql
```
6. Build the project:

View File

@@ -31,8 +31,8 @@ The Token Aggregation Service now includes a full-featured Control Panel and Pro
### 1. Database Setup
```bash
# Run migrations
psql $DATABASE_URL -f explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql
psql $DATABASE_URL -f explorer-monorepo/backend/database/migrations/0012_admin_config_schema.up.sql
psql $DATABASE_URL -f ~/projects/explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql
psql $DATABASE_URL -f ~/projects/explorer-monorepo/backend/database/migrations/0012_admin_config_schema.up.sql
```
### 2. Deploy to Proxmox

View File

@@ -17,7 +17,7 @@ CREATE EXTENSION IF NOT EXISTS timescaledb;
2. Run the migration from the explorer database:
```bash
# The migration file is located at:
# explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql
# ~/projects/explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql
```
3. Verify tables were created:

View File

@@ -7,7 +7,7 @@ set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
SERVICE_DIR="$SCRIPT_DIR/.."
MIGRATIONS_DIR="$PROJECT_ROOT/explorer-monorepo/backend/database/migrations"
MIGRATIONS_DIR="$HOME/projects/explorer-monorepo/backend/database/migrations"
echo "=========================================="
echo "Token Aggregation Service - Complete Setup"

View File

@@ -6,7 +6,7 @@ set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
SERVICE_DIR="$SCRIPT_DIR/.."
MIGRATIONS_DIR="$PROJECT_ROOT/explorer-monorepo/backend/database/migrations"
MIGRATIONS_DIR="$HOME/projects/explorer-monorepo/backend/database/migrations"
# Load environment
if [[ -f "$SERVICE_DIR/.env" ]]; then

View File

@@ -43,7 +43,7 @@ fi
# Verify database migration
echo "📊 Verifying database migration..."
echo "⚠️ Please ensure migration 0011_token_aggregation_schema.up.sql has been run"
echo " Location: explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql"
echo " Location: ~/projects/explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql"
echo ""
echo "✅ Setup complete!"

View File

@@ -1,5 +1,6 @@
import { Router, Request, Response } from 'express';
import fs from 'fs';
import os from 'os';
import path from 'path';
import { getNetworks, getConfigByChain, API_VERSION, type NetworkEntry } from '../../config/networks';
import { getCanonicalTokensByChain, getLogoUriForSpec, getTokenRegistryFamily } from '../../config/canonical-tokens';
@@ -103,13 +104,8 @@ function resolveRuntimeNetworksPath(): string | null {
const candidates = uniquePaths([
process.env.NETWORKS_JSON_PATH,
process.env.CONFIG_NETWORKS_JSON_PATH,
path.resolve(process.cwd(), 'explorer-monorepo/backend/api/rest/config/metamask/DUAL_CHAIN_NETWORKS.json'),
path.resolve(process.cwd(), '../explorer-monorepo/backend/api/rest/config/metamask/DUAL_CHAIN_NETWORKS.json'),
path.resolve(process.cwd(), '../../explorer-monorepo/backend/api/rest/config/metamask/DUAL_CHAIN_NETWORKS.json'),
path.resolve(process.cwd(), 'explorer-monorepo/backend/config/metamask/DUAL_CHAIN_NETWORKS.json'),
path.resolve(process.cwd(), '../explorer-monorepo/backend/config/metamask/DUAL_CHAIN_NETWORKS.json'),
path.resolve(process.cwd(), '../../explorer-monorepo/backend/config/metamask/DUAL_CHAIN_NETWORKS.json'),
path.resolve(__dirname, '../../../../../../explorer-monorepo/backend/api/rest/config/metamask/DUAL_CHAIN_NETWORKS.json'),
path.join(os.homedir(), 'projects/explorer-monorepo/backend/api/rest/config/metamask/DUAL_CHAIN_NETWORKS.json'),
path.join(os.homedir(), 'projects/explorer-monorepo/backend/config/metamask/DUAL_CHAIN_NETWORKS.json')
]);
for (const candidate of candidates) {