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

# SDK Introduction

> Build on Orica with the TypeScript and Python SDKs.

![Orica SDK](https://mintcdn.com/orica/YTb3GLKscfwACNYH/images/image.png?fit=max\&auto=format\&n=YTb3GLKscfwACNYH\&q=85\&s=e73cf6aae2197856e6870aea5faa9df8)

The Orica SDKs provide complete interfaces for interacting with the Orica prediction market protocol on Solana. Available in both **TypeScript** and **Python**.

***

## Choose Your SDK

> [card] [TypeScript SDK](https://github.com/neko/orica-ts-sdk)
>
> `@neko/orica-sdk` for Node.js and browser applications.
>
> * [GitHub](https://github.com/neko/orica-ts-sdk)
> * [Documentation](https://neko.github.io/orica-ts-sdk/)
> * [NPM Package](https://github.com/neko/orica-ts-sdk/pkgs/npm/orica-sdk)

> [card] [Python SDK](https://github.com/neko/orica-py-sdk)
>
> `orica-sdk` for Python 3.12+ applications.
>
> * [GitHub](https://github.com/neko/orica-py-sdk)
> * [Documentation](https://neko.github.io/orica-py-sdk/)

***

## Features

> [card] Transaction Builders
>
> Build instructions for all on-chain operations: trading, redemption, disputes.

> [card] Account Fetching
>
> Fetch and decode market, position, and dispute accounts.

> [card] PDA Derivation
>
> Utilities for deriving Program Derived Addresses.

> [card] Typed
>
> Full TypeScript types and Python dataclasses for all accounts.

***

## Quick Example

> [tab] TypeScript
>
> ```typescript theme={"dark"}
> import { OricaSDK } from "@neko/orica-sdk";
> import { Connection } from "@solana/web3.js";
>
> const connection = new Connection("https://api.mainnet-beta.solana.com");
> const sdk = await OricaSDK.createFromChain(connection);
>
> // Fetch all markets
> const markets = await sdk.orica.fetchAllMarkets();
> for (const { publicKey, account } of markets) {
>   console.log(`${account.question} - ${account.status}`);
> }
>
> // Fetch user position
> const position = await sdk.orica.fetchPosition(marketAddress, userPubkey);
> if (position) {
>   console.log(`holdings: ${position.outcomeAmounts}`);
> }
> ```

> [tab] Python
>
> ```python theme={"dark"}
> from orica_sdk import OricaSDK
> from solana.rpc.async_api import AsyncClient
>
> async def main():
>     connection = AsyncClient("https://api.mainnet-beta.solana.com")
>     sdk = await OricaSDK.create(connection)
>
>     # Fetch all markets
>     markets = await sdk.orica.fetch_all_markets()
>     for address, market in markets:
>         print(f"{market.question} - {market.status.value}")
>
>     # Fetch user position
>     position = await sdk.orica.fetch_position(market_address, user_pubkey)
>     if position:
>         print(f"holdings: {position.outcome_amounts}")
> ```

***

## SDK Architecture

Both SDKs expose two main clients:

> [tab] TypeScript
>
> ```typescript theme={"dark"}
> const sdk = await OricaSDK.createFromChain(connection);
>
> sdk.orica     // OricaClient - markets and trading
> sdk.disputes  // DisputesClient - dispute resolution
> ```

> [tab] Python
>
> ```python theme={"dark"}
> sdk = await OricaSDK.create(connection)
>
> sdk.orica     # OricaClient - markets and trading
> sdk.disputes  # DisputesClient - dispute resolution
> ```

***

## OricaClient Methods

| Category | TypeScript | Python |
| - | - | - |
| **Protocol** | `fetchGlobalState()` | `fetch_global_state()` |
| **Markets** | `fetchMarket()`, `fetchAllMarkets()` | `fetch_market()`, `fetch_all_markets()` |
| **Trading** | `buildBuy()`, `buildSell()`, `buildRedeem()` | `build_buy()`, `build_sell()`, `build_redeem()` |
| **Positions** | `fetchPosition()`, `fetchUserPositions()` | `fetch_position()` |
| **Utilities** | `calculatePrices()` | `calculate_prices()` |

***

## DisputesClient Methods

| Category | TypeScript | Python |
| - | - | - |
| **Voting** | `buildVoteForDispute()`, `fetchDisputeVote()` | `build_vote_for_dispute()`, `fetch_dispute_vote()` |
| **Messages** | `buildPostMessage()`, `buildBoostMessage()` | `build_post_message()`, `build_boost_message()` |
| **Disputes** | `fetchDispute()`, `fetchAllDisputes()` | `fetch_dispute()`, `fetch_all_disputes()` |

***

## Program IDs

| Network | Orica Program | Disputes Program |
| - | - | - |
| Mainnet | `oEarJ8xDDssLcWwgkSpRVVbmiUyeDnoHFNAHPp6eetw` | `oVEzkDiY2FZP4ADfCeUfrg8jgCoMnPcVQao99indSqN` |

***

## Links

| Resource | TypeScript | Python |
| - | - | - |
| GitHub | [orica-ts-sdk](https://github.com/neko/orica-ts-sdk) | [orica-py-sdk](https://github.com/neko/orica-py-sdk) |
| Documentation | [neko.github.io/orica-ts-sdk](https://neko.github.io/orica-ts-sdk/) | [neko.github.io/orica-py-sdk](https://neko.github.io/orica-py-sdk/) |
| Package | [NPM](https://github.com/neko/orica-ts-sdk/pkgs/npm/orica-sdk) | [GitHub](https://github.com/neko/orica-py-sdk) |

***

## Next Steps

> [card] [Installation](https://docs.orica.markets/sdk/installation.md)
>
> Install the SDK and dependencies.

> [card] [Configuration](https://docs.orica.markets/sdk/configuration.md)
>
> Configure the SDK for your use case.

> [card] [Markets](https://docs.orica.markets/sdk/markets.md)
>
> Fetch and query market data.

> [card] [Trading](https://docs.orica.markets/sdk/trading.md)
>
> Execute buy, sell, and redeem operations.


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