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

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

Supported Intents & Examples

πŸ”„ Swaps

  • executeSwap Based on Flashnet Execute Swap.

    {
      "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.

    {
      "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

πŸ’§ Liquidity


Response

βœ… Success

On success, the method resolves to the signed intent:

  • intent β€” the full serialized Flashnet intent

  • signature β€” signature from the user’s Spark identity key

❌ Error

On error, the method rejects with an error object:

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.

Last updated