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 1 commit 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
30 changes: 17 additions & 13 deletions src/config/development.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import {
celoAlfajores,
gnosis,
goerli,
optimismSepolia,
polygon,
arbitrumSepolia,
celoAlfajores as celoAlfajoresDefault,
gnosis as gnosisDefault,
goerli as goerliDefault,
optimismSepolia as optimismSepoliaDefault,
polygon as polygonDefault,
arbitrumSepolia as arbitrumSepoliaDefault,
} from 'wagmi/chains';
import { WalletAdapterNetwork } from '@solana/wallet-adapter-base';
import { type Chain } from 'viem';
Expand All @@ -26,6 +26,8 @@ import { IconUnknown } from '@/components/Icons/Unknown';
import IconSolana from '@/components/Icons/Solana';
import IconArbitrum from '@/components/Icons/Arbitrum';

import { updateBlockExplorers } from './utils';

const BASE_ROUTE =
process.env.NEXT_PUBLIC_BASE_ROUTE ||
'https://impact-graph.serve.giveth.io';
Expand Down Expand Up @@ -67,7 +69,7 @@ const SOLANA_NETWORK: NonEVMChain = {
},
};

const classic = {
const classicDefault = {
id: 63,
name: 'Ethereum Classic Mordor',
network: 'mordor',
Expand All @@ -80,15 +82,17 @@ const classic = {
default: { http: ['https://rpc.mordor.etccooperative.org'] },
public: { http: ['https://rpc.mordor.etccooperative.org'] },
},
blockExplorers: {
default: {
name: 'Blockscout',
url: 'https://etc-mordor.blockscout.com',
},
},
subgraphAddress: 'http://167.172.97.150:8000/subgraphs/name/giveth/etc',
};

const classic = updateBlockExplorers(classicDefault);
const polygon = updateBlockExplorers(polygonDefault);
const goerli = updateBlockExplorers(goerliDefault);
const gnosis = updateBlockExplorers(gnosisDefault);
const optimismSepolia = updateBlockExplorers(optimismSepoliaDefault);
const celoAlfajores = updateBlockExplorers(celoAlfajoresDefault);
const arbitrumSepolia = updateBlockExplorers(arbitrumSepoliaDefault);

const EVM_CHAINS = [
polygon,
goerli,
Expand Down
25 changes: 18 additions & 7 deletions src/config/production.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
celo,
classic,
gnosis,
mainnet,
optimism,
polygon,
arbitrum,
celo as celoDefault,
classic as classicDefault,
gnosis as gnosisDefault,
mainnet as mainnetDefault,
optimism as optimismDefault,
polygon as polygonDefault,
arbitrum as arbitrumDefault,
} from '@wagmi/core/chains';
import { WalletAdapterNetwork } from '@solana/wallet-adapter-base';
import React from 'react';
Expand All @@ -27,6 +27,8 @@ import { IconClassic } from '@/components/Icons/Classic';
import IconSolana from '@/components/Icons/Solana';
import IconArbitrum from '@/components/Icons/Arbitrum';

import { updateBlockExplorers } from './utils';

const GNOSIS_GIV_TOKEN_ADDRESS = '0x4f4F9b8D5B4d0Dc10506e5551B0513B61fD59e75';
const OPTIMISM_GIV_TOKEN_ADDRESS = '0x528CDc92eAB044E1E39FE43B9514bfdAB4412B98';

Expand All @@ -52,6 +54,15 @@ const SOLANA_NETWORK: NonEVMChain = {
},
},
};

const mainnet = updateBlockExplorers(mainnetDefault);
const gnosis = updateBlockExplorers(gnosisDefault);
const polygon = updateBlockExplorers(polygonDefault);
const optimism = updateBlockExplorers(optimismDefault);
const celo = updateBlockExplorers(celoDefault);
const arbitrum = updateBlockExplorers(arbitrumDefault);
const classic = updateBlockExplorers(classicDefault);

const EVM_CHAINS = [
mainnet,
gnosis,
Expand Down
44 changes: 44 additions & 0 deletions src/config/utils.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import {
celoAlfajores,
gnosis,
goerli,
optimismSepolia,
polygon,
arbitrumSepolia,
celo,
classic,
mainnet,
optimism,
arbitrum,
} from '@wagmi/core/chains';
import { type Chain } from 'viem';

const EXPLORER_URLS = {
[63]: 'https://etc-mordor.blockscout.com', // Ethereum Classic Mordor
[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',
};

export function updateBlockExplorers(chain: Chain) {
if (!EXPLORER_URLS[chain.id]) {
return chain;
}
return {
...chain,
blockExplorers: {
default: {
name: 'Blockscout',
url: EXPLORER_URLS[chain.id],
},
},
};
}
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