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

Use Blockscout as the default block explorer #4206

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion src/components/views/nft/mint/NFTMintIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export const NFTMintIndex = () => {
</DescCenter>
<ButtonLink
linkType='texty'
label='View transaction on etherscan'
label='View transaction on Blockscout'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The button label change aligns with the PR's objective. Consider using template literals for constructing URLs to improve readability.

- href={`${config.MAINNET_CONFIG.blockExplorers?.default.url}/tx/${txHash}`}
+ href={\`${config.MAINNET_CONFIG.blockExplorers?.default.url}/tx/${txHash}\`}

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
label='View transaction on Blockscout'
label='View transaction on Blockscout'
href={`${config.MAINNET_CONFIG.blockExplorers?.default.url}/tx/${txHash}`}

href={`${config.MAINNET_CONFIG.blockExplorers?.default.url}/tx/${txHash}`}
/>
<MintAgainButton
Expand Down
76 changes: 76 additions & 0 deletions src/config/chains.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import {
celoAlfajores,
gnosis,
goerli,
sepolia,
optimismSepolia,
polygon,
arbitrumSepolia,
celo,
classic,
mainnet,
optimism,
arbitrum,
base,
baseSepolia,
polygonZkEvm,
polygonZkEvmCardona,
} from '@wagmi/core/chains';
import { type Chain } from 'viem';

const EXPLORER_URLS: Record<Chain['id'], string> = {
[polygon.id]: 'https://polygon.blockscout.com',
[goerli.id]: 'https://eth-goerli.blockscout.com',
[gnosis.id]: 'https://gnosis.blockscout.com',
[optimismSepolia.id]: 'https://optimism-sepolia.blockscout.com',
[celoAlfajores.id]: 'https://explorer.celo.org/alfajores',
[arbitrumSepolia.id]: 'https://sepolia-explorer.arbitrum.io',
[celo.id]: 'https://explorer.celo.org/mainnet',
[classic.id]: 'https://etc.blockscout.com',
[mainnet.id]: 'https://eth.blockscout.com',
[optimism.id]: 'https://optimism.blockscout.com',
[arbitrum.id]: 'https://arbitrum.blockscout.com',
[sepolia.id]: 'https://eth-sepolia.blockscout.com',
[base.id]: 'https://base.blockscout.com',
[baseSepolia.id]: 'https://base-sepolia.blockscout.com',
[polygonZkEvm.id]: 'https://zkevm.blockscout.com',
[polygonZkEvmCardona.id]: 'https://explorer-ui.cardona.zkevm-rpc.com',
};

function updateBlockExplorers(chain: Chain): Chain {
if (!EXPLORER_URLS[chain.id]) {
return chain;
}
return {
...chain,
blockExplorers: {
default: {
name: 'Blockscout',
url: EXPLORER_URLS[chain.id],
},
},
};
}

const chains: Record<string, Chain> = Object.fromEntries(
Object.entries({
celoAlfajores,
gnosis,
goerli,
sepolia,
optimismSepolia,
polygon,
arbitrumSepolia,
celo,
classic,
mainnet,
optimism,
arbitrum,
base,
baseSepolia,
polygonZkEvm,
polygonZkEvmCardona,
}).map(([key, chain]) => [key, updateBlockExplorers(chain)]),
);

export default chains;
23 changes: 13 additions & 10 deletions src/config/development.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
import React from 'react';
import {
celoAlfajores,
gnosis,
sepolia,
optimismSepolia,
polygon,
arbitrumSepolia,
baseSepolia,
polygonZkEvmCardona,
} from 'wagmi/chains';
import { WalletAdapterNetwork } from '@solana/wallet-adapter-base';
import { type Chain } from 'viem';
import {
Expand All @@ -32,6 +22,19 @@ import IconArbitrum from '@/components/Icons/Arbitrum';
import IconStellar from '@/components/Icons/Stellar';
import { IconClassic } from '@/components/Icons/Classic';

import chains from './chains';

const {
celoAlfajores,
gnosis,
sepolia,
optimismSepolia,
polygon,
arbitrumSepolia,
baseSepolia,
polygonZkEvmCardona,
} = chains;

const BASE_ROUTE =
process.env.NEXT_PUBLIC_BASE_ROUTE ||
'https://impact-graph.serve.giveth.io';
Expand Down
25 changes: 14 additions & 11 deletions src/config/production.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
import {
celo,
classic,
gnosis,
mainnet,
optimism,
polygon,
arbitrum,
base,
polygonZkEvm,
} from '@wagmi/core/chains';
import { WalletAdapterNetwork } from '@solana/wallet-adapter-base';
import React from 'react';
import { type Chain } from 'viem';
Expand All @@ -32,6 +21,20 @@ import IconArbitrum from '@/components/Icons/Arbitrum';
import IconZKEVM from '@/components/Icons/ZKEVM';
import IconStellar from '@/components/Icons/Stellar';

import chains from './chains';

const {
celo,
classic,
gnosis,
mainnet,
optimism,
polygon,
arbitrum,
base,
polygonZkEvm,
} = chains;

const GNOSIS_GIV_TOKEN_ADDRESS = '0x4f4F9b8D5B4d0Dc10506e5551B0513B61fD59e75';
const OPTIMISM_GIV_TOKEN_ADDRESS = '0x528CDc92eAB044E1E39FE43B9514bfdAB4412B98';
const ZKEVM_GIV_TOKEN_ADDRESS = '0xddAFB91475bBf6210a151FA911AC8fdA7dE46Ec2';
Expand Down
4 changes: 2 additions & 2 deletions src/content/FAQ.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ const faqContent = (formatMessage: any) => {
<FormattedMessage id='page.faq.how_do_i_knnow_projects_get_my_money.content.one' />{' '}
(e.g.,{' '}
<ExternalLink
href='https://etherscan.io'
title='etherscan.io'
href='https://eth.blockscout.com'
title='eth.blockscout.com'
/>
){' '}
<FormattedMessage id='page.faq.how_do_i_knnow_projects_get_my_money.content.two' />
Expand Down