ArkadeSwaps handles reverse swaps (Lightning to Arkade) and submarine swaps (Arkade to Lightning), with optional background monitoring via SwapManager.
Installation
Initialization
ArkadeSwaps.create() auto-detects the network from your wallet and creates a BoltzSwapProvider automatically. SwapManager is enabled by default for background claim/refund.
Manual configuration
Manual configuration
You can provide a custom
BoltzSwapProvider if needed:Receiving Lightning payments
Create a Lightning invoice via a reverse swap (Lightning to Arkade). When the invoice is paid, SwapManager auto-claims the funds into your wallet.Waiting for payment
With SwapManager enabled (default), claiming happens automatically. You can block until the swap completes:Sending Lightning payments
Pay a Lightning invoice via a submarine swap (Arkade to Lightning).sendLightningPayment creates the swap, sends funds, and waits for settlement in one call. If the payment fails, it auto-refunds.
Decoding invoices
Fees and limits
SwapManager
SwapManager runs in the background by default, auto-claiming reverse swaps and auto-refunding failed submarine swaps.Listening for updates
Per-swap subscriptions
Configuration
Storage
Swaps are persisted viaSwapRepository. The default is IndexedDbSwapRepository (browser). Other backends:
Querying swaps
Cleanup
Error handling
With SwapManager enabled, refunds are automatic. Listen toonSwapFailed for notifications. Without SwapManager, handle errors manually: