From fe74bbe9e773178330f2973bb02c314a72904a9c Mon Sep 17 00:00:00 2001 From: umiyahara <138246513+umiyahara@users.noreply.github.com> Date: Wed, 25 Oct 2023 16:35:55 -0400 Subject: [PATCH 1/7] Update getting_started.md --- src/guide/getting_started.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/guide/getting_started.md b/src/guide/getting_started.md index 687126f..471239d 100644 --- a/src/guide/getting_started.md +++ b/src/guide/getting_started.md @@ -11,6 +11,10 @@ The Breez SDK provides the following services: Connecting to a node requires a seed (your master key). The seed is a bip39 mnemonic. +## Pricing + +The Breez SDK is free for developers. + ## API Key and Invite Code Before you start, you will need an API Key to use the SDK, as well as an Invite Code when you create a new node. From 04a91ade4bcd31d93b1bf4d9192b917736e1995f Mon Sep 17 00:00:00 2001 From: Roy Sheinfeld <31890660+kingonly@users.noreply.github.com> Date: Thu, 2 Nov 2023 10:25:06 +0200 Subject: [PATCH 2/7] Update receive_onchain.md --- src/guide/receive_onchain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/guide/receive_onchain.md b/src/guide/receive_onchain.md index 833265c..be73801 100644 --- a/src/guide/receive_onchain.md +++ b/src/guide/receive_onchain.md @@ -2,7 +2,7 @@ There are cases when you have funds in some bitcoin address and you would like to send those to your lightning node. In such cases, the SDK might have to open a new channel, for which case you can specify an optional user-selected -channel opening fee[^1]. For simplicity, the examples below use the cheapest fee available. +channel opening fee[^1]. In order to receive funds you first have to be connected to an [LSP](connecting_lsp.md). From f717da59157a49ffac6ec3b434f8fcb1c26685ef Mon Sep 17 00:00:00 2001 From: Roei Erez Date: Wed, 18 Oct 2023 09:24:30 +0300 Subject: [PATCH 3/7] Change send_paymenet to use to msat --- src/guide/send_payment.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/guide/send_payment.md b/src/guide/send_payment.md index c94f785..623ac4e 100644 --- a/src/guide/send_payment.md +++ b/src/guide/send_payment.md @@ -18,9 +18,9 @@ sdk.send_payment(bolt11.into(), None).await?; ```swift let bolt11 = "..."; do { - // The `amountSats` param is optional so nil can be passed if the - // bolt11 invoice spesifies an amount. - let payment = try sdk.sendPayment(bolt11: bolt11, amountSats: 3000) + // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. + // The amount_msat is required in case an amount is not specified in the bolt11 invoice'. + let payment = try sdk.sendPayment(bolt11: bolt11, amount_msat: 3000) } catch { // handle error } @@ -61,7 +61,7 @@ String bolt11 = "..."; try { Payment payment = await sendPayment( bolt11: bolt11, - amountSats: 3000, + amount_msat: 3000, ); } catch (error) { // handle error @@ -75,9 +75,9 @@ try { ```python bolt11 = "..." try: - # The `amountSats` param is optional so None can be passed if the - # bolt11 invoice spesifies an amount. - sdk_services.send_payment(bolt11=bolt11, amount_sats=None) + # The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. + # The amount_msat is required in case an amount is not specified in the bolt11 invoice'. + sdk_services.send_payment(bolt11=bolt11, amount_msat=None) except Exception as error: # Handle error ``` @@ -88,8 +88,8 @@ except Exception as error: ```go bolt11 := "bolt11 invoice" -amountSats := uint64(3000) -if payment, err := sdk.SendPayment(bolt11, &amountSats); err == nil { +amount_msat := uint64(3000) +if payment, err := sdk.SendPayment(bolt11, &amount_msat); err == nil { log.Printf("%#v", payment) } ``` From f6dcd33c2e27028b92865bbf4b43e162c106b0d0 Mon Sep 17 00:00:00 2001 From: Roei Erez Date: Wed, 18 Oct 2023 13:14:43 +0300 Subject: [PATCH 4/7] Document all languages --- src/guide/send_payment.md | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/guide/send_payment.md b/src/guide/send_payment.md index 623ac4e..1b897f8 100644 --- a/src/guide/send_payment.md +++ b/src/guide/send_payment.md @@ -8,7 +8,10 @@ Once you have outbound liquidity you can start sending payments too. ```rust,ignore let bolt11 = "..."; -sdk.send_payment(bolt11.into(), None).await?; +// The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. +// The amount_msat is required in case an amount is not specified in the bolt11 invoice'. +let amount_msat: Option = None; +sdk.send_payment(bolt11.into(), amount_msat).await?; ``` @@ -20,7 +23,7 @@ let bolt11 = "..."; do { // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. // The amount_msat is required in case an amount is not specified in the bolt11 invoice'. - let payment = try sdk.sendPayment(bolt11: bolt11, amount_msat: 3000) + let payment = try sdk.sendPayment(bolt11: bolt11, amount_msat: 3000000) } catch { // handle error } @@ -33,7 +36,10 @@ do { ```kotlin,ignore val bolt11 = "..." try { - val payment = sdk.sendPayment(bolt11, 3000L.toULong()) + // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. + // The amount_msat is required in case an amount is not specified in the bolt11 invoice'. + var amount_msat = 3000000L.toULong() + val payment = sdk.sendPayment(bolt11, amount_msat) } catch (e: Exception) { // handle error } @@ -46,7 +52,10 @@ try { ```typescript const bolt11 = "..." try { - const payment = await sendPayment(bolt11, 3000) + // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. + // The amount_msat is required in case an amount is not specified in the bolt11 invoice'. + const amount_msat = 3000000 + const payment = await sendPayment(bolt11, amount_msat) } catch (error) { console.log(error) } @@ -59,6 +68,8 @@ try { ```dart String bolt11 = "..."; try { + // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. + // The amount_msat is required in case an amount is not specified in the bolt11 invoice'. Payment payment = await sendPayment( bolt11: bolt11, amount_msat: 3000, @@ -88,7 +99,9 @@ except Exception as error: ```go bolt11 := "bolt11 invoice" -amount_msat := uint64(3000) +// The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. +// The amount_msat is required in case an amount is not specified in the bolt11 invoice'. +amount_msat := uint64(3000000) if payment, err := sdk.SendPayment(bolt11, &amount_msat); err == nil { log.Printf("%#v", payment) } @@ -102,7 +115,10 @@ if payment, err := sdk.SendPayment(bolt11, &amount_msat); err == nil { var bolt11 = "..."; try { - var payment = sdk.SendPayment(bolt11, 3000); + // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. + // The amount_msat is required in case an amount is not specified in the bolt11 invoice'. + var amount_msat = 3000000; + var payment = sdk.SendPayment(bolt11, amount_msat); } catch (Exception) { From 35bac7838e6f3ab6ae21040501c0a0e58843ab24 Mon Sep 17 00:00:00 2001 From: Roei Erez Date: Wed, 18 Oct 2023 13:54:32 +0300 Subject: [PATCH 5/7] fix amountMsat case and docs --- src/guide/send_payment.md | 44 +++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/guide/send_payment.md b/src/guide/send_payment.md index 1b897f8..e8398e1 100644 --- a/src/guide/send_payment.md +++ b/src/guide/send_payment.md @@ -21,9 +21,9 @@ sdk.send_payment(bolt11.into(), amount_msat).await?; ```swift let bolt11 = "..."; do { - // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. - // The amount_msat is required in case an amount is not specified in the bolt11 invoice'. - let payment = try sdk.sendPayment(bolt11: bolt11, amount_msat: 3000000) + // The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount. + // The amountMsat is required in case an amount is not specified in the bolt11 invoice'. + let payment = try sdk.sendPayment(bolt11: bolt11, amountMsat: 3000000) } catch { // handle error } @@ -36,10 +36,10 @@ do { ```kotlin,ignore val bolt11 = "..." try { - // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. - // The amount_msat is required in case an amount is not specified in the bolt11 invoice'. - var amount_msat = 3000000L.toULong() - val payment = sdk.sendPayment(bolt11, amount_msat) + // The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount. + // The amountMsat is required in case an amount is not specified in the bolt11 invoice'. + var amountMsat = 3000000L.toULong() + val payment = sdk.sendPayment(bolt11, amountMsat) } catch (e: Exception) { // handle error } @@ -52,10 +52,10 @@ try { ```typescript const bolt11 = "..." try { - // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. - // The amount_msat is required in case an amount is not specified in the bolt11 invoice'. - const amount_msat = 3000000 - const payment = await sendPayment(bolt11, amount_msat) + // The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount. + // The amountMsat is required in case an amount is not specified in the bolt11 invoice'. + const amountMsat = 3000000 + const payment = await sendPayment(bolt11, amountMsat) } catch (error) { console.log(error) } @@ -68,11 +68,11 @@ try { ```dart String bolt11 = "..."; try { - // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. - // The amount_msat is required in case an amount is not specified in the bolt11 invoice'. + // The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount. + // The amountMsat is required in case an amount is not specified in the bolt11 invoice'. Payment payment = await sendPayment( bolt11: bolt11, - amount_msat: 3000, + amountMsat: 3000000, ); } catch (error) { // handle error @@ -99,10 +99,10 @@ except Exception as error: ```go bolt11 := "bolt11 invoice" -// The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. -// The amount_msat is required in case an amount is not specified in the bolt11 invoice'. -amount_msat := uint64(3000000) -if payment, err := sdk.SendPayment(bolt11, &amount_msat); err == nil { +// The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount. +// The amountMsat is required in case an amount is not specified in the bolt11 invoice'. +amountMsat := uint64(3000000) +if payment, err := sdk.SendPayment(bolt11, &amountMsat); err == nil { log.Printf("%#v", payment) } ``` @@ -115,10 +115,10 @@ if payment, err := sdk.SendPayment(bolt11, &amount_msat); err == nil { var bolt11 = "..."; try { - // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. - // The amount_msat is required in case an amount is not specified in the bolt11 invoice'. - var amount_msat = 3000000; - var payment = sdk.SendPayment(bolt11, amount_msat); + // The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount. + // The amountMsat is required in case an amount is not specified in the bolt11 invoice'. + var amountMsat = 3000000; + var payment = sdk.SendPayment(bolt11, amountMsat); } catch (Exception) { From 344b952b90f6f827555624a7f89026555d8117dd Mon Sep 17 00:00:00 2001 From: Erdem Yerebasmaz Date: Fri, 20 Oct 2023 14:32:16 +0300 Subject: [PATCH 6/7] Wrap send_payment args intro requests --- src/guide/send_payment.md | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/guide/send_payment.md b/src/guide/send_payment.md index e8398e1..735453a 100644 --- a/src/guide/send_payment.md +++ b/src/guide/send_payment.md @@ -7,11 +7,14 @@ Once you have outbound liquidity you can start sending payments too.
```rust,ignore -let bolt11 = "..."; // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. // The amount_msat is required in case an amount is not specified in the bolt11 invoice'. let amount_msat: Option = None; -sdk.send_payment(bolt11.into(), amount_msat).await?; +let req = SendPaymentRequest { + bolt11: "...".into(), + amount_msat, +}; +let response = self.send_payment(req).await?; ```
@@ -19,11 +22,11 @@ sdk.send_payment(bolt11.into(), amount_msat).await?;
```swift -let bolt11 = "..."; do { // The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount. // The amountMsat is required in case an amount is not specified in the bolt11 invoice'. - let payment = try sdk.sendPayment(bolt11: bolt11, amountMsat: 3000000) + let req = SendPaymentRequest(bolt11: "...", amountMsat: 3000000) + let response = try sdk.sendSpontaneousPayment(req: req) } catch { // handle error } @@ -38,8 +41,9 @@ val bolt11 = "..." try { // The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount. // The amountMsat is required in case an amount is not specified in the bolt11 invoice'. - var amountMsat = 3000000L.toULong() - val payment = sdk.sendPayment(bolt11, amountMsat) + val amountMsat = 3000000L.toULong() + val req = SendPaymentRequest(bolt11, amountMsat) + val response = sdk.sendPayment(req) } catch (e: Exception) { // handle error } @@ -55,7 +59,7 @@ try { // The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount. // The amountMsat is required in case an amount is not specified in the bolt11 invoice'. const amountMsat = 3000000 - const payment = await sendPayment(bolt11, amountMsat) + const response = await sendPayment({bolt11, amountMsat}) } catch (error) { console.log(error) } @@ -70,10 +74,11 @@ String bolt11 = "..."; try { // The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount. // The amountMsat is required in case an amount is not specified in the bolt11 invoice'. - Payment payment = await sendPayment( + SendPaymentRequest req = SendPaymentRequest( bolt11: bolt11, amountMsat: 3000000, ); + SendPaymentResponse payment = await sendPayment(req: req); } catch (error) { // handle error } @@ -88,7 +93,8 @@ bolt11 = "..." try: # The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. # The amount_msat is required in case an amount is not specified in the bolt11 invoice'. - sdk_services.send_payment(bolt11=bolt11, amount_msat=None) + req = SendPaymentRequest(bolt11=bolt11, amount_msat=None) + sdk_services.send_payment(req=req) except Exception as error: # Handle error ``` @@ -102,8 +108,12 @@ bolt11 := "bolt11 invoice" // The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount. // The amountMsat is required in case an amount is not specified in the bolt11 invoice'. amountMsat := uint64(3000000) -if payment, err := sdk.SendPayment(bolt11, &amountMsat); err == nil { - log.Printf("%#v", payment) +sendPaymentRequest := breez_sdk.SendPaymentRequest{ + Bolt11: bolt11, + AmountMsat: amountMsat, +} +if response, err := sdk.SendPayment(sendPaymentRequest); err == nil { + log.Printf("%#v", response) } ```
@@ -113,12 +123,12 @@ if payment, err := sdk.SendPayment(bolt11, &amountMsat); err == nil { ```cs var bolt11 = "..."; +var amountMsat = 3000000; try { // The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount. // The amountMsat is required in case an amount is not specified in the bolt11 invoice'. - var amountMsat = 3000000; - var payment = sdk.SendPayment(bolt11, amountMsat); + var response = sdk.SendPayment(new SendPaymentRequest(bolt11, amountMsat)); } catch (Exception) { From 2c5b8d6846bd5fedd76b2b97ae03ec6fb68b7ceb Mon Sep 17 00:00:00 2001 From: Erdem Yerebasmaz Date: Fri, 20 Oct 2023 16:31:00 +0300 Subject: [PATCH 7/7] Address feedback --- src/guide/send_payment.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/guide/send_payment.md b/src/guide/send_payment.md index 735453a..27e168c 100644 --- a/src/guide/send_payment.md +++ b/src/guide/send_payment.md @@ -26,7 +26,7 @@ do { // The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount. // The amountMsat is required in case an amount is not specified in the bolt11 invoice'. let req = SendPaymentRequest(bolt11: "...", amountMsat: 3000000) - let response = try sdk.sendSpontaneousPayment(req: req) + let response = try sdk.sendPayment(req: req) } catch { // handle error } @@ -93,7 +93,7 @@ bolt11 = "..." try: # The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. # The amount_msat is required in case an amount is not specified in the bolt11 invoice'. - req = SendPaymentRequest(bolt11=bolt11, amount_msat=None) + req = breez_sdk.SendPaymentRequest(bolt11=bolt11, amount_msat=3000000) sdk_services.send_payment(req=req) except Exception as error: # Handle error