chore: create new token #24
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Validate New Token Configurations | |
on: | |
pull_request: | |
paths: | |
- "registry/mainnet/interchain/squid.tokenlist.json" | |
jobs: | |
validate-tokens: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "16" | |
- name: Install dependencies | |
run: | | |
npm install ethers@6.13.2 | |
npm install axios | |
- name: Extract and validate new tokens | |
run: | | |
git fetch origin ${{ github.base_ref }} | |
git show origin/${{ github.base_ref }}:registry/mainnet/interchain/squid.tokenlist.json > base_file.json | |
cp registry/mainnet/interchain/squid.tokenlist.json current_file.json | |
node -e " | |
const fs = require('fs'); | |
const base = JSON.parse(fs.readFileSync('base_file.json', 'utf8')); | |
const current = JSON.parse(fs.readFileSync('current_file.json', 'utf8')); | |
const newTokens = Object.entries(current.tokens) | |
.filter(([id, token]) => !base.tokens[id]) | |
.reduce((obj, [id, token]) => ({ ...obj, [id]: token }), {}); | |
fs.writeFileSync('new_tokens.json', JSON.stringify(newTokens, null, 2)); | |
" | |
node scripts/validate-token-configs.js | |
- name: Check validation results | |
run: | | |
if [ -f validation_errors.txt ]; then | |
echo "Validation errors found:" | |
cat validation_errors.txt | |
exit 1 | |
else | |
echo "All new token configurations are valid." | |
fi |