Skip to content

johnalbertini14-glitch/openclaw-skills / skills/0xmasayoshi/sushiswap-sdk

sushiswap-sdk

Verified

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

FileKindSize
SKILL.mdskill md3.5 KB
_meta.jsonconfig283 B
references/REFERENCE.mdmarkdown2.1 KB

references/REFERENCE.md

View on GitHub
# SushiSwap SDK Reference

This document provides practical examples for interacting with the SushiSwap
Aggregator using the Sushi SDK.

The SDK functions shown here are thin wrappers around the SushiSwap REST API and
are provided for convenience. All swap execution data ultimately comes from the
API.

---

## Getting a Swap Quote

Use `getQuote` to retrieve pricing, routing, and estimated output information for
a token swap.

This endpoint is read-only and does not generate executable transaction data.

```ts
import { getQuote, EvmChainId } from 'sushi/evm'

const data = await getQuote({
  chainId: EvmChainId.ETHEREUM,
  tokenIn: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
  tokenOut: '0x6B3595068778DD592e39A122f4f5a5cF09C90fE2',
  amount: 1000000000000000000n,
  maxSlippage: 0.005,
})

```

---

## Generating and Executing a Swap

Use `getSwap` to generate executable transaction data for a swap.

The API returns calldata that must be used exactly as provided.

```ts
import { getSwap, EvmChainId } from 'sushi/evm'
import { createPublicClient, createWalletClient, http, type Hex } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { mainnet } from 'viem/chains'

const publicClient = createPublicClient({
  chain: mainnet,
  transport: http(),
})

const data = await getSwap({
  chainId: EvmChainId.ETHEREUM,
  tokenIn: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
  tokenOut: '0x6B3595068778DD592e39A122f4f5a5cF09C90fE2',
  sender: '0xYourAddressHere',
  amount: 1000000000000000000n,
  maxSlippage: 0.005,
})

if (data.status === 'Success') {
  const { tx } = data

  const callResult = await publicClient.call({
    account: tx.from,
    data: tx.data,
    to: tx.to,
    value: tx.value,
  })

  console.log('Simulated output:', callResult)

  const PRIVATE_KEY = process.env.PRIVATE_KEY as Hex
  const walletClient = createWalletClient({
    chain: mainnet,
    transport: http(),
  })

  const hash = await walletClient.sendTransaction({
    account: privateKeyToAccount(PRIVATE_KEY),
    data: tx.data,
    to: tx.to,
    value: tx.value,
  })

  console.log('Tx:', hash)
}
```
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall