mirror of
https://github.com/aljazceru/breez-sdk-docs.git
synced 2025-12-17 13:54:20 +01:00
Document swap limits
This commit is contained in:
@@ -2,83 +2,84 @@ using Breez.Sdk;
|
|||||||
|
|
||||||
public class ReceiveOnchainSnippets
|
public class ReceiveOnchainSnippets
|
||||||
{
|
{
|
||||||
public void ReceiveOnchain(BlockingBreezServices sdk)
|
public void ReceiveOnchain(BlockingBreezServices sdk)
|
||||||
|
{
|
||||||
|
// ANCHOR: generate-receive-onchain-address
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// ANCHOR: generate-receive-onchain-address
|
var swapInfo = sdk.ReceiveOnchain(new ReceiveOnchainRequest());
|
||||||
try
|
// Send your funds to the below bitcoin address
|
||||||
{
|
var address = swapInfo.bitcoinAddress;
|
||||||
var swapInfo = sdk.ReceiveOnchain(new ReceiveOnchainRequest());
|
Console.WriteLine($"Minimum amount allowed to deposit in sats: {swapInfo.minAllowedDeposit}");
|
||||||
|
Console.WriteLine($"Maximum amount allowed to deposit in sats: {swapInfo.maxAllowedDeposit}");
|
||||||
// Send your funds to the below bitcoin address
|
|
||||||
var address = swapInfo.bitcoinAddress;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
// Handle error
|
|
||||||
}
|
|
||||||
// ANCHOR_END: generate-receive-onchain-address
|
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
public void GetInProgressSwap(BlockingBreezServices sdk)
|
|
||||||
{
|
{
|
||||||
// ANCHOR: in-progress-swap
|
// Handle error
|
||||||
try
|
|
||||||
{
|
|
||||||
var swapInfo = sdk.InProgressSwap();
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
// Handle error
|
|
||||||
}
|
|
||||||
// ANCHOR_END: in-progress-swap
|
|
||||||
}
|
}
|
||||||
|
// ANCHOR_END: generate-receive-onchain-address
|
||||||
|
}
|
||||||
|
|
||||||
public void ListRefundables(BlockingBreezServices sdk)
|
public void GetInProgressSwap(BlockingBreezServices sdk)
|
||||||
|
{
|
||||||
|
// ANCHOR: in-progress-swap
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// ANCHOR: list-refundables
|
var swapInfo = sdk.InProgressSwap();
|
||||||
try
|
|
||||||
{
|
|
||||||
var refundables = sdk.ListRefundables();
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
// Handle error
|
|
||||||
}
|
|
||||||
// ANCHOR_END: list-refundables
|
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// Handle error
|
||||||
|
}
|
||||||
|
// ANCHOR_END: in-progress-swap
|
||||||
|
}
|
||||||
|
|
||||||
public void ExecuteRefund(BlockingBreezServices sdk, uint refundTxFeeRate, SwapInfo refundable)
|
public void ListRefundables(BlockingBreezServices sdk)
|
||||||
|
{
|
||||||
|
// ANCHOR: list-refundables
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// ANCHOR: execute-refund
|
var refundables = sdk.ListRefundables();
|
||||||
var destinationAddress = "...";
|
|
||||||
var satPerVbyte = refundTxFeeRate;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var result = sdk.Refund(
|
|
||||||
new RefundRequest(
|
|
||||||
refundable.bitcoinAddress,
|
|
||||||
destinationAddress,
|
|
||||||
satPerVbyte));
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
// Handle error
|
|
||||||
}
|
|
||||||
// ANCHOR_END: execute-refund
|
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// Handle error
|
||||||
|
}
|
||||||
|
// ANCHOR_END: list-refundables
|
||||||
|
}
|
||||||
|
|
||||||
public void GetChannelOpeningFees(BlockingBreezServices sdk, ulong amountMsat)
|
public void ExecuteRefund(BlockingBreezServices sdk, uint refundTxFeeRate, SwapInfo refundable)
|
||||||
|
{
|
||||||
|
// ANCHOR: execute-refund
|
||||||
|
var destinationAddress = "...";
|
||||||
|
var satPerVbyte = refundTxFeeRate;
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// ANCHOR: get-channel-opening-fees
|
var result = sdk.Refund(
|
||||||
try
|
new RefundRequest(
|
||||||
{
|
refundable.bitcoinAddress,
|
||||||
var channelFees = sdk.OpenChannelFee(
|
destinationAddress,
|
||||||
new OpenChannelFeeRequest(amountMsat));
|
satPerVbyte));
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
// Handle error
|
|
||||||
}
|
|
||||||
// ANCHOR_END: get-channel-opening-fees
|
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// Handle error
|
||||||
|
}
|
||||||
|
// ANCHOR_END: execute-refund
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GetChannelOpeningFees(BlockingBreezServices sdk, ulong amountMsat)
|
||||||
|
{
|
||||||
|
// ANCHOR: get-channel-opening-fees
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var channelFees = sdk.OpenChannelFee(
|
||||||
|
new OpenChannelFeeRequest(amountMsat));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// Handle error
|
||||||
|
}
|
||||||
|
// ANCHOR_END: get-channel-opening-fees
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ Future<SwapInfo> generateReceiveOnchainAddress() async {
|
|||||||
// Send your funds to the below bitcoin address
|
// Send your funds to the below bitcoin address
|
||||||
String address = swapInfo.bitcoinAddress;
|
String address = swapInfo.bitcoinAddress;
|
||||||
print(address);
|
print(address);
|
||||||
|
print("Minimum amount allowed to deposit in sats: ${swapInfo.minAllowedDeposit}");
|
||||||
|
print("Maximum amount allowed to deposit in sats: ${swapInfo.maxAllowedDeposit}");
|
||||||
return swapInfo;
|
return swapInfo;
|
||||||
// ANCHOR_END: generate-receive-onchain-address
|
// ANCHOR_END: generate-receive-onchain-address
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ func GenerateReceiveOnchainAddress() {
|
|||||||
// Send your funds to the below bitcoin address
|
// Send your funds to the below bitcoin address
|
||||||
address := swapInfo.BitcoinAddress
|
address := swapInfo.BitcoinAddress
|
||||||
log.Printf("%v", address)
|
log.Printf("%v", address)
|
||||||
|
|
||||||
|
log.Printf("Minimum amount allowed to deposit in sats: %v", swapInfo.minAllowedDeposit)
|
||||||
|
log.Printf("Maximum amount allowed to deposit in sats: %v", swapInfo.maxAllowedDeposit)
|
||||||
}
|
}
|
||||||
// ANCHOR_END: generate-receive-onchain-address
|
// ANCHOR_END: generate-receive-onchain-address
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ class ReceiveOnchain {
|
|||||||
val swapInfo = sdk.receiveOnchain(ReceiveOnchainRequest())
|
val swapInfo = sdk.receiveOnchain(ReceiveOnchainRequest())
|
||||||
// Send your funds to the bellow bitcoin address
|
// Send your funds to the bellow bitcoin address
|
||||||
val address = swapInfo.bitcoinAddress
|
val address = swapInfo.bitcoinAddress
|
||||||
|
// Log.v("Breez", "Minimum amount allowed to deposit in sats: ${swapInfo.minAllowedDeposit}")
|
||||||
|
// Log.v("Breez", "Maximum amount allowed to deposit in sats: ${swapInfo.maxAllowedDeposit}")
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
// handle error
|
// handle error
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ def generate_receive_onchain_address(sdk_services):
|
|||||||
|
|
||||||
# Send your funds to the below bitcoin address
|
# Send your funds to the below bitcoin address
|
||||||
address = swap_info.bitcoin_address
|
address = swap_info.bitcoin_address
|
||||||
|
print("Minimum amount allowed to deposit in sats: {}", swap_info.min_allowed_deposit);
|
||||||
|
print("Maximum amount allowed to deposit in sats: {}", swap_info.max_allowed_deposit);
|
||||||
# ANCHOR_END: generate-receive-onchain-address
|
# ANCHOR_END: generate-receive-onchain-address
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
print(error)
|
print(error)
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ const exampleReceiveOnchain = async () => {
|
|||||||
|
|
||||||
// Send your funds to the below bitcoin address
|
// Send your funds to the below bitcoin address
|
||||||
const address = swapInfo.bitcoinAddress
|
const address = swapInfo.bitcoinAddress
|
||||||
|
console.log("Minimum amount allowed to deposit in sats: {}", swapInfo.minAllowedDeposit);
|
||||||
|
console.log("Maximum amount allowed to deposit in sats: {}", swapInfo.maxAllowedDeposit);
|
||||||
// ANCHOR_END: generate-receive-onchain-address
|
// ANCHOR_END: generate-receive-onchain-address
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ async fn generate_receive_onchain_address(sdk: Arc<BreezServices>) -> Result<()>
|
|||||||
|
|
||||||
// Send your funds to the below bitcoin address
|
// Send your funds to the below bitcoin address
|
||||||
let address = swap_info.bitcoin_address;
|
let address = swap_info.bitcoin_address;
|
||||||
|
info!("Minimum amount allowed to deposit in sats: {}", swap_info.min_allowed_deposit);
|
||||||
|
info!("Maximum amount allowed to deposit in sats: {}", swap_info.max_allowed_deposit);
|
||||||
// ANCHOR_END: generate-receive-onchain-address
|
// ANCHOR_END: generate-receive-onchain-address
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ func generateReceiveOnchainAddress(sdk: BlockingBreezServices) -> String? {
|
|||||||
|
|
||||||
// Send your funds to the bellow bitcoin address
|
// Send your funds to the bellow bitcoin address
|
||||||
let address = swapInfo?.bitcoinAddress
|
let address = swapInfo?.bitcoinAddress
|
||||||
|
print("Minimum amount allowed to deposit in sats: \(swapInfo.minAllowedDeposit)")
|
||||||
|
print("Maximum amount allowed to deposit in sats: \(swapInfo.maxAllowedDeposit)")
|
||||||
// ANCHOR_END: generate-receive-onchain-address
|
// ANCHOR_END: generate-receive-onchain-address
|
||||||
|
|
||||||
return address
|
return address
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ In order to receive funds you first have to be connected to an [LSP](connecting_
|
|||||||
</section>
|
</section>
|
||||||
</custom-tabs>
|
</custom-tabs>
|
||||||
|
|
||||||
|
It's important to be aware that the swap information provided includes maximum and minimum limits. Users must be informed of these limits because if the amount transferred to the swap address falls outside this valid range, the funds will not be successfully received via lightning. In such cases, a refund will be necessary.
|
||||||
|
|
||||||
## Get the in-progress Swap
|
## Get the in-progress Swap
|
||||||
|
|
||||||
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:
|
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:
|
||||||
|
|||||||
Reference in New Issue
Block a user