> For the complete documentation index, see [llms.txt](https://docs.gammaswap.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gammaswap.com/developers/getting-started/imports.md).

# Imports

All public clients can be imported from the main SDK package.

```ts
import {
  createInfoClient,
  createExchangeClient,
  createDepositClient,
  createExchangeWebSocketClient,
  createOracleWebSocketClient,
} from "@gammaswap/v2-exchange-sdk";
```

### Client imports

#### InfoClient

```ts
import { createInfoClient } from "@gammaswap/v2-exchange-sdk";
```

Use `InfoClient` for unsigned, read-only HTTP requests.

```ts
const info = createInfoClient({
  apiUrl: "https://external-api.gammaswap.com/api",
});
```

#### ExchangeClient

```ts
import { createExchangeClient } from "@gammaswap/v2-exchange-sdk";
import { Wallet } from "ethers";
```

Use `ExchangeClient` for wallet-signed exchange actions.

```ts
const wallet = new Wallet(process.env.PRIVATE_KEY!);

const exchange = createExchangeClient({
  apiUrl: "https://external-api.gammaswap.com/api",
  wallet,
  chainId: "84532",
});
```

#### DepositClient

```ts
import { createDepositClient } from "@gammaswap/v2-exchange-sdk";
import { Wallet } from "ethers";
```

Use `DepositClient` for on-chain deposit reads and transactions.

```ts
const wallet = new Wallet(process.env.PRIVATE_KEY!);

const deposit = createDepositClient({
  rpcUrl: process.env.RPC_URL!,
  wallet,
  chainId: "84532",
});
```

#### ExchangeWebSocketClient

```ts
import {
  createExchangeWebSocketClient,
} from "@gammaswap/v2-exchange-sdk";
```

Use `ExchangeWebSocketClient` for live market updates.

```ts
const orderbookStream = createExchangeWebSocketClient({
  websocketUrl: "wss://external-api.gammaswap.com/ws/",
  onError: (error) => console.error(error),
});
```

#### OracleWebSocketClient

```ts
import {
  createOracleWebSocketClient,
} from "@gammaswap/v2-exchange-sdk";
```

Use `OracleWebSocketClient` for live oracle prices.

```ts
const oracleStream = createOracleWebSocketClient({
  websocketUrl: "wss://oracle-api.gammaswap.com/ws/",
  onError: (error) => console.error(error),
});
```

### Submodule imports

WebSocket clients can also be imported from their dedicated submodules.

```ts
import {
  createExchangeWebSocketClient,
} from "@gammaswap/v2-exchange-sdk/websocket";

import {
  createOracleWebSocketClient,
} from "@gammaswap/v2-exchange-sdk/oracle-websocket";
```

### Input utilities

Integer-input helpers are exported from:

```ts
import {
  parseUnsignedInteger,
} from "@gammaswap/v2-exchange-sdk/integer-inputs";
```

These helpers validate canonical unsigned decimal strings and `bigint` values.

They reject JavaScript numbers unless a helper explicitly supports safe JSON or runtime integers.

### String utilities

Address and hexadecimal-string helpers are exported from:

```ts
import {
  parseAddress,
} from "@gammaswap/v2-exchange-sdk/string-inputs";
```

The string utility module includes validation for:

* EVM addresses
* Non-zero addresses
* Hexadecimal data
* `bytes32` values
* Case-insensitive address comparison

### Constants

Protocol constants such as time-in-force values can be imported from:

```ts
import {
  TimeInForce,
} from "@gammaswap/v2-exchange-sdk/constants";
```

Example:

```ts
await exchange.placeOrder({
  assetId: "261336857817713630688382311349658711122006440411137",
  epoch: "12",
  side: false,
  price: "99.9",
  size: "10.25",
  timeInForce: TimeInForce.GTC,
});
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.gammaswap.com/developers/getting-started/imports.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
