uniswap-swap-integration

創作者:Uniswap Labs
0
25

簡介

For Developers

Add Uniswap token swaps to any application — choose the integration method that fits your stack.

  • Three supported methods: Trading API (frontend/backend), Universal Router SDK (full control), direct contract call (Solidity)
  • Built-in input validation and mandatory user confirmation before every transaction
  • Complete Trading API reference included — all routing types and order variants
uniswap
swap
defi
trading-api
universal-router
permit2
ethereum

SKILL.md

Uniswap Swap Integration

Integrate Uniswap token swaps into any application layer — React frontend, backend script, or Solidity smart contract.

Prerequisites

  • claude plugin add @uniswap/uniswap-trading or npx skills add Uniswap/uniswap-ai installed
  • uniswap-viem installed and configured (required foundation)
  • Uniswap Developer Portal API key (for Trading API authentication)

When to Use This Skill

Use this skill when the user:

  • Wants to add swap functionality to a React or Next.js frontend
  • Is building a backend script or bot that executes Uniswap swaps
  • Wants to call Uniswap swaps from within a Solidity smart contract
  • Asks about the Uniswap Trading API, Universal Router, or swap integration methods

How It Works

Three integration paths are available depending on what you're building:

MethodBest for
Trading APIReact/Next.js frontends or backend scripts — best routing, fastest to integrate
Universal Router SDKScenarios requiring full transaction-level control
Direct execute() callSolidity contracts composing on-chain with other DeFi protocols

All paths include strict input validation. The skill enforces a mandatory user confirmation step before any transaction is submitted — this cannot be bypassed. The complete Trading API reference is included, covering all routing types, order variants, and error handling.

Key endpoints (base URL: https://trade-api.gateway.uniswap.org/v1):

  • POST /check_approval — Check if a token approval is needed before swapping
  • POST /quote — Get an executable quote with optimal routing
  • POST /swap — Get a signed transaction ready to submit