assembly/composables/useLink.ts

38 lines
1.3 KiB
TypeScript
Raw Normal View History

2021-08-31 19:23:47 +00:00
import { computed } from "@nuxtjs/composition-api";
import { useNetwork } from "./useNetwork";
2021-07-24 23:40:30 +00:00
export function useLink() {
2021-08-31 19:23:47 +00:00
const { activeNetworkId } = useNetwork();
2021-07-24 23:40:30 +00:00
const addressDetailsLink = computed(() => {
2021-08-31 19:23:47 +00:00
if (activeNetworkId.value === "polygon") {
return "https://polygonscan.com/address";
2021-07-24 23:40:30 +00:00
}
2021-10-17 12:57:51 +00:00
2021-10-08 15:49:24 +00:00
if (activeNetworkId.value === "arbitrum") {
return "https://arbiscan.io/address";
}
2021-07-24 23:40:30 +00:00
2021-10-17 12:57:51 +00:00
if (activeNetworkId.value === "avalanche") {
return "https://cchain.explorer.avax.network/address";
}
2021-08-31 19:23:47 +00:00
return "https://etherscan.io/address";
});
2021-07-24 23:40:30 +00:00
2021-08-31 19:23:47 +00:00
return { addressDetailsLink };
2021-07-24 23:40:30 +00:00
}
2021-08-31 19:23:47 +00:00
export const getEtherscanLink = transactionHash =>
`https://etherscan.io/tx/${transactionHash}`;
export const getMaticLink = transactionHash =>
`https://polygonscan.com/tx/${transactionHash}`;
export const getPolygonLink = transactionHash =>
`https://polygonscan.com/tx/${transactionHash}`;
2021-10-08 15:49:24 +00:00
export const getArbitrumLink = transactionHash =>
`https://arbiscan.io/tx/${transactionHash}`;
2021-10-17 12:57:51 +00:00
export const getAvalancheLink = transactionHash =>
`https://cchain.explorer.avax.network/tx/${transactionHash}`;
2021-08-31 19:23:47 +00:00
export const getTenderlyLink = simulationId =>
`https://dashboard.tenderly.co/public/InstaDApp/dsa-simulations/fork-simulation/${simulationId}?hideSidebar=true`;