Skip to main content
createReadOnly() is the no-signing, no-submission mode.
  • no private key
  • no signer
  • no transaction building
  • all read methods available

When to use it

  • price widgets
  • charts and dashboards
  • analytics tools
  • account views that display positions, orders, fills, or candles

Example

const client = await OstiumClient.createReadOnly();

const { pairs } = await client.getPairs();
const { prices } = await client.getAllPrices();
const positions = await client.getOpenPositions({ user: '0xTraderAddress' });
For low-latency account snapshots, pass user and an Alchemy key:
const stream = client.streamAccountUpdates({
  user: ['0xTraderAddress'],
  alchemyApiKey: process.env.ALCHEMY_API_KEY!,
});
Write methods throw INVALID_CONFIG in this mode.

Parameters

All fields are optional.
FieldTypeDefaultNotes
rpcUrlstringpublic RPCArbitrum RPC URL for reads/simulation.
testnetbooleanfalseUse Arbitrum Sepolia.
subgraphUrlstringmainnet/testnet subgraphOverride the subgraph endpoint.
builderApiUrlstringhttps://builder.ostium.ioOverride the builder API base URL.
alchemyApiKeystringRequired only to start streamAccountUpdates().
Read-only clients do not accept slippageBps or builder. See Client Configuration for the full reference.