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

# Overview

The GammaSwap V2 protocol provides HTTP, WebSocket, and on-chain interfaces for building integrations with AI agents, trading algorithms and third party tools.

The recommended integration method is the official TypeScript SDK:

```
@gammaswap/v2-exchange-sdk
```

The SDK provides five specialized clients.

<table><thead><tr><th>Client</th><th>Purpose</th><th width="180.9453125">Connects to</th></tr></thead><tbody><tr><td><code>InfoClient</code></td><td>Read exchange and account data</td><td>Exchange HTTP API</td></tr><tr><td><code>ExchangeClient</code></td><td>Submit signed exchange actions</td><td>Exchange HTTP API</td></tr><tr><td><code>DepositClient</code></td><td>Read deposit state and submit deposits</td><td>Onchain Contracts</td></tr><tr><td><code>ExchangeWebSocketClient</code></td><td>Subscribe to live market updates</td><td>Market WebSocket</td></tr><tr><td><code>OracleWebSocketClient</code></td><td>Subscribe to live oracle prices</td><td>Oracle WebSocket</td></tr></tbody></table>

### Exchange HTTP API

The Exchange HTTP API provides public endpoints for:

* Asset metadata
* Account balances
* Positions
* Order-book snapshots
* Top-of-book data
* Resolution prices
* Agent approval status
* Orders
* Cancels
* Cancel-and-replace operations
* Claims
* Withdrawals
* Agent approval and revocation

Read-only requests do not require a wallet or signature. Exchange actions are authenticated using EIP-712 signatures.

### Market WebSocket

The market WebSocket publishes real-time updates for subscribed asset IDs.

Update types include:

* Orders
* Trades
* Cancels
* Market resolutions

Applications maintaining a local order book should use the HTTP API to load an initial snapshot and use WebSocket updates to keep it current.

If the connection is interrupted or the SDK detects that resynchronization is required, reload the full order-book snapshot before processing subsequent updates.

### Oracle WebSocket

The oracle WebSocket publishes live prices for subscribed symbol IDs.

Each price update includes:

* Symbol ID
* Price
* Timestamp

After a reconnect or stale-price notification, consumers should accept the next live price update.

### Deposits

Deposits are submitted directly to the configured chain through the `DepositClient`.

The deposit client supports:

* Discovering settlement and ledger contract addresses
* Reading pending and processed balances
* Checking deposit-processing state
* Reading token balances and allowances
* Approving the deposit ledger or Permit2
* Depositing settlement tokens
* Signing and submitting permit-based deposits

A wallet, RPC URL, and matching chain ID are required for on-chain transactions.

### Agent wallets

An agent wallet is a separate EVM wallet approved to sign exchange actions for a master account.

Agent wallets can submit:

* Orders
* Cancels
* Cancel-and-replace actions
* Claims

The master account remains the owner of the positions, balances, and orders. The agent wallet is only the signer.

### Data conventions

Blockchain integers are represented as decimal strings in JSON.

SDK order and transfer inputs use human-readable decimal strings:

* `size` and `amount` support up to two decimal places.
* `price` supports up to one decimal place.
* Addresses use standard EVM hexadecimal format.
* Order IDs and action hashes use `bytes32` hexadecimal strings.
* `false` represents a buy order.
* `true` represents a sell order.

The SDK validates and converts these values before sending requests.


---

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