> 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/installation.md).

# Installation

Install the GammaSwap V2 TypeScript SDK from npm.

```bash
npm install @gammaswap/v2-exchange-sdk
```

### Requirements

* Node.js 20 or later
* An EVM-compatible wallet for signed exchange actions
* An RPC provider for deposits and other on-chain operations
* A WebSocket implementation when the runtime does not provide one

The SDK uses the global `fetch` and `WebSocket` implementations when they are available. Custom implementations can be supplied through the client constructors.

### Ethers

Signed exchange actions and on-chain deposits use an `ethers` wallet.

If `ethers` is not already installed in your application, install it alongside the SDK:

```bash
npm install ethers
```

### Node WebSocket support

The WebSocket clients use `globalThis.WebSocket` when the runtime provides it. In Node.js environments without a global WebSocket implementation, the SDK can use the `ws` package.

```bash
npm install ws
```

You can also provide a custom WebSocket constructor through `WebSocketCtor`.

### Environment variables

A typical server-side integration may use the following environment variables:

```bash
EXCHANGE_API_URL=https://external-api.gammaswap.com/api
ORDERBOOK_WS_URL=wss://external-api.gammaswap.com/ws/
ORACLE_WS_URL=wss://oracle-api.gammaswap.com/ws/

CHAIN_ID=84532
RPC_URL=https://your-rpc-provider.example
PRIVATE_KEY=0x...
```

Never expose a private key in client-side code, committed source files, logs, or public environment configuration.

### Verify the installation

Create a read-only client and request asset metadata:

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

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

const asset = await info.getAsset(
  "261336857817713630688382311349658711122006440411137",
);

console.log(asset);
```

`InfoClient` does not require a wallet because its methods only read public exchange data.

### Local SDK development

The SDK repository uses:

* Node.js 20 or later
* pnpm 10 or later

These requirements apply when developing the SDK itself. Applications consuming the published npm package do not need to use pnpm.


---

# 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/installation.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.
