# spark\_flashnet\_removeLiquidity

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

Use the `spark_flashnet_removeLiquidity` method to request liquidity removal from a Flashnet pool.\
Your app specifies the pool and the LP tokens to burn. The wallet shows the user a transaction review screen with the expected assets they will receive, and upon confirmation, executes the removal on Flashnet.

***

## Example

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

try {
  const response = await request("spark_flashnet_removeLiquidity", {
    poolId: "03aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899",
    lpTokensToRemove: "12340000", // amount of LP tokens in smallest units
    userPublicKey: "03abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567",
    nonce: "remove-liquidity-nonce-789"
  });

  if ("result" in response) {
    console.log("Liquidity removal result:", response.result);
  } else {
    console.error("Remove liquidity failed:", response.error.message);
  }
} catch (error) {
  console.error("Unexpected error:", error);
}
```

***

## Parameters

* **`poolId`** *(string, required)* — ID of the Flashnet pool.
* **`lpTokensToRemove`** *(string, required)* — Amount of LP tokens to burn (in smallest unit).
* **`userPublicKey`** *(string, required)* — Public key of the user removing liquidity. Must match their Spark wallet.
* **`nonce`** *(string, required)* — Unique nonce to prevent replay attacks.

***

## What `spark_flashnet_removeLiquidity` does

When called, the wallet:

1. Shows the user a transaction review screen with pool info, LP tokens to burn, and expected asset withdrawals.
2. On approval, signs the request with the user’s Spark key.
3. Submits the removal to Flashnet.
4. Returns the result of the operation (success or error).

***

## Response

The method returns a Promise that resolves to a `SparkFlashnetRemoveLiquidityResult` object:

### **✅ Success**

```json
{
  "accepted": true,
  "assetAWithdrawn": "100000000",
  "assetBWithdrawn": "50000",
  "assetATransferId": "spark-transfer-a-789",
  "assetBTransferId": "spark-transfer-b-012",
  "requestId": "01HJZKFABCDEFGHJKLMNPQRSTVW"
}
```

### **⚠️ Failure**

```json
{
  "accepted": false,
  "error": "Insufficient LP token balance",
  "requestId": "01HJZKFABCDEFGHJKLMNPQRSTVW"
}
```


---

# 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_removeliquidity.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.
