From 12dd6cdd34eef3568d69982e2d3243014921c22f Mon Sep 17 00:00:00 2001 From: Theo Date: Thu, 1 Jun 2023 07:23:10 -0700 Subject: [PATCH] Update explorers --- constants/chainInfo.ts | 7 +++++-- modals/ConfirmationModal.vue | 4 ++-- types/index.ts | 3 ++- utilities/crypto.ts | 6 +++--- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/constants/chainInfo.ts b/constants/chainInfo.ts index 5aa3854..744e135 100644 --- a/constants/chainInfo.ts +++ b/constants/chainInfo.ts @@ -17,6 +17,7 @@ const CHAINS: NetworkConfig = { hexChainId: '0x64', isEipSupported: false, ensSubdomainKey: 'gnosis-nova', + blockExplorerUrl: 'https://gnosisscan.io' }, [ChainId.MAINNET]: { symbol: 'ETH', @@ -30,6 +31,7 @@ const CHAINS: NetworkConfig = { hexChainId: '0x1', isEipSupported: true, ensSubdomainKey: 'mainnet-tornado', + blockExplorerUrl: 'https://etherscan.io' }, [ChainId.BSC]: { symbol: 'BNB', @@ -43,6 +45,7 @@ const CHAINS: NetworkConfig = { hexChainId: '0x38', isEipSupported: false, ensSubdomainKey: 'bsc-tornado', + blockExplorerUrl: 'https://bscscan.com' }, } @@ -56,7 +59,7 @@ const METAMASK_LIST: MetamaskList = { symbol: 'BNB', decimals: 18, }, - blockExplorerUrls: ['https://bscscan.com'], + blockExplorerUrls: [CHAINS[ChainId.BSC].blockExplorerUrl], }, [ChainId.XDAI]: { chainId: '0x64', @@ -67,7 +70,7 @@ const METAMASK_LIST: MetamaskList = { symbol: 'xDAI', decimals: 18, }, - blockExplorerUrls: ['https://blockscout.com/xdai/mainnet'], + blockExplorerUrls: [CHAINS[ChainId.XDAI].blockExplorerUrl], }, } diff --git a/modals/ConfirmationModal.vue b/modals/ConfirmationModal.vue index 8b0f06b..1c01a29 100644 --- a/modals/ConfirmationModal.vue +++ b/modals/ConfirmationModal.vue @@ -61,7 +61,7 @@ import { mapGetters, mapMutations, mapState } from 'vuex' import { ApplicationMutation } from '@/types' import { SuccessModal } from '@/modals' import { createModalArgs, getEtherscanLink } from '@/utilities' -import { numbers, confirmationStatus, confirmationStep, transactionMethods } from '@/constants' +import { numbers, confirmationStatus, confirmationStep, transactionMethods, CHAINS } from '@/constants' export default { name: 'ConfirmationModal', @@ -136,7 +136,7 @@ export default { } }, l2Link() { - return `https://alm-xdai.herokuapp.com/${this.modal.chainId}/${this.txHash}` + return getEtherscanLink(this.modal.chainId, this.txHash, 'transaction') }, explorerLink() { return getEtherscanLink(this.modal.chainId, this.txHash, 'transaction') diff --git a/types/index.ts b/types/index.ts index ac9d52a..8822249 100644 --- a/types/index.ts +++ b/types/index.ts @@ -30,7 +30,8 @@ export type NetworkConfigItem = { blockGasLimit: number hexChainId: string isEipSupported: boolean - ensSubdomainKey: string + ensSubdomainKey: string, + blockExplorerUrl: string } export type MetamaskConfigItem = { diff --git a/utilities/crypto.ts b/utilities/crypto.ts index be87935..f65bee6 100644 --- a/utilities/crypto.ts +++ b/utilities/crypto.ts @@ -7,7 +7,7 @@ import { hexDataSlice } from '@ethersproject/bytes' import { keccak256 } from '@ethersproject/keccak256' import { entropyToMnemonic } from '@ethersproject/hdnode' -import { numbers } from '@/constants' +import { numbers, CHAINS } from '@/constants' import { ChainId, L1ChainId } from '@/types' import { getBridgeHelper, getMulticall } from '@/contracts' import { ArgsProof, ExtData } from '@/services/core/@types' @@ -74,9 +74,9 @@ export function getEtherscanLink(chainId: ChainId, data: string, type: 'transact let prefix = `https://${ETHERSCAN_PREFIXES[chainId]}etherscan.io` if (chainId === ChainId.BSC) { - prefix = `https://bscscan.com` + prefix = CHAINS[ChainId.BSC].blockExplorerUrl } else if (chainId === ChainId.XDAI) { - prefix = `https://blockscout.com/poa/xdai` + prefix = CHAINS[ChainId.XDAI].blockExplorerUrl } switch (type) {