Skip to content

SDKs

Ekubo publishes three libraries. All of them implement the same protocol math, so quotes computed off-chain match on-chain execution exactly.

Package Language Use it for
ekubo_sdk Rust Computing quotes and simulating swaps across every pool type
@ekubo/sdk TypeScript Pool math, tick and price conversions, pool key encoding
@ekubo/yul-router-sdk TypeScript Encoding swap routes for execution on EVM chains

All three cover both Starknet and EVM deployments where the underlying math is shared.

The Rust SDK is the most complete implementation — it is what powers Ekubo’s own routing. It exists primarily to compute quotes from Ekubo pools, plus the supporting protocol math.

[dependencies]
ekubo_sdk = { version = "3.2", features = ["evm"] }

The crate is no_std-compatible, which makes it usable in constrained environments. Select what you need with feature flags:

Feature Effect
std (default) / no_std Standard library or libm-backed math; exactly one must be enabled
evm EVM types via alloy-primitives (v1 by default; evm-alloy-0_6 pins v0.6)
starknet Starknet felt types via starknet-types-core
serde Serialization for the protocol types

Three modules:

  • math — tick and sqrt-ratio conversions, swap step computation, deltas, fixed-point helpers, and TWAMM math
  • quoting — the quoting engine: a Pool trait with a quote method, QuoteParams / Quote / TokenAmount types, and PoolKey / PoolConfig / Tick definitions
  • chain — the EVM and Starknet type mappings

The quoting::pools module implements every pool type and extension so that off-chain quotes account for extension behavior: concentrated, full_range, stableswap, limit_order, mev_capture, twamm, oracle, ve33, spline, and boosted_fees variants. This is the practical reason to prefer the Rust SDK for routing — replicating extension behavior by hand is where most integrations go wrong (see Aggregators).

Terminal window
npm install @ekubo/sdk

Shared math and protocol encoding utilities, with no runtime dependencies. It covers the pieces most integrations need in a browser or Node environment:

  • Tick and price math — conversions between ticks, sqrt ratios, and prices for both chains (see Price representation)
  • Liquidity mathmaxLiquidityForTokenAmounts, liquidityToAmountBase / liquidityToAmountQuote, amountsFromSpecifiedAmount, and the amount0Delta / amount1Delta primitives for sizing positions
  • Swap mathcomputeStep, computeFee, amountBeforeFee, nextSqrtRatioFromAmount0 / nextSqrtRatioFromAmount1
  • TWAMM mathcalculateNextSqrtRatio for DCA pools
  • Pool key and protocol encoding for EVM
  • Chain constantsEVM_MIN_TICK / EVM_MAX_TICK (±88,722,835), EVM_MAX_TICK_SPACING, EVM_MIN_SQRT_RATIO / EVM_MAX_SQRT_RATIO, and the Starknet equivalents (±88,722,883)
Terminal window
npm install @ekubo/yul-router-sdk

Encodes calldata for the Yul Router, the router used for Ekubo swaps on EVM chains. Use it to turn a route — typically one returned by the Quoter API — into a transaction. See the Yul Router guide for the full surface and worked examples.