From 4cbe04da8b7bef82c92749ab1cdee5225f46ef88 Mon Sep 17 00:00:00 2001 From: Ross Savage Date: Thu, 13 Jul 2023 22:59:01 +0200 Subject: [PATCH] Fix some layout and typo issues --- src/guide/connecting_lsp.md | 7 ++++--- src/guide/fiat_currencies.md | 9 ++++----- src/guide/getting_started.md | 4 ++-- src/guide/receive_onchain.md | 37 ++++++++++++++++++------------------ 4 files changed, 28 insertions(+), 29 deletions(-) diff --git a/src/guide/connecting_lsp.md b/src/guide/connecting_lsp.md index 6cb324a..cb9e8f9 100644 --- a/src/guide/connecting_lsp.md +++ b/src/guide/connecting_lsp.md @@ -3,12 +3,13 @@
Swift
+ Based on the API key provided to the Breez SDK, a default LSP is selected for your node to provide liquidity to it. To get the information about the selected LSP you can do the following: ```swift do { - let lspId = let lspId = try sdk.lspId() - let lspInfo = try sdk.fetchLspInfo(lspId: lspID!) + let lspId = try sdk.lspId() + let lspInfo = try sdk.fetchLspInfo(lspId: lspId!) } catch { // Handle error } @@ -18,7 +19,7 @@ When you have selected an LSP you may then connect to it. ```swift do { - try sdk.connectLsp(lspId: lspID!) + try sdk.connectLsp(lspId: lspId!) } catch { // Handle error } diff --git a/src/guide/fiat_currencies.md b/src/guide/fiat_currencies.md index 7b318d1..d1fc69a 100644 --- a/src/guide/fiat_currencies.md +++ b/src/guide/fiat_currencies.md @@ -18,7 +18,7 @@ To get the current BTC rate for the currencies. ```dart try { - Map fiatRatesMap = fetchFiatRates(); + Map fiatRatesMap = fetchFiatRates(); // print your desired rate print(fiatRatesMap["USD"]?.value); } catch(e) { @@ -26,11 +26,10 @@ try { } ```
-
python
+
Python
- - In order to list the availiable fiat currencies. + ```python try: fiat_currencies = sdk_services.list_fiat_currencies() @@ -43,7 +42,7 @@ To get the current BTC rate for the currencies. ```python try: - fiat_rates = sdk_services.sdk_services.fetch_fiat_rates() + fiat_rates = sdk_services.fetch_fiat_rates() # print your desired rate except Exception as error: # Handle error diff --git a/src/guide/getting_started.md b/src/guide/getting_started.md index dd11069..406da79 100644 --- a/src/guide/getting_started.md +++ b/src/guide/getting_started.md @@ -127,7 +127,7 @@ try { // Connect to the Breez SDK make it ready for use const sdkServices = await connect(config, seed); } catch (error) { - console.log(error); + console.log(error) } ``` @@ -139,7 +139,7 @@ try { const lnBalance = nodeInfo.channelsBalanceMsat; const onchainBalance = nodeInfo.onchainBalanceMsat; } catch (error) { - console.log(error); + console.log(error) } ```
diff --git a/src/guide/receive_onchain.md b/src/guide/receive_onchain.md index 4f539ff..b34660d 100644 --- a/src/guide/receive_onchain.md +++ b/src/guide/receive_onchain.md @@ -97,7 +97,7 @@ do { ```typescript try { - const swapInfo = await receiveOnchain(); + const swapInfo = await receiveOnchain() // Send your funds to the below bitcoin address const address = swapInfo.bitcoinAddress; @@ -347,29 +347,28 @@ To calculate the fees for a channel being opened by the LSP: ```swift func calculateChannelOpeningFee(amountMsats: Int64) -> Int64? { - var channelOpeningFeeNeeded = isChannelOpeningFeeNeeded(amountMsats: amountMsats) - if channelOpeningFeeNeeded { - return calculateFeesForAmount(amountMsats: amountMsats) - } - return nil + var channelOpeningFeeNeeded = isChannelOpeningFeeNeeded(amountMsats: amountMsats) + if channelOpeningFeeNeeded { + return calculateFeesForAmount(amountMsats: amountMsats) } + return nil +} ``` How to detect if open channel fees are needed: ```swift func isChannelOpeningFeeNeeded(amountMsats: Int64) -> Bool { - do { - let nodeInfo = try sdk.nodeInfo() + do { + let nodeInfo = try sdk.nodeInfo() - if let inboundLiquidityMsats = nodeInfo?.inboundLiquidityMsats { - return inboundLiquidityMsats <= amountMsats - } - - } catch { - // Handle error - } - return false + if let inboundLiquidityMsats = nodeInfo?.inboundLiquidityMsats { + return inboundLiquidityMsats <= amountMsats + } + } catch { + // Handle error } + return false +} ``` LSP fees are calculated in two ways, either by a minimum fee set by the LSP or by a fee per myriad calculated based on the amount being received. If the fee calculated from the fee per myriad is less than the minimum fee, the minimum fee is used. @@ -417,7 +416,7 @@ How to detect if open channel fees are needed: // Assumes nodeState isn't empty bool isChannelOpeningFeeNeeded(int amountMsat) async { NodeState? nodeState = await getNodeState(); - return amountMsat >= nodeState.inboundLiquidityMsats; + return amountMsat >= nodeState.inboundLiquidityMsats; } ``` @@ -493,7 +492,7 @@ To calculate the fees for a channel being opened by the LSP: func CalculateChannelOpeningFee(amountMsats uint64) (uint64, error) { isChannelOpeningFeeNeeded := isChannelOpeningFeeNeeded(amountMsats) if !isChannelOpeningFeeNeeded { - return 0, fmt.Errorf("Channel not needed") + return 0, fmt.Errorf("Channel not needed") } return calculateFeesForAmount(amountMsats), nil } @@ -504,7 +503,7 @@ How to detect if open channel fees are needed: func isChannelOpeningFeeNeeded(amountMsats uint64) bool { nodeInfo, err := sdkServices.NodeInfo() if err != nil { - // Handle error + // Handle error } return nodeInfo.InboundLiquidityMsats <= amountMsats }