The Polyester TypeScript SDK (@polyester/sdk) is the official client library for the Polyester
exchange. It wraps the public ConnectRPC API in a fully typed surface: every request is validated
before it leaves your process, every response is parsed into plain TypeScript objects, and every
price and quantity crosses the boundary as an exact decimal string — no floating point, no raw
scaled integers.
What you can build with it
- Market data — market overview tickers, OHLCV candles, order book snapshots and live depth, public trades, order book heatmaps, and chain analytics.
- Trading — place, modify, and cancel spot orders with attached take-profit / stop-loss / trailing-stop risk, plus standalone triggers (stop, trailing, TWAP, ladder).
- Accounts — wallet and API key authentication, subaccounts with roles and policies, balances and equity history, MFA, profiles, and address books.
- Funding — deposit addresses, ledger transfers, internal transfers, and withdrawals to Funding or an external chain.
- Realtime — every domain has a matching WebSocket stream with typed events and a simple
subscribe(...)/ unsubscribe contract.
One SDK, three clients
The SDK ships one core client and two specializations, so the same service surface works in any JavaScript runtime:
| Client | Runs in | Authenticates with |
|---|---|---|
PolyesterClient | Anywhere (Node, Bun, edge, browser) | API key (Ed25519) or a JWT you supply |
PolyesterBrowserClient | Browsers | A wallet-backed account signer (login flow managed for you) |
PolyesterServerClient | Servers handling user requests | Session cookies forwarded from the browser |
All three expose the same lazily constructed services — client.orders, client.marketData, client.balances, and so on — plus a shared realtime client and a reference-data catalog.
Entry points
The package keeps heavy dependency graphs out of your main bundle by splitting specialized helpers into subpath exports:
| Import | Contents |
|---|---|
@polyester/sdk | Clients, environments, errors, service types, utilities |
@polyester/sdk/account-signer | createPolyesterAccountSigner — counterfactual Safe signer for wallet auth |
@polyester/sdk/smart-account | Smart account + bundler/paymaster helpers for on-chain actions |
@polyester/sdk/catalogs | Catalog snapshot builders and reader types |
@polyester/sdk/server-session | Cookie/session parsing helpers for servers |
How these docs are organized
- Get started walks you from install to your first order on testnet.
- Guides are task-oriented: authentication, market data, trading, streaming, accounts, funding, server-side usage, and error handling.
- Concepts explain how the SDK works: architecture, environments, the authentication model, and the catalog / decimal-precision system.
- Reference documents every service method, configuration option, and error type.
Ready to start? Head to Installation.