# Installation

This guide will help you install the Opinion CLOB TypeScript SDK and its dependencies.

Package registry: <https://www.npmjs.com/package/@opinion-labs/opinion-clob-sdk>

### Requirements

#### Node.js Version

* **Node.js 18 or higher**

Check your Node.js version:

```bash
node --version
```

#### System Requirements

* **Operating Systems**: Linux, macOS, Windows
* **Network**: Internet connection for API access and blockchain RPC
* **Optional**: Git (for development installation)

### Installation Methods

#### Install from npm (Recommended)

The simplest way to install the Opinion CLOB TypeScript SDK is via a package manager.

{% tabs %}
{% tab title="npm" %}

```bash
npm install @opinion-labs/opinion-clob-sdk
```

{% endtab %}

{% tab title="yarn" %}

```bash
yarn add @opinion-labs/opinion-clob-sdk
```

{% endtab %}

{% tab title="pnpm" %}

```bash
pnpm add @opinion-labs/opinion-clob-sdk
```

{% endtab %}
{% endtabs %}

This will install the latest stable version and all required dependencies including `viem`.

{% hint style="info" %}
The TypeScript SDK is ESM-only. Ensure your `package.json` has `"type": "module"`.
{% endhint %}

### Dependencies

The SDK automatically installs the following key dependency:

| Package | Purpose                                                      |
| ------- | ------------------------------------------------------------ |
| `viem`  | Blockchain interactions, contract calls, transaction signing |

### Verify Installation

After installation, verify it works:

```typescript
import {
  Client,
  TopicType,
  TopicStatus,
  CHAIN_ID_BNB_MAINNET,
} from '@opinion-labs/opinion-clob-sdk';

console.log('Opinion CLOB TypeScript SDK installed successfully!');
console.log('Supported chain:', CHAIN_ID_BNB_MAINNET);
```

### Project Setup

Create a new project and configure it for the SDK:

#### Create a new project

```bash
mkdir my-opinion-bot
cd my-opinion-bot
npm init -y
```

#### Add ESM support

Add `"type": "module"` to `package.json`, then install dependencies:

```bash
npm install @opinion-labs/opinion-clob-sdk
npm install -D typescript @types/node dotenv
```

#### Initialize TypeScript

```bash
npx tsc --init
```

Ensure your `tsconfig.json` includes the following settings:

```json
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "esModuleInterop": true,
    "strict": true,
    "outDir": "./dist"
  }
}
```

### Upgrading

To upgrade to the latest version:

```bash
npm install @opinion-labs/opinion-clob-sdk@latest
```

### Uninstalling

To remove the SDK:

```bash
npm uninstall @opinion-labs/opinion-clob-sdk
```

### Next Steps

Once installed, proceed to:

1. [Quick Start Guide - Build your first application](/developer-guide/opinion-clob-typescript-sdk/getting-started/quick-start.md)
2. [Configuration - Set up API keys and credentials](/developer-guide/opinion-clob-typescript-sdk/getting-started/configuration.md)
3. [API Reference - Explore available methods](/developer-guide/opinion-clob-typescript-sdk/api-references.md)

<details>

<summary>Having issues?</summary>

Check the Troubleshooting Guide or FAQ.

</details>


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.opinion.trade/developer-guide/opinion-clob-typescript-sdk/getting-started/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
