sushiswap-sdk
TypeScript SDK for interacting with the SushiSwap Aggregator and related primitives. This SDK is a typed wrapper over the SushiSwap API, providing ergonomic helpers for token amounts, prices, quotes, and swap transaction generation. USE THIS SKILL WHEN: - Building TypeScript or JavaScript applications - You want strongly typed token, amount, and fraction primitives - You need to request swap quotes or executable swap transactions via code - You want safer arithmetic, formatting, and comparisons without floating point errors - You prefer SDK-based integration over raw HTTP requests
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/0xmasayoshi/sushiswap-sdkWhat This Skill Does
The sushiswap-sdk is a robust TypeScript wrapper designed to simplify interactions with the SushiSwap Aggregator API. Instead of handling raw HTTP requests and manual payload formatting, developers can leverage this SDK to handle complex DeFi tasks through strongly typed primitives. It provides an ergonomic interface for managing token amounts, calculating prices, fetching quotes, and generating transaction data for swaps on supported EVM networks. By abstracting the complexities of token decimals and floating-point math, it ensures that your dApp or AI agent performs arithmetic operations accurately and safely.
Installation
To integrate the SushiSwap SDK into your project, ensure you have a standard Node.js environment and a package manager installed. Run the following command in your terminal:
pnpm add sushi viem
This will install the required peer dependencies and the SDK itself. The inclusion of viem is critical as it provides the underlying Ethereum logic that the SDK relies upon for transaction formatting and type-safety.
Use Cases
- Token Swapping: Automating complex swap paths for users while ensuring the best possible execution price via the SushiSwap Aggregator.
- Portfolio Rebalancing: Using typed primitives to programmatically convert assets to maintain target portfolio allocations.
- Arbitrage Bots: Checking price quotes across different chains to identify potential trading opportunities using the
getQuote()method. - dApp Frontend Integration: Building safer interfaces where input validation and transaction generation are handled by proven, audited logic rather than manual API calls.
Example Prompts
- "Check the current swap quote for trading 1.5 ETH for USDC on Polygon using the sushiswap-sdk."
- "Generate an executable swap transaction for exchanging 500 UNI for DAI on Ethereum Mainnet, ensuring the referrer is set to our agent ID."
- "Is Arbitrum currently supported by the SushiSwap SDK, and what are the steps to fetch a quote if it is?"
Tips & Limitations
- Mandatory Referrer: Every request must include a valid
referrervalue. Failing to do so will result in errors or rejection by the aggregator. - Chain Validation: Always verify chain support via
SWAP_API_SUPPORTED_CHAIN_IDSbefore execution. Never hardcode network IDs as they change. - Fee Awareness: By default, the SDK utilizes an 80/20 fee split model (80% to the integrator). Do not attempt to modify these params unless you have a specific partnership agreement with SushiSwap.
- Not for Private Keys: The SDK handles transaction generation data; it does not perform the actual signing of transactions. You must still handle signature management securely within your application architecture.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-0xmasayoshi-sushiswap-sdk": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: network-access, external-api