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