spark_flashnet_addLiquidity
Use the spark_flashnet_addLiquidity method to request a Flashnet liquidity provision directly from the userβs Spark wallet.
Your app provides the pool and asset parameters (asset A/B amounts, minimum amounts, etc.), and the wallet handles the full process:
Initiates the Spark transfers for both assets
Generates and signs the liquidity intent
Submits to Flashnet
Returns the result (success, partial acceptance, or rejection)
This abstracts all complexity into a single request, making liquidity provision simple and secure.
π¦ Example
import { request } from "sats-connect";
try {
const response = await request("spark_flashnet_addLiquidity", {
poolId: "03aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899",
assetAAmountToAdd: "100000000", // sats or smallest units
assetAMinAmountIn: "95000000",
assetBAmountToAdd: "50000",
assetBMinAmountIn: "45000",
userPublicKey: "03abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567",
nonce: "add-liquidity-1702934567890"
});
if ("result" in response) {
console.log("Liquidity result:", response.result);
} else {
console.error("Add liquidity failed:", response.error.message);
}
} catch (error) {
console.error("Unexpected error:", error);
}π€ Parameters
poolId
string
β
Flashnet pool to add liquidity to
assetAAmountToAdd
string
β
Amount of asset A to add (in smallest unit)
assetAMinAmountIn
string
β
Minimum asset A amount required (slippage protection)
assetBAmountToAdd
string
β
Amount of asset B to add
assetBMinAmountIn
string
β
Minimum asset B amount required (slippage protection)
userPublicKey
string
β
Must match the walletβs Spark account
nonce
string
optional
Unique nonce. If omitted, wallet generates one
β
Responses
The method returns a Promise resolving to a SparkFlashnetAddLiquidityResult.
Full Success
Rejection
Partial Success (with refund)
Last updated