import { ConduitCheckout } from "@conduitexchange/connect";
import { mintCoreAsset } from "@conduitexchange/connect/solana";
import { useConnection, useWallet } from "@solana/wallet-adapter-react";
export function FoundersPass() {
const { connection } = useConnection();
const wallet = useWallet();
const [minted, setMinted] = useState<string | null>(null);
return (
<ConduitCheckout
amount="25"
currency="USDC"
merchantAddress={process.env.NEXT_PUBLIC_TREASURY!}
orderId={`founders_${crypto.randomUUID()}`}
description="Conduit Founders Pass"
onSuccess={async (paymentId) => {
// Reserve via Conduit's backend — verifies payment completed,
// enforces max 3 per wallet, issues an HMAC-signed mint token.
const reserve = await fetch("/api/connect/founders-pass/reserve", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
paymentId,
recipient: wallet.publicKey!.toString(),
}),
}).then((r) => r.json());
// Real Metaplex Core mint, direct to the buyer's wallet.
const res = await mintCoreAsset({
wallet: wallet.wallet!.adapter,
rpcEndpoint: connection.rpcEndpoint,
name: reserve.name,
uri: reserve.uri,
collection: process.env.NEXT_PUBLIC_FOUNDERS_COLLECTION,
recipient: wallet.publicKey!.toString(),
});
// Confirm with the backend so the supply counter commits.
await fetch("/api/connect/founders-pass/confirm", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
...reserve,
result: "success",
assetAddress: res.asset,
signature: res.signature,
}),
});
setMinted(res.asset);
}}
/>
);
}