|
1 |
| -# Receiving an on-chain transaction (Swap-In) |
| 1 | +<h1 id="receiving-an-on-chain-transaction"> |
| 2 | + <a class="header" href="#receiving-an-on-chain-transaction">Receiving an on-chain transaction</a> |
| 3 | + <a class="tag" target="_blank" href="https://breez.github.io/breez-sdk-greenlight/breez_sdk_core/struct.BreezServices.html#method.receive_onchain">API docs</a> |
| 4 | +</h1> |
2 | 5 |
|
3 | 6 | There are cases when you have funds in some bitcoin address and you would like to send those to your lightning node.
|
4 | 7 |
|
@@ -79,8 +82,10 @@ The `swap_info` above includes maximum and minimum limits. Your application's us
|
79 | 82 |
|
80 | 83 | </div>
|
81 | 84 |
|
82 |
| - |
83 |
| -## Get the in-progress Swap |
| 85 | +<h2 id="get-the-in-progress-swap"> |
| 86 | + <a class="header" href="#get-the-in-progress-swap">Get the in-progress Swap</a> |
| 87 | + <a class="tag" target="_blank" href="https://breez.github.io/breez-sdk-greenlight/breez_sdk_core/struct.BreezServices.html#method.in_progress_swap">API docs</a> |
| 88 | +</h2> |
84 | 89 |
|
85 | 90 | Once you've sent the funds to the above address, the SDK will monitor this address for unspent confirmed outputs and use a trustless submarine swap to receive these into your Lightning node. You can always monitor the status of the current in-progress swap using the following code:
|
86 | 91 |
|
@@ -170,7 +175,10 @@ This means that, when the user performs a swap-in (receive onchain), the app wil
|
170 | 175 | - automatically complete the swap in the background when the onchain transaction is confirmed, even if the app is closed
|
171 | 176 | - display an OS notification, informing the user of the received funds
|
172 | 177 |
|
173 |
| -## Refund a Swap |
| 178 | +<h2 id="refund-a-swap"> |
| 179 | + <a class="header" href="#refund-a-swap">Refund a Swap</a> |
| 180 | + <a class="tag" target="_blank" href="https://breez.github.io/breez-sdk-greenlight/breez_sdk_core/struct.BreezServices.html#method.list_refundables">API docs</a> |
| 181 | +</h2> |
174 | 182 |
|
175 | 183 | In order to execute a refund, you need to supply an on-chain address to where the refunded amount will be sent. The following code will retrieve the refundable swaps:
|
176 | 184 |
|
@@ -240,6 +248,11 @@ In order to execute a refund, you need to supply an on-chain address to where th
|
240 | 248 | </section>
|
241 | 249 | </custom-tabs>
|
242 | 250 |
|
| 251 | +<h2 id="execute-a-refund"> |
| 252 | + <a class="header" href="#execute-a-refund">Execute a refund</a> |
| 253 | + <a class="tag" target="_blank" href="https://breez.github.io/breez-sdk-greenlight/breez_sdk_core/struct.BreezServices.html#method.refund">API docs</a> |
| 254 | +</h2> |
| 255 | + |
243 | 256 | Once you have a refundable swap in hand, use the following code to execute a refund:
|
244 | 257 |
|
245 | 258 | <custom-tabs category="lang">
|
@@ -315,7 +328,10 @@ A refund can be attempted several times. A common scenario where this is useful
|
315 | 328 |
|
316 | 329 | </div>
|
317 | 330 |
|
318 |
| -# Rescanning swaps |
| 331 | +<h2 id="rescanning-swaps"> |
| 332 | + <a class="header" href="#rescanning-swaps">Rescanning swaps</a> |
| 333 | + <a class="tag" target="_blank" href="https://breez.github.io/breez-sdk-greenlight/breez_sdk_core/struct.BreezServices.html#method.rescan_swaps">API docs</a> |
| 334 | +</h2> |
319 | 335 |
|
320 | 336 | The SDK continuously monitors any ongoing swap transactions until they are either completed or refunded. Once one of these outcomes occurs, the SDK ceases its monitoring activities, and users are advised against sending additional funds to the swap address. However, if users inadvertently send additional funds to a swap address that was already used, the SDK won't automatically recognize it. In such cases, the SDK provides an option to manually scan the used swap addressed to identify additional transactions. This action allows the address to be included in the list eligible for refunds, enabling the initiation of a refund process. For the purpose of rescanning all historical swap addresses and updating their on-chain status, the following code can be used:
|
321 | 337 |
|
@@ -385,7 +401,10 @@ The SDK continuously monitors any ongoing swap transactions until they are eithe
|
385 | 401 | </section>
|
386 | 402 | </custom-tabs>
|
387 | 403 |
|
388 |
| -# Calculating fees |
| 404 | +<h2 id="calculating-fees"> |
| 405 | + <a class="header" href="#calculating-fees">Calculating fees</a> |
| 406 | + <a class="tag" target="_blank" href="https://breez.github.io/breez-sdk-greenlight/breez_sdk_core/struct.BreezServices.html#method.open_channel_fee">API docs</a> |
| 407 | +</h2> |
389 | 408 |
|
390 | 409 | When the amount to be received exceeds the inbound liquidity of the node, a new channel will be opened by the LSP in order for the node to receive it. This can checked by retrieving the NodeState from the SDK and comparing the inbound liquidity to the amount to be received. If the amount is greater or equal to the inbound liquidity, a new channel opening is required.
|
391 | 410 |
|
|
0 commit comments