Skip to content

Commit

Permalink
Update chain configs
Browse files Browse the repository at this point in the history
  • Loading branch information
rkalis committed Nov 1, 2024
1 parent 478a3c1 commit 8a4108e
Show file tree
Hide file tree
Showing 5 changed files with 238 additions and 110 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "revoke-cash-browser-extension",
"version": "0.6.1",
"version": "0.6.2",
"description": "The Revoke.cash browser extension helps you stay safe from crypto allowance scams.",
"main": "index.js",
"scripts": {
Expand All @@ -21,7 +21,7 @@
"@amplitude/analytics-browser": "^1.2.3",
"@heroicons/react": "^2.1.3",
"@metamask/post-message-stream": "^8.1.0",
"@revoke.cash/chains": "^45.0.0",
"@revoke.cash/chains": "^54.0.0",
"eth-rpc-errors": "^4.0.3",
"object-hash": "^3.0.0",
"react": "^18.3.1",
Expand Down
12 changes: 4 additions & 8 deletions src/lib/chains/Chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class Chain {

getSlug(): string {
const chainName = this.getName();
return chainName.toLowerCase().replace(' (unsupported)', '').replace(/\s/g, '-');
return chainName.toLowerCase().replace(' (unsupported)', '').replace(/\s/g, '-').replace(/\./g, '-');
}

isTestnet(): boolean {
Expand All @@ -68,15 +68,11 @@ export class Chain {
}

getLogoUrl(): string | undefined {
if (!this.options.logoUrl) {
return getChain(this.chainId)?.iconURL;
}

if (this.options.logoUrl.startsWith('/')) {
if (this.options.logoUrl?.startsWith('/')) {
return `https://revoke.cash${this.options.logoUrl}`;
}

return this.options.logoUrl;
return this.options.logoUrl ?? getChain(this.chainId)?.iconURL;
}

getExplorerUrl(): string {
Expand Down Expand Up @@ -107,7 +103,7 @@ export class Chain {
getInfoUrl(): string | undefined {
// TODO: Ideally we would call getInfoUrl() for the mainnet chain here in case it has overridden infoUrl, but then
// we run into circular dependency issues 😅
const mainnetChainId = this.getCorrespondingMainnetChainId()!;
const mainnetChainId = this.getCorrespondingMainnetChainId() ?? -1;
return this.options.infoUrl ?? getChain(mainnetChainId)?.infoURL ?? getChain(this.chainId)?.infoURL;
}

Expand Down
Loading

0 comments on commit 8a4108e

Please sign in to comment.