From 30f3da0a1a2a233ecd6984510d9ff8b9cd28b5db Mon Sep 17 00:00:00 2001 From: Erwin Lejeune Date: Sun, 24 Sep 2023 18:36:58 +0400 Subject: [PATCH] Zora + Adsense (#64) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Home Page, Empty Tx Pages, all arch setup * update readme * Logos * Tabs * Formatting * Fees, Interaction and Volume cards from ZkFlow * Explorer Polymorphised Services * Main Page update with new stuffé * Testing new stuff * Generic Explorer Interface * readme * Hotfix: Readme hiccup * Add DEX Screener Token Prices fetcher * Balance but it's buggy * Fully functional balance * Non working Docker stuff * Remove all warnings * Containers * add docker section to readme * Design Tweaks for centering cards * temp: network host * added CI/CD with codecov * Revert "temp: network host" This reverts commit f720d464db7c42f3b553c09afe8f864415fd3c46. * better layout * Fix activities on all chains * Move donation card, add powered by... msg * Add Criteria Card * Adjust Card Size * loading + countdown * Fixes: better api for zks * Update names * Logos, Metadata and Date fixes * wip: date shit * Ft: redesign tabs, add qr code/clipboard, fix volume change * tweak sizes * Wip: volume toggle bridge only * Feature: all bridges done, wip mantle * Fully functional bridges * Install Vite * Create CI * add wflows * Add PR rule * Fix lints and warns * Fix builds * Fix warning * remove unused lint ignores * remove useless prints * remove base path * Reduce loading time * fixup badges * add vercel analytics * add vercel badge * cleanup layout * update readme * Use blockscout linea api * Update License * comment coverage * Update pages deployment * Countdown from 20s to be sure * add twitter logo (#42) * Metadata Hotfix (#59) * add twitter logo * Hotfix: metadata link * Zora Chain + Logos + Adsense (#63) * Zora and Nova * wip: zeta/nova * Fix Warnings * Remove unused lines * Remove inferrable type * Fix weird layout * Bridges * Iteration fix --------- Co-authored-by: SomaGallai --- index.html | 2 ++ package-lock.json | 14 +++++------ package.json | 2 +- public/chains/nova.svg | 28 +++++++++++++++++++++ src/components/Header.tsx | 12 ++++++--- src/components/VolumeCard.tsx | 2 +- src/pages/AddressPage.tsx | 9 +++++++ src/services/explorers/kakarot.ts | 0 src/services/explorers/nova.ts | 10 ++++++++ src/services/explorers/opbnb.ts | 0 src/services/explorers/scroll.ts | 22 ++++++++++++++-- src/services/explorers/standard_explorer.ts | 12 +++++++++ src/services/explorers/taiko.ts | 15 ++++++++++- src/services/explorers/zetachain.ts | 10 ++++++++ src/services/explorers/zora.ts | 19 ++++++++++++++ 15 files changed, 141 insertions(+), 16 deletions(-) create mode 100644 public/chains/nova.svg create mode 100644 src/services/explorers/kakarot.ts create mode 100644 src/services/explorers/nova.ts create mode 100644 src/services/explorers/opbnb.ts create mode 100644 src/services/explorers/zetachain.ts create mode 100644 src/services/explorers/zora.ts diff --git a/index.html b/index.html index b01086b..113ec2c 100644 --- a/index.html +++ b/index.html @@ -34,6 +34,8 @@ gtag('config', 'G-J0F0S558N9'); +
diff --git a/package-lock.json b/package-lock.json index 9de83f0..f2fe53c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-helmet-async": "^1.3.0", - "react-icons": "^4.10.1", + "react-icons": "^4.11.0", "react-loading-skeleton": "^3.3.1", "react-router-dom": "^6.11.2", "react-switch": "^7.0.0" @@ -4252,9 +4252,9 @@ } }, "node_modules/react-icons": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.10.1.tgz", - "integrity": "sha512-/ngzDP/77tlCfqthiiGNZeYFACw85fUjZtLbedmJ5DTlNDIwETxhwBzdOJ21zj4iJdvc0J3y7yOsX3PpxAJzrw==", + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.11.0.tgz", + "integrity": "sha512-V+4khzYcE5EBk/BvcuYRq6V/osf11ODUM2J8hg2FDSswRrGvqiYUYPRy4OdrWaQOBj4NcpJfmHZLNaD+VH0TyA==", "peerDependencies": { "react": "*" } @@ -7756,9 +7756,9 @@ } }, "react-icons": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.10.1.tgz", - "integrity": "sha512-/ngzDP/77tlCfqthiiGNZeYFACw85fUjZtLbedmJ5DTlNDIwETxhwBzdOJ21zj4iJdvc0J3y7yOsX3PpxAJzrw==", + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.11.0.tgz", + "integrity": "sha512-V+4khzYcE5EBk/BvcuYRq6V/osf11ODUM2J8hg2FDSswRrGvqiYUYPRy4OdrWaQOBj4NcpJfmHZLNaD+VH0TyA==", "requires": {} }, "react-loading-skeleton": { diff --git a/package.json b/package.json index f0ebea2..6b96702 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-helmet-async": "^1.3.0", - "react-icons": "^4.10.1", + "react-icons": "^4.11.0", "react-loading-skeleton": "^3.3.1", "react-router-dom": "^6.11.2", "react-switch": "^7.0.0" diff --git a/public/chains/nova.svg b/public/chains/nova.svg new file mode 100644 index 0000000..b88b384 --- /dev/null +++ b/public/chains/nova.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 26043ec..870aee2 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -1,5 +1,5 @@ import React, { FC, useState } from 'react'; -import { FaTwitter } from 'react-icons/fa'; +import { FaTwitter, FaGithub } from 'react-icons/fa'; interface HeaderProps { hasSearchBar?: boolean; @@ -28,14 +28,18 @@ const Header: FC = ({ hasSearchBar }) => { TrackDrop Logo TrackDrop - + {/* Twitter icon with margin */} - + + + + {/* Twitter icon with margin */} + {hasSearchBar && (
-
+
= ({ address, transactions }) => { return (
-
+

Volume {showBridgeTransactions ? '(Bridge)' : '(Total)'} diff --git a/src/pages/AddressPage.tsx b/src/pages/AddressPage.tsx index b7a29ae..5bc169c 100644 --- a/src/pages/AddressPage.tsx +++ b/src/pages/AddressPage.tsx @@ -25,6 +25,9 @@ import BaseExplorerService from '../services/explorers/base.ts'; import ZkEvmExplorerService from '../services/explorers/zkevm.ts'; import ZkSyncExplorerService from '../services/explorers/zksync.ts'; // Import the appropriate services import LineaExplorerService from '../services/explorers/linea.ts'; +import ZoraExplorerService from '../services/explorers/zora.ts'; +// import ZetaExplorerService from '../services/explorers/zetachain.ts'; +// import NovaExplorerService from '../services/explorers/nova.ts'; const AddressPage = () => { const address = window.location.search.split('=')[1]; @@ -37,6 +40,9 @@ const AddressPage = () => { const mantleService = new MantleExplorerService(); const taikoService = new TaikoExplorerService(); const scrollService = new ScrollExplorerService(); + const zoraService = new ZoraExplorerService(); + // const novaService = new NovaExplorerService(); + // const zetaService = new ZetaExplorerService(); const availableExplorers: Map = new Map(); availableExplorers.set('zkSync', zkSyncService); @@ -44,8 +50,11 @@ const AddressPage = () => { availableExplorers.set('Base', baseService); availableExplorers.set('Linea', lineaService); availableExplorers.set('Mantle', mantleService); + availableExplorers.set('Zora', zoraService); + // availableExplorers.set('Nova', novaService); availableExplorers.set('Scroll(T)', scrollService); availableExplorers.set('Taiko(T)', taikoService); + // availableExplorers.set('Zeta(T)', zetaService); const tabsInfos: TabInfo[] = Array.from(availableExplorers).map(([key, explorer]) => ({ name: key, diff --git a/src/services/explorers/kakarot.ts b/src/services/explorers/kakarot.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/services/explorers/nova.ts b/src/services/explorers/nova.ts new file mode 100644 index 0000000..f1f1dc9 --- /dev/null +++ b/src/services/explorers/nova.ts @@ -0,0 +1,10 @@ +import StandardExplorerService from './standard_explorer.ts'; +import { ETH_TOKEN } from '../../common/common.ts'; + +class NovaExplorerService extends StandardExplorerService { + constructor() { + super('nova-explorer.arbitrum.io', "nova", "./chains/nova.svg", 'https://nova-explorer.arbitrum.io/', ETH_TOKEN); + } +} + +export default NovaExplorerService; diff --git a/src/services/explorers/opbnb.ts b/src/services/explorers/opbnb.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/services/explorers/scroll.ts b/src/services/explorers/scroll.ts index 20790fd..0e4dc4d 100644 --- a/src/services/explorers/scroll.ts +++ b/src/services/explorers/scroll.ts @@ -1,9 +1,27 @@ import StandardExplorerService from './standard_explorer.ts'; import { ETH_TOKEN } from '../../common/common.ts'; - +import { Transaction } from './explorer.ts'; class ScrollExplorerService extends StandardExplorerService { constructor() { - super('sepolia-blockscout.scroll.io', 'scroll', "./chains/scroll.svg", 'https://sepolia-blockscout.scroll.io/', ETH_TOKEN); + super( + 'sepolia-blockscout.scroll.io', + 'scroll', + './chains/scroll.svg', + 'https://sepolia-blockscout.scroll.io/', + ETH_TOKEN, + ); + } + + needInternalTx(): boolean { + return true; + } + + isFromBridge(tx: Transaction): boolean { + if (!tx.from) return false; + if (tx.from.toLowerCase() === '0x91e8addfe1358aca5314c644312d38237fc1101c'.toLowerCase()) { + return true; + } + return false; } } diff --git a/src/services/explorers/standard_explorer.ts b/src/services/explorers/standard_explorer.ts index 97ec1f0..cd44462 100644 --- a/src/services/explorers/standard_explorer.ts +++ b/src/services/explorers/standard_explorer.ts @@ -59,12 +59,17 @@ export interface StandardTransaction { class StandardExplorerService extends ExplorerService { uri: string; + address = ''; constructor(uri: string, name: string, logo: string, explorer_url: string, chain_token: Token) { super(explorer_url, name, logo, chain_token); this.uri = uri; } + setAddress(address: string) { + this.address = address; + } + convertToCommonTokens(response: StandardToken[]): Token[] { const commonTokens: Token[] = []; @@ -220,6 +225,8 @@ class StandardExplorerService extends ExplorerService { } async getTransactionsList(address: string): Promise { + this.setAddress(address); + const limit = 100; let page = 1; const transactions: Transaction[] = []; @@ -265,12 +272,17 @@ class StandardExplorerService extends ExplorerService { ); if (response.status === 200) { + let i = 0; const commonTransactions = this.convertToCommonTransactions(response.data.result); for (const ctx of commonTransactions) { if (ctx.fee === 'NaN') ctx.fee = '0'; + if (response.data.result[i].transactionHash && ctx.hash == undefined) { + ctx.hash = response.data.result[i].transactionHash; + } if (ctx.hash !== undefined || ctx.from !== undefined || ctx.to !== undefined) { transactions.push(ctx); } + i += 1; } if (response.data.result.length < limit) { diff --git a/src/services/explorers/taiko.ts b/src/services/explorers/taiko.ts index 1d22152..88af94f 100644 --- a/src/services/explorers/taiko.ts +++ b/src/services/explorers/taiko.ts @@ -1,9 +1,22 @@ import StandardExplorerService from './standard_explorer.ts'; import { ETH_TOKEN } from '../../common/common.ts'; +import { Transaction } from './explorer.ts'; class TaikoExplorerService extends StandardExplorerService { constructor() { - super('explorer.test.taiko.xyz', "taiko", "./chains/taiko.svg", 'https://explorer.test.taiko.xyz', ETH_TOKEN); + super('blockscoutapi.jolnir.taiko.xyz', 'taiko', './chains/taiko.svg', 'https://blockscoutapi.jolnir.taiko.xyz/', ETH_TOKEN); + } + + needInternalTx(): boolean { + return true; + } + + isFromBridge(tx: Transaction): boolean { + if (!tx.from) return false; + if (tx.from.toLowerCase() === '0x1000777700000000000000000000000000000004'.toLowerCase()) { + return true; + } + return false; } } diff --git a/src/services/explorers/zetachain.ts b/src/services/explorers/zetachain.ts new file mode 100644 index 0000000..614741f --- /dev/null +++ b/src/services/explorers/zetachain.ts @@ -0,0 +1,10 @@ +import StandardExplorerService from './standard_explorer.ts'; +import { ETH_TOKEN } from '../../common/common.ts'; + +class ZetaExplorerService extends StandardExplorerService { + constructor() { + super('explorer.zetachain.com', "zora", "./chains/zora.svg", 'https://explorer.zetachain.com/', ETH_TOKEN); + } +} + +export default ZetaExplorerService; diff --git a/src/services/explorers/zora.ts b/src/services/explorers/zora.ts new file mode 100644 index 0000000..08576e0 --- /dev/null +++ b/src/services/explorers/zora.ts @@ -0,0 +1,19 @@ +import StandardExplorerService from './standard_explorer.ts'; +import { ETH_TOKEN } from '../../common/common.ts'; +import { Transaction } from './explorer.ts'; + +class ZoraExplorerService extends StandardExplorerService { + constructor() { + super('explorer.zora.energy', "zora", "./chains/zora.svg", 'https://explorer.zora.energy/', ETH_TOKEN); + } + + isFromBridge(tx: Transaction): boolean { + if (!tx.from) return false; + if (tx.from.toLowerCase() === this.address.toLowerCase() && tx.to.toLowerCase() === this.address.toLowerCase()) { + return true; + } + return false; + } +} + +export default ZoraExplorerService;