import {
simulateSwapFacilitySwap,
writeSwapFacilitySwap,
addresses,
} from "@camino-treasury/sdk";
const { c0, swapFacility } = addresses[mainnet.id];
const USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
// Approve the SwapFacility to pull USDC first (use viem's erc20Abi
// + writeContract from @wagmi/core, or the wallet's existing approve flow).
const { request } = await simulateSwapFacilitySwap(config, {
account,
address: swapFacility,
args: [
USDC, // tokenIn
c0, // tokenOut
100_000_000n, // amountIn (100, 6 decimals)
"0xYourAddress", // recipient
],
});
const txHash = await writeSwapFacilitySwap(config, request);