> 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/api-reference/info-methods.md).

# Info Methods

`InfoClient` provides read-only access to exchange, market, account, resolution, and agent data through the Exchange HTTP API.

These methods do not require a wallet or signature.

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

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

### `getAsset`

Returns registered metadata for the current state of an asset.

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

Endpoint:

```
GET /asset/:assetId
```

Response:

```json
{
  "assetId": "261336857817713630688382311349658711122006440411137",
  "epoch": "12",
  "registered": true,
  "expiration": "1730000000",
  "assetType": "2",
  "strikePrice": "999000",
  "ledger": "0x1111111111111111111111111111111111111111"
}
```

### `getResolutionPrice`

Returns the stored resolution price for a specific asset and epoch.

```ts
const resolution = await info.getResolutionPrice({
  assetId: "261336857817713630688382311349658711122006440411137",
  epoch: "12",
});
```

Endpoint:

```
GET /resolve/:assetId/:epoch
```

Response:

```json
{
  "assetId": "261336857817713630688382311349658711122006440411137",
  "epoch": "12",
  "id": 1,
  "ts": "1730000000",
  "price": "999000",
  "isNull": false
}
```

### `getLastResolutionPrice`

Returns the latest stored resolution price for an asset.

```ts
const resolution = await info.getLastResolutionPrice(
  "261336857817713630688382311349658711122006440411137",
);
```

Endpoint:

```
GET /resolve/last/epoch/:assetId
```

Response:

```json
{
  "assetId": "261336857817713630688382311349658711122006440411137",
  "epoch": "12",
  "id": 1,
  "ts": "1730000000",
  "price": "999000",
  "isNull": false
}
```

### `getBalance`

Returns the current balance snapshot for an account.

```ts
const balance = await info.getBalance(
  "0x1111111111111111111111111111111111111111",
);
```

Endpoint:

```
GET /balance/:account
```

Response:

```json
{
  "account": "0x1111111111111111111111111111111111111111",
  "ts": 1730000000,
  "balance": "100000000",
  "pending": "5000000"
}
```

### `getOrderBook`

Returns an aggregated order-book snapshot for an asset and epoch.

```ts
const book = await info.getOrderBook({
  assetId: "261336857817713630688382311349658711122006440411137",
  epoch: "12",
});
```

Endpoint:

```
GET /book/:assetId/:epoch
```

The endpoint also accepts an optional `depth` query parameter. It defaults to `200` and is constrained to a value between `1` and `5000`.

Response:

```json
{
  "assetId": "261336857817713630688382311349658711122006440411137",
  "epoch": "12",
  "ts": 1730000000,
  "seqId": 123,
  "bids": [
    {
      "price": "999000",
      "size": "1025",
      "orderCount": 1,
      "orders": [
        {
          "id": "0x1111111111111111111111111111111111111111111111111111111111111111",
          "size": "1025",
          "price": 999000,
          "time": 1730000000,
          "account": "0x1111111111111111111111111111111111111111"
        }
      ]
    }
  ],
  "asks": [
    {
      "price": "1000000",
      "size": "500",
      "orderCount": 1,
      "orders": [
        {
          "id": "0x2222222222222222222222222222222222222222222222222222222222222222",
          "size": "500",
          "price": 1000000,
          "time": 1730000001,
          "account": "0x2222222222222222222222222222222222222222"
        }
      ]
    }
  ]
}
```

### `getBookOrders`

Returns resting book orders owned by one account.

```ts
const orders = await info.getBookOrders({
  assetId: "261336857817713630688382311349658711122006440411137",
  epoch: "12",
  account: "0x1111111111111111111111111111111111111111",
});
```

Endpoint:

```
GET /book/:assetId/:epoch/:account
```

Response:

```json
{
  "assetId": "261336857817713630688382311349658711122006440411137",
  "epoch": "12",
  "seqId": 123,
  "ts": 1730000000,
  "buys": [
    {
      "id": "0x1111111111111111111111111111111111111111111111111111111111111111",
      "size": "1025",
      "price": 999000,
      "time": 1730000000,
      "account": "0x1111111111111111111111111111111111111111"
    }
  ],
  "sells": []
}
```

### `getTopOfBook`

Returns the best bid, best ask, and last traded price for an asset and epoch.

