This document describes how to integrate the soroswap/token-list repository with the indexer to automatically sync token list changes.
When tokens are added or removed from the Soroswap token list, a GitHub Action in the soroswap/token-list repository should call the indexer API to sync the changes to the database.
Syncs the Soroswap token list from the canonical tokenList.json.
Authentication: x-github-key header with the GitHub Actions API key
Request Body: Full tokenList.json content
Example Request:
curl -X POST \
-H "Content-Type: application/json" \
-H "x-github-key: YOUR_GITHUB_API_KEY" \
-d @tokenList.json \
https://your-indexer-url.com/api/token-lists/soroswap/syncSuccess Response (200):
{
"success": true,
"list_id": "soroswap",
"version": "1.3.4",
"processed": {
"tokens": 33,
"lists": 1,
"memberships": 33
},
"processingTimeMs": 150
}Error Responses:
401 Unauthorized: Missing or invalid API key400 Bad Request: Invalid payload structure500 Internal Server Error: Database or processing error
Add the indexer GitHub API key as a repository secret:
- Go to
soroswap/token-listrepository settings - Navigate to Secrets and variables > Actions
- Click New repository secret
- Name:
INDEXER_GITHUB_API_KEY - Value: The GitHub API key from the indexer configuration
Update .github/workflows/update-token-list.yml to call the indexer after merging the token list:
name: Update Token List
on:
push:
branches:
- main
paths:
- 'assets/**'
jobs:
update-token-list:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: yarn install
- name: Merge token lists
run: yarn merge
- name: Commit updated tokenList.json
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add tokenList.json
git diff --staged --quiet || git commit -m "chore: update tokenList.json"
git push
- name: Sync to Indexer
run: |
response=$(curl -s -w "\n%{http_code}" -X POST \
-H "Content-Type: application/json" \
-H "x-github-key: ${{ secrets.INDEXER_GITHUB_API_KEY }}" \
-d @tokenList.json \
https://your-indexer-url.com/api/token-lists/soroswap/sync)
http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')
echo "Response: $body"
echo "HTTP Status: $http_code"
if [ "$http_code" != "200" ]; then
echo "Failed to sync to indexer"
exit 1
fiFor different environments, you may want to use environment variables or secrets for the indexer URL:
- name: Sync to Indexer
env:
INDEXER_URL: ${{ secrets.INDEXER_URL || 'https://indexer.soroswap.finance' }}
run: |
curl -X POST \
-H "Content-Type: application/json" \
-H "x-github-key: ${{ secrets.INDEXER_GITHUB_API_KEY }}" \
-d @tokenList.json \
"${INDEXER_URL}/api/token-lists/soroswap/sync"The endpoint expects the standard tokenList.json format:
interface TokenListPayload {
name: string; // "Assets curated by Soroswap Protocol"
provider: string; // "Soroswap Protocol"
description?: string;
version: string; // Semantic version, e.g., "1.3.4"
feedback?: string;
network: string; // "mainnet"
assets: Array<{
code: string; // Token symbol, e.g., "USDC"
issuer?: string; // Stellar issuer (G... address), optional
contract: string; // Soroban contract (C... address)
name?: string; // Full name, e.g., "USD Coin"
org?: string; // Organization, e.g., "Centre Consortium LLC"
domain?: string; // e.g., "circle.com"
icon?: string; // Icon URL
decimals: number; // Token decimals, e.g., 7
}>;
}The sync operation performs a full replace:
- All tokens in the payload are upserted (created or updated)
- The token list metadata is updated
- All existing token list memberships for
soroswapare deleted - New memberships are created for all tokens in the payload
This ensures the database always reflects the exact state of tokenList.json.
- Verify the
INDEXER_GITHUB_API_KEYsecret is set correctly - Ensure the header is
x-github-key(notx-api-keyor other)
- Check that
tokenList.jsonis valid JSON - Verify all required fields are present
- Ensure contract addresses match the pattern
C[A-Z0-9]{55}
- Check indexer logs for database connection issues
- Verify the indexer service is running and healthy