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

# Delphi SDK

## 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](/tech/delphi-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](/tech/agentic-trading.md) under the hood.