```ts
const top = await info.getTopOfBook({
  assetId: "261336857817713630688382311349658711122006440411137",
  epoch: "12",
});
```

Endpoint:

```
GET /book/market/top/:assetId/:epoch
```

Response:

```json
{
  "assetId": "261336857817713630688382311349658711122006440411137",
  "epoch": "12",
  "seqId": 123,
  "ts": 1730000000,
  "bid": {
    "price": "999000",
    "size": "1025",
    "orderCount": 1,
    "orders": []
  },
  "ask": {
    "price": "1000000",
    "size": "500",
    "orderCount": 1,
    "orders": []
  },
  "last": "999500",
  "lastTs": "1730000000"
}
```

### `getPosition`

Returns an account’s position for a specific asset and epoch.

```ts
const position = await info.getPosition({
  account: "0x1111111111111111111111111111111111111111",
  assetId: "261336857817713630688382311349658711122006440411137",
  epoch: "12",
});
```

Endpoint:

```
GET /position/:account/:assetId/:epoch
```

Response:

```json
{
  "account": "0x1111111111111111111111111111111111111111",
  "assetId": "261336857817713630688382311349658711122006440411137",
  "epoch": "12",
  "ts": 1730000000,
  "size": "1025",
  "margin": "1000000",
  "balance": "5000000",
  "pnl": "250000",
  "side": false,
  "bSide": false,
  "mSide": false,
  "pSide": false
}
```

### `getAgentApproval`

Returns the current agent approval for a master account.

```ts
const approval = await info.getAgentApproval(
  "0x1111111111111111111111111111111111111111",
);
```

Endpoint:

```
GET /agents/status/:master
```

Response:

```json
{
  "agent": "0x2222222222222222222222222222222222222222",
  "nonce": "1730000300000",
  "status": "active"
}
```

Possible `status` values:

```
active
inactive
expired
```

When no approval exists, the response uses an empty agent address and a zero nonce:

```json
{
  "agent": "",
  "nonce": "0",
  "status": "inactive"
}
```

### `getAgentApprovalNonce`

Returns only the parsed agent approval nonce for a master account.

```ts
const approvalNonce =
  await info.getAgentApprovalNonce(
    "0x1111111111111111111111111111111111111111",
  );
```

Endpoint:

```
GET /agents/status/:master
```

SDK response:

```ts
1730000300000n
```

The underlying HTTP endpoint returns the complete approval object:

```json
{
  "agent": "0x2222222222222222222222222222222222222222",
  "nonce": "1730000300000",
  "status": "active"
}
```

`getAgentApprovalNonce` parses and returns only the `nonce` field.

### `getExchangeConfig`

Returns the configured exchange contract addresses for a chain.

```ts
const config = await info.getExchangeConfig("84532");
```

Endpoint:

```
GET /config/chains/:chainId
```

The SDK README identifies this method and endpoint, but the supplied HTTP API documentation does not define the response body.

An example response should not be published until the development team provides the exact returned contract fields.

### Available methods

<table><thead><tr><th width="225.07293701171875">Method</th><th>Endpoint</th></tr></thead><tbody><tr><td><code>getAsset</code></td><td><code>GET /asset/:assetId</code></td></tr><tr><td><code>getResolutionPrice</code></td><td><code>GET /resolve/:assetId/:epoch</code></td></tr><tr><td><code>getLastResolutionPrice</code></td><td><code>GET /resolve/last/epoch/:assetId</code></td></tr><tr><td><code>getBalance</code></td><td><code>GET /balance/:account</code></td></tr><tr><td><code>getOrderBook</code></td><td><code>GET /book/:assetId/:epoch</code></td></tr><tr><td><code>getBookOrders</code></td><td><code>GET /book/:assetId/:epoch/:account</code></td></tr><tr><td><code>getTopOfBook</code></td><td><code>GET /book/market/top/:assetId/:epoch</code></td></tr><tr><td><code>getPosition</code></td><td><code>GET /position/:account/:assetId/:epoch</code></td></tr><tr><td><code>getAgentApproval</code></td><td><code>GET /agents/status/:master</code></td></tr><tr><td><code>getAgentApprovalNonce</code></td><td><code>GET /agents/status/:master</code></td></tr><tr><td><code>getExchangeConfig</code></td><td><code>GET /config/chains/:chainId</code></td></tr></tbody></table>


---

# 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/api-reference/info-methods.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.
