Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: create new token #129

Merged
merged 34 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
cec5647
chore: create new token
SGiaccobasso Sep 23, 2024
9ad979d
Merge branch 'feat/new-tokens-validation' into test/action
SGiaccobasso Sep 23, 2024
6163831
chore: update yml
SGiaccobasso Sep 23, 2024
ab63736
chore: update yml
SGiaccobasso Sep 23, 2024
aa561e0
chore: update yml
SGiaccobasso Sep 23, 2024
4966773
chore: update yml
SGiaccobasso Sep 23, 2024
4635289
chore: update yml
SGiaccobasso Sep 24, 2024
f0236f4
chore: update yml
SGiaccobasso Sep 24, 2024
2d9ca8a
chore: update yml
SGiaccobasso Sep 24, 2024
d617825
chore: update script
SGiaccobasso Sep 24, 2024
b0ac587
chore: update script
SGiaccobasso Sep 24, 2024
ee553be
chore: add test token
SGiaccobasso Sep 24, 2024
55df272
chore: change order of tests
SGiaccobasso Sep 24, 2024
10d2503
chore: ethers import
SGiaccobasso Sep 24, 2024
779234c
chore: change ethers version
SGiaccobasso Sep 24, 2024
0cc9efc
chore: change ethers version
SGiaccobasso Sep 24, 2024
4881ed0
chore: change ethers version
SGiaccobasso Sep 24, 2024
727756d
chore: change ethers version
SGiaccobasso Sep 24, 2024
99c6d25
chore: change ethers version
SGiaccobasso Sep 24, 2024
6787e0d
chore: change ethers version
SGiaccobasso Sep 24, 2024
75d3c8f
chore: node v
SGiaccobasso Sep 24, 2024
1c4f090
chore: node v
SGiaccobasso Sep 24, 2024
a6c63d7
chore: node v
SGiaccobasso Sep 24, 2024
8a5667d
chore: node v
SGiaccobasso Sep 24, 2024
acde4ec
chore: node v
SGiaccobasso Sep 24, 2024
94a64cd
chore: node v
SGiaccobasso Sep 24, 2024
77cbb8f
chore: node v
SGiaccobasso Sep 24, 2024
19f13e2
chore: node v
SGiaccobasso Sep 24, 2024
632fa82
chore: node v
SGiaccobasso Sep 24, 2024
dfeab94
chore: node v
SGiaccobasso Sep 24, 2024
02084c6
chore: node v
SGiaccobasso Sep 24, 2024
bb77c7a
chore: node v
SGiaccobasso Sep 24, 2024
ed5d2ee
chore: local validation
SGiaccobasso Sep 24, 2024
b370672
chore: remove test token
SGiaccobasso Sep 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions .github/workflows/validate-tokens.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,33 @@ jobs:
validate-tokens:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Use Node.js
uses: actions/setup-node@v2
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
node-version: "16"
bun-version: latest

- name: Install dependencies
run: |
npm install [email protected]
npm install axios
run: bun install

- name: Extract and validate new tokens
run: |
DIFF=$(git diff origin/${{ github.base_ref }} -- registry/mainnet/interchain/squid.tokenlist.json | grep '^+' | grep -v '+++')
NEW_TOKENS=$(echo "$DIFF" | sed -n '/"0x/,/]/{/]/q;p}' | jq -s 'reduce .[] as $item ({}; . + ($item | fromjson))')
echo "$NEW_TOKENS" > new_tokens.json
node scripts/validate-token-configs.js
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

- 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
bun run - <<EOF
import * as fs from 'fs/promises';

const base = JSON.parse(await fs.readFile('base_file.json', 'utf8'));
const current = JSON.parse(await fs.readFile('current_file.json', 'utf8'));
const newTokens = Object.entries(current.tokens)
.filter(([id, token]) => !base.tokens[id])
.reduce((obj, [id, token]) => ({ ...obj, [id]: token }), {});
await fs.writeFile('new_tokens.json', JSON.stringify(newTokens, null, 2));
EOF

bun run scripts/validate-token-configs.ts
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"codegen:chains": "bun run scripts/codegen-chains.ts",
"codegen": "bun run codegen:schemas && bun run codegen:chains",
"test": "vitest --run",
"prepare": "husky install"
"prepare": "husky install",
"validate": "bun run scripts/run-validation.ts"
},
"keywords": [
"axelar",
Expand All @@ -20,7 +21,9 @@
],
"license": "LicenseRef-LICENSE",
"dependencies": {
"@inquirer/prompts": "^4.3.0"
"@inquirer/prompts": "^4.3.0",
"ethers": "^6.13.2",
"axios": "^1.6.7"
},
"devDependencies": {
"@axelarjs/utils": "^0.1.12",
Expand Down
Loading
Loading