fix formatting

This commit is contained in:
Roei Erez
2023-12-13 11:04:22 +02:00
parent 9c78f98320
commit db739dd3e8
2 changed files with 68 additions and 68 deletions

View File

@@ -2,84 +2,84 @@ using Breez.Sdk;
public class ReceiveOnchainSnippets
{
public void ReceiveOnchain(BlockingBreezServices sdk)
{
// ANCHOR: generate-receive-onchain-address
try
public void ReceiveOnchain(BlockingBreezServices sdk)
{
var swapInfo = sdk.ReceiveOnchain(new ReceiveOnchainRequest());
// Send your funds to the below bitcoin address
var address = swapInfo.bitcoinAddress;
Console.WriteLine($"Minimum amount allowed to deposit in sats: {swapInfo.minAllowedDeposit}");
Console.WriteLine($"Maximum amount allowed to deposit in sats: {swapInfo.maxAllowedDeposit}");
// ANCHOR: generate-receive-onchain-address
try
{
var swapInfo = sdk.ReceiveOnchain(new ReceiveOnchainRequest());
// Send your funds to the below bitcoin address
var address = swapInfo.bitcoinAddress;
Console.WriteLine($"Minimum amount allowed to deposit in sats: {swapInfo.minAllowedDeposit}");
Console.WriteLine($"Maximum amount allowed to deposit in sats: {swapInfo.maxAllowedDeposit}");
}
catch (Exception)
{
// Handle error
}
// ANCHOR_END: generate-receive-onchain-address
}
catch (Exception)
{
// Handle error
}
// ANCHOR_END: generate-receive-onchain-address
}
public void GetInProgressSwap(BlockingBreezServices sdk)
{
// ANCHOR: in-progress-swap
try
public void GetInProgressSwap(BlockingBreezServices sdk)
{
var swapInfo = sdk.InProgressSwap();
// ANCHOR: in-progress-swap
try
{
var swapInfo = sdk.InProgressSwap();
}
catch (Exception)
{
// Handle error
}
// ANCHOR_END: in-progress-swap
}
catch (Exception)
{
// Handle error
}
// ANCHOR_END: in-progress-swap
}
public void ListRefundables(BlockingBreezServices sdk)
{
// ANCHOR: list-refundables
try
public void ListRefundables(BlockingBreezServices sdk)
{
var refundables = sdk.ListRefundables();
// ANCHOR: list-refundables
try
{
var refundables = sdk.ListRefundables();
}
catch (Exception)
{
// Handle error
}
// ANCHOR_END: list-refundables
}
catch (Exception)
{
// Handle error
}
// ANCHOR_END: list-refundables
}
public void ExecuteRefund(BlockingBreezServices sdk, uint refundTxFeeRate, SwapInfo refundable)
{
// ANCHOR: execute-refund
var destinationAddress = "...";
var satPerVbyte = refundTxFeeRate;
try
public void ExecuteRefund(BlockingBreezServices sdk, uint refundTxFeeRate, SwapInfo refundable)
{
var result = sdk.Refund(
new RefundRequest(
refundable.bitcoinAddress,
destinationAddress,
satPerVbyte));
// ANCHOR: execute-refund
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: execute-refund
}
public void GetChannelOpeningFees(BlockingBreezServices sdk, ulong amountMsat)
{
// ANCHOR: get-channel-opening-fees
try
public void GetChannelOpeningFees(BlockingBreezServices sdk, ulong amountMsat)
{
var channelFees = sdk.OpenChannelFee(
new OpenChannelFeeRequest(amountMsat));
// ANCHOR: get-channel-opening-fees
try
{
var channelFees = sdk.OpenChannelFee(
new OpenChannelFeeRequest(amountMsat));
}
catch (Exception)
{
// Handle error
}
// ANCHOR_END: get-channel-opening-fees
}
catch (Exception)
{
// Handle error
}
// ANCHOR_END: get-channel-opening-fees
}
}

View File

@@ -7,8 +7,8 @@ def generate_receive_onchain_address(sdk_services):
# Send your funds to the below 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)
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
except Exception as error:
print(error)