|
| 1 | +# Token List Fetch Feature |
| 2 | + |
| 3 | +Automated token list management with local and CI execution options. |
| 4 | + |
| 5 | +## Local Usage |
| 6 | + |
| 7 | +Run these commands in order: |
| 8 | + |
| 9 | +```bash |
| 10 | +# 1. Fetch token list from external source |
| 11 | +npm run tokenlist:fetch |
| 12 | + |
| 13 | +# 2. Generate token list files |
| 14 | +npm run generate |
| 15 | + |
| 16 | +# 3. Create PR with changes |
| 17 | +npm run tokenlist:pr |
| 18 | +``` |
| 19 | + |
| 20 | +## CI Usage |
| 21 | + |
| 22 | +Use the GitHub Actions workflow: |
| 23 | + |
| 24 | +1. Go to **Actions** tab |
| 25 | +2. Select **"Token List Fetch"** workflow |
| 26 | +3. Configure inputs: |
| 27 | + - `source_url`: External token list URL |
| 28 | + - `target_token_file`: Local file path |
| 29 | + - `assets_dir`: Logo storage directory |
| 30 | +4. Click **"Run workflow"** |
| 31 | + |
| 32 | +## Environment Variables |
| 33 | + |
| 34 | +| Variable | Purpose | Default | |
| 35 | +| ------------------- | ----------------------- | --------------------------------------------- | |
| 36 | +| `SOURCE_URL` | External token list URL | - | |
| 37 | +| `TARGET_TOKEN_FILE` | Local token file path | `src/tokenlists/balancer/tokens/berachain.ts` | |
| 38 | +| `ASSETS_DIR` | Logo assets directory | `src/assets/images/tokens` | |
| 39 | +| `GITHUB_TOKEN` | PR creation (CI only) | - | |
| 40 | +| `INFURA_KEY` | Blockchain API access | - | |
| 41 | +| `ALCHEMY_KEY` | Alternative API access | - | |
| 42 | + |
| 43 | +## Workflow Steps |
| 44 | + |
| 45 | +1. **Fetch**: Download token list and logos |
| 46 | +2. **Generate**: Process and format token data |
| 47 | +3. **Detect Changes**: Compare with existing files |
| 48 | +4. **Create PR**: If changes found, create pull request |
| 49 | +5. **Add Comment**: Include workflow metadata |
| 50 | + |
| 51 | +## Required Secrets (CI) |
| 52 | + |
| 53 | +- `GITHUB_TOKEN`: Repository access |
| 54 | +- `INFURA_KEY`: Blockchain API |
| 55 | +- `ALCHEMY_KEY`: Alternative API |
| 56 | + |
| 57 | +## Troubleshooting |
| 58 | + |
| 59 | +- **No changes detected**: Source data unchanged or wrong paths |
| 60 | +- **PR creation fails**: Check `GITHUB_TOKEN` secret |
| 61 | +- **Fetch fails**: Verify source URL accessibility |
0 commit comments