Skip to content

Commit 2202295

Browse files
authored
Multichain explorer v2 (#3259)
* Support redirect to a correct view from search * show domains on address page * migrate to new API version to display address domains * another api update * new design for chain widget on home page + tests * chain widget styles for mobile devices * ecosystems page * update types * add ecosystems to navigation * address portfolio: pt.1 * portfolio tokens list * filter portfolio by chain * skip redirect when navigating to search result by clicking on "show all results" link * net worth block design * add filter input to chain select and fix tokens table * calculate address portfolio * adjust card logic * support custom token types in multichain explorer * handle case when new worth is 0 * add text filter to tokens list * fixes * demo envs * portfolio tests * ecosystems test * change signature for getTokenTypes function * fix adding token to the wallet from the list * lazy load all address domains * show contract creator and implementations info * fix tests * add poor reputation tokens toggle * tweaks * dim celo native tokens * disable env validator * fix tests * remove tokens with 0 usd value from top tokens * fixes * preserve selected chain when switching tabs on address page * add hints to stats widgets on home page * update envs for demo * fix portfolio cards and home page * update styles for contract creator and implementations * fix select issues * add chains from cluster to network menu * hide csv export link on empty logs page * update screenshots * rollback select fix * update cut length calculation for portfolio cards * fix chain select * update screenshots * fix tests * more fixes * add sorting to ecosystems table * fix test * fixes * fix loading state in ecosystems page * review fixes * fix tests
1 parent 5ca1006 commit 2202295

File tree

188 files changed

+3403
-1769
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+3403
-1769
lines changed

.vscode/tasks.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@
357357
"neon_devnet",
358358
"numine",
359359
"optimism",
360-
"optimism_interop_0",
361360
"optimism_sepolia",
362361
"optimism_superchain",
363362
"polygon",

configs/envs/.env.optimism_interop_0

Lines changed: 0 additions & 54 deletions
This file was deleted.

configs/envs/.env.optimism_superchain

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,26 @@ NEXT_PUBLIC_APP_HOST=localhost
88
NEXT_PUBLIC_APP_PORT=3000
99
NEXT_PUBLIC_APP_ENV=development
1010

11-
NEXT_PUBLIC_MULTICHAIN_AGGREGATOR_API_HOST=https://multichain-aggregator.k8s-dev.blockscout.com
12-
NEXT_PUBLIC_MULTICHAIN_STATS_API_HOST=http://multichain-search-stats.k8s-dev.blockscout.com
1311
NEXT_PUBLIC_MULTICHAIN_ENABLED=true
14-
NEXT_PUBLIC_MULTICHAIN_CLUSTER=interop
12+
# NEXT_PUBLIC_MULTICHAIN_AGGREGATOR_API_HOST=https://multichain-aggregator.k8s-dev.blockscout.com
13+
# NEXT_PUBLIC_MULTICHAIN_CLUSTER=interop
14+
# NEXT_PUBLIC_MULTICHAIN_STATS_API_HOST=http://multichain-search-stats.k8s-dev.blockscout.com
15+
NEXT_PUBLIC_MULTICHAIN_AGGREGATOR_API_HOST=https://multichain-aggregator.services.blockscout.com
16+
NEXT_PUBLIC_MULTICHAIN_CLUSTER=multichain
17+
NEXT_PUBLIC_MULTICHAIN_STATS_API_HOST=https://multichain-stats.k8s-prod-3.blockscout.com
1518

16-
SKIP_ENVS_VALIDATION=false
19+
SKIP_ENVS_VALIDATION=true
20+
NEXT_PUBLIC_MULTICHAIN_BALANCE_PROVIDER_CONFIG=[{'name': 'zerion', 'url_template': 'https://app.zerion.io/{address}/overview?utm_source=blockscout&utm_medium=address', 'logo': 'https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/marketplace-logos/zerion.svg'}]
1721

1822
NEXT_PUBLIC_HOMEPAGE_CHARTS=['daily_txs','coin_price','market_cap']
1923
NEXT_PUBLIC_HOMEPAGE_STATS=['total_txs','wallet_addresses']
2024
NEXT_PUBLIC_API_DOCS_TABS=[]
21-
NEXT_PUBLIC_FEATURED_NETWORKS=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/featured-networks/optimism-mainnet.json
22-
NEXT_PUBLIC_FOOTER_LINKS=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/footer-links/optimism.json
23-
NEXT_PUBLIC_HOMEPAGE_CHARTS=['daily_txs', 'coin_price', 'market_cap', 'secondary_coin_price']
24-
NEXT_PUBLIC_HOMEPAGE_HERO_BANNER_CONFIG={'background':['linear-gradient(90deg, rgb(232, 52, 53) 0%, rgb(139, 28, 232) 100%)'],'text_color':['rgb(255, 255, 255)']}
25-
NEXT_PUBLIC_NETWORK_ICON=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/network-icons/optimism-superchain.svg
26-
NEXT_PUBLIC_NETWORK_ICON_DARK=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/network-icons/optimism-superchain.svg
27-
NEXT_PUBLIC_NETWORK_LOGO=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/network-logos/optimism-superchain.svg
28-
NEXT_PUBLIC_NETWORK_LOGO_DARK=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/network-logos/optimism-superchain-dark.svg
29-
NEXT_PUBLIC_NETWORK_NAME=OP Superchain
30-
NEXT_PUBLIC_NETWORK_SHORT_NAME=OP Superchain
31-
NEXT_PUBLIC_OG_IMAGE_URL=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/og-images/optimism-mainnet.png
25+
NEXT_PUBLIC_NETWORK_NAME=Blockscout
3226
NEXT_PUBLIC_GAS_TRACKER_ENABLED=false
3327
NEXT_PUBLIC_HIDE_INDEXING_ALERT_BLOCKS=true
3428
NEXT_PUBLIC_HIDE_INDEXING_ALERT_INT_TXS=true
3529
NEXT_PUBLIC_IS_ACCOUNT_SUPPORTED=false
36-
NEXT_PUBLIC_IS_TESTNET=true
30+
NEXT_PUBLIC_IS_TESTNET=false
3731
NEXT_PUBLIC_USE_NEXT_JS_PROXY=true
3832
NEXT_PUBLIC_HAS_USER_OPS=true
3933
NEXT_PUBLIC_ADVANCED_FILTER_ENABLED=false

deploy/tools/llms-txt-generator/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ const outputFile = resolvePath(outputDir, 'llms.txt');
1111

1212
function run() {
1313
try {
14+
if(config.features.opSuperchain.isEnabled){
15+
console.log('⏭️ Skipping llms.txt generation for multichain explorer');
16+
return;
17+
}
18+
1419
console.log('🌀 Generating llms.txt...');
1520

1621
const chainName = config.chain.name ?? '';

icons/navigation/ecosystems.svg

Lines changed: 4 additions & 0 deletions
Loading

lib/api/services/multichainAggregator.ts

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ApiResource } from '../types';
22
import type * as multichain from '@blockscout/multichain-aggregator-types';
3-
import type { AddressTokensResponse, TokensResponse } from 'types/client/multichain-aggregator';
3+
import type { AddressTokensFilter, AddressTokensResponse, TokensResponse } from 'types/client/multichain-aggregator';
44

55
export const MULTICHAIN_AGGREGATOR_API_RESOURCES = {
66
address: {
@@ -11,17 +11,33 @@ export const MULTICHAIN_AGGREGATOR_API_RESOURCES = {
1111
path: '/addresses/:hash/tokens',
1212
pathParams: [ 'hash' as const ],
1313
paginated: true,
14-
filterFields: [ 'chain_id' as const, 'type' as const ],
14+
filterFields: [ 'chain_id' as const, 'type' as const, 'query' as const ],
15+
},
16+
address_domains: {
17+
path: '/addresses/:hash/domains',
18+
pathParams: [ 'hash' as const ],
19+
paginated: true,
20+
},
21+
address_portfolio: {
22+
path: '/addresses/:hash/portfolio',
23+
pathParams: [ 'hash' as const ],
24+
filterFields: [ 'chain_id' as const, 'query' as const ],
1525
},
1626
tokens: {
1727
path: '/tokens',
1828
filterFields: [ 'chain_id' as const, 'type' as const, 'query' as const ],
1929
paginated: true,
2030
},
31+
domain_protocols: {
32+
path: '/domain-protocols',
33+
},
2134
quick_search: {
2235
path: '/search\\:quick',
2336
filterFields: [ 'q' as const ],
2437
},
38+
search_check_redirect: {
39+
path: '/search\\:check-redirect',
40+
},
2541
search_addresses: {
2642
path: '/search/addresses',
2743
filterFields: [ 'q' as const, 'chain_id' as const ],
@@ -57,6 +73,9 @@ export const MULTICHAIN_AGGREGATOR_API_RESOURCES = {
5773
filterFields: [ 'q' as const, 'chain_id' as const ],
5874
paginated: true,
5975
},
76+
chain_metrics: {
77+
path: '/chain-metrics',
78+
},
6079
} satisfies Record<string, ApiResource>;
6180

6281
export type MultichainAggregatorApiResourceName = `multichainAggregator:${ keyof typeof MULTICHAIN_AGGREGATOR_API_RESOURCES }`;
@@ -65,21 +84,26 @@ export type MultichainAggregatorApiResourceName = `multichainAggregator:${ keyof
6584
export type MultichainAggregatorApiResourcePayload<R extends MultichainAggregatorApiResourceName> =
6685
R extends 'multichainAggregator:address' ? multichain.GetAddressResponse :
6786
R extends 'multichainAggregator:address_tokens' ? AddressTokensResponse :
87+
R extends 'multichainAggregator:address_portfolio' ? multichain.GetAddressPortfolioResponse :
88+
R extends 'multichainAggregator:address_domains' ? multichain.LookupAddressDomainsResponse :
6889
R extends 'multichainAggregator:tokens' ? TokensResponse :
90+
R extends 'multichainAggregator:domain_protocols' ? multichain.ListDomainProtocolsResponse :
6991
R extends 'multichainAggregator:quick_search' ? multichain.ClusterQuickSearchResponse :
92+
R extends 'multichainAggregator:search_check_redirect' ? multichain.CheckRedirectResponse :
7093
R extends 'multichainAggregator:search_addresses' ? multichain.SearchAddressesResponse :
7194
R extends 'multichainAggregator:search_blocks' ? multichain.SearchBlocksResponse :
7295
R extends 'multichainAggregator:search_block_numbers' ? multichain.SearchBlockNumbersResponse :
7396
R extends 'multichainAggregator:search_transactions' ? multichain.SearchTransactionsResponse :
7497
R extends 'multichainAggregator:search_tokens' ? multichain.SearchTokensResponse :
7598
R extends 'multichainAggregator:search_nfts' ? multichain.SearchNftsResponse :
7699
R extends 'multichainAggregator:search_domains' ? multichain.SearchDomainsResponse :
100+
R extends 'multichainAggregator:chain_metrics' ? multichain.ListChainMetricsResponse :
77101
never;
78102
/* eslint-enable @stylistic/indent */
79103

80104
/* eslint-disable @stylistic/indent */
81105
export type MultichainAggregatorApiPaginationFilters<R extends MultichainAggregatorApiResourceName> =
82-
R extends 'multichainAggregator:address_tokens' ? Partial<multichain.ListAddressTokensRequest> :
106+
R extends 'multichainAggregator:address_tokens' ? AddressTokensFilter :
83107
R extends 'multichainAggregator:tokens' ? Partial<multichain.ListClusterTokensRequest> :
84108
never;
85109
/* eslint-enable @stylistic/indent */

lib/cookies.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export enum NAMES {
2525
HIDE_ADD_TO_WALLET_BUTTON = 'hide_add_to_wallet_button',
2626
UUID = 'uuid',
2727
SHOW_SCAM_TOKENS = 'show_scam_tokens',
28+
SHOW_POOR_REPUTATION_TOKENS = 'show_poor_reputation_tokens',
2829
APP_PROFILE = 'app_profile',
2930
TABLE_VIEW_ON_MOBILE = 'table_view_on_mobile',
3031
}

lib/hooks/useNavItems.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,12 @@ export default function useNavItems(): ReturnType {
271271
icon: 'navigation/chain_stats',
272272
isActive: pathname.startsWith('/stats'),
273273
},
274+
config.features.opSuperchain.isEnabled && {
275+
text: 'Ecosystems',
276+
nextRoute: { pathname: '/ecosystems' as const },
277+
icon: 'navigation/ecosystems',
278+
isActive: pathname.startsWith('/ecosystems'),
279+
},
274280
megaEthFeature.isEnabled && megaEthFeature.socketUrl.metrics && {
275281
text: 'Uptime',
276282
nextRoute: { pathname: '/uptime' as const },

lib/metadata/getPageOgType.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ const OG_TYPE_DICT: Record<Route['pathname'], OGPageType> = {
8383
'/chain/[chain_slug]/token/[hash]/instance/[id]': 'Regular page',
8484
'/chain/[chain_slug]/tx/[hash]': 'Regular page',
8585
'/chain/[chain_slug]/visualize/sol2uml': 'Regular page',
86+
'/ecosystems': 'Root page',
8687

8788
// service routes, added only to make typescript happy
8889
'/login': 'Regular page',

lib/metadata/templates/description.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ const TEMPLATE_MAP: Record<Route['pathname'], string> = {
8686
'/chain/[chain_slug]/token/[hash]/instance/[id]': DEFAULT_TEMPLATE,
8787
'/chain/[chain_slug]/tx/[hash]': DEFAULT_TEMPLATE,
8888
'/chain/[chain_slug]/visualize/sol2uml': DEFAULT_TEMPLATE,
89+
'/ecosystems': DEFAULT_TEMPLATE,
8990

9091
// service routes, added only to make typescript happy
9192
'/login': DEFAULT_TEMPLATE,

0 commit comments

Comments
 (0)