spark_flashnet_createCPPool
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.
The dApp provides the pool parameters (assets, fees, namespace, etc.), and the wallet handles the signing and submission to Flashnet.
π¦ Example
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
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)
{
"requestId": "01HJZKFABCDEFGHJKLMNPQRSTVW"
}
Failure
400 Bad Request
if the request is invalid401 Unauthorized
if authentication fails500 Internal Server Error
if something goes wrong internally
Last updated