@ostium/builder-sdk@0.9.0. See the Changelog for what it adds and the three behaviour changes to know about before upgrading.
Install
Core SDK surfaces
- client creation methods for each execution mode
- build-only transaction helpers for client-side signing
- SDK-managed write methods for direct submission
- read methods backed by the subgraph and builder API
- live streams for prices, positions, and low-latency account confirmations
- pre-trade previews for order and close tickets, derived from the same math the contracts run
- a subscribable store that keeps pairs, prices and positions current for you
safeAddress to skip the smart-account derivation call during construction.
Method index
Client creation
createSelfAndSelfcreateSelfAndGaslesscreateDelegatedAndSelfcreateDelegatedAndGaslesscreateReadOnly
Previews and limits
previewOpenTradepreviewCloseTradegetMaxCollateralgetOnboardingStatusgetVaultBalance
Live state
createStorePAIR_SNAPSHOTselectPosition,selectPositionsForPair,selectPrice,selectPair,selectPairMeta,selectMarkets,selectPositionsNearLiquidation,memoSelector
createStore() holds pairs, live prices and positions in one subscribable object and keeps them current. Its getState/subscribe pair matches React’s useSyncExternalStore.
Standalone math
liquidationPricepnlrolloverFee
Helpers
canBuildTransactionscanSubmitTransactionsgetTraderAddressisReadOnlygetSmartAccountAddresscheckUsdcAllowancegetBalancesextractOrderIdFromReceipt
Utilities and constants
parseUsdcparsePriceparseLeverageMIN_OPEN_SIZE_USDMIN_COLLATERAL_USDMAX_COLLATERAL_USD
Read methods
getPairsgetAllPricesgetOpenPositionsgetOpenOrdersgetOrdersgetBuilderOrdersgetFillsgetFillsByTimegetSimSlippagegetSimOrderbookgetCandlesgetVaultBalancestreamPricesstreamPositionUpdatesstreamAccountUpdates
Transaction builders
getSetupGaslessDelegationTxgetApproveUsdcTxgetSetDelegateTxgetRemoveDelegateTxgetOpenTradeTxgetCloseTradeTxgetCancelOrderTxgetModifyOrderTxgetUpdateCollateralTx
Write methods
approveUsdcsetupGaslessDelegationsetDelegateremoveDelegateopenTradecloseTrademodifyOrderupdateCollateralcancelOrder
Build vs submit
Every write action now has two SDK surfaces:get*Tx()returns unsigned transaction data for wallet-driven or Safe-driven client applications- the write method (
openTrade,closeTrade,approveUsdc, and so on) signs and submits through the configured mode when the client was created with credentials
get*Tx() methods return a Safe-style request instead of an EOA request.
Guides
If you want implementation examples instead of method reference, use the guides section:Examples
Three runnable programs ship with the package:
See Examples for what each one covers and how to run it. The same page lists the
llms.txt and Claude skill files shipped for AI coding agents.
Error handling
See Errors for the exportedOstiumError, OstiumSubgraphError, OstiumSubmissionPendingError, and their error codes.
Changelog
See Changelog for the versioned SDK changes, including the0.8.0 preview and gasless-submission work and the 0.9.0 store, rollover and reconnect additions.