Changelog
All notable changes to@ostium/builder-sdk will be documented in this file.
The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.
[0.7.0] - 2026-07-29
Changed
- Gasless key-mode factories (
createSelfAndGasless,createDelegatedAndGasless) accept an optionalsafeAddress. Use the smart-account address from a previousclient.getSmartAccountAddress()call to skip the counterfactual-address derivationeth_calland make gasless construction network-free. The address is deterministic per key and chain. - Client construction no longer blocks on a subgraph pair-list fetch. Pair metadata loads lazily on first use, so build-only consumers and price streams can start without waiting for a full pair cache.
streamPrices(pairIds)can be called immediately after client creation. If the pair list is still loading, the stream connects and applies the pair filter once pair metadata resolves.
Fixed
OpenOrder.idxfromgetOpenOrders()now carries the on-chain limit slot index, not the subgraph’s global order id. Pass this value directly tocancelOrder({ type: CancelOrderType.Limit })andmodifyOrder().Fill.oidandOrder.oidare now documented and normalized as the on-chain keeper order id, formatted as a base-10 numeric string for both fast-overlay and subgraph-indexed entries.extractOrderIdFromReceipt()now decodes order ids from the currentMarketOpenOrderInitiated,MarketCloseOrderInitiated, andMarketCloseOrderInitiatedV2events, while still supporting olderPriceRequestedreceipts.- Fast-overlay trades in
streamAccountUpdates()seed their rollover baseline from the pair’s rollover accumulator at the open block, keeping streamed PnL and liquidation estimates aligned with indexed positions. OstiumPriceStream.subscribe()and.unsubscribe()no longer drop filter messages while the socket is still connecting; pending filter changes are sent on open.- The account-updates WebSocket retries reconnection indefinitely with a 2-second delay instead of stopping after viem’s default retry limit.
[0.6.0] - 2026-07-23
Changed
- BREAKING: Migrated the default builder API endpoints from
https://builder.ostium.iotohttps://builder.prod.bedrock.ostium.io(subgraph, Pimlico sponsor, prices/OHLC, and WebSocket stream).builder.ostium.iois being deprecated; clients relying on the old default must upgrade. Consumers passing explicit URLs should update them accordingly.
Fixed
- Ghost positions in
streamAccountUpdates(): a trade closed before its open was ever observed indexed, whoseMarketCloseExecutedV2event was missed (e.g. during a WebSocket reconnect), previously lingered in the emitted snapshot forever. Three complementary fixes:- The account snapshot query now also fetches recently executed close/liquidation orders (15-minute lookback) and tombstones matching overlay entries, so the subgraph poll can clear a ghost even with a dead event socket.
- New missed-event backfill: each poll sweeps
MarketOpenExecuted/MarketCloseExecutedV2logs over HTTP from the last swept block, so events dropped during a WebSocket flap surface within roughly one poll interval instead of being lost. executedoverlay entries are no longer exempt from the overlay TTL; an executed trade the subgraph never confirms within the TTL now expires instead of ghosting indefinitely.
[0.5.0] - 2026-07-13
Changed
streamAccountUpdates()now fetches the account snapshot for all subscribed traders in one batched subgraph query per poll instead of one query per trader. If the shared 1000-row window saturates (any entity set returns a full page), the poll transparently falls back to per-user queries so a busy account still cannot starve the others.- Default
pollIntervalMsraised from700to3000. Sub-second open/close confirmations come from the Alchemy event watchers (which also trigger an immediate poll), so the timer poll only paces reconciliation of changes with no watcher (limit fills, partial closes, TP/SL edits, liquidations). PasspollIntervalMsto restore a faster cadence. - The per-poll Alchemy
eth_blockNumbercall is now served from a 30-second cache. Combined with the changes above, a 20-user stream drops from ~1,700 subgraph requests/minute to ~20, and steady-state Alchemy HTTP calls drop ~15×.
[0.4.1] - 2026-06-14
Added
streamAccountUpdates()now acceptsuseras an address array, allowing one or more trader addresses on a single stream (one WebSocket, one poll loop, one price feed). Emitted snapshots are keyed by normalized trader address with{ positions, orders, limits }per trader.OstiumAccountUpdatesStream.usersgetter returning the subscribed trader addresses.- Optional
userargument toOstiumAccountUpdatesStream.addOptimisticOpen(params, submission?, user?)to attribute an optimistic open to a specific subscribed address. Required when streaming multiple addresses; defaults to the sole subscribed address otherwise.
[0.4.0] - 2026-06-11
Added
- Added this changelog.
- Added
setspagination support togetCandles(). - Added
getOrders()filters for global orders, builder address, status, pair ids, and execution time (start/endas Unix seconds UTC, inclusive bounds onexecutedAt). - Added
getBuilderOrders(builder, params?)— fetches builder-tagged open orders plus sibling close/TP/SL orders on the same positions.limitcaps phase-1 results only; phase-2 siblings are appended without a cap. - Added
builderto returnedFillandOrderobjects. - Added
ntl(USD notional) to returnedFillandOrderobjects. - Added
traderto returnedFill,Order,Position, andOpenOrderobjects. - Added
timestamp(execution time, Unix seconds UTC — subgraphexecutedAt) to returnedFillandOrderobjects. - Added
MIN_OPEN_SIZE_USDfor the fixed $5 minimum open size. - Added per-trade optional
builder.address/builder.feeBpsoverrides onopenTrade(); omitted fields fall back to client config. - Added
openFeeandcloseFee(bps) toPair—openFeeistakerFeeP / 10_000plus the configured builder fee;closeFeeis always0as there’s no closing fees on Ostium currently. - Added
streamAccountUpdates()for low-latency account confirmations using subgraph polling, Alchemy contract-log overlays, and live price repricing for open-trade PnL. - Added optimistic market-open overlays to
streamAccountUpdates(), receiptorderIdextraction viaextractOrderIdFromReceipt(), andattachOrderId()reconciliation for lower-latency confirmations. - Added
alchemyApiKeyas a client option for account confirmation streams. - Added account update snapshots with SDK-formatted
Order,OpenOrder, andPairPositionvalues. - Added
schedule(market hours —timezone,openingHours,alwaysOpen) toPairreturned bygetPairs(), and toPriceData/PriceTickfrom the live price feed. - Added background SDK usage attribution: submissions that target the Trading contract report their transaction hash to the builder API (
POST /v1/trade) as a fire-and-forget request that never blocks or affects trading calls.
Changed
- Updated the default mainnet subgraph URL to
https://builder.ostium.io/v1/subgraph/gn.
Fixed
- Removed the SDK-side
openTrade()maximum leverage cap so contract-side validation is authoritative. - Removed the internal minimum-open-size config override path.
[0.3.1]
- Current published package version when this changelog was introduced.