🚀Widget Quick Start
All swaps are trustless and there's no risk to user funds. If user navigates away from the page or swap fails for any reason, user's Lightning invoice payment will be canceled in ~24 hours and their funds will return to their Lightning wallet.
No need for API keys
You can integrate the library into your app and start making requests on mainnet right away. If you need help integrating or testing the widget, feel free to contact us.
If you prefer testnet you can test the available widget functions at http://testnet.lnswap.org:8081 or embed the widget into your site from http://testnet.lnswap.org:8081/widget.js.
Discord: https://discord.gg/8jGPCKmnnA
Twitter: https://twitter.com/ln_swap
Email: hi@lnswap.org
Install the widget
The best way to interact with our API is to use the below code to make it available on your site:
Note: You can use the same script on any site. Just drop into your static page and lnswap
function should be available globally or under window.lnswap
Create your first swap request
To create your first swap request, populate the values below and call the lnswap
function which will make the required call to LNSwap API.
How it works: Stacks contract calls are triggered when required STX (or SIP10) is locked into the swap contract and once it's confirmed, user calls one of the trigger
calls that can be found in the triggerswap contract.
Here's the latest triggerswap contract: https://explorer.stacks.co/txid/SP2507VNQZC9VBXM7X7KB4SF4QJDJRSWHG4V39WPY.triggerswap-v6?chain=mainnet
Take a look at different swap types you can trigger using the widget:
Note that you can listen to widget updates from the host page via cross-origin communications as below.
Last updated