# spark\_flashnet\_signIntent

Use the `spark_flashnet_signIntent` method to request a **signed Flashnet intent** from the user’s Spark wallet.\
An intent describes a Flashnet action (swap, liquidity, or pool creation).\
The wallet serializes the intent, shows the user a clear review screen, and signs it with their Spark key.

## Parameters

```ts
{
  "type": "executeSwap" 
        | "executeRouteSwap"
        | "createConstantProductPool"
        | "createSingleSidedPool"
        | "confirmInitialDeposit"
        | "addLiquidity"
        | "removeLiquidity"
        | "clawback",
  "data": { /* intent-specific fields */ }
}
```

## Supported Intents & Examples

### **🔄 Swaps**

* **`executeSwap`**\
  Based on [Flashnet Execute Swap](https://docs.flashnet.xyz/api-reference/swaps/execute-swap).

  ```json
  {
    "type": "executeSwap",
    "data": {
      "userPublicKey": "02abcdef...",
      "poolId": "03aabb...",
      "transferId": "spark-transfer-123",
      "assetInAddress": "03bitcoinassetpubkey...",
      "assetOutAddress": "03usdstablecoinpubkey...",
      "amountIn": "100000000",
      "maxSlippageBps": 50,
      "minAmountOut": "99500000",
      "totalIntegratorFeeRateBps": 100,
      "nonce": "unique-swap-nonce-123"
    }
  }
  ```
* **`executeRouteSwap`**\
  Based on [Flashnet Route Swap](https://docs.flashnet.xyz/api-reference/swaps/execute-route-swap).

  ```json
  {
    "type": "executeRouteSwap",
    "data": {
      "userPublicKey": "02abcdef...",
      "initialSparkTransferId": "spark-route-transfer-123456",
      "hops": [
        {
          "poolId": "03pool1...",
          "inputAssetAddress": "03bitcoinassetpubkey...",
          "outputAssetAddress": "03ethereumassetpubkey...",
          "hopIntegratorFeeRateBps": 25
        },
        {
          "poolId": "03pool2...",
          "inputAssetAddress": "03ethereumassetpubkey...",
          "outputAssetAddress": "03usdstablecoinpubkey...",
          "hopIntegratorFeeRateBps": 25
        }
      ],
      "inputAmount": "100000000",
      "maxRouteSlippageBps": 200,
      "minAmountOut": "99500000",
      "defaultIntegratorFeeRateBps": 50,
      "nonce": "unique-route-swap-nonce-789"
    }
  }

  ```

### **🚀 Token Launch**&#x20;

* `createConstantProductPool`\
  Based on Flashnet [Create Constant Product Pool](https://docs.flashnet.xyz/api-reference/pools/create-cp-pool).

  ```json
  {
    "type": "createConstantProductPool",
    "data": {
      "poolOwnerPublicKey": "03b06b7c...",
      "assetAAddress": "0338d697...",
      "assetBAddress": "02020202...",
      "lpFeeRateBps": 300,
      "totalHostFeeRateBps": 200,
      "nonce": "550e8400..."
    }
  }

  ```
* `createSingleSidedPool`\
  Based on Flashnet [Create Bonding Pool](https://docs.flashnet.xyz/api-reference/pools/create-bonding-pool).

  ```json
  {
    "type": "createSingleSidedPool",
    "data": {
      "assetAAddress": "0338d697...",
      "assetBAddress": "02020202...",
      "assetAInitialReserve": "1000000000",
      "virtualReserveA": "0",
      "virtualReserveB": "0",
      "threshold": "5000000000",
      "lpFeeRateBps": 500,
      "totalHostFeeRateBps": 200,
      "poolOwnerPublicKey": "03b06b7c...",
      "nonce": "550e8400..."
    }
  }

  ```
* `confirmInitialDeposit`\
  Based on Flashnet [Confirm Initial Deposit](https://docs.flashnet.xyz/api-reference/pools/confirm-initial-deposit).

  ```json
  {
    "type": "confirmInitialDeposit",
    "data": {
      "poolId": "03poollp...",
      "assetASparkTransferId": "spark-transfer-uuid...",
      "poolOwnerPublicKey": "03b06b7c...",
      "nonce": "confirm-deposit-nonce-789"
    }
  }
  ```

### **💧 Liquidity**

* **`addLiquidity`**\
  Based on Flashnet [Add Liquidity](https://docs.flashnet.xyz/api-reference/liquidity/add-liquidity).

  ```json
  {
    "type": "addLiquidity",
    "data": {
      "userPublicKey": "03abcdef...",
      "poolId": "03aabb...",
      "assetAAmount": "100000000",
      "assetBAmount": "50000",
      "assetAMinAmountIn": "95000000",
      "assetBMinAmountIn": "45000",
      "assetATransferId": "spark-transfer-a-123",
      "assetBTransferId": "spark-transfer-b-456",
      "nonce": "add-liquidity-1702934567890"
    }
  }
  ```
* **`removeLiquidity`**\
  Based on [Remove Liquidity](https://docs.flashnet.xyz/api-reference/liquidity/remove-liquidity).

  ```json
  {
    "type": "removeLiquidity",
    "data": {
      "userPublicKey": "03abcdef...",
      "poolId": "03aabb...",
      "lpTokensToRemove": "12340000",
      "nonce": "remove-liquidity-nonce-789"
    }
  }
  ```
* **`clawback`**\
  Based on Flashnet [Clawback Funds](https://docs.flashnet.xyz/api-reference/clawback/clawback-funds).

  ```json
  {
    "type": "clawback",
    "data": {
      "senderPublicKey": "02abcdef...",
      "sparkTransferId": "550e8400...",
      "lpIdentityPublicKey": "03aabb...",
      "nonce": "clawback-nonce-123456"
    }
  }
  ```

***

## Response

### :white\_check\_mark: Success

On success, the method resolves to the signed intent:

```json
{
  "intent": "<serialized-intent>",
  "signature": "<spark-signature>"
}
```

* **`intent`** — the full serialized Flashnet intent
* **`signature`** — signature from the user’s Spark identity key

### :x: Error

On error, the method rejects with an error object:

```json
{
  "errorCode": "INTENT-VALIDATION-001",
  "message": "Invalid or unsupported intent type: createXYZPool",
  "requestId": "01HJZKFABCDEFGHJKLMNPQRSTVW"
}
```

Common failure cases include:

* **Malformed request** (missing required fields like `poolId` or `assetInAddress`)
* **Unsupported type** (intent type not recognized)
* **Invalid values** (negative amounts, bad public key format, etc.)
* **Wallet-level rejection** (user cancels the request)

These errors are surfaced as standard Sats Connect errors for your App to handle.
