spark_flashnet_createBondingPool
Use the spark_flashnet_createBondingPool
method to request the creation of a bonding curve pool (single-sided pool) on Flashnet directly from the userβs Spark wallet.
Bonding pools are typically used for token launches, where liquidity grows gradually along a curve until a graduation threshold is reached.
π¦ Example
import { request } from "sats-connect";
try {
const response = await request("spark_flashnet_createBondingPool", {
assetAAddress: "0338d6978bd3163d1547f9ddb8b215d1c163bc7b4a552e559b89057f5449ba69de",
assetAInitialReserve: "1000000000", // sats or smallest units
assetBAddress: "020202020202020202020202020202020202020202020202020202020202020202",
graduationThresholdPct: 50, // % of target to trigger graduation
hostNamespace: "my-cool-exchange",
lpFeeRateBps: 500, // 5.00%
totalHostFeeRateBps: 200, // 2.00%
targetBRaisedAtGraduation: "10000000000", // target raise
poolOwnerPublicKey: "03b06b7c3e39bf922be19b7ad5f19554bb7991cae585ed2e3374d51213ff4eeb3c",
nonce: "550e8400-e29b-41d4-a716-446655440000"
});
if ("result" in response) {
console.log("Bonding pool created:", response.result);
} else {
console.error("Pool creation failed:", response.error.message);
}
} catch (error) {
console.error("Unexpected error:", error);
}
π€ Parameters
assetAAddress
string
β
Address of the base asset (usually Spark BTC)
assetAInitialReserve
string
β
Initial reserve of asset A
assetBAddress
string
β
Address of the token being launched (asset B)
graduationThresholdPct
number
β
% of target raised to graduate pool (e.g. 50 = 50%)
hostNamespace
string
β
Unique namespace for the pool (e.g. launchpad name)
lpFeeRateBps
number
β
Liquidity provider fee in basis points
totalHostFeeRateBps
number
β
Host fee in basis points
targetBRaisedAtGraduation
string
β
Target amount of asset B to raise by graduation
poolOwnerPublicKey
string
β
Public key of the pool owner
nonce
string
optional
Unique request identifier. If omitted, the wallet generates one
β
Responses
Success (202 Accepted) β Returns pool creation details and deposit address
{
"requestId": "01HJZKFABCDEFGHJKLMNPQRSTVW",
"poolId": "03aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899",
"depositAddress": "sprt1qxyz..."
}
Failure
400 Bad Request
if validation fails401 Unauthorized
if authentication fails500 Internal Server Error
if creation fails
Last updated