After graduation, curve trading stays closed and liquidity moves to a locked Uniswap V4 position. The SDK discovers the canonical pool and builds the Universal Router and Permit2 instructions for you.
pnpm add @clanktrade/sdk viembun add @clanktrade/sdk viemnpm i @clanktrade/sdk viemyarn add @clanktrade/sdk viemThis guide assumes your app has a Robinhood Chain publicClient, a connected
walletClient, and the launch-token address.
Resolve the graduated market
import { createClankClient } from "@clanktrade/sdk";
import { parseEther, type Address } from "viem";
const launchToken = "0x..." as Address;
const [trader] = await walletClient.getAddresses();
if (!trader) throw new Error("Connect a wallet before trading");
const clank = await createClankClient({ publicClient, launchToken });
if (clank.venue !== "uniswap-v4") {
throw new Error("This launch has not completed graduation");
}createClankClient reads the launch record, curve state, pool fee, tick
spacing, pair token, and initialization hook. It rejects states 1 and 2
while graduation is still in progress.
Quote and build a buy
All SDK buys are priced in native ETH, including launches paired with an ERC-20. The SDK searches supported direct ETH and WETH routes and can bridge through USDG before entering the launch pool.
const buyQuote = await clank.quoteBuy({
ethIn: parseEther("0.1"),
trader,
slippageBps: 100,
});
console.log({
launchTokensOut: buyQuote.amountOut,
minimumLaunchTokensOut: buyQuote.minimumAmountOut,
route: buyQuote.route.label,
});
const buyInstructions = await clank.buildBuy({
quote: buyQuote,
trader,
});The buy is one Universal Router transaction. Its value is the quoted ETH input, and its minimum output applies across the complete route.
Quote and build a sell
const sellQuote = await clank.quoteSell({
launchTokensIn: parseEther("1000"),
trader,
slippageBps: 100,
});
console.log({
ethOut: sellQuote.amountOut,
minimumEthOut: sellQuote.minimumAmountOut,
route: sellQuote.route.label,
});
const sellInstructions = await clank.buildSell({
quote: sellQuote,
trader,
});A first sell may return two approval instructions—launch token to Permit2 and Permit2 to Universal Router—before the trade. Existing sufficient allowances are reused.
Submit the instructions
Submit instructions in order and wait for each successful receipt. Do not send the trade until every approval it depends on is confirmed.
const submit = async (
instructions: Awaited<ReturnType<typeof clank.buildSell>>
) => {
for (const instruction of instructions) {
const hash = await walletClient.sendTransaction({
account: trader,
to: instruction.to,
data: instruction.data,
value: instruction.value ?? 0n,
});
const receipt = await publicClient.waitForTransactionReceipt({ hash });
if (receipt.status !== "success") {
throw new Error(`${instruction.label} reverted`);
}
}
};
await submit(sellInstructions);buildBuy and buildSell use a short deadline derived from the latest chain
timestamp unless you provide one explicitly.
See the SDK API reference for every method, parameter, and return type.