> For the complete documentation index, see [llms.txt](https://kaspacom.gitbook.io/kaspacom-defi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kaspacom.gitbook.io/kaspacom-defi/dex/dex-integration.md).

# DEX Integration

KaspaCom DEX allows seamless token swaps across Kaspa-compatible EVM chains. Integrate it into your application with two flexible options:<br>

## Option 1: SDK Integration (TypeScript)

For advanced or fully custom integrations, use the **KaspaCom Swap SDK** — a lightweight TypeScript library built on top of the Uniswap V2 SDK.

* 🔗 [NPM Package](https://www.npmjs.com/package/@kaspacom/swap-sdk)
* 🔗 [Examples Repository](https://github.com/KASPACOM/swap-sdk-examples)

#### Overview

* Written in **TypeScript** for strong typing and better developer experience.
* Provides easy-to-use tools for implementing swap functionality in wallets or websites.
* Powered by the **Uniswap V2 SDK**.
* Compatible with **custom EVM chains**.
* Supports any external wallet provider implementing **EIP-1193** (e.g., MetaMask, WalletConnect, custom wallets).
* Designed for developers who need flexibility and full control.

### Option 2: Iframe Integration <a href="#option-1-iframe-integration" id="option-1-iframe-integration"></a>

The easiest and fastest way to embed the KaspaCom Swap UI into any website or web app. \
\
🔗 [**Base Iframe URL**](https://defi.kaspa.com/swap) (Mainnet) \
🔗 [**Base Iframe URL**](https://dev-defi.kaspa.com/swap) (Testnet): Use the testnet URL for development and testing purposes.\
\
**URL Parameters**\
Customize the iframe using the following query parameters:

|                  |                                                      |
| ---------------- | ---------------------------------------------------- |
| `inputCurrency`  | Token address the user will swap **from**            |
| `outputCurrency` | Token address the user will swap **to**              |
| `chain`          | **Chain ID** (as a number) of the target EVM network |
| partnerKey       | Please reach out to receive key                      |

✅ **Example**<br>

```html
<iframe
  src="https://defi.kaspa.com/swap?inputCurrency=0x654A3287c317D4Fc6e8482FeF523Dc4572b563AA&outputCurrency=0xD33d07ccfEd8038cEd1aa393FbEf7D7dA72be20e&chain=167012"
  width="100%"
  height="600"
  style="border: none; border-radius: 12px;"
  allow="clipboard-write"
  sandbox="allow-scripts allow-same-origin"
></iframe>
```

This will:

* Load the KaspaCom Swap UI
* Preselect the token pair
* Connect to chain ID `167012` (e.g., **Kasplex Testnet**

### Partner Integration <a href="#getting-started" id="getting-started"></a>

Interested in integrating the **KaspaCom DEX** into your platform or wallet? We can enable a **custom client fee** and provide you with a **partner key**.\
\
👉 Reach out on [**Telegram**](https://t.me/AbiKaspa) to get started.


---

# 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://kaspacom.gitbook.io/kaspacom-defi/dex/dex-integration.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.
