Skip to content

swap-integration ​

Plugin: pancakeswap-driver · Model: Opus · Version: 1.1.0

Integrate PancakeSwap swaps into frontends, backends, and smart contracts.

Overview ​

This skill produces integration code — not deep links. The output is a working implementation using the Smart Router SDK, Universal Router SDK, or direct V2 Router contract calls, depending on the use case.

Quick Decision Guide ​

Building...Use This Method
Quick quote or prototypePancakeSwap Routing API (Method 1)
Frontend with React/Next.jsSmart Router SDK + Universal Router (Method 2)
Backend script or trading botSmart Router SDK + Universal Router (Method 2)
Simple V2 swap via smart contractDirect V2 Router contract calls (Method 3)
Need exact Universal Router encodingUniversal Router SDK directly (Method 2)

Protocol Types ​

ProtocolDescriptionFee Tiers (bps)Chains
V2Classic AMM (xy=k)25 (0.25%)BSC only
V3Concentrated liquidity1, 5, 25, 100 (0.01–1%)All chains
StableSwapLow-slippage for correlated/pegged assets1, 4 (0.01–0.04%)BSC only
MixedSplit route across V2 + V3 + StableSwapN/A (composite)BSC primarily

Supported Chains ​

ChainChain IDV2V3StableSwap
BNB Smart Chain56✅✅✅
BSC Testnet97✅❌❌
Ethereum1❌✅❌
Arbitrum One42161❌✅❌
Base8453❌✅❌
Polygon137❌✅❌
zkSync Era324❌✅❌
Linea59144❌✅❌
opBNB204❌✅❌

Key SDKs ​

bash
npm install @pancakeswap/smart-router @pancakeswap/universal-router-sdk viem

Usage Examples ​

Integrate PancakeSwap swaps into my Next.js dApp
Write a Node.js script to swap BNB for CAKE using the Smart Router
How do I use the Universal Router to execute a V3 swap on BSC?
Add swap functionality to my trading bot

Full Reference ​

See the source SKILL.md for the complete skill with code templates, address tables, and anti-patterns.

Released under the MIT License.