> 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://exchange-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://exchange-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 marketStream = createExchangeWebSocketClient({
  websocketUrl: "wss://exchange-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://exchange-api.gammaswap.com/oracle-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 dynamically by asking a question.

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

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
