# SDK

Software Development Kits for integrating Omniston liquidity aggregation across swap and order settlement flows.

## Features

* **Best Price Discovery**: Automatically finds optimal swap and order routes
* **Cross-chain Aggregation**: Supports cross-chain settlement flows
* **Real-time Quotes**: Live RFQ updates via WebSocket
* **Settlement-specific APIs**: TON transaction builders and EVM order payload flows
* **Error Handling**: Comprehensive error types and recovery

## SDKs

We provide two packages for different use cases:

* `@ston-fi/omniston-sdk` for direct SDK usage in backend services, bots, scripts, and custom application architectures
* `@ston-fi/omniston-sdk-react` for React applications that want Omniston exposed as ready-to-use hooks

### Node.js SDK

Use the Node.js SDK when you want direct access to the Omniston API surface and full control over request, quote, and settlement handling.

#### Key benefits:

* Low-level access to RFQ, tracking, and settlement APIs
* Direct Observable-based integration without React dependencies
* Best fit for backend services, bots, server actions, and custom app architectures
* Easier to build your own abstractions on top of the raw SDK primitives

#### Installation:

```bash
npm install @ston-fi/omniston-sdk
```

#### Quick start:

```typescript
import { Omniston } from '@ston-fi/omniston-sdk';

const omniston = new Omniston({
  apiUrl: 'wss://omni-ws.ston.fi'
});

omniston.requestForQuote({ /** */ }).subscribe((quoteEvent) => {
  switch (quoteEvent?.$case) {
    case 'ack':
      console.log('RFQ id:', quoteEvent.value.rfqId);
      break;
    case 'quoteUpdated':
      console.log('Quote:', quoteEvent.value);
      break;
    case 'noQuote':
      console.log('No quote available');
      break;
  }
});
```

#### Detailed guide:

* [Node.js SDK Documentation](/developer-section/omniston/sdk/nodejs.md)

### React SDK

Use the React SDK when you are building a React application and want Omniston exposed as ready-to-use hooks.

#### Key benefits:

* React-first API built on top of the base SDK
* TanStack Query integration for loading, caching, and stream-driven updates
* Less boilerplate for binding RFQ, tracking, and settlement flows to UI state
* Best fit for browser apps, wallet-connected UIs, and dashboards

#### Installation:

```bash
npm install @ston-fi/omniston-sdk-react
```

#### Quick start:

```tsx
import { useRfq } from '@ston-fi/omniston-sdk-react';

function SwapComponent() {
  const { data: quoteEvent, error } = useRfq({ /** */ });

  if (error) {
    return <ErrorState error={error} />;
  }

  switch (quoteEvent?.$case) {
    case 'quoteUpdated':
      return <QuotePreview quote={quoteEvent.value} />;
    case 'noQuote':
      return <NoQuote />;
    case 'ack':
    default:
      return <Loading />;
  }
}
```

#### Detailed guide:

* [React SDK Documentation](/developer-section/omniston/sdk/react.md)
* [React SDK v0.7 to v0.8 Migration](/developer-section/omniston/sdk/migration-v0.7-to-v0.8.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ston.fi/developer-section/omniston/sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
