forked from rango-exchange/token-list
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add script for generating rango custom token list
- Loading branch information
Showing
7 changed files
with
255 additions
and
12 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
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,80 @@ | ||
{ | ||
"name": "Rango Custom Token List", | ||
"logoURI": "", | ||
"keywords": ["rango", "list"], | ||
"timestamp": "2023-08-23T12:15:28.176Z", | ||
"version": { | ||
"major": 1, | ||
"minor": 1, | ||
"patch": 1 | ||
}, | ||
"tags": {}, | ||
"tokens": [ | ||
[ | ||
{ | ||
"name": "BIFI", | ||
"address": "0x4e720dd3ac5cfe1e1fbde4935f386bb1c66f4642", | ||
"symbol": "BIFI", | ||
"decimals": 18, | ||
"chainId": 10, | ||
"logoURI": "https://raw.githubusercontent.com/rango-exchange/rango-token-list/main/tokens/custom/bifi/icon.png" | ||
} | ||
], | ||
[ | ||
{ | ||
"name": "Flash 3.0", | ||
"symbol": "FLASH", | ||
"address": "0xBb19DA2482308ec02a242ACED4Fe0f09D06b12A7", | ||
"chainId": 1, | ||
"decimals": 18, | ||
"logoURI": "https://raw.githubusercontent.com/rango-exchange/rango-token-list/main/tokens/custom/flash/icon.png" | ||
} | ||
], | ||
[ | ||
{ | ||
"name": "Godzilla Project Token", | ||
"symbol": "GODZ", | ||
"address": "0xae7cf30e14e132e43689ebe4fab49706c59a0bf7", | ||
"chainId": 56, | ||
"decimals": 9, | ||
"logoURI": "https://raw.githubusercontent.com/rango-exchange/rango-token-list/main/tokens/custom/godzilla/icon.png" | ||
} | ||
], | ||
[ | ||
{ | ||
"name": "KAXAA", | ||
"symbol": "KAX", | ||
"address": "0x42aF7aAc6AE6425Ffa96370cFD0B12522Aa4b458", | ||
"chainId": 137, | ||
"decimals": 18, | ||
"logoURI": "https://raw.githubusercontent.com/rango-exchange/rango-token-list/main/tokens/custom/kaxaa/icon.png" | ||
} | ||
], | ||
[ | ||
{ | ||
"name": "Rocket Vault RocketX", | ||
"symbol": "RVF", | ||
"address": "0xdc8aF07A7861bedD104B8093Ae3e9376fc8596D2", | ||
"chainId": 1, | ||
"decimals": 18, | ||
"logoURI": "https://raw.githubusercontent.com/rango-exchange/rango-token-list/main/tokens/custom/rocketx/icon.png" | ||
}, | ||
{ | ||
"name": "Rocket Vault RocketX", | ||
"symbol": "RVF", | ||
"address": "0x872a34Ebb2d54Af86827810EeBC7b9dC6B2144aA", | ||
"chainId": 56, | ||
"decimals": 18, | ||
"logoURI": "https://raw.githubusercontent.com/rango-exchange/rango-token-list/main/tokens/custom/rocketx/icon.png" | ||
}, | ||
{ | ||
"name": "Rocket Vault RocketX", | ||
"symbol": "RVF", | ||
"address": "0x2CE13E4199443FDfFF531ABb30c9B6594446bbC7", | ||
"chainId": 137, | ||
"decimals": 18, | ||
"logoURI": "https://raw.githubusercontent.com/rango-exchange/rango-token-list/main/tokens/custom/rocketx/icon.png" | ||
} | ||
] | ||
] | ||
} |
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 |
---|---|---|
@@ -1,3 +1,12 @@ | ||
{ | ||
"extends": ["plugin:json/recommended"] | ||
"extends": ["plugin:json/recommended"], | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"env": { | ||
"browser": true, | ||
"node": true, | ||
"es6": true | ||
} | ||
} |
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 |
---|---|---|
|
@@ -6,10 +6,14 @@ | |
"repository": "[email protected]:rango-exchange/rango-token-list.git", | ||
"author": "RanGojo <[email protected]>", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"private": true, | ||
"scripts": { | ||
"eslint": "eslint tokens/* --ext .json --fix", | ||
"prepare": "husky install" | ||
"prepare": "husky install", | ||
"generate-token-list": "node ./scripts/generate.mjs" | ||
}, | ||
"lint-staged": { | ||
"**.{json}": [ | ||
|
@@ -19,12 +23,12 @@ | |
"devDependencies": { | ||
"eslint": "^8.9.0", | ||
"eslint-plugin-json": "^3.1.0", | ||
"lint-staged": "^13.2.2", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"husky": "^8.0.0", | ||
"lint-staged": "^13.2.2", | ||
"prettier": "^2.7.1", | ||
"eslint-plugin-prettier": "^4.2.1" | ||
}, | ||
"dependencies": { | ||
"glob": "^10.3.3", | ||
"husky-init": "^8.0.0" | ||
} | ||
}, | ||
"dependencies": {} | ||
} |
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,27 @@ | ||
import fs from "fs"; | ||
|
||
const customTokensDir = "./tokens/custom/"; | ||
const logoBaseURI = | ||
"https://raw.githubusercontent.com/rango-exchange/rango-token-list/main/tokens/custom"; | ||
|
||
const projectsList = fs.readdirSync(customTokensDir); | ||
const template = JSON.parse(fs.readFileSync("./templates/token-list.json")); | ||
|
||
const projects = []; | ||
for (let i = 0; i < projectsList.length; i++) { | ||
const projectName = projectsList[i]; | ||
const projectTokens = JSON.parse( | ||
fs.readFileSync(`${customTokensDir}${projectName}/manifest.json`) | ||
); | ||
for (const token of projectTokens) { | ||
token["logoURI"] = `${logoBaseURI}/${projectName}/icon.png`; | ||
} | ||
projects.push(projectTokens); | ||
} | ||
|
||
template["tokens"] = projects; | ||
template["timestamp"] = new Date(); | ||
fs.writeFileSync( | ||
"./dest/rango-custom-tokens.json", | ||
JSON.stringify(template, undefined, 2) | ||
); |
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,13 @@ | ||
{ | ||
"name": "Rango Custom Token List", | ||
"logoURI": "", | ||
"keywords": ["rango", "list"], | ||
"timestamp": "2023-08-23T00:00:00.000Z", | ||
"version": { | ||
"major": 1, | ||
"minor": 1, | ||
"patch": 1 | ||
}, | ||
"tags": {}, | ||
"tokens": [] | ||
} |
Oops, something went wrong.