> For the complete documentation index, see [llms.txt](https://docs.ston.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ston.fi/developer-section/omniston/sdk.md).

# SDK

Omniston SDK reference - TypeScript/JavaScript tools for building cross-chain liquidity aggregation

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, EVM order payload flows, and TRON order settlement
* **Error Handling**: Comprehensive error types and recovery

## Reference Implementation

The open source [React demo app](https://github.com/ston-fi/omniston-sdk/tree/main/examples/react-app) shows a configured multi-chain Omniston integration, including TON, EVM chains, and TRON.

Use the chain-specific guides below when studying how network-specific wallet and settlement logic is wired.

## 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)

## Chain-specific Guides

* [EVM chain](/developer-section/omniston/sdk/evm.md)
* [TRON chain](/developer-section/omniston/sdk/tron.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
