spark_flashnet_createBondingPool

This method is coming πŸ”œ

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

Field
Type
Required
Description

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 fails

    • 401 Unauthorized if authentication fails

    • 500 Internal Server Error if creation fails

Last updated