Skip to main content
All builders are exported from 0xtrails. Amount fields accept human-readable decimal strings (e.g., "0.5" for 0.5 USDC), raw bigint values, or dynamic() for runtime resolution.

swap

Executes a token exchange via Uniswap V3 or SushiSwap V3. Trade type is inferred from which amount field you provide: amountIn produces EXACT_INPUT; amountOut produces EXACT_OUTPUT.

Low-level swap utilities

For advanced use cases that need pre-flight pricing or manual call construction:

lend

Supplies tokens to a lending market. Use useEarnMarkets to discover available marketId values.

deposit

Contributes funds to a vault-shaped market: ERC-4626, Morpho, or Yearn vaults.

assertCondition

An onchain guard. If the condition evaluates to false at execution time, the entire batch reverts. Use this to validate state before continuing (minimum balance, deadline, allowance).
assertCondition does not accept dynamic() values, it evaluates concrete conditions against live chain state.

custom

An escape hatch for arbitrary contract calls. Use encodeFunctionData from viem to build the calldata.

ERC-20 helpers

Utilities for constructing standard ERC-20 calls and looking up token metadata.

Token registry

Calldata builders

Slippage calculator