diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9a53863..9321242 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,7 +38,7 @@ jobs: repository: breez/breez-sdk ref: ${{ needs.setup.outputs.sdk-ref }} package-version: ${{ needs.setup.outputs.package-version }} - packages-to-publish: '["csharp", "flutter"]' + packages-to-publish: '["csharp", "flutter", "golang"]' use-dummy-binaries: true check-rust: @@ -157,6 +157,49 @@ jobs: working-directory: snippets/csharp run: dotnet build + check-golang: + needs: + - setup + - build-packages + name: Check Go snippets + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - uses: actions/setup-go@v4 + with: + go-version: '1.21' + + - name: Download archived package + uses: actions/download-artifact@v3 + with: + name: breez-sdk-go-${{ needs.setup.outputs.package-version }} + path: snippets/go/packages/breez-sdk-go + + - name: Format the Go snippets + working-directory: snippets/go + run: go fmt + + - name: Test formatted correctly + working-directory: snippets/go + run: | + status=$(git status --porcelain) + if [[ -n "$status" ]]; then + echo "Git status has changes" + echo "$status" + git diff + exit 1 + else + echo "No changes in git status" + fi + + - name: Build the Go snippets + working-directory: snippets/go + run: | + go get + go build . + build: name: Build mdbook runs-on: ubuntu-latest diff --git a/snippets/go/.gitignore b/snippets/go/.gitignore index 8867f65..4f6c6d1 100644 --- a/snippets/go/.gitignore +++ b/snippets/go/.gitignore @@ -23,4 +23,7 @@ go.work # Ignore Go binaries **/* !**/*.go -!**/ \ No newline at end of file +!**/*.md +!**/ + +breez-sdk-go \ No newline at end of file diff --git a/snippets/go/README.md b/snippets/go/README.md new file mode 100644 index 0000000..6a91a04 --- /dev/null +++ b/snippets/go/README.md @@ -0,0 +1,6 @@ +## Steps to compile the snippets locally +1. Build a golang package + - By running the publish-all-platforms CI in the breez-sdk repository (use dummy binaries) + - or by cloning https://github.com/breez/breez-sdk-go +2. Place the files in the folder `snippets/go/packages/breez-sdk-go` +3. Happy coding \ No newline at end of file diff --git a/snippets/go/getting_started.go b/snippets/go/getting_started.go index 51a4124..b50264b 100644 --- a/snippets/go/getting_started.go +++ b/snippets/go/getting_started.go @@ -14,7 +14,7 @@ func (BreezListener) OnEvent(e breez_sdk.BreezEvent) { log.Printf("received event %#v", e) } -func GettingStarted() { +func GettingStarted() *breez_sdk.BlockingBreezServices { // Create the default config seed, err := breez_sdk.MnemonicToSeed("") if err != nil { @@ -38,6 +38,8 @@ func GettingStarted() { if err != nil { log.Fatalf("Connect failed: %#v", err) } + + return sdk } // ANCHOR_END: init-sdk diff --git a/snippets/go/go.mod b/snippets/go/go.mod index 1547ad9..ebdc98e 100644 --- a/snippets/go/go.mod +++ b/snippets/go/go.mod @@ -2,4 +2,6 @@ module main go 1.19 -require github.com/breez/breez-sdk-go v0.2.7 +require github.com/breez/breez-sdk-go v0.2.9 + +replace github.com/breez/breez-sdk-go => ./packages/breez-sdk-go diff --git a/snippets/go/list_payments.go b/snippets/go/list_payments.go index e55c4e1..858a561 100644 --- a/snippets/go/list_payments.go +++ b/snippets/go/list_payments.go @@ -8,7 +8,7 @@ import ( func ListPayments() { // ANCHOR: list-payments - if payments, err := sdk.ListPayments(breez_sdk.ListPaymentsRequest{Filter: breez_sdk.PaymentTypeFilterAll}); err == nil { + if payments, err := sdk.ListPayments(breez_sdk.ListPaymentsRequest{}); err == nil { log.Printf("%#v", payments) } // ANCHOR_END: list-payments @@ -16,10 +16,11 @@ func ListPayments() { func ListPaymentsFiltered() { // ANCHOR: list-payments-filtered + filters := []breez_sdk.PaymentTypeFilter{breez_sdk.PaymentTypeFilterSent} fromTimestamp := int64(1696880000) includeFailures := true listPaymentsRequest := breez_sdk.ListPaymentsRequest{ - Filter: breez_sdk.PaymentTypeFilterSent, + Filters: &filters, FromTimestamp: &fromTimestamp, IncludeFailures: &includeFailures, } diff --git a/snippets/react-native/list_payments.ts b/snippets/react-native/list_payments.ts index 9f36687..30aadb6 100644 --- a/snippets/react-native/list_payments.ts +++ b/snippets/react-native/list_payments.ts @@ -5,14 +5,14 @@ import { const exampleListPayments = async () => { // ANCHOR: list-payments - const payments = listPayments({ filter: PaymentTypeFilter.ALL }) + const payments = listPayments({}) // ANCHOR_END: list-payments } const exampleListPaymentsFiltered = async () => { // ANCHOR: list-payments-filtered const payments = listPayments({ - filter: PaymentTypeFilter.SENT, + filters: [PaymentTypeFilter.SENT], fromTimestamp: 1696880000, includeFailures: true }) diff --git a/snippets/react-native/package.json b/snippets/react-native/package.json index 2599f99..9645661 100644 --- a/snippets/react-native/package.json +++ b/snippets/react-native/package.json @@ -8,12 +8,11 @@ "lint": "eslint . --ext .js,.jsx,.ts,.tsx" }, "dependencies": { - "@breeztech/react-native-breez-sdk": "0.2.7", + "@breeztech/react-native-breez-sdk": "0.2.9", "react": "18.1.0", "react-native": "0.70.6" }, "devDependencies": { "tsx": "^3.12.7" } - } - \ No newline at end of file +} diff --git a/snippets/react-native/send_payment.ts b/snippets/react-native/send_payment.ts index 2a86cbe..7d29ba0 100644 --- a/snippets/react-native/send_payment.ts +++ b/snippets/react-native/send_payment.ts @@ -2,6 +2,7 @@ import { sendPayment } from "@breeztech/react-native-breez-sdk" const exampleSendLightningPayment = async () => { // ANCHOR: send-payment + const 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'. const amountMsat = 3000000 diff --git a/snippets/react-native/yarn.lock b/snippets/react-native/yarn.lock index 2097498..49a73a4 100644 --- a/snippets/react-native/yarn.lock +++ b/snippets/react-native/yarn.lock @@ -709,10 +709,10 @@ "@babel/helper-validator-identifier" "^7.22.20" to-fast-properties "^2.0.0" -"@breeztech/react-native-breez-sdk@0.2.7": - version "0.2.7" - resolved "https://registry.yarnpkg.com/@breeztech/react-native-breez-sdk/-/react-native-breez-sdk-0.2.7.tgz#8c2fae69df11e43852f0744b1f39f45057a7cabd" - integrity sha512-/d0O54YNzd6dIjPVu6uX3iBFXu54EjunUvdT0cWsaIXUXfAlVyr3DLio4dQ+PDSMQXM3vtaggC3MBFGeGfq9OA== +"@breeztech/react-native-breez-sdk@0.2.9": + version "0.2.9" + resolved "https://registry.yarnpkg.com/@breeztech/react-native-breez-sdk/-/react-native-breez-sdk-0.2.9.tgz#e1bcd37f16b92ac5792fedf7c4afa481322dac80" + integrity sha512-4mziuxCa8hpDGtMFD4VWK7tj+z3F/48x5NsKwxIYMkfLxxYP+6ZvD0ucEbyqr3P0Lwn0Cj4/iCnwM2gIL8UFcw== "@esbuild/android-arm64@0.18.20": version "0.18.20" diff --git a/src/guide/buy_btc.md b/src/guide/buy_btc.md index d9e6cfc..af82abc 100644 --- a/src/guide/buy_btc.md +++ b/src/guide/buy_btc.md @@ -19,7 +19,7 @@ Once the buy is completed, the provider will transfer the Bitcoin to the generat
Swift
-```swift +```swift,ignore do { let buyBitcoinResponse = try sdk.buyBitcoin( req: BuyBitcoinRequest(provider: .moonpay)) @@ -32,7 +32,7 @@ do {
Kotlin
-```kotlin +```kotlin,ignore try { // Choose your provider val provider = BuyBitcoinProvider.MOONPAY @@ -57,7 +57,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/buy_btc.dart:buy-btc}} ```
@@ -65,7 +65,7 @@ try {
Python
-```python +```python,ignore try: buy_bitcoin_resp = sdk_services.buy_bitcoin( breez_sdk.BuyBitcoinRequest( @@ -78,7 +78,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/buy_btc.go:buy-btc}} ```
@@ -87,7 +87,7 @@ except Exception as error:
-```cs +```cs,ignore {{#include ../../snippets/csharp/BuyBtc.cs:buy-btc}} ```
diff --git a/src/guide/connecting_lsp.md b/src/guide/connecting_lsp.md index 6ae96b0..e0ff29c 100644 --- a/src/guide/connecting_lsp.md +++ b/src/guide/connecting_lsp.md @@ -14,7 +14,7 @@ Based on the API key provided to the Breez SDK, a default LSP is selected for yo
Swift
-```swift +```swift,ignore do { let lspId = try sdk.lspId() let lspInfo = try sdk.lspInfo() @@ -52,7 +52,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/connecting_lsp.dart:get-lsp-info}} ```
@@ -60,7 +60,7 @@ try {
Python
-```python +```python,ignore try: lsp_id = sdk_services.lsp_id() lsp_info = sdk_services.lsp_info() @@ -73,7 +73,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/connecting_lsp.go:get-lsp-info}} ```
@@ -81,7 +81,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/ConnectingLsp.cs:get-lsp-info}} ```
@@ -101,7 +101,7 @@ When you have selected an LSP you may then connect to it.
Swift
-```swift +```swift,ignore do { try sdk.connectLsp(lspId: lspId!) } catch { @@ -133,7 +133,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/connecting_lsp.dart:connect-lsp}} ```
@@ -141,7 +141,7 @@ try {
Python
-```python +```python,ignore try: sdk_services.connect_lsp(lsp_id) except Exception as error: @@ -152,7 +152,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/connecting_lsp.go:connect-lsp}} ```
@@ -160,7 +160,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/ConnectingLsp.cs:connect-lsp}} ```
diff --git a/src/guide/fiat_currencies.md b/src/guide/fiat_currencies.md index 31fbf5e..3f142ce 100644 --- a/src/guide/fiat_currencies.md +++ b/src/guide/fiat_currencies.md @@ -34,7 +34,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/fiat_currencies.dart:list-fiat-currencies}} ```
@@ -42,7 +42,7 @@ try {
Python
-```python +```python,ignore try: fiat_currencies = sdk_services.list_fiat_currencies() @@ -54,7 +54,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/fiat_currencies.go:list-fiat-currencies}} ```
@@ -62,7 +62,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/FiatCurrencies.cs:list-fiat-currencies}} ```
@@ -102,7 +102,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/fiat_currencies.dart:fetch-fiat-rates}} ```
@@ -110,7 +110,7 @@ try {
Python
-```python +```python,ignore try: fiat_rates = sdk_services.fetch_fiat_rates() # print your desired rate @@ -122,7 +122,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/fiat_currencies.go:fetch-fiat-rates}} ```
@@ -130,7 +130,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/FiatCurrencies.cs:fetch-fiat-rates}} ```
@@ -188,7 +188,7 @@ fun fiatCurrenciesAndRate(): Map = try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/fiat_currencies.dart:get-fiat-currencies-and-rates}} ```
@@ -196,7 +196,7 @@ fun fiatCurrenciesAndRate(): Map = try {
Python
-```python +```python,ignore # TODO ```
@@ -204,7 +204,7 @@ fun fiatCurrenciesAndRate(): Map = try {
Go
-```go +```go,ignore {{#include ../../snippets/go/fiat_currencies.go:get-fiat-currencies-and-rates}} ```
@@ -212,7 +212,7 @@ fun fiatCurrenciesAndRate(): Map = try {
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/FiatCurrencies.cs:get-fiat-currencies-and-rates}} ```
diff --git a/src/guide/getting_started.md b/src/guide/getting_started.md index 8aa262f..dfdfdc5 100644 --- a/src/guide/getting_started.md +++ b/src/guide/getting_started.md @@ -50,7 +50,7 @@ Now you are ready to interact with the SDK.
Swift
-```swift +```swift,ignore // SDK events listener class SDKListener: EventListener { func onEvent(e: BreezEvent) { @@ -125,7 +125,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/getting_started.dart:init-sdk}} ```
@@ -133,7 +133,7 @@ try {
Python
-```python +```python,ignore # SDK events listener class SDKListener(breez_sdk.EventListener): def on_event(self, event): @@ -160,7 +160,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/getting_started.go:init-sdk}} ```
@@ -168,7 +168,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/GettingStarted.cs:init-sdk}} ```
@@ -188,7 +188,7 @@ At any point we can fetch our balance from the Greenlight node:
Swift
-```swift +```swift,ignore do { let nodeInfo = try sdk.nodeInfo() let lnBalance = nodeInfo?.channelsBalanceMsat @@ -224,7 +224,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/getting_started.dart:fetch-balance}} ```
@@ -232,7 +232,7 @@ try {
Python
-```python +```python,ignore try: node_info = node_info() ln_balance = node_info.channels_balance_msat @@ -245,7 +245,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/getting_started.go:fetch-balance}} ```
@@ -253,7 +253,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/GettingStarted.cs:fetch-balance}} ```
diff --git a/src/guide/list_payments.md b/src/guide/list_payments.md index df6b663..ee601f5 100644 --- a/src/guide/list_payments.md +++ b/src/guide/list_payments.md @@ -14,7 +14,7 @@ To view your payment history you can list and filter all the sent and received p
Swift
-```swift +```swift,ignore do { let payments = try sdk.listPayments(req: ListPaymentsRequest(filter: PaymentTypeFilter.all)) } catch { @@ -46,7 +46,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/list_payments.dart:list-payments}} ```
@@ -54,7 +54,7 @@ try {
Python
-```python +```python,ignore try: sdk_services.list_payments(breez_sdk.ListPaymentsRequest(breez_sdk.PaymentTypeFilter.All)) except Exception as error: @@ -65,7 +65,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/list_payments.go:list-payments}} ```
@@ -73,7 +73,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/ListPayments.cs:list-payments}} ```
@@ -93,7 +93,7 @@ You can optionally filter payments by timestamp and include failed payments.
Swift
-```swift +```swift,ignore do { let payments = try sdk.listPayments( req: ListPaymentsRequest( @@ -131,7 +131,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/list_payments.dart:list-payments-filtered}} ```
@@ -139,7 +139,7 @@ try {
Python
-```python +```python,ignore try: sdk_services.list_payments( breez_sdk.ListPaymentsRequest( @@ -154,7 +154,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/list_payments.go:list-payments-filtered}} ```
@@ -162,7 +162,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/ListPayments.cs:list-payments-filtered}} ```
diff --git a/src/guide/lnurl_auth.md b/src/guide/lnurl_auth.md index ee6ab6c..921cc6f 100644 --- a/src/guide/lnurl_auth.md +++ b/src/guide/lnurl_auth.md @@ -13,7 +13,7 @@
Swift
-```swift +```swift,ignore // Endpoint can also be of the form: // keyauth://domain.com/auth?key=val let lnurlAuthUrl = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttvdankjm3lw3skw0tvdankjm3xdvcn6vtp8q6n2dfsx5mrjwtrxdjnqvtzv56rzcnyv3jrxv3sxqmkyenrvv6kve3exv6nqdtyv43nqcmzvdsnvdrzx33rsenxx5unqc3cxgeqgntfgu" @@ -68,7 +68,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/lnurl_auth.dart:lnurl-auth}} ```
@@ -76,7 +76,7 @@ try {
Python
-```python +```python,ignore # Endpoint can also be of the form: # keyauth://domain.com/auth?key=val lnurl_auth_url = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttvdankjm3lw3skw0tvdankjm3xdvcn6vtp8q6n2dfsx5mrjwtrxdjnqvtzv56rzcnyv3jrxv3sxqmkyenrvv6kve3exv6nqdtyv43nqcmzvdsnvdrzx33rsenxx5unqc3cxgeqgntfgu" @@ -97,7 +97,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/lnurl_auth.go:lnurl-auth}} ```
@@ -105,7 +105,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/LnurlAuth.cs:lnurl-auth}} ```
diff --git a/src/guide/lnurl_pay.md b/src/guide/lnurl_pay.md index 31c558f..5b41440 100644 --- a/src/guide/lnurl_pay.md +++ b/src/guide/lnurl_pay.md @@ -14,7 +14,7 @@
Swift
-```swift +```swift,ignore // Endpoint can also be of the form: // lnurlp://domain.com/lnurl-pay?key=val // lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttsv9un7um9wdekjmmw84jxywf5x43rvv35xgmr2enrxanr2cfcvsmnwe3jxcukvde48qukgdec89snwde3vfjxvepjxpjnjvtpxd3kvdnxx5crxwpjvyunsephsz36jf @@ -66,7 +66,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/lnurl_pay.dart:lnurl-pay}} ```
@@ -74,7 +74,7 @@ try {
Python
-```python +```python,ignore # Endpoint can also be of the form: # lnurlp://domain.com/lnurl-pay?key=val # lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttsv9un7um9wdekjmmw84jxywf5x43rvv35xgmr2enrxanr2cfcvsmnwe3jxcukvde48qukgdec89snwde3vfjxvepjxpjnjvtpxd3kvdnxx5crxwpjvyunsephsz36jf @@ -97,7 +97,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/lnurl_pay.go:lnurl-pay}} ```
@@ -105,7 +105,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/LnurlPay.cs:lnurl-pay}} ```
diff --git a/src/guide/lnurl_withdraw.md b/src/guide/lnurl_withdraw.md index 65d6ab8..3a58f76 100644 --- a/src/guide/lnurl_withdraw.md +++ b/src/guide/lnurl_withdraw.md @@ -15,7 +15,7 @@
Swift
-```swift +```swift,ignore // Endpoint can also be of the form: // lnurlw://domain.com/lnurl-withdraw?key=val let lnurlWithdrawUrl = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4exctthd96xserjv9mn7um9wdekjmmw843xxwpexdnxzen9vgunsvfexq6rvdecx93rgdmyxcuxverrvcursenpxvukzv3c8qunsdecx33nzwpnvg6ryc3hv93nzvecxgcxgwp3h33lxk" @@ -70,7 +70,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/lnurl_withdraw.dart:lnurl-withdraw}} ```
@@ -78,7 +78,7 @@ try {
Python
-```python +```python,ignore # Endpoint can also be of the form: # lnurlw://domain.com/lnurl-withdraw?key=val lnurl_withdraw_url = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4exctthd96xserjv9mn7um9wdekjmmw843xxwpexdnxzen9vgunsvfexq6rvdecx93rgdmyxcuxverrvcursenpxvukzv3c8qunsdecx33nzwpnvg6ryc3hv93nzvecxgcxgwp3h33lxk" @@ -96,7 +96,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/lnurl_withdraw.go:lnurl-withdraw}} ```
@@ -104,7 +104,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/LnurlWithdraw.cs:lnurl-withdraw}} ```
diff --git a/src/guide/receive_onchain.md b/src/guide/receive_onchain.md index f9f99e6..b5377c7 100644 --- a/src/guide/receive_onchain.md +++ b/src/guide/receive_onchain.md @@ -17,7 +17,7 @@ In order to receive funds you first have to be connected to an [LSP](connecting_
Swift
-```swift +```swift,ignore do { let swapInfo = try sdk.receiveOnchain(req: ReceiveOnchainRequest()) @@ -54,7 +54,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/receive_onchain.dart:generate-receive-onchain-address}} ```
@@ -62,7 +62,7 @@ try {
Python
-```python +```python,ignore try: swap_info = sdk_services.receive_onchain(breez_sdk.ReceiveOnchainRequest()) @@ -76,7 +76,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/receive_onchain.go:generate-receive-onchain-address}} ```
@@ -84,7 +84,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/ReceiveOnchain.cs:generate-receive-onchain-address}} ```
@@ -104,7 +104,7 @@ Once you've sent the funds to the above address, the SDK will monitor this addre
Swift
-```swift +```swift,ignore do { let swapInfo = try sdk.inProgressSwap() } catch { @@ -136,7 +136,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/receive_onchain.dart:in-progress-swap}} ```
@@ -144,7 +144,7 @@ try {
Python
-```python +```python,ignore try: swap_info = sdk_services.in_progress_swap() except Exception as error: @@ -155,7 +155,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/receive_onchain.go:in-progress-swap}} ``` @@ -164,7 +164,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/ReceiveOnchain.cs:in-progress-swap}} ```
@@ -189,7 +189,7 @@ In order to execute a refund, you need to supply an on-chain address to where th
Swift
-```swift +```swift,ignore do { let refundables = try sdk.listRefundables() } catch { @@ -221,7 +221,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/receive_onchain.dart:list-refundables}} ```
@@ -229,7 +229,7 @@ try {
Python
-```python +```python,ignore try: refundables = sdk_services.list_refundables() except Exception as error: @@ -240,7 +240,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/receive_onchain.go:list-refundables}} ```
@@ -248,7 +248,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/ReceiveOnchain.cs:list-refundables}} ```
@@ -268,7 +268,7 @@ Once you have a refundable swap in hand, use the following code to execute a ref
Swift
-```swift +```swift,ignore let destinationAddress = "..." let satPerVbyte = @@ -309,7 +309,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/receive_onchain.dart:execute-refund}} ```
@@ -317,7 +317,7 @@ try {
Python
-```python +```python,ignore destination_address = "..." sat_per_vbyte = 5 @@ -333,7 +333,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/receive_onchain.go:execute-refund}} ```
@@ -341,7 +341,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/ReceiveOnchain.cs:execute-refund}} ```
@@ -365,7 +365,7 @@ To calculate the fees for a channel being opened by the LSP:
Swift
-```swift +```swift,ignore let amountMsat = do { let channelFees = try sdk.openChannelFee( @@ -395,7 +395,7 @@ do {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/receive_onchain.dart:get-channel-opening-fees}} ```
@@ -403,7 +403,7 @@ do {
Python
-```python +```python,ignore amount_msat = try: channel_fees = sdk_services.open_channel_fee( @@ -417,7 +417,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/receive_onchain.go:get-channel-opening-fees}} ```
@@ -425,14 +425,11 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/ReceiveOnchain.cs:get-channel-opening-fees}} ```
- - - [^1]: For more details on these fees, see [Channel Opening Fees](connecting_lsp.md#channel-opening-fees) diff --git a/src/guide/receive_payment.md b/src/guide/receive_payment.md index 19c6e0e..808287a 100644 --- a/src/guide/receive_payment.md +++ b/src/guide/receive_payment.md @@ -15,7 +15,7 @@ The Breez SDK automatically connects your node to the LSP peer and you can now r
Swift
-```swift +```swift,ignore do { let invoice = try sdk.receivePayment( req: ReceivePaymentRequest( @@ -53,7 +53,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/receive_payment.dart:receive-payment}} ```
@@ -61,7 +61,7 @@ try {
Python
-```python +```python,ignore try: receive_payment_response = sdk_services.receive_payment( breez_sdk.ReceivePaymentRequest( @@ -75,7 +75,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/receive_payment.go:receive-payment}} ```
@@ -83,7 +83,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/ReceivePayment.cs:receive-payment}} ```
diff --git a/src/guide/send_onchain.md b/src/guide/send_onchain.md index 1e6fb47..eb66625 100644 --- a/src/guide/send_onchain.md +++ b/src/guide/send_onchain.md @@ -16,7 +16,7 @@ First, fetch the current reverse swap fees:
Swift
-```swift +```swift,ignore let sendAmountSat:UInt64? = 50000 try { let currentFees = try sdk.fetchReverseSwapFees( @@ -52,7 +52,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/send_onchain.dart:estimate-current-reverse-swap-total-fees}} ```
@@ -60,7 +60,7 @@ try {
Python
-```python +```python,ignore try: current_fees = sdk_services.fetch_reverse_swap_fees( breez_sdk.ReverseSwapFeesRequest(send_amount_sat=50000)) @@ -73,7 +73,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/send_onchain.go:estimate-current-reverse-swap-total-fees}} ```
@@ -81,7 +81,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/SendOnchain.cs:estimate-current-reverse-swap-total-fees}} ```
@@ -105,7 +105,7 @@ Fetching the fees also tells you what is the range of amounts you can send:
Swift
-```swift +```swift,ignore println("Minimum amount, in sats: \(current_fees.min)") println("Maximum amount, in sats: \(current_fees.max)") ``` @@ -131,7 +131,7 @@ Log.v("Breez", "Maximum amount, in sats: ${fees.max}")
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/send_onchain.dart:get-current-reverse-swap-min-max}} ```
@@ -139,7 +139,7 @@ Log.v("Breez", "Maximum amount, in sats: ${fees.max}")
Python
-```python +```python,ignore print("Minimum amount, in sats: ", current_fees.min) print("Maximum amount, in sats: ", current_fees.max) ``` @@ -148,7 +148,7 @@ print("Maximum amount, in sats: ", current_fees.max)
Go
-```go +```go,ignore {{#include ../../snippets/go/send_onchain.go:get-current-reverse-swap-min-max}} ```
@@ -156,7 +156,7 @@ print("Maximum amount, in sats: ", current_fees.max)
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/SendOnchain.cs:get-current-reverse-swap-min-max}} ```
@@ -176,7 +176,7 @@ Once you checked the fees are acceptable, you can start the reverse swap:
Swift
-```swift +```swift,ignore let destinationAddress = "bc1.." let amountSat = currentFees.min let satPerVbyte = @@ -218,7 +218,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/send_onchain.dart:start-reverse-swap}} ```
@@ -226,7 +226,7 @@ try {
Python
-```python +```python,ignore destination_address = "bc1.." amount_sat = 50000 sat_per_vbyte = 5 @@ -243,7 +243,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/send_onchain.go:start-reverse-swap}} ```
@@ -251,7 +251,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/SendOnchain.cs:start-reverse-swap}} ```
@@ -275,7 +275,7 @@ You can check its status with:
Swift
-```swift +```swift,ignore for rs in sdk.inProgressReverseSwaps() { println("Reverse swap \(rs.id) in progress, status is \(rs.status)") } @@ -303,7 +303,7 @@ for (rs in sdk.inProgressReverseSwaps()) {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/send_onchain.dart:check-reverse-swaps-status}} ```
@@ -311,7 +311,7 @@ for (rs in sdk.inProgressReverseSwaps()) {
Python
-```python +```python,ignore try: reverse_swaps = sdk_services.in_progress_reverse_swaps() for rs in reverse_swaps: @@ -324,7 +324,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/send_onchain.go:check-reverse-swaps-status}} ```
@@ -332,7 +332,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/SendOnchain.cs:check-reverse-swaps-status}} ```
diff --git a/src/guide/send_payment.md b/src/guide/send_payment.md index 6a63e4e..b8aad56 100644 --- a/src/guide/send_payment.md +++ b/src/guide/send_payment.md @@ -14,7 +14,7 @@ Once you have outbound liquidity you can start sending payments too.
Swift
-```swift +```swift,ignore 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'. @@ -54,7 +54,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/send_payment.dart:send-payment}} ```
@@ -62,7 +62,7 @@ try {
Python
-```python +```python,ignore bolt11 = "..." try: # The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. @@ -77,7 +77,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/send_payment.go:send-payment}} ```
@@ -85,7 +85,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/SendPayment.cs:send-payment}} ```
diff --git a/src/guide/send_spontaneous_payment.md b/src/guide/send_spontaneous_payment.md index 22a84d1..4295967 100644 --- a/src/guide/send_spontaneous_payment.md +++ b/src/guide/send_spontaneous_payment.md @@ -14,7 +14,7 @@ They can even be spontaneous payments to a node without a bolt11 invoice.
Swift
-```swift +```swift,ignore let nodeId = "..."; do { let response = try sdk.sendSpontaneousPayment( @@ -53,7 +53,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/send_spontaneous_payment.dart:send-spontaneous-payment}} ```
@@ -61,7 +61,7 @@ try {
Python
-```python +```python,ignore try: sdk_services.send_spontaneous_payment( breez_sdk.SendSpontaneousPaymentRequest( @@ -75,7 +75,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/send_spontaneous_payment.go:send-spontaneous-payment}} ```
@@ -83,7 +83,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/SendSpontaneousPayment.cs:send-spontaneous-payment}} ```
diff --git a/src/guide/static_channel_backup.md b/src/guide/static_channel_backup.md index cdca95c..e5a9af7 100644 --- a/src/guide/static_channel_backup.md +++ b/src/guide/static_channel_backup.md @@ -20,7 +20,7 @@ In order to use the recoverchannel method, the user needs to provide the static
Swift
-```swift +```swift,ignore do { let backupData = breez_sdk.staticBackup(request: StaticBackupRequest(workingDir: "")); } catch{ @@ -55,7 +55,7 @@ try {
Dart
-```dart +```dart,ignore {{#include ../../snippets/dart_snippets/lib/static_channel_backup.dart:static-channel-backup}} ```
@@ -63,7 +63,7 @@ try {
Python
-```python +```python,ignore try: backup_data = breez_sdk.static_backup(breez_sdk.StaticBackupRequest(working_dir="")) except Exception as error: @@ -74,7 +74,7 @@ except Exception as error:
Go
-```go +```go,ignore {{#include ../../snippets/go/static_channel_backup.go:static-channel-backup}} ```
@@ -82,7 +82,7 @@ except Exception as error:
C#
-```cs +```cs,ignore {{#include ../../snippets/csharp/StaticChannelBackup.cs:static-channel-backup}} ```