Files
proxmox/scripts/export-all-token-reports-for-publication.sh
defiQUG b3a8fe4496
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
chore: sync all changes to Gitea
- Config, docs, scripts, and backup manifests
- Submodule refs unchanged (m = modified content in submodules)

Made-with: Cursor
2026-03-02 11:37:34 -08:00

70 lines
2.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Export all token reports (CoinGecko, CMC, token-list) for all supported chains.
# Use for CoinGecko/CMC submission and publication.
#
# Prerequisites: Token-aggregation API reachable at API_BASE (e.g. https://explorer.d-bis.org)
# Usage: ./scripts/export-all-token-reports-for-publication.sh [API_BASE]
#
# Output: docs/04-configuration/coingecko/exports/ (created if missing)
set -euo pipefail
API_BASE="${1:-https://explorer.d-bis.org}"
OUTPUT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/docs/04-configuration/coingecko/exports"
mkdir -p "$OUTPUT_DIR"
# All chains from token-aggregation chains.ts
CHAINS=(138 651940 1 56 137 100 10 42161 8453 43114 25 42220 1111)
echo "Exporting token reports from $API_BASE to $OUTPUT_DIR"
echo ""
for chain in "${CHAINS[@]}"; do
echo "Chain $chain:"
curl -sS -L --connect-timeout 15 --max-time 60 \
"${API_BASE}/api/v1/report/coingecko?chainId=${chain}" \
-o "${OUTPUT_DIR}/report-coingecko-${chain}.json" 2>/dev/null || true
curl -sS -L --connect-timeout 15 --max-time 60 \
"${API_BASE}/api/v1/report/cmc?chainId=${chain}" \
-o "${OUTPUT_DIR}/report-cmc-${chain}.json" 2>/dev/null || true
if [ -s "${OUTPUT_DIR}/report-coingecko-${chain}.json" ]; then
count=$(jq -r '.tokens | length' "${OUTPUT_DIR}/report-coingecko-${chain}.json" 2>/dev/null || echo "?")
echo " coingecko: $count tokens"
else
echo " coingecko: (empty or failed)"
fi
if [ -s "${OUTPUT_DIR}/report-cmc-${chain}.json" ]; then
count=$(jq -r '.tokens | length' "${OUTPUT_DIR}/report-cmc-${chain}.json" 2>/dev/null || echo "?")
echo " cmc: $count tokens"
else
echo " cmc: (empty or failed)"
fi
done
echo ""
echo "Unified token list (all chains):"
curl -sS -L --connect-timeout 15 --max-time 60 \
"${API_BASE}/api/v1/report/token-list" \
-o "${OUTPUT_DIR}/token-list-all.json" 2>/dev/null || true
if [ -s "${OUTPUT_DIR}/token-list-all.json" ]; then
count=$(jq -r '.tokens | length' "${OUTPUT_DIR}/token-list-all.json" 2>/dev/null || echo "?")
echo " token-list: $count tokens"
else
echo " token-list: (empty or failed)"
fi
echo ""
echo "Cross-chain report (Chain 138):"
curl -sS -L --connect-timeout 15 --max-time 60 \
"${API_BASE}/api/v1/report/cross-chain?chainId=138" \
-o "${OUTPUT_DIR}/report-cross-chain-138.json" 2>/dev/null || true
if [ -s "${OUTPUT_DIR}/report-cross-chain-138.json" ]; then
echo " cross-chain: exported"
else
echo " cross-chain: (empty or failed)"
fi
echo ""
echo "Done. Exports in $OUTPUT_DIR"
echo "Use for: CoinGecko/CMC submission, DefiLlama, LiFi, etc. See docs/04-configuration/PUBLICATION_LOCATIONS_MASTER.md"