Skip to content

Commit

Permalink
add collectionExplorer
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyAdoniev committed Aug 3, 2023
1 parent 7f4ff48 commit 90a0b72
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/components/Details/DetailsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ import {
currency,
chains,
chainNoncetoName,
collectionExplorers,
} from "../../constants";
import { ethers } from "ethers";

import ClockIcon from "../../assets/icons/clock.svg";
import { getExchangeRates } from "../../getExchangeRate";
import { formatFees, extractHash } from "./helpers";

const DetailsList = ({ data, copyProps }: DetailsCard) => {
const { loading: dataLoad, event } = data;
const { setTooltipCopy, tooltipCopy, tooltips } = copyProps;
const { tooltipCopy } = copyProps;
const [exchangeRates, setExchangeRates] = useState<{
[key: string]: { usd: number };
}>({});
Expand Down Expand Up @@ -300,7 +301,7 @@ const DetailsList = ({ data, copyProps }: DetailsCard) => {
rel="noreferrer"
href={`${
event?.toChain &&
addressExplorers[event.toChain]
collectionExplorers[event.toChain]
}${encodeURIComponent(event.destContract)}`}
>
<span className="text-[#235EF5]">
Expand Down
23 changes: 19 additions & 4 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const txExplorers: any = {
"18": "https://tezblock.io/transaction/",
"23": "https://gatescan.org/tx/",
"9": "https://tronscan.org/#/transaction/",
"25": "https://explore.vechain.org/transactions/",
"25": "https://vechainstats.com/transaction/",
"15": "https://algoexplorer.io/tx/",
"22": "https://v1.gwscan.com/tx/",
"24": "https://www.mintscan.io/secret/transactions/",
Expand All @@ -86,7 +86,7 @@ export const txExplorers: any = {
};

export const addressExplorers: any = {
"4": "https://bscscan.com//address/",
"4": "https://bscscan.com/address/",
"19": "https://explorer.velas.com/address/",
"14": "https://blockscout.com/xdai/mainnet/address/",
"2": "https://explorer.elrond.com/accounts/",
Expand All @@ -101,9 +101,9 @@ export const addressExplorers: any = {
"18": "https://tezblock.io/account/",
"23": "https://gatescan.org/address/",
"9": "https://tronscan.org/#/address/",
"25": "https://explore.vechain.org/accounts/",
"25": "https://vechainstats.com/account/",
"15": "https://algoexplorer.io/address/",
"22": "https://v1.gwscan.com/tx/",
"22": "https://v1.gwscan.com/address/",
"24": `https://www.mintscan.io/secret/accounts/`,
"32": "https://moonscan.io/address/",
"27": "https://tonscan.org/address/",
Expand All @@ -119,6 +119,21 @@ export const addressExplorers: any = {
"34": "https://explorer.aptoslabs.com/account/",
};

export const collectionExplorers: any = {
...Object.entries(addressExplorers).reduce(
(acc: Object, [k, v]) => ({
...acc,
[k]: (v as string).replace(/(address|accounts?)\/$/, "token/"),
}),
{}
),
"25": "https://vechainstats.com/account/",
"22": "https://v1.gwscan.com/nft-collection/",
"14": "https://gnosis.blockscout.com/address/",
"20": "https://iotexscan.io/address/",
"9": "https://tronscan.org/#/contract/",
};

export const chainNoncetoName: any = {
"0": "Unknown",
"4": "BSC",
Expand Down

0 comments on commit 90a0b72

Please sign in to comment.