diff --git a/lib/contracts/constants.ts b/lib/contracts/constants.ts index 453a9597..462bea6d 100644 --- a/lib/contracts/constants.ts +++ b/lib/contracts/constants.ts @@ -15,6 +15,11 @@ const chainId = Number(process.env.NEXT_PUBLIC_CHAIN_ID || "84532"); export const IS_TESTNET = chainId === 84532; export const BASE_CHAIN_ID = chainId; +/** Block explorer base URL (no trailing slash) */ +export const EXPLORER_URL = IS_TESTNET + ? "https://sepolia.basescan.org" + : "https://basescan.org"; + // --------------------------------------------------------------------------- // PlotLink contracts // --------------------------------------------------------------------------- diff --git a/src/app/register-agent/page.tsx b/src/app/register-agent/page.tsx index 7f4da512..897276a8 100644 --- a/src/app/register-agent/page.tsx +++ b/src/app/register-agent/page.tsx @@ -6,7 +6,7 @@ import { decodeEventLog, type Hex } from "viem"; import { useRouter } from "next/navigation"; import { publicClient } from "../../../lib/rpc"; import { erc8004Abi } from "../../../lib/contracts/erc8004"; -import { ERC8004_REGISTRY, BASE_CHAIN_ID } from "../../../lib/contracts/constants"; +import { ERC8004_REGISTRY, BASE_CHAIN_ID, EXPLORER_URL } from "../../../lib/contracts/constants"; import { ConnectWallet } from "../../components/ConnectWallet"; // --------------------------------------------------------------------------- @@ -439,7 +439,15 @@ export default function RegisterAgentPage() { {regTxHash && (
+ Tx:{" "} + + {txHash.slice(0, 10)}...{txHash.slice(-8)} + +
+ )} {error &&{error}
} ); diff --git a/src/components/DonateWidget.tsx b/src/components/DonateWidget.tsx index c3374521..f091abcb 100644 --- a/src/components/DonateWidget.tsx +++ b/src/components/DonateWidget.tsx @@ -7,7 +7,7 @@ import { parseUnits, formatUnits } from "viem"; import { publicClient } from "../../lib/rpc"; import { erc20Abi } from "../../lib/price"; import { storyFactoryAbi } from "../../lib/contracts/abi"; -import { STORY_FACTORY, PLOT_TOKEN, IS_TESTNET } from "../../lib/contracts/constants"; +import { STORY_FACTORY, PLOT_TOKEN, IS_TESTNET, EXPLORER_URL } from "../../lib/contracts/constants"; type TxState = "idle" | "approving" | "confirming" | "pending" | "indexing" | "done" | "error"; @@ -190,7 +190,15 @@ export function DonateWidget({ storylineId }: DonateWidgetProps) { {error &&{error}
} {txHash && txState === "done" && (- Tx: {txHash.slice(0, 10)}...{txHash.slice(-8)} + Tx:{" "} + + {txHash.slice(0, 10)}...{txHash.slice(-8)} +
)} diff --git a/src/components/TradingWidget.tsx b/src/components/TradingWidget.tsx index ed7904cd..1d7bdc51 100644 --- a/src/components/TradingWidget.tsx +++ b/src/components/TradingWidget.tsx @@ -6,7 +6,7 @@ import { useQuery } from "@tanstack/react-query"; import { parseUnits, formatUnits, type Address } from "viem"; import { publicClient } from "../../lib/rpc"; import { mcv2BondAbi, erc20Abi } from "../../lib/price"; -import { MCV2_BOND, PLOT_TOKEN, IS_TESTNET } from "../../lib/contracts/constants"; +import { MCV2_BOND, PLOT_TOKEN, IS_TESTNET, EXPLORER_URL } from "../../lib/contracts/constants"; type Tab = "buy" | "sell"; type TxState = "idle" | "approving" | "confirming" | "pending" | "done" | "error"; @@ -269,7 +269,15 @@ export function TradingWidget({ tokenAddress }: { tokenAddress: Address }) { {error &&{error}
} {txHash && txState === "done" && (- Tx: {txHash.slice(0, 10)}...{txHash.slice(-8)} + Tx:{" "} + + {txHash.slice(0, 10)}...{txHash.slice(-8)} +
)}