uniswap-swap
Uniswap Swap
Return a comparable quote and a bounded unsigned handoff, or resolve an existing transaction/order. Distinguish CLASSIC AMM transactions from UniswapX signed orders before constructing anything. Use the official Trading API or verified official interface; a wallet connection is not needed to explain or compare a public quote, but its real swapper address is needed for an executable one.
For application integration work, discover the official swap-integration skill from uniswap/uniswap-ai if already available. This operational recipe complements that upstream integration surface; it does not require an automatic install or replace upstream transaction builders.
Gather and quote
Require chain IDs, exact input/output token addresses, raw integer amount, exact-input or exact-output intent, swapper, recipient intent, slippage and expiry/cost bounds. Look up token decimals on the selected chain; symbols do not identify assets. For exact-output intent show maximum input, not a fixed input debit.
Use API recipes. Obtain an API key through the user's existing secret mechanism; never print it. Missing key means use a connected official tool/UI or produce a parameter-complete request marked unqueried, not a fabricated quote. Pin one supported x-universal-router-version consistently through the journey. For an AMM-only task request protocols: ["V2","V3","V4"] only if the user accepts those protocols; narrow to the approved subset when required.
Interpret the actual routing discriminator, quoteId, quoted input/output and minimum/maximum amounts. Preserve returned quote JSON rather than reconstructing it. Check txFailureReasons, gas, recipient, chain, token identities and quote time. A successful quote endpoint does not prove allowance, affordability or a submitted swap.