@epsilon-exchange/sdk
TypeScript SDK for Epsilon on Robinhood Chain
(id 4663): a thin client for the /v1 REST API
plus non-custodial EIP-712 order signing for limit, stop-loss, and DCA orders.
Orders are signed locally with your wallet and executed on-chain by keepers —
funds stay in the wallet until fill. The API key is attribution and rate
limiting; authorization is the maker's signature.
npm install @epsilon-exchange/sdk viem
Quickstart: place a limit order
import { privateKeyToAccount } from 'viem/accounts'
import {
apiPost, fetchOrderRoute, buildAndSignOrder,
calculateTriggerPrice, parseUnits, makePublicClient, tokenMeta,
DEFAULT_RPC_URL, type ApiConfig,
} from '@epsilon-exchange/sdk'
const cfg: ApiConfig = {
baseUrl: 'https://api.epsilon.exchange',
apiKey: process.env.EPSILON_API_KEY!,
}
const account = privateKeyToAccount(process.env.WALLET_KEY as `0x${string}`)
const pub = makePublicClient(DEFAULT_RPC_URL)
const tokenIn = '0x5fc5360d0400a0fd4f2af552add042d716f1d168'
const tokenOut = '0x0bd7d308f8e1639fab988df18a8011f41eacad73'
const inMeta = await tokenMeta(pub, tokenIn)
const outMeta = await tokenMeta(pub, tokenOut)
const amountIn = parseUnits('25', inMeta.decimals)
const route = await fetchOrderRoute(cfg, {
tokenIn, tokenOut,
amountIn: amountIn.toString(),
slippagePpm: 10_000,
wallet: account.address,
})
const signed = await buildAndSignOrder({
account, tokenIn, tokenOut, amountIn,
triggerPrice: calculateTriggerPrice('0.0004', outMeta.decimals),
tokenInDecimals: inMeta.decimals,
deadline: Math.floor(Date.now() / 1000) + 7 * 24 * 3600,
slippagePpm: 10_000,
kind: 'limit',
feeLegs: route.feeLegs,
})
const res = await apiPost<{ orderHash: string }>(cfg, '/v1/orders', {
orderType: 'limit',
...signed,
})
console.log('placed:', res.orderHash)
Remember the one-time ERC-20 approval of the router for tokenIn
(approveRouter in this package) before the first order.
What's inside
api.ts — /v1 client (apiGet/apiPost/apiDelete, fetchOrderRoute)
order.ts — buildAndSignOrder, signCancel, trigger-price math, unit helpers
makerTraits.ts — the v7 makerTraits bit layout encoder
wallet.ts — viem chain definition, token metadata/balances/allowance, router approval
chain.ts — chain id, router address, EIP-712 domain and types
The signing implementation is cross-verified byte-for-byte against the Go
indexer via a shared fixture — the same code path the
@epsilon-exchange/mcp
server uses.
Docs
MIT