import { BondkitToken } from "@b3dotfun/sdk/bondkit";import { parseEther, formatEther } from "viem";// Connect to your deployed tokenconst token = new BondkitToken( tokenAddress, process.env.WALLET_PRIVATE_KEY);
// Get a price quote firstconst ethAmount = parseEther("1"); // 1 ETHconst expectedTokens = await token.getAmountOfTokensToBuy(ethAmount);console.log(`1 ETH will buy: ${formatEther(expectedTokens)} tokens`);// Execute the purchaseconst buyTx = await token.buy( 0n, // minTokensOut (0 = accept any amount, use for slippage protection) "1" // ETH amount as string);console.log("Purchase complete! Tx:", buyTx);