diff --git a/packages/neuron-wallet/src/controllers/app/menu.ts b/packages/neuron-wallet/src/controllers/app/menu.ts index 5b98e98827..e8a16f2a99 100644 --- a/packages/neuron-wallet/src/controllers/app/menu.ts +++ b/packages/neuron-wallet/src/controllers/app/menu.ts @@ -6,6 +6,7 @@ import { UpdateController } from 'controllers' import { showWindow } from './show-window' import NetworksService from 'services/networks' import WalletsService from 'services/wallets' +import ChainInfo from 'models/chain-info' import CommandSubject from 'models/subjects/command' enum URL { @@ -437,7 +438,7 @@ const contextMenuTemplate: { }, { label: i18n.t('contextMenu.view-on-explorer'), - click: () => { shell.openExternal(`${env.explorer}/address/${address}`) } + click: () => { shell.openExternal(`${ChainInfo.getInstance().explorerUrl()}/address/${address}`) } }, ] }, @@ -455,7 +456,7 @@ const contextMenuTemplate: { }, { label: i18n.t('contextMenu.view-on-explorer'), - click: () => { shell.openExternal(`${env.explorer}/transaction/${hash}`) } + click: () => { shell.openExternal(`${ChainInfo.getInstance().explorerUrl()}/transaction/${hash}`) } }, ] }, diff --git a/packages/neuron-wallet/src/env.ts b/packages/neuron-wallet/src/env.ts index ef6958190b..945b731de3 100644 --- a/packages/neuron-wallet/src/env.ts +++ b/packages/neuron-wallet/src/env.ts @@ -39,7 +39,6 @@ interface ENV { current: 'testnet' list: NetworkWithID[] } - explorer: string isTestMode: boolean } const env: ENV = { @@ -66,7 +65,6 @@ const env: ENV = { }, ], }, - explorer: 'https://explorer.nervos.org', isTestMode, } diff --git a/packages/neuron-wallet/src/models/chain-info.ts b/packages/neuron-wallet/src/models/chain-info.ts index 3ceeeba749..d5fbf6394b 100644 --- a/packages/neuron-wallet/src/models/chain-info.ts +++ b/packages/neuron-wallet/src/models/chain-info.ts @@ -22,4 +22,11 @@ export default class ChainInfo { public isMainnet = (): boolean => { return this.chain === 'ckb' } + + public explorerUrl = (): string => { + if (this.isMainnet()) { + return "https://explorer.nervos.org" + } + return "https://explorer.nervos.org" // TODO: change this to proper testnet explorer URL + } }