-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: validation script to run when new tokens are pushed
- Loading branch information
1 parent
6f92255
commit 08ff230
Showing
2 changed files
with
406 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
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 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
|
||
- name: Install dependencies | ||
run: | | ||
npm install -g typescript | ||
npm install ethers@5.7.2 | ||
npm install viem | ||
npm install axios | ||
npm install fs | ||
npm install @types/node | ||
- name: Compile TypeScript | ||
run: tsc validate-token-configs.ts | ||
|
||
- 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 validate-token-configs.ts | ||
- 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 |
Oops, something went wrong.