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

# SDK Overview

> Package structure, entry points, and Chain enum

`@wraith-protocol/sdk` is a single npm package with multiple entry points. Most developers use the root import. Power users building custom stealth address integrations use the chain-specific imports.

## Installation

```bash theme={null}
npm install @wraith-protocol/sdk
```

## Entry Points

| Import                                | Purpose                                      | Audience                                     |
| ------------------------------------- | -------------------------------------------- | -------------------------------------------- |
| `@wraith-protocol/sdk`                | Agent client — create agents, chat, payments | Most developers                              |
| `@wraith-protocol/sdk/chains/evm`     | Raw secp256k1 stealth crypto primitives      | Power users building custom EVM integrations |
| `@wraith-protocol/sdk/chains/stellar` | Raw ed25519 stealth crypto for Stellar       | Power users building on Stellar              |
| `@wraith-protocol/sdk/chains/solana`  | Raw ed25519 stealth crypto for Solana        | Power users building on Solana               |
| `@wraith-protocol/sdk/chains/ckb`     | Raw secp256k1 stealth crypto for CKB         | Power users building on Nervos CKB           |

### Root Import — Agent Client

```typescript theme={null}
import { Wraith, Chain } from "@wraith-protocol/sdk";
```

This is the managed platform client. It talks to Wraith's hosted TEE infrastructure over HTTP. Zero heavy dependencies — just `fetch` and TypeScript types. No crypto libraries, no database drivers, no native modules.

### Chain Imports — Crypto Primitives

```typescript theme={null}
// EVM chains (secp256k1)
import {
  generateStealthAddress,
  deriveStealthKeys,
  scanAnnouncements,
  deriveStealthPrivateKey,
} from "@wraith-protocol/sdk/chains/evm";

// Stellar (ed25519)
import {
  generateStealthAddress,
  deriveStealthKeys,
  scanAnnouncements,
  deriveStealthPrivateScalar,
} from "@wraith-protocol/sdk/chains/stellar";

// Solana (ed25519)
import {
  generateStealthAddress,
  deriveStealthKeys,
  scanAnnouncements,
  deriveStealthPrivateScalar,
} from "@wraith-protocol/sdk/chains/solana";

// CKB (secp256k1 + Cell model)
import {
  generateStealthAddress,
  deriveStealthKeys,
  scanStealthCells,
  deriveStealthPrivateKey,
} from "@wraith-protocol/sdk/chains/ckb";
```

Each chain module exports the same conceptual functions adapted to that chain's cryptographic scheme and address format. You only need these if you're building custom stealth address integrations without the managed agent platform.

## The `Chain` Enum

Always use the `Chain` enum when specifying chains. Never pass raw strings.

```typescript theme={null}
import { Chain } from "@wraith-protocol/sdk";

// Single chain
const agent = await wraith.createAgent({
  name: "alice",
  chain: Chain.Horizen,
  wallet: "0x...",
  signature: "0x...",
});

// Multiple chains
const agent = await wraith.createAgent({
  name: "bob",
  chain: [Chain.Horizen, Chain.Stellar, Chain.Ethereum],
  wallet: "0x...",
  signature: "0x...",
});

// All supported chains
const agent = await wraith.createAgent({
  name: "carol",
  chain: Chain.All,
  wallet: "0x...",
  signature: "0x...",
});
```

### Available Values

```typescript theme={null}
enum Chain {
  Horizen = "horizen",
  Ethereum = "ethereum",
  Polygon = "polygon",
  Base = "base",
  Stellar = "stellar",
  Solana = "solana",
  CKB = "ckb",
  All = "all",
}
```

## Dependencies

| Package                | Used By                             | Purpose                                 |
| ---------------------- | ----------------------------------- | --------------------------------------- |
| `@noble/curves`        | EVM + Stellar + Solana + CKB chains | Elliptic curve operations               |
| `@noble/hashes`        | EVM + Stellar + Solana + CKB chains | SHA-256, SHA-512, keccak256, blake2b    |
| `viem`                 | EVM chains + agent client           | EVM utilities, address encoding         |
| `@stellar/stellar-sdk` | Stellar chain (optional peer dep)   | StrKey encoding for Stellar addresses   |
| `@solana/web3.js`      | Solana chain (optional peer dep)    | PublicKey encoding for Solana addresses |

`@stellar/stellar-sdk` and `@solana/web3.js` are optional peer dependencies. They're only needed if you import their respective chain modules. The CKB module has no additional peer dependencies — it uses raw `fetch` for RPC calls and `@noble/hashes` for blake2b.

## Package Exports

The SDK uses `package.json` exports to expose multiple entry points from a single package:

```json theme={null}
{
  "exports": {
    ".": {
      "types": "./dist/index.d.ts",
      "import": "./dist/index.js",
      "require": "./dist/index.cjs"
    },
    "./chains/evm": {
      "types": "./dist/chains/evm/index.d.ts",
      "import": "./dist/chains/evm/index.js",
      "require": "./dist/chains/evm/index.cjs"
    },
    "./chains/stellar": {
      "types": "./dist/chains/stellar/index.d.ts",
      "import": "./dist/chains/stellar/index.js",
      "require": "./dist/chains/stellar/index.cjs"
    },
    "./chains/solana": {
      "types": "./dist/chains/solana/index.d.ts",
      "import": "./dist/chains/solana/index.js",
      "require": "./dist/chains/solana/index.cjs"
    },
    "./chains/ckb": {
      "types": "./dist/chains/ckb/index.d.ts",
      "import": "./dist/chains/ckb/index.js",
      "require": "./dist/chains/ckb/index.cjs"
    }
  }
}
```

Both ESM and CJS formats are supported. TypeScript declarations are included.

## Next Steps

* [Agent Client API](agent-client) — full reference for `Wraith` and `WraithAgent` classes
* [EVM Crypto Primitives](chains/evm) — low-level stealth address functions for EVM
* [Stellar Crypto Primitives](chains/stellar) — low-level stealth address functions for Stellar
* [Solana Crypto Primitives](chains/solana) — low-level stealth address functions for Solana
* [CKB Crypto Primitives](chains/ckb) — low-level stealth address functions for Nervos CKB
