From 520da0f2c31f04756a354446dce3243fd404800e Mon Sep 17 00:00:00 2001 From: Roei Erez Date: Tue, 25 Apr 2023 14:32:04 +0300 Subject: [PATCH] Refine wording. --- src/guide/getting_started.md | 25 ++++++++++++++++++++----- src/guide/lnurl.md | 2 +- src/guide/lnurl_auth.md | 2 +- src/guide/lnurl_pay.md | 2 +- src/guide/lnurl_withdraw.md | 2 +- src/guide/payments.md | 6 +++--- src/guide/recieve_onchain.md | 15 +++++++-------- src/guide/send_onchain.md | 2 +- 8 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/guide/getting_started.md b/src/guide/getting_started.md index 5f0ffb4..f03ebfe 100644 --- a/src/guide/getting_started.md +++ b/src/guide/getting_started.md @@ -1,9 +1,15 @@ # Getting Started -Connecting to your node is the first step before attempting to send and receive lightning payments. +The Breez SDK enables mobile developers to integrate Lightning and bitcoin payments into their apps with a very shallow learning curve. The use cases are endless – from social apps that want to integrate tipping between users to content-creation apps interested in adding bitcoin monetization. Crucially, this SDK is an end-to-end, non-custodial, drop-in solution powered by Greenlight, a built-in LSP, on-chain interoperability, third-party fiat on-ramps, and other services users and operators need. -The SDK is implemented in rust and is made accessible to other languages using ffi binding. -Connecting to a node requires a seed (your master key) and credentials. The seed represents a bip39 mnemonics and the credentials are retrieved by registering a new node or recovering an existing one. +The Breez SDK provides the following services: + +* Sending payments (via various protocols such as: bolt11, keysend, lnurl-pay, lightning address, etc.) +* Receiving payments (via various protocols such as: bolt11, lnurl-withdraw, etc.) +* Fetching node status (e.g. balance, max allow to pay, max allow to receive, on-chain balance, etc.) +* Connecting to a new or existing node. + +Connecting to a node requires a seed (your master key) and credentials. The seed is a bip39 mnemonic and the credentials are retrieved by registering a new node or recovering an existing one. ## Registering a new node ```rust @@ -16,7 +22,8 @@ let seed = ; let credentials = BreezServices::register_node(Network::Bitcoin, seed).await?; ``` -Once you got your credentials you should save them in a secure storage and then you are able to initialize the SDK and start using your node: +Once the credentials are retrieved they should be saved in a secured storage. +The next step is to initialize the SDK and start the node: ## Initializing the SDK ```rust @@ -38,4 +45,12 @@ let sdk = BreezServices::init_services( BreezServices::start(rt(), &sdk).await?; ``` -Now your node is ready to receive payments. \ No newline at end of file +At any point we can fetch our balance from the Greenlight node + +```rust +if let Some(node_state) = sdk.node_info()? { + let balance_ln = node_state.channels_balance_msat; + let balance_onchain = node_state.onchain_balance_msat; +} +``` +We are now ready to receive [payments](guide/payments.md) \ No newline at end of file diff --git a/src/guide/lnurl.md b/src/guide/lnurl.md index 9d04b53..72029f7 100644 --- a/src/guide/lnurl.md +++ b/src/guide/lnurl.md @@ -1 +1 @@ -# Lnurl +# lnurl diff --git a/src/guide/lnurl_auth.md b/src/guide/lnurl_auth.md index eff0ef8..3860368 100644 --- a/src/guide/lnurl_auth.md +++ b/src/guide/lnurl_auth.md @@ -1 +1 @@ -# Lnurl Auth +# lnurl-auth diff --git a/src/guide/lnurl_pay.md b/src/guide/lnurl_pay.md index 79e428c..b19a562 100644 --- a/src/guide/lnurl_pay.md +++ b/src/guide/lnurl_pay.md @@ -1 +1 @@ -# Lnurl Pay +# lnurl-pay diff --git a/src/guide/lnurl_withdraw.md b/src/guide/lnurl_withdraw.md index 874432e..9e5c1cd 100644 --- a/src/guide/lnurl_withdraw.md +++ b/src/guide/lnurl_withdraw.md @@ -1 +1 @@ -# Lnurl Withdraw +# lnurl-withdraw diff --git a/src/guide/payments.md b/src/guide/payments.md index 7f5670a..c6106da 100644 --- a/src/guide/payments.md +++ b/src/guide/payments.md @@ -1,14 +1,14 @@ # Payments ## Receiving Lightning Payments -Breez SDK doesn't require you to open a channel and set up your inbound liquidity. at this stage your node should already be connected to the LSP peer and you can use the follwing code to receive payments: +Breez SDK doesn't require you to open a channel and set up your inbound liquidity. +Breez SDK automatically connects your node to the LSP peer and you can now receive payments: ```rust let invoice = sdk.receive_payment(3000, "Invoice for 3000 sats".into()).await?; ``` -The above will create an invoice that is ready to be paid. -Once this invoice is paid the LSP connected to your node will open a JIT (just in time) channel to your node and forward the amount minus some setup fee. +Or make payments ## Sending Lightning Payments ```rust diff --git a/src/guide/recieve_onchain.md b/src/guide/recieve_onchain.md index ebb009e..84388ca 100644 --- a/src/guide/recieve_onchain.md +++ b/src/guide/recieve_onchain.md @@ -1,4 +1,4 @@ -# Receive via Onchain +# Receive via on-chain There are cases when you have funds in some bitcoin address and you would like to send those to your lightning node. ```rust @@ -8,19 +8,18 @@ let swap_info = sdk.receive_onchain().await?; let address = swap_info.bitcoin_address; ``` -Once you send the funds to the above address the SDK will monitor this address for unspent confirmed outputs and use a trustless submarine swap process to receive these into your lightning node. -You can always monitor the status of the current in progress swap using the follwing 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: ```rust let swap_info = sdk.in_progress_swap().await? ``` -The process of receiving via onchain address is trustless and uses submarine swap. this means there are two ways to spend the sent funds: -1. Either by a preimage that is exposed when the lightning payment is completed - This is the positive case where the swap was succesfull. -2. Or by your node when the swap didn't complete in a certiain timeout - This is the negative case where your node will execute a refund. +The process of receiving funds via an on-chain address is trustless and uses a submarine swap. This means there are two ways to spend the sent funds: -In order to execute a refund you need to supply an onchain address to where the refunded amount will be sent to. -The following code will retrieve the refundable swaps: +1. Either by a preimage that is exposed when the Lightning payment is completed - this is the positive case where the swap was successful. +2. Or by your node when the swap didn't complete within a certain timeout - this is the negative case where your node will execute a refund. + +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: ```rust let refundables = sdk.list_refundables().await? diff --git a/src/guide/send_onchain.md b/src/guide/send_onchain.md index be3b5d8..cb4a68b 100644 --- a/src/guide/send_onchain.md +++ b/src/guide/send_onchain.md @@ -1 +1 @@ -# Send Onchain +# Send on-chain