> 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://exchange-api.gammaswap.com/api
MARKET_WS_URL=wss://exchange-api.gammaswap.com/ws/
ORACLE_WS_URL=wss://exchange-api.gammaswap.com/oracle-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://exchange-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 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/installation.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.
