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: refactor logos #23

Merged
merged 6 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 6 additions & 20 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
{
"tabWidth": 4,
"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"
]
"tabWidth": 4,
"semi": false,
"singleQuote": false,
"bracketSpacing": true,
"useTabs": false,
"printWidth": 40
}
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/**/*.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")
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions src/images/tokens/1/0x6e0dccf49d095f8ea8920a8af03d236fa167b7e0.svg
23 changes: 23 additions & 0 deletions src/images/tokens/1/0xa94ec39c91df334dcab55adaa8edd9c1daf67ca7.svg
22 changes: 22 additions & 0 deletions src/images/tokens/1/0xbde752ef69880c00a795d88438040b8f737eb254.svg
Loading
Loading