Skip to content

Commit

Permalink
[LUM-868] Explorer soft deprecation
Browse files Browse the repository at this point in the history
This PR replaces all lum explorer links to mintscan
  • Loading branch information
greedyboi committed Feb 6, 2024
1 parent 9737b02 commit ba83c1a
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 35 deletions.
7 changes: 4 additions & 3 deletions src/components/Cards/AddressCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import ClipboardJS from 'clipboard';
import printJS from 'print-js';

import assets from 'assets';
import { HoverTooltip } from 'components';
import { LUM_MINTSCAN_URL } from 'constant';
import { Card, CodeQr } from 'frontend-elements';
import { showErrorToast, showSuccessToast } from 'utils';

import Modal from '../Modals/Modal';
import { getExplorerLink, showErrorToast, showSuccessToast } from 'utils';
import { HoverTooltip } from 'components';

const AddressCard = ({ address }: { address: string }): JSX.Element => {
const { t } = useTranslation();
Expand Down Expand Up @@ -42,7 +43,7 @@ const AddressCard = ({ address }: { address: string }): JSX.Element => {
<h2 className="ps-2 pt-3 text-white">{t('common.address')}</h2>
<a
className="wallet-address"
href={`${getExplorerLink()}/account/${address}`}
href={`${LUM_MINTSCAN_URL}/address/${address}`}
target="_blank"
rel="noreferrer"
>
Expand Down
17 changes: 9 additions & 8 deletions src/components/Tables/TransactionsTable/TransactionsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import assets from 'assets';
import { SmallerDecimal, TransactionTypeBadge } from 'components';
import { Table } from 'frontend-elements';
import { Transaction, Wallet } from 'models';
import { getExplorerLink, NumbersUtils, DenomsUtils, trunc, getMillionsLink } from 'utils';
import { NumbersUtils, DenomsUtils, trunc, getMillionsLink } from 'utils';
import { LUM_MINTSCAN_URL } from 'constant';

interface TransactionsTableProps {
transactions: Transaction[];
Expand All @@ -28,7 +29,7 @@ const TransactionRow = (props: RowProps): JSX.Element => {
return (
<tr>
<td data-label={headers[0]}>
<a href={`${getExplorerLink()}/txs/${row.hash}`} target="_blank" rel="noreferrer">
<a href={`${LUM_MINTSCAN_URL}/tx/${row.hash}`} target="_blank" rel="noreferrer">
{trunc(row.hash)}
</a>
</td>
Expand All @@ -41,8 +42,8 @@ const TransactionRow = (props: RowProps): JSX.Element => {
<td data-label={headers[2]}>
{row.fromAddress && row.fromAddress.startsWith('lum') ? (
<a
href={`${getExplorerLink()}/${
row.fromAddress.includes(LumBech32Prefixes.VAL_ADDR) ? 'validators' : 'account'
href={`${LUM_MINTSCAN_URL}/${
row.fromAddress.includes(LumBech32Prefixes.VAL_ADDR) ? 'validators' : 'address'
}/${row.fromAddress}`}
target="_blank"
rel="noreferrer"
Expand All @@ -56,8 +57,8 @@ const TransactionRow = (props: RowProps): JSX.Element => {
<td data-label={headers[3]} className="text-end">
{row.toAddress && row.toAddress.startsWith('lum') && row.messages.length === 1 ? (
<a
href={`${getExplorerLink()}/${
row.toAddress.includes(LumBech32Prefixes.VAL_ADDR) ? 'validators' : 'account'
href={`${LUM_MINTSCAN_URL}/${
row.toAddress.includes(LumBech32Prefixes.VAL_ADDR) ? 'validators' : 'address'
}/${row.toAddress}`}
target="_blank"
rel="noreferrer"
Expand All @@ -78,7 +79,7 @@ const TransactionRow = (props: RowProps): JSX.Element => {
</a>
) : row.toAddress.startsWith(t('transactions.proposal')) ? (
<a
href={`${getExplorerLink()}/proposals/${row.toAddress.replace(t('transactions.proposal'), '')}`}
href={`${LUM_MINTSCAN_URL}/proposals/${row.toAddress.replace(t('transactions.proposal'), '')}`}
target="_blank"
rel="noreferrer"
>
Expand Down Expand Up @@ -110,7 +111,7 @@ const TransactionRow = (props: RowProps): JSX.Element => {
<span className="ms-2">{DenomsUtils.computeDenom(row.amount[0].denom)}</span>
</>
) : (
<a href={`${getExplorerLink()}/txs/${row.hash}`} rel="noreferrer" target="_blank">
<a href={`${LUM_MINTSCAN_URL}/tx/${row.hash}`} rel="noreferrer" target="_blank">
<span className="color-type me-1">{t('common.more')}</span>
<img src={assets.images.moreIcon} alt="more" />
</a>
Expand Down
4 changes: 2 additions & 2 deletions src/constant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ export const LUM_LEDGER_APP_INSTALL_LINK =
export const COSMOS_LEDGER_APP_INSTALL_LINK =
'https://support.ledger.com/hc/en-us/articles/360013713840-Cosmos-ATOM-?docs=true';
export const KEPLR_INSTALL_LINK = 'https://keplr.app';
export const LUM_EXPLORER = 'https://explorer.lum.network';
export const LUM_WALLET = 'https://wallet.lum.network';
export const LUM_EXPLORER_TESTNET = 'https://explorer.testnet.lum.network';
export const LUM_WALLET_TESTNET = 'https://wallet.testnet.lum.network';
export const LUM_MILLIONS = 'https://cosmosmillions.com';
export const LUM_MILLIONS_TESTNET = 'https://testnet.cosmosmillions.com';
Expand All @@ -24,6 +22,8 @@ export const MEDIUM_AIRDROP_ARTICLE =

export const KEPLR_DEFAULT_COIN_TYPE = 118;

export const LUM_MINTSCAN_URL = 'https://mintscan.io/lum';

export const COINGECKO_API_URL = 'https://api.coingecko.com/api/v3';

export const BUY_LUM_URL = 'https://app.osmosis.zone/?from=ATOM&to=LUM';
Expand Down
6 changes: 3 additions & 3 deletions src/screens/Staking/components/Lists/AvailableValidators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import numeral from 'numeral';
import { Table, ValidatorLogo } from 'frontend-elements';

import { Button, Input } from 'components';
import { LUM_ASSETS_GITHUB } from 'constant';
import { trunc, NumbersUtils, sortByVotingPower, WalletClient, getExplorerLink } from 'utils';
import { LUM_ASSETS_GITHUB, LUM_MINTSCAN_URL } from 'constant';
import { trunc, NumbersUtils, sortByVotingPower, WalletClient } from 'utils';

import searchIcon from 'assets/images/search.svg';

Expand Down Expand Up @@ -66,7 +66,7 @@ const AvailableValidators = ({ validators, totalVotingPower, onDelegate }: Props
</td>
<td data-label={headers[1]}>
<a
href={`${getExplorerLink()}/validators/${validator.operatorAddress}`}
href={`${LUM_MINTSCAN_URL}/validators/${validator.operatorAddress}`}
target="_blank"
rel="noreferrer"
>
Expand Down
6 changes: 3 additions & 3 deletions src/screens/Staking/components/Lists/MyValidators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import {
} from '@lum-network/sdk-javascript/build/codegen/cosmos/staking/v1beta1/staking';

import { Badge, DropdownButton, SmallerDecimal } from 'components';
import { LUM_ASSETS_GITHUB } from 'constant';
import { LUM_ASSETS_GITHUB, LUM_MINTSCAN_URL } from 'constant';
import { Table, ValidatorLogo } from 'frontend-elements';
import { Rewards, UserValidator } from 'models';
import { RootState } from 'redux/store';
import { getExplorerLink, getUserValidators, NumbersUtils, sortByVotingPower, trunc, WalletClient } from 'utils';
import { getUserValidators, NumbersUtils, sortByVotingPower, trunc, WalletClient } from 'utils';

interface Props {
validators: Validator[];
Expand Down Expand Up @@ -79,7 +79,7 @@ const MyValidators = ({
<tr key={index} className="validators-table-row">
<td data-label={headers[0]}>
<a
href={`${getExplorerLink()}/validators/${validator.operatorAddress}`}
href={`${LUM_MINTSCAN_URL}/validators/${validator.operatorAddress}`}
target="_blank"
rel="noreferrer"
>
Expand Down
10 changes: 3 additions & 7 deletions src/screens/Staking/components/Lists/OtherStakingRewards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import numeral from 'numeral';
import { Validator } from '@lum-network/sdk-javascript/build/codegen/cosmos/staking/v1beta1/staking';

import { Collapsible, SmallerDecimal } from 'components';
import { CLIENT_PRECISION, LUM_ASSETS_GITHUB } from 'constant';
import { CLIENT_PRECISION, LUM_ASSETS_GITHUB, LUM_MINTSCAN_URL } from 'constant';
import { Card, ValidatorLogo } from 'frontend-elements';
import { Reward, Rewards } from 'models';
import { RootState } from 'redux/store';
import { DenomsUtils, NumbersUtils, WalletClient, getExplorerLink, trunc, useWindowSize } from 'utils';
import { DenomsUtils, NumbersUtils, WalletClient, trunc, useWindowSize } from 'utils';

const OtherStakingRewards = ({ validators, otherRewards }: { validators: Validator[]; otherRewards: Rewards[] }) => {
const prices = useSelector((state: RootState) => state.stats.prices);
Expand All @@ -29,11 +29,7 @@ const OtherStakingRewards = ({ validators, otherRewards }: { validators: Validat
key={`other-staking-reward-${index + 1}`}
className="other-reward-collapse d-flex flex-column flex-sm-row justify-content-between align-items-start align-items-sm-center mt-4 pt-4"
>
<a
href={`${getExplorerLink()}/validators/${rewards.validatorAddress}`}
target="_blank"
rel="noreferrer"
>
<a href={`${LUM_MINTSCAN_URL}/validators/${rewards.validatorAddress}`} target="_blank" rel="noreferrer">
<ValidatorLogo
width={34}
height={34}
Expand Down
10 changes: 1 addition & 9 deletions src/utils/links.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import WalletClient from './client';
import {
LUM_EXPLORER,
LUM_EXPLORER_TESTNET,
LUM_MILLIONS,
LUM_MILLIONS_TESTNET,
LUM_WALLET,
LUM_WALLET_TESTNET,
} from 'constant';
import { LUM_MILLIONS, LUM_MILLIONS_TESTNET, LUM_WALLET, LUM_WALLET_TESTNET } from 'constant';

const CUSTOM_NODE_KEY = 'custom-nodes';

Expand All @@ -29,6 +22,5 @@ export const getCustomNodes = (): string[] => {

export const getRpcFromNode = (node: string): string => `https://${node}/rpc`;

export const getExplorerLink = (): string => (WalletClient.isTestnet() ? LUM_EXPLORER_TESTNET : LUM_EXPLORER);
export const getWalletLink = (): string => (WalletClient.isTestnet() ? LUM_WALLET_TESTNET : LUM_WALLET);
export const getMillionsLink = (): string => (WalletClient.isTestnet() ? LUM_MILLIONS_TESTNET : LUM_MILLIONS);

0 comments on commit ba83c1a

Please sign in to comment.