Skip to content

Commit

Permalink
chore: tabWidth
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulydev committed Sep 18, 2024
1 parent cfcd423 commit 76edd00
Show file tree
Hide file tree
Showing 7 changed files with 1,804 additions and 1,778 deletions.
12 changes: 6 additions & 6 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"tabWidth": 2,
"semi": false,
"singleQuote": false,
"bracketSpacing": true,
"useTabs": false,
"printWidth": 40
"tabWidth": 4,
"semi": false,
"singleQuote": false,
"bracketSpacing": true,
"useTabs": false,
"printWidth": 40
}
24 changes: 24 additions & 0 deletions refactor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import fs from "fs"

const replaceTokenLogo = async (token: { chainId: number, address: string, logoURI: string }) => {
const needToReplaceLogo = token.logoURI.startsWith("/") && (token.logoURI as string).split("/").length-1 === 3
if (needToReplaceLogo) {
const newURI = `/images/tokens/${token.chainId}/${token.address.toLowerCase()}.${token.logoURI.split(".")[1]}`
fs.copyFileSync("./src" + token.logoURI, "./src" + newURI)
token.logoURI = newURI
}
}

const run = async (tokenListPath: string) => {
const tokenList = JSON.parse(fs.readFileSync(tokenListPath).toString())
tokenList.forEach(token => {
replaceTokenLogo(token)
if (token.extensions?.vault?.logoURI) {
replaceTokenLogo(token.extensions.vault)
}
})
fs.writeFileSync(tokenListPath, JSON.stringify(tokenList))
}

run("./src/tokens/spectraTokens.json")
run("./src/tokens/erc4626Wrappers.json")
Loading

0 comments on commit 76edd00

Please sign in to comment.