> ## Documentation Index
> Fetch the complete documentation index at: https://docs.epicentral.markets/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Install the Solana Option Standard SDK, configure your Solana Kit client, and switch between Devnet and Mainnet.

`@epicentral/sos-sdk` is the TypeScript client for the Solana Option Standard program on Epicentral. Use it to read onchain option markets and build version 1 transactions for Longs, Shorts, OMLP lending, and withdrawals.

Import everything from the package root. The package requires `@solana/kit` `^8.3.0` as a peer dependency and is currently pre-1.0 (`0.33.1`).

## Install

Install `@epicentral/sos-sdk` alongside `@solana/kit`:

```bash pnpm theme={"dark"}
pnpm add @epicentral/sos-sdk @solana/kit
```

```bash npm theme={"dark"}
npm install @epicentral/sos-sdk @solana/kit
```

```bash yarn theme={"dark"}
yarn add @epicentral/sos-sdk @solana/kit
```

## Client Setup

You bring a `@solana/kit` RPC client, an RPC subscriptions client, and a transaction signer. Centralize your RPC URLs and token mints in one config module so switching from Devnet to Mainnet takes a single environment update.

Set these variables where your app loads environment values. `config.ts` reads them. Fill `UNDERLYING_MINT` and `COLLATERAL_MINT` with the mints for the cluster you are using.

```bash .env theme={"dark"}
SOLANA_RPC_URL=https://api.devnet.solana.com
SOLANA_RPC_WS_URL=wss://api.devnet.solana.com
UNDERLYING_MINT=
COLLATERAL_MINT=
```

```ts config.ts theme={"dark"}
import { createSolanaRpc, createSolanaRpcSubscriptions } from "@solana/kit";
import { getProgramId } from "@epicentral/sos-sdk";

export const RPC_URL =
  process.env.SOLANA_RPC_URL ?? "https://api.devnet.solana.com";
export const RPC_WS_URL =
  process.env.SOLANA_RPC_WS_URL ?? "wss://api.devnet.solana.com";

export const UNDERLYING_MINT = process.env.UNDERLYING_MINT!;
export const COLLATERAL_MINT = process.env.COLLATERAL_MINT!;

export const rpc = createSolanaRpc(RPC_URL);
export const rpcSubscriptions = createSolanaRpcSubscriptions(RPC_WS_URL);
export const programId = getProgramId();
```

## First Read

Verify your setup by reading the program address and listing all onchain option pools:

```ts theme={"dark"}
import { fetchAllOptionPools, getProgramIdString } from "@epicentral/sos-sdk";
import { rpc } from "./config";

console.log("Program ID:", getProgramIdString());

const pools = await fetchAllOptionPools(rpc);
console.log(`Found ${pools.length} option pools.`);
```

## First Write Pattern

Every high-level builder returns a `BuiltTransaction` containing `@solana/kit` instructions. Pass that result to `sendBuiltTransaction` with `version: 1`:

```ts theme={"dark"}
import { sendBuiltTransaction } from "@epicentral/sos-sdk";
import { rpc, rpcSubscriptions } from "./config";

const signature = await sendBuiltTransaction({
  ...builtTransaction,
  rpc,
  rpcSubscriptions,
  feePayer: signer,
  version: 1,
});
```

## Switching to Mainnet

The SDK program address and version 1 transaction flow stay identical across clusters. To move a Devnet integration to Mainnet, update three values:

**1. Point RPC and Subscriptions to Mainnet**

Set `SOLANA_RPC_URL` and `SOLANA_RPC_WS_URL` to your Mainnet RPC provider.

**2. Replace Paper Mints with Mainnet Mints**

Update `UNDERLYING_MINT` and `COLLATERAL_MINT` to the Mainnet underlying asset mint and allowlisted Collateral Mint.

**3. Remove the Test Collateral Faucet Step**

Skip `requestTestUsdc`. Mainnet wallets fund positions with real tokens.

## Next Steps

> [card] [Concepts](https://docs.epicentral.markets/sos-sdk/concepts.md)
>
> Learn Option Series, base units, cash settlement, and OMLP mechanics.

> [card] [Test Funds (Devnet)](https://docs.epicentral.markets/sos-sdk/test-collateral.md)
>
> Claim Devnet test USDC with `requestTestUsdc` to start testing trades.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.