> For the complete documentation index, see [llms.txt](https://docs.delphi.fyi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.delphi.fyi/tools/sdk.md).

# SDK

TypeScript SDK for interacting with Delphi information markets on the Gensyn blockchain.

## Overview

This Delphi SDK provides a single `DelphiClient` interface for reading market data, executing trades, managing positions, and querying historical on-chain events.

### What it Does

The SDK has two core layers: the **\[1]** REST API client (for read operations) and the **\[2]** on-chain methods (for write operations).

1. **REST API client (*****reading)*****:** List and filter markets, query wallet positions, and check service health through Delphi's centralized API endpoints.
2. **On-chain methods (*****writing)*****:** Buy and sell outcome shares, approve token spending, redeem winning positions, and read contract state directly on the Gensyn blockchain via the Gateway contract.

{% hint style="info" %}
This is a **TypeScript** only SDK. There is no Python SDK at this time.
{% endhint %}

The `@gensyn-ai/gensyn-delphi-sdk` package is available on `npm`. It supports private key signing and Coinbase Developer Platform (CDP) Server Wallets.

The SDK supports testnet, mainnet, and `competition-testnet`. The competition network powers the agent trading competition.

#### Market Deployments

Testnet and mainnet use automated-settlement gateways by default. Some legacy markets remain on the earlier deployment.

The client resolves a market's owning gateway before each market-scoped operation. This includes trades, quotes, redemptions, and liquidations. See [On-Chain Methods](/tools/sdk/methods.md) for routing details.

Delphi app markets use Dynamic Parimutuel (DPM) pricing. Automated settlement changes settlement and routing. It does not change Delphi markets to LMSR.

`competition-testnet` is separate. Its agent-competition markets use LMSR contracts with the same SDK trading interfaces.

{% hint style="warning" %}
Setting `gatewayAddress` or `DELPHI_GATEWAY_CONTRACT` pins all calls to that gateway. It disables automatic routing.
{% endhint %}

#### Upgrading to 2.0.0

Automated settlement changes gateway addresses and market routing. Statuses now include `failed`, which requires liquidation rather than redemption.

{% hint style="info" %}
Default subgraphs now index automated-settlement events.
{% endhint %}

### Who it's For

The Delphi SDK is the foundational layer for any programmatic interaction with [Delphi](https://app.delphi.fyi/) markets. It is used directly by developers building custom integrations, and it powers the [Agentic Trading toolkit](/tools/agentic-trading.md) under the hood.


---

# 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.delphi.fyi/tools/sdk.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.
