Skip to content

Commit

Permalink
chore: refactor logos
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulydev committed Sep 17, 2024
1 parent 4a9698a commit fe16bf9
Show file tree
Hide file tree
Showing 202 changed files with 734 additions and 1,889 deletions.
19 changes: 2 additions & 17 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
{
"tabWidth": 4,
"tabWidth": 2,
"semi": false,
"singleQuote": false,
"bracketSpacing": true,
"useTabs": false,
"importOrder": [
"^@*/(.*)$",
"^styles/(.*)$",
"^state/(.*)$",
"^hooks/(.*)$",
"^(data|web3|contracts|utils)/(.*)$",
"^(components|routes)/(.*)$",
"^assets/(.*)$",
"^[./]"
],
"importOrderSeparation": true,
"plugins": [
"@trivago/prettier-plugin-sort-imports",
"prettier-plugin-tailwindcss"
]
"useTabs": false
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"author": "Spectra",
"license": "ISC",
"scripts": {
"build": "tsup"
"build": "tsup",
"format": "prettier --write src/tokens/*.json"
},
"dependencies": {
"react": "^18.3.1",
Expand Down
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")
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
23 changes: 23 additions & 0 deletions src/images/tokens/1/0x40d16fc0246ad3160ccc09b8d0d3a2cd28ae6c2f.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
50 changes: 50 additions & 0 deletions src/images/tokens/1/0x6e0dccf49d095f8ea8920a8af03d236fa167b7e0.svg
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
23 changes: 23 additions & 0 deletions src/images/tokens/1/0xa94ec39c91df334dcab55adaa8edd9c1daf67ca7.svg
File renamed without changes
File renamed without changes
22 changes: 22 additions & 0 deletions src/images/tokens/1/0xbde752ef69880c00a795d88438040b8f737eb254.svg
File renamed without changes
Loading

0 comments on commit fe16bf9

Please sign in to comment.