Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Mempool UI URL #93

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/app/components/Delegations/Delegation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ import { Tooltip } from "react-tooltip";

import { DelegationState, StakingTx } from "@/app/types/delegations";
import { GlobalParamsVersion } from "@/app/types/globalParams";
import {
PUBLIC_MEMPOOL_URL,
PUBLIC_MEMPOOL_URL_SIGNET,
} from "@/config/mempool";
import { getNetworkConfig } from "@/config/network.config";
import { satoshiToBtc } from "@/utils/btcConversions";
import { durationTillNow } from "@/utils/formatTime";
import { getState, getStateTooltip } from "@/utils/getState";
import { maxDecimals } from "@/utils/maxDecimals";
import { trim } from "@/utils/trim";
import { Network } from "@/utils/wallet/wallet_provider";

interface DelegationProps {
finalityProviderMoniker: string;
Expand Down Expand Up @@ -111,7 +116,12 @@ export const Delegation: React.FC<DelegationProps> = ({
}
};

const { coinName, mempoolApiUrl } = getNetworkConfig();
const { coinName, network } = getNetworkConfig();

const mempoolUIUrl =
network === Network.MAINNET
? PUBLIC_MEMPOOL_URL
: PUBLIC_MEMPOOL_URL_SIGNET;

return (
<div
Expand All @@ -135,7 +145,7 @@ export const Delegation: React.FC<DelegationProps> = ({
</p>
<div className="justify-center lg:flex order-2 lg:order-3">
<a
href={`${mempoolApiUrl}/tx/${stakingTxHash}`}
href={`${mempoolUIUrl}/tx/${stakingTxHash}`}
target="_blank"
rel="noopener noreferrer"
className="text-primary hover:underline"
Expand Down
2 changes: 2 additions & 0 deletions src/config/mempool.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const PUBLIC_MEMPOOL_URL = "https://mempool.space";
export const PUBLIC_MEMPOOL_URL_SIGNET = "https://mempool.space/signet";