# spark\_flashnet\_createCPPool

{% hint style="info" %}
This method is coming :soon:
{% endhint %}

Use the `spark_flashnet_createCPPool` method to request the creation of a **Constant Product (CP) liquidity pool** on Flashnet directly from the user’s Spark wallet.

Your app provides the pool parameters (assets, fees, namespace, etc.), and the wallet handles the signing and submission to Flashnet.

***

## 📦 Example

```ts
import { request } from "sats-connect";

try {
  const response = await request("spark_flashnet_createCPPool", {
    assetAAddress: "0338d6978bd3163d1547f9ddb8b215d1c163bc7b4a552e559b89057f5449ba69de",
    assetBAddress: "020202020202020202020202020202020202020202020202020202020202020202",
    hostNamespace: "my-cool-exchange",
    lpFeeRateBps: 300, // 3.00% LP fee
    totalHostFeeRateBps: 200, // 2.00% host fee
    poolOwnerPublicKey: "03b06b7c3e39bf922be19b7ad5f19554bb7991cae585ed2e3374d51213ff4eeb3c",
    nonce: "550e8400-e29b-41d4-a716-446655440000"
  });

  if ("result" in response) {
    console.log("Pool created, requestId:", response.result.requestId);
  } else {
    console.error("Pool creation failed:", response.error.message);
  }
} catch (error) {
  console.error("Unexpected error:", error);
}
```

***

## 📤 Parameters

| Field                 | Type     | Required | Description                                                      |
| --------------------- | -------- | -------- | ---------------------------------------------------------------- |
| `assetAAddress`       | `string` | ✅        | Address of the first asset in the pool                           |
| `assetBAddress`       | `string` | ✅        | Address of the second asset in the pool                          |
| `hostNamespace`       | `string` | ✅        | Unique namespace for the pool (e.g. exchange name)               |
| `lpFeeRateBps`        | `number` | ✅        | Liquidity provider fee in basis points (e.g. 300 = 3.00%)        |
| `totalHostFeeRateBps` | `number` | ✅        | Host fee in basis points (e.g. 200 = 2.00%)                      |
| `poolOwnerPublicKey`  | `string` | ✅        | Public key of the pool owner                                     |
| `nonce`               | `string` | optional | Unique request identifier. If omitted, the wallet generates one. |

***

## ✅ Responses

* **Success (202 Accepted)**

```json
{
  "requestId": "01HJZKFABCDEFGHJKLMNPQRSTVW"
}
```

* **Failure**
  * `400 Bad Request` if the request is invalid
  * `401 Unauthorized` if authentication fails
  * `500 Internal Server Error` if something goes wrong internally


---

# Agent Instructions: 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:

```
GET https://docs.xverse.app/sats-connect/spark-methods/flashnet-trading/spark_flashnet_createcppool.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
