Skip to content

Commit 60e7a0b

Browse files
committed
feat: add custom block explorer URL param
1 parent e676447 commit 60e7a0b

File tree

4 files changed

+100
-68
lines changed

4 files changed

+100
-68
lines changed

configs/app/app.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const baseUrl = [
1212
const isDev = getEnvValue('NEXT_PUBLIC_APP_ENV') === 'development';
1313
const isPw = getEnvValue('NEXT_PUBLIC_APP_INSTANCE') === 'pw';
1414
const spriteHash = getEnvValue('NEXT_PUBLIC_ICON_SPRITE_HASH');
15+
const blockExplorerUrl = getEnvValue('NEXT_PUBLIC_BLOCK_EXPLORER_URL') || getEnvValue('NEXT_PUBLIC_APP_HOST');
1516

1617
const app = Object.freeze({
1718
isDev,
@@ -22,6 +23,7 @@ const app = Object.freeze({
2223
baseUrl,
2324
useProxy: getEnvValue('NEXT_PUBLIC_USE_NEXT_JS_PROXY') === 'true',
2425
spriteHash,
26+
blockExplorerUrl: blockExplorerUrl as string,
2527
});
2628

2729
export default app;

deploy/tools/envs-validator/schema.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ const urlTest: yup.TestConfig = {
7171
exclusive: true,
7272
};
7373

74-
const getYupValidationErrorMessage = (error: unknown) =>
75-
typeof error === 'object' &&
76-
error !== null &&
77-
'errors' in error &&
78-
Array.isArray(error.errors) ?
79-
error.errors.join(', ') :
74+
const getYupValidationErrorMessage = (error: unknown) =>
75+
typeof error === 'object' &&
76+
error !== null &&
77+
'errors' in error &&
78+
Array.isArray(error.errors) ?
79+
error.errors.join(', ') :
8080
'';
8181

8282
const marketplaceAppSchema: yup.ObjectSchema<MarketplaceAppOverview> = yup
@@ -709,6 +709,7 @@ const schema = yup
709709
NEXT_PUBLIC_APP_PORT: yup.number().positive().integer(),
710710
NEXT_PUBLIC_APP_ENV: yup.string(),
711711
NEXT_PUBLIC_APP_INSTANCE: yup.string(),
712+
NEXT_PUBLIC_BLOCK_EXPLORER_URL: yup.string(),
712713

713714
// 2. Blockchain parameters
714715
NEXT_PUBLIC_NETWORK_NAME: yup.string().required(),

docs/ENVS.md

Lines changed: 90 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -16,67 +16,95 @@ All json-like values should be single-quoted. If it contains a hash (`#`) or a d
1616
&nbsp;
1717

1818
## Table of contents
19-
- [App configuration](#app-configuration)
20-
- [Blockchain parameters](#blockchain-parameters)
21-
- [API configuration](#api-configuration)
22-
- [UI configuration](#ui-configuration)
23-
- [Homepage](#homepage)
24-
- [Navigation](#navigation)
25-
- [Footer](#footer)
26-
- [Favicon](#favicon)
27-
- [Meta](#meta)
28-
- [Views](#views)
29-
- [Block](#block-views)
30-
- [Address](#address-views)
31-
- [Transaction](#transaction-views)
32-
- [NFT](#nft-views)
33-
- [Misc](#misc)
34-
- [App features](#app-features)
35-
- [My account](#my-account)
36-
- [Gas tracker](#gas-tracker)
37-
- [Advanced filter](#advanced-filter)
38-
- [Address verification](#address-verification-in-my-account) in "My account"
39-
- [Blockchain interaction](#blockchain-interaction-writing-to-contract-etc) (writing to contract, etc.)
40-
- [Banner ads](#banner-ads)
41-
- [Text ads](#text-ads)
42-
- [Beacon chain](#beacon-chain)
43-
- [User operations](#user-operations-erc-4337)
44-
- [Rollup chain](#rollup-chain)
45-
- [Export data to CSV file](#export-data-to-csv-file)
46-
- [Google analytics](#google-analytics)
47-
- [Mixpanel analytics](#mixpanel-analytics)
48-
- [GrowthBook feature flagging and A/B testing](#growthbook-feature-flagging-and-ab-testing)
49-
- [GraphQL API documentation](#graphql-api-documentation)
50-
- [REST API documentation](#rest-api-documentation)
51-
- [Marketplace](#marketplace)
52-
- [Solidity to UML diagrams](#solidity-to-uml-diagrams)
53-
- [Blockchain statistics](#blockchain-statistics)
54-
- [Web3 wallet integration](#web3-wallet-integration-add-token-or-network-to-the-wallet) (add token or network to the wallet)
55-
- [Transaction interpretation](#transaction-interpretation)
56-
- [Verified tokens info](#verified-tokens-info)
57-
- [Name service integration](#name-service-integration)
58-
- [Metadata service integration](#metadata-service-integration)
59-
- [Public tag submission](#public-tag-submission)
60-
- [Data availability](#data-availability)
61-
- [Bridged tokens](#bridged-tokens)
62-
- [Safe{Core} address tags](#safecore-address-tags)
63-
- [Address profile API](#address-profile-api)
64-
- [Address XStar XHS score](#address-xstar-xhs-score)
65-
- [SUAVE chain](#suave-chain)
66-
- [Celo chain](#celo-chain)
67-
- [Ton Application Chain (TAC)](#ton-application-chain-tac)
68-
- [MetaSuites extension](#metasuites-extension)
69-
- [Validators list](#validators-list)
70-
- [Sentry error monitoring](#sentry-error-monitoring)
71-
- [Rollbar error monitoring](#rollbar-error-monitoring)
72-
- [OpenTelemetry](#opentelemetry)
73-
- [DeFi dropdown](#defi-dropdown)
74-
- [Multichain balance button](#multichain-balance-button)
75-
- [Get gas button](#get-gas-button)
76-
- [Save on gas with GasHawk](#save-on-gas-with-gashawk)
77-
- [Rewards service API](#rewards-service-api)
78-
- [DEX pools](#dex-pools)
79-
- [3rd party services configuration](#external-services-configuration)
19+
- [Run-time environment variables](#run-time-environment-variables)
20+
- [Read before you run the app](#read-before-you-run-the-app)
21+
- [Variables compulsoriness](#variables-compulsoriness)
22+
- [Disclaimer about using variables](#disclaimer-about-using-variables)
23+
- [Note about escaping variables values](#note-about-escaping-variables-values)
24+
- [Table of contents](#table-of-contents)
25+
- [App configuration](#app-configuration)
26+
- [Blockchain parameters](#blockchain-parameters)
27+
- [API configuration](#api-configuration)
28+
- [UI configuration](#ui-configuration)
29+
- [Homepage](#homepage)
30+
- [Hero banner configuration properties](#hero-banner-configuration-properties)
31+
- [Navigation](#navigation)
32+
- [Featured network configuration properties](#featured-network-configuration-properties)
33+
- [Footer](#footer)
34+
- [Footer links configuration properties](#footer-links-configuration-properties)
35+
- [Favicon](#favicon)
36+
- [Meta](#meta)
37+
- [Views](#views)
38+
- [Block views](#block-views)
39+
- [Block fields list](#block-fields-list)
40+
- [Address views](#address-views)
41+
- [Address views list](#address-views-list)
42+
- [Transaction views](#transaction-views)
43+
- [Transaction fields list](#transaction-fields-list)
44+
- [Transaction additional fields list](#transaction-additional-fields-list)
45+
- [Token views](#token-views)
46+
- [NFT views](#nft-views)
47+
- [NFT marketplace properties](#nft-marketplace-properties)
48+
- [Misc](#misc)
49+
- [Network explorer configuration properties](#network-explorer-configuration-properties)
50+
- [Contract code IDE configuration properties](#contract-code-ide-configuration-properties)
51+
- [Font family configuration properties](#font-family-configuration-properties)
52+
- [App features](#app-features)
53+
- [My account](#my-account)
54+
- [Gas tracker](#gas-tracker)
55+
- [Advanced filter](#advanced-filter)
56+
- [Address verification in "My account"](#address-verification-in-my-account)
57+
- [Blockchain interaction (writing to contract, etc.)](#blockchain-interaction-writing-to-contract-etc)
58+
- [Banner ads](#banner-ads)
59+
- [Text ads](#text-ads)
60+
- [Beacon chain](#beacon-chain)
61+
- [User operations (ERC-4337)](#user-operations-erc-4337)
62+
- [Rollup chain](#rollup-chain)
63+
- [Parent chain configuration properties](#parent-chain-configuration-properties)
64+
- [Export data to CSV file](#export-data-to-csv-file)
65+
- [Google analytics](#google-analytics)
66+
- [Mixpanel analytics](#mixpanel-analytics)
67+
- [GrowthBook feature flagging and A/B testing](#growthbook-feature-flagging-and-ab-testing)
68+
- [GraphQL API documentation](#graphql-api-documentation)
69+
- [REST API documentation](#rest-api-documentation)
70+
- [Marketplace](#marketplace)
71+
- [Marketplace app configuration properties](#marketplace-app-configuration-properties)
72+
- [Solidity to UML diagrams](#solidity-to-uml-diagrams)
73+
- [Blockchain statistics](#blockchain-statistics)
74+
- [Web3 wallet integration (add token or network to the wallet)](#web3-wallet-integration-add-token-or-network-to-the-wallet)
75+
- [Transaction interpretation](#transaction-interpretation)
76+
- [External transactions](#external-transactions)
77+
- [Verified tokens info](#verified-tokens-info)
78+
- [Name service integration](#name-service-integration)
79+
- [Metadata service integration](#metadata-service-integration)
80+
- [Public tag submission](#public-tag-submission)
81+
- [Data Availability](#data-availability)
82+
- [Bridged tokens](#bridged-tokens)
83+
- [Bridged token chain configuration properties](#bridged-token-chain-configuration-properties)
84+
- [Token bridge configuration properties](#token-bridge-configuration-properties)
85+
- [Safe{Core} address tags](#safecore-address-tags)
86+
- [Address profile API](#address-profile-api)
87+
- [Address profile API configuration properties](#address-profile-api-configuration-properties)
88+
- [Address XStar XHS score](#address-xstar-xhs-score)
89+
- [SUAVE chain](#suave-chain)
90+
- [Celo chain](#celo-chain)
91+
- [Ton Application Chain (TAC)](#ton-application-chain-tac)
92+
- [MetaSuites extension](#metasuites-extension)
93+
- [Validators list](#validators-list)
94+
- [Sentry error monitoring](#sentry-error-monitoring)
95+
- [Rollbar error monitoring](#rollbar-error-monitoring)
96+
- [OpenTelemetry](#opentelemetry)
97+
- [DeFi dropdown](#defi-dropdown)
98+
- [Multichain balance button](#multichain-balance-button)
99+
- [Multichain button configuration properties](#multichain-button-configuration-properties)
100+
- [Get gas button](#get-gas-button)
101+
- [Get gas button configuration properties](#get-gas-button-configuration-properties)
102+
- [Save on gas with GasHawk](#save-on-gas-with-gashawk)
103+
- [Rewards service API](#rewards-service-api)
104+
- [DEX pools](#dex-pools)
105+
- [Badge claim link](#badge-claim-link)
106+
- [External services configuration](#external-services-configuration)
107+
- [Google ReCaptcha](#google-recaptcha)
80108

81109
&nbsp;
82110

@@ -419,6 +447,7 @@ This feature is **enabled by default**. To switch it off pass `NEXT_PUBLIC_ADVAN
419447
| NEXT_PUBLIC_NETWORK_CURRENCY_NAME | `string` | See in [Blockchain parameters](#blockchain-parameters) section | Required | - | `Ether` | v1.0.x+ |
420448
| NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL | `string` | See in [Blockchain parameters](#blockchain-parameters) section | Required | - | `ETH` | v1.0.x+ |
421449
| NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS | `string` | See in [Blockchain parameters](#blockchain-parameters) section | - | `18` | `6` | v1.0.x+ |
450+
| NEXT_PUBLIC_BLOCK_EXPLORER_URL | `string` | Custom block explorer URL | - | `NEXT_PUBLIC_APP_HOST` | - |
422451

423452
&nbsp;
424453

lib/web3/useAddChain.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function getParams(): AddEthereumChainParameter {
2222
decimals: config.chain.currency.decimals ?? 18,
2323
},
2424
rpcUrls: config.chain.rpcUrls,
25-
blockExplorerUrls: [ config.app.baseUrl ],
25+
blockExplorerUrls: [ config.app.blockExplorerUrl ],
2626
};
2727
}
2828

0 commit comments

Comments
 (0)