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

# TypeScript SDK Overview

> Decibel TypeScript SDK for reading market data and submitting transactions on Aptos

## What is the Decibel TypeScript SDK?

The SDK provides a clean, typed interface to interact with Decibel on Aptos:

<Info>
  Both `DecibelReadDex` and `DecibelWriteDex` require a [Node API token](/quickstart/node-api-key) for authentication. Without one, all requests return `401 Unauthorized: anonymous requests are not allowed`. Get yours from [Geomi](https://geomi.dev) before starting.
</Info>

<Note>
  **More SDKs coming soon.** Rust SDK is in development. For other languages, use the [REST API](/api-reference/rest/overview) or [WebSocket API](/api-reference/websocket/overview) directly.
</Note>

* Read operations: `DecibelReadDex` - query markets, depth, prices, trades, positions, orders, Trading Accounts, vaults.
* Write operations: `DecibelWriteDex` - place/cancel orders, manage positions and Trading Accounts, vault operations, delegation.

<CardGroup cols={3}>
  <Card title="Installation" icon="download" href="/typescript-sdk/installation">
    Install the SDK and required peer dependencies for Node or browser
    environments.
  </Card>

  <Card title="Read SDK" icon="eye" href="/typescript-sdk/read-sdk">
    Market data, account state, orders, positions, and historical data.
  </Card>

  <Card title="Write SDK" icon="exchange" href="/typescript-sdk/write-sdk">
    Trading, position management, TP/SL, TWAP, Trading Accounts, and vault
    transactions.
  </Card>
</CardGroup>

## Quick start

### Read: market and account data

```ts theme={null}
import { DecibelReadDex, NETNA_CONFIG } from "@decibeltrade/sdk";

const read = new DecibelReadDex(NETNA_CONFIG, {
  // Required: used to send Authorization: Bearer <YOUR_NODE_API_KEY> on node requests
  nodeApiKey: process.env.APTOS_NODE_API_KEY!,
});

const markets = await read.markets.getAll();
const account = await read.accountOverview.getByAddr("0x...account");
```

### Write: submit transactions

```ts theme={null}
import { DecibelWriteDex, NETNA_CONFIG } from "@decibeltrade/sdk";
import { Ed25519Account, Ed25519PrivateKey } from "@aptos-labs/ts-sdk";

const account = new Ed25519Account({
  privateKey: new Ed25519PrivateKey(process.env.PRIVATE_KEY!),
});

const write = new DecibelWriteDex(NETNA_CONFIG, account, {
  // Required: used to send Authorization: Bearer <YOUR_NODE_API_KEY> on node requests
  nodeApiKey: process.env.APTOS_NODE_API_KEY!,
  // Defaults: simulate before submit, fee payer enabled
});
```

## When to use which

* Use `DecibelReadDex` when you need market data, order/position history, or account state. No private keys required.
* Use `DecibelWriteDex` for on-chain actions and trading. In browsers, avoid embedding private keys; prefer session keys or a wallet and pass `accountOverride` for specific calls.

## Related

* Configuration and network presets: `NETNA_CONFIG`, `LOCAL_CONFIG`, `DOCKER_CONFIG`, `NAMED_CONFIGS`
* See REST and WebSocket topics in Quick Start for direct API access.
