Merge pull request #96 from breez/savage-snippets-update

Update Go & RN to 0.2.9
This commit is contained in:
ok300
2023-11-13 16:20:07 +01:00
committed by GitHub
24 changed files with 200 additions and 146 deletions

View File

@@ -38,7 +38,7 @@ jobs:
repository: breez/breez-sdk repository: breez/breez-sdk
ref: ${{ needs.setup.outputs.sdk-ref }} ref: ${{ needs.setup.outputs.sdk-ref }}
package-version: ${{ needs.setup.outputs.package-version }} package-version: ${{ needs.setup.outputs.package-version }}
packages-to-publish: '["csharp", "flutter"]' packages-to-publish: '["csharp", "flutter", "golang"]'
use-dummy-binaries: true use-dummy-binaries: true
check-rust: check-rust:
@@ -157,6 +157,49 @@ jobs:
working-directory: snippets/csharp working-directory: snippets/csharp
run: dotnet build 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: build:
name: Build mdbook name: Build mdbook
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@@ -23,4 +23,7 @@ go.work
# Ignore Go binaries # Ignore Go binaries
**/* **/*
!**/*.go !**/*.go
!**/*.md
!**/ !**/
breez-sdk-go

6
snippets/go/README.md Normal file
View File

@@ -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

View File

@@ -14,7 +14,7 @@ func (BreezListener) OnEvent(e breez_sdk.BreezEvent) {
log.Printf("received event %#v", e) log.Printf("received event %#v", e)
} }
func GettingStarted() { func GettingStarted() *breez_sdk.BlockingBreezServices {
// Create the default config // Create the default config
seed, err := breez_sdk.MnemonicToSeed("<mnemonic words>") seed, err := breez_sdk.MnemonicToSeed("<mnemonic words>")
if err != nil { if err != nil {
@@ -38,6 +38,8 @@ func GettingStarted() {
if err != nil { if err != nil {
log.Fatalf("Connect failed: %#v", err) log.Fatalf("Connect failed: %#v", err)
} }
return sdk
} }
// ANCHOR_END: init-sdk // ANCHOR_END: init-sdk

View File

@@ -2,4 +2,6 @@ module main
go 1.19 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

View File

@@ -8,7 +8,7 @@ import (
func ListPayments() { func ListPayments() {
// ANCHOR: list-payments // 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) log.Printf("%#v", payments)
} }
// ANCHOR_END: list-payments // ANCHOR_END: list-payments
@@ -16,10 +16,11 @@ func ListPayments() {
func ListPaymentsFiltered() { func ListPaymentsFiltered() {
// ANCHOR: list-payments-filtered // ANCHOR: list-payments-filtered
filters := []breez_sdk.PaymentTypeFilter{breez_sdk.PaymentTypeFilterSent}
fromTimestamp := int64(1696880000) fromTimestamp := int64(1696880000)
includeFailures := true includeFailures := true
listPaymentsRequest := breez_sdk.ListPaymentsRequest{ listPaymentsRequest := breez_sdk.ListPaymentsRequest{
Filter: breez_sdk.PaymentTypeFilterSent, Filters: &filters,
FromTimestamp: &fromTimestamp, FromTimestamp: &fromTimestamp,
IncludeFailures: &includeFailures, IncludeFailures: &includeFailures,
} }

View File

@@ -5,14 +5,14 @@ import {
const exampleListPayments = async () => { const exampleListPayments = async () => {
// ANCHOR: list-payments // ANCHOR: list-payments
const payments = listPayments({ filter: PaymentTypeFilter.ALL }) const payments = listPayments({})
// ANCHOR_END: list-payments // ANCHOR_END: list-payments
} }
const exampleListPaymentsFiltered = async () => { const exampleListPaymentsFiltered = async () => {
// ANCHOR: list-payments-filtered // ANCHOR: list-payments-filtered
const payments = listPayments({ const payments = listPayments({
filter: PaymentTypeFilter.SENT, filters: [PaymentTypeFilter.SENT],
fromTimestamp: 1696880000, fromTimestamp: 1696880000,
includeFailures: true includeFailures: true
}) })

View File

@@ -8,12 +8,11 @@
"lint": "eslint . --ext .js,.jsx,.ts,.tsx" "lint": "eslint . --ext .js,.jsx,.ts,.tsx"
}, },
"dependencies": { "dependencies": {
"@breeztech/react-native-breez-sdk": "0.2.7", "@breeztech/react-native-breez-sdk": "0.2.9",
"react": "18.1.0", "react": "18.1.0",
"react-native": "0.70.6" "react-native": "0.70.6"
}, },
"devDependencies": { "devDependencies": {
"tsx": "^3.12.7" "tsx": "^3.12.7"
} }
} }

View File

@@ -2,6 +2,7 @@ import { sendPayment } from "@breeztech/react-native-breez-sdk"
const exampleSendLightningPayment = async () => { const exampleSendLightningPayment = async () => {
// ANCHOR: send-payment // 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` 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'. // The amountMsat is required in case an amount is not specified in the bolt11 invoice'.
const amountMsat = 3000000 const amountMsat = 3000000

View File

@@ -709,10 +709,10 @@
"@babel/helper-validator-identifier" "^7.22.20" "@babel/helper-validator-identifier" "^7.22.20"
to-fast-properties "^2.0.0" to-fast-properties "^2.0.0"
"@breeztech/react-native-breez-sdk@0.2.7": "@breeztech/react-native-breez-sdk@0.2.9":
version "0.2.7" version "0.2.9"
resolved "https://registry.yarnpkg.com/@breeztech/react-native-breez-sdk/-/react-native-breez-sdk-0.2.7.tgz#8c2fae69df11e43852f0744b1f39f45057a7cabd" resolved "https://registry.yarnpkg.com/@breeztech/react-native-breez-sdk/-/react-native-breez-sdk-0.2.9.tgz#e1bcd37f16b92ac5792fedf7c4afa481322dac80"
integrity sha512-/d0O54YNzd6dIjPVu6uX3iBFXu54EjunUvdT0cWsaIXUXfAlVyr3DLio4dQ+PDSMQXM3vtaggC3MBFGeGfq9OA== integrity sha512-4mziuxCa8hpDGtMFD4VWK7tj+z3F/48x5NsKwxIYMkfLxxYP+6ZvD0ucEbyqr3P0Lwn0Cj4/iCnwM2gIL8UFcw==
"@esbuild/android-arm64@0.18.20": "@esbuild/android-arm64@0.18.20":
version "0.18.20" version "0.18.20"

View File

@@ -19,7 +19,7 @@ Once the buy is completed, the provider will transfer the Bitcoin to the generat
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
do { do {
let buyBitcoinResponse = try sdk.buyBitcoin( let buyBitcoinResponse = try sdk.buyBitcoin(
req: BuyBitcoinRequest(provider: .moonpay)) req: BuyBitcoinRequest(provider: .moonpay))
@@ -32,7 +32,7 @@ do {
<div slot="title">Kotlin</div> <div slot="title">Kotlin</div>
<section> <section>
```kotlin ```kotlin,ignore
try { try {
// Choose your provider // Choose your provider
val provider = BuyBitcoinProvider.MOONPAY val provider = BuyBitcoinProvider.MOONPAY
@@ -57,7 +57,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/buy_btc.dart:buy-btc}} {{#include ../../snippets/dart_snippets/lib/buy_btc.dart:buy-btc}}
``` ```
</section> </section>
@@ -65,7 +65,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
try: try:
buy_bitcoin_resp = sdk_services.buy_bitcoin( buy_bitcoin_resp = sdk_services.buy_bitcoin(
breez_sdk.BuyBitcoinRequest( breez_sdk.BuyBitcoinRequest(
@@ -78,7 +78,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/buy_btc.go:buy-btc}} {{#include ../../snippets/go/buy_btc.go:buy-btc}}
``` ```
</section> </section>
@@ -87,7 +87,7 @@ except Exception as error:
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/BuyBtc.cs:buy-btc}} {{#include ../../snippets/csharp/BuyBtc.cs:buy-btc}}
``` ```
</section> </section>

View File

@@ -14,7 +14,7 @@ Based on the API key provided to the Breez SDK, a default LSP is selected for yo
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
do { do {
let lspId = try sdk.lspId() let lspId = try sdk.lspId()
let lspInfo = try sdk.lspInfo() let lspInfo = try sdk.lspInfo()
@@ -52,7 +52,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/connecting_lsp.dart:get-lsp-info}} {{#include ../../snippets/dart_snippets/lib/connecting_lsp.dart:get-lsp-info}}
``` ```
</section> </section>
@@ -60,7 +60,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
try: try:
lsp_id = sdk_services.lsp_id() lsp_id = sdk_services.lsp_id()
lsp_info = sdk_services.lsp_info() lsp_info = sdk_services.lsp_info()
@@ -73,7 +73,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/connecting_lsp.go:get-lsp-info}} {{#include ../../snippets/go/connecting_lsp.go:get-lsp-info}}
``` ```
</section> </section>
@@ -81,7 +81,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/ConnectingLsp.cs:get-lsp-info}} {{#include ../../snippets/csharp/ConnectingLsp.cs:get-lsp-info}}
``` ```
</section> </section>
@@ -101,7 +101,7 @@ When you have selected an LSP you may then connect to it.
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
do { do {
try sdk.connectLsp(lspId: lspId!) try sdk.connectLsp(lspId: lspId!)
} catch { } catch {
@@ -133,7 +133,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/connecting_lsp.dart:connect-lsp}} {{#include ../../snippets/dart_snippets/lib/connecting_lsp.dart:connect-lsp}}
``` ```
</section> </section>
@@ -141,7 +141,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
try: try:
sdk_services.connect_lsp(lsp_id) sdk_services.connect_lsp(lsp_id)
except Exception as error: except Exception as error:
@@ -152,7 +152,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/connecting_lsp.go:connect-lsp}} {{#include ../../snippets/go/connecting_lsp.go:connect-lsp}}
``` ```
</section> </section>
@@ -160,7 +160,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/ConnectingLsp.cs:connect-lsp}} {{#include ../../snippets/csharp/ConnectingLsp.cs:connect-lsp}}
``` ```
</section> </section>

View File

@@ -34,7 +34,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/fiat_currencies.dart:list-fiat-currencies}} {{#include ../../snippets/dart_snippets/lib/fiat_currencies.dart:list-fiat-currencies}}
``` ```
</section> </section>
@@ -42,7 +42,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
try: try:
fiat_currencies = sdk_services.list_fiat_currencies() fiat_currencies = sdk_services.list_fiat_currencies()
@@ -54,7 +54,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/fiat_currencies.go:list-fiat-currencies}} {{#include ../../snippets/go/fiat_currencies.go:list-fiat-currencies}}
``` ```
</section> </section>
@@ -62,7 +62,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/FiatCurrencies.cs:list-fiat-currencies}} {{#include ../../snippets/csharp/FiatCurrencies.cs:list-fiat-currencies}}
``` ```
</section> </section>
@@ -102,7 +102,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/fiat_currencies.dart:fetch-fiat-rates}} {{#include ../../snippets/dart_snippets/lib/fiat_currencies.dart:fetch-fiat-rates}}
``` ```
</section> </section>
@@ -110,7 +110,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
try: try:
fiat_rates = sdk_services.fetch_fiat_rates() fiat_rates = sdk_services.fetch_fiat_rates()
# print your desired rate # print your desired rate
@@ -122,7 +122,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/fiat_currencies.go:fetch-fiat-rates}} {{#include ../../snippets/go/fiat_currencies.go:fetch-fiat-rates}}
``` ```
</section> </section>
@@ -130,7 +130,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/FiatCurrencies.cs:fetch-fiat-rates}} {{#include ../../snippets/csharp/FiatCurrencies.cs:fetch-fiat-rates}}
``` ```
</section> </section>
@@ -188,7 +188,7 @@ fun fiatCurrenciesAndRate(): Map<FiatCurrency, Rate> = try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/fiat_currencies.dart:get-fiat-currencies-and-rates}} {{#include ../../snippets/dart_snippets/lib/fiat_currencies.dart:get-fiat-currencies-and-rates}}
``` ```
</section> </section>
@@ -196,7 +196,7 @@ fun fiatCurrenciesAndRate(): Map<FiatCurrency, Rate> = try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
# TODO # TODO
``` ```
</section> </section>
@@ -204,7 +204,7 @@ fun fiatCurrenciesAndRate(): Map<FiatCurrency, Rate> = try {
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/fiat_currencies.go:get-fiat-currencies-and-rates}} {{#include ../../snippets/go/fiat_currencies.go:get-fiat-currencies-and-rates}}
``` ```
</section> </section>
@@ -212,7 +212,7 @@ fun fiatCurrenciesAndRate(): Map<FiatCurrency, Rate> = try {
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/FiatCurrencies.cs:get-fiat-currencies-and-rates}} {{#include ../../snippets/csharp/FiatCurrencies.cs:get-fiat-currencies-and-rates}}
``` ```
</section> </section>

View File

@@ -50,7 +50,7 @@ Now you are ready to interact with the SDK.
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
// SDK events listener // SDK events listener
class SDKListener: EventListener { class SDKListener: EventListener {
func onEvent(e: BreezEvent) { func onEvent(e: BreezEvent) {
@@ -125,7 +125,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/getting_started.dart:init-sdk}} {{#include ../../snippets/dart_snippets/lib/getting_started.dart:init-sdk}}
``` ```
</section> </section>
@@ -133,7 +133,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
# SDK events listener # SDK events listener
class SDKListener(breez_sdk.EventListener): class SDKListener(breez_sdk.EventListener):
def on_event(self, event): def on_event(self, event):
@@ -160,7 +160,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/getting_started.go:init-sdk}} {{#include ../../snippets/go/getting_started.go:init-sdk}}
``` ```
</section> </section>
@@ -168,7 +168,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/GettingStarted.cs:init-sdk}} {{#include ../../snippets/csharp/GettingStarted.cs:init-sdk}}
``` ```
</section> </section>
@@ -188,7 +188,7 @@ At any point we can fetch our balance from the Greenlight node:
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
do { do {
let nodeInfo = try sdk.nodeInfo() let nodeInfo = try sdk.nodeInfo()
let lnBalance = nodeInfo?.channelsBalanceMsat let lnBalance = nodeInfo?.channelsBalanceMsat
@@ -224,7 +224,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/getting_started.dart:fetch-balance}} {{#include ../../snippets/dart_snippets/lib/getting_started.dart:fetch-balance}}
``` ```
</section> </section>
@@ -232,7 +232,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
try: try:
node_info = node_info() node_info = node_info()
ln_balance = node_info.channels_balance_msat ln_balance = node_info.channels_balance_msat
@@ -245,7 +245,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/getting_started.go:fetch-balance}} {{#include ../../snippets/go/getting_started.go:fetch-balance}}
``` ```
</section> </section>
@@ -253,7 +253,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/GettingStarted.cs:fetch-balance}} {{#include ../../snippets/csharp/GettingStarted.cs:fetch-balance}}
``` ```
</section> </section>

View File

@@ -14,7 +14,7 @@ To view your payment history you can list and filter all the sent and received p
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
do { do {
let payments = try sdk.listPayments(req: ListPaymentsRequest(filter: PaymentTypeFilter.all)) let payments = try sdk.listPayments(req: ListPaymentsRequest(filter: PaymentTypeFilter.all))
} catch { } catch {
@@ -46,7 +46,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/list_payments.dart:list-payments}} {{#include ../../snippets/dart_snippets/lib/list_payments.dart:list-payments}}
``` ```
</section> </section>
@@ -54,7 +54,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
try: try:
sdk_services.list_payments(breez_sdk.ListPaymentsRequest(breez_sdk.PaymentTypeFilter.All)) sdk_services.list_payments(breez_sdk.ListPaymentsRequest(breez_sdk.PaymentTypeFilter.All))
except Exception as error: except Exception as error:
@@ -65,7 +65,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/list_payments.go:list-payments}} {{#include ../../snippets/go/list_payments.go:list-payments}}
``` ```
</section> </section>
@@ -73,7 +73,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/ListPayments.cs:list-payments}} {{#include ../../snippets/csharp/ListPayments.cs:list-payments}}
``` ```
</section> </section>
@@ -93,7 +93,7 @@ You can optionally filter payments by timestamp and include failed payments.
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
do { do {
let payments = try sdk.listPayments( let payments = try sdk.listPayments(
req: ListPaymentsRequest( req: ListPaymentsRequest(
@@ -131,7 +131,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/list_payments.dart:list-payments-filtered}} {{#include ../../snippets/dart_snippets/lib/list_payments.dart:list-payments-filtered}}
``` ```
</section> </section>
@@ -139,7 +139,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
try: try:
sdk_services.list_payments( sdk_services.list_payments(
breez_sdk.ListPaymentsRequest( breez_sdk.ListPaymentsRequest(
@@ -154,7 +154,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/list_payments.go:list-payments-filtered}} {{#include ../../snippets/go/list_payments.go:list-payments-filtered}}
``` ```
</section> </section>
@@ -162,7 +162,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/ListPayments.cs:list-payments-filtered}} {{#include ../../snippets/csharp/ListPayments.cs:list-payments-filtered}}
``` ```
</section> </section>

View File

@@ -13,7 +13,7 @@
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
// Endpoint can also be of the form: // Endpoint can also be of the form:
// keyauth://domain.com/auth?key=val // keyauth://domain.com/auth?key=val
let lnurlAuthUrl = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttvdankjm3lw3skw0tvdankjm3xdvcn6vtp8q6n2dfsx5mrjwtrxdjnqvtzv56rzcnyv3jrxv3sxqmkyenrvv6kve3exv6nqdtyv43nqcmzvdsnvdrzx33rsenxx5unqc3cxgeqgntfgu" let lnurlAuthUrl = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttvdankjm3lw3skw0tvdankjm3xdvcn6vtp8q6n2dfsx5mrjwtrxdjnqvtzv56rzcnyv3jrxv3sxqmkyenrvv6kve3exv6nqdtyv43nqcmzvdsnvdrzx33rsenxx5unqc3cxgeqgntfgu"
@@ -68,7 +68,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/lnurl_auth.dart:lnurl-auth}} {{#include ../../snippets/dart_snippets/lib/lnurl_auth.dart:lnurl-auth}}
``` ```
</section> </section>
@@ -76,7 +76,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
# Endpoint can also be of the form: # Endpoint can also be of the form:
# keyauth://domain.com/auth?key=val # keyauth://domain.com/auth?key=val
lnurl_auth_url = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttvdankjm3lw3skw0tvdankjm3xdvcn6vtp8q6n2dfsx5mrjwtrxdjnqvtzv56rzcnyv3jrxv3sxqmkyenrvv6kve3exv6nqdtyv43nqcmzvdsnvdrzx33rsenxx5unqc3cxgeqgntfgu" lnurl_auth_url = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttvdankjm3lw3skw0tvdankjm3xdvcn6vtp8q6n2dfsx5mrjwtrxdjnqvtzv56rzcnyv3jrxv3sxqmkyenrvv6kve3exv6nqdtyv43nqcmzvdsnvdrzx33rsenxx5unqc3cxgeqgntfgu"
@@ -97,7 +97,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/lnurl_auth.go:lnurl-auth}} {{#include ../../snippets/go/lnurl_auth.go:lnurl-auth}}
``` ```
</section> </section>
@@ -105,7 +105,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/LnurlAuth.cs:lnurl-auth}} {{#include ../../snippets/csharp/LnurlAuth.cs:lnurl-auth}}
``` ```
</section> </section>

View File

@@ -14,7 +14,7 @@
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
// Endpoint can also be of the form: // Endpoint can also be of the form:
// lnurlp://domain.com/lnurl-pay?key=val // lnurlp://domain.com/lnurl-pay?key=val
// lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttsv9un7um9wdekjmmw84jxywf5x43rvv35xgmr2enrxanr2cfcvsmnwe3jxcukvde48qukgdec89snwde3vfjxvepjxpjnjvtpxd3kvdnxx5crxwpjvyunsephsz36jf // lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttsv9un7um9wdekjmmw84jxywf5x43rvv35xgmr2enrxanr2cfcvsmnwe3jxcukvde48qukgdec89snwde3vfjxvepjxpjnjvtpxd3kvdnxx5crxwpjvyunsephsz36jf
@@ -66,7 +66,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/lnurl_pay.dart:lnurl-pay}} {{#include ../../snippets/dart_snippets/lib/lnurl_pay.dart:lnurl-pay}}
``` ```
</section> </section>
@@ -74,7 +74,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
# Endpoint can also be of the form: # Endpoint can also be of the form:
# lnurlp://domain.com/lnurl-pay?key=val # lnurlp://domain.com/lnurl-pay?key=val
# lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttsv9un7um9wdekjmmw84jxywf5x43rvv35xgmr2enrxanr2cfcvsmnwe3jxcukvde48qukgdec89snwde3vfjxvepjxpjnjvtpxd3kvdnxx5crxwpjvyunsephsz36jf # lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttsv9un7um9wdekjmmw84jxywf5x43rvv35xgmr2enrxanr2cfcvsmnwe3jxcukvde48qukgdec89snwde3vfjxvepjxpjnjvtpxd3kvdnxx5crxwpjvyunsephsz36jf
@@ -97,7 +97,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/lnurl_pay.go:lnurl-pay}} {{#include ../../snippets/go/lnurl_pay.go:lnurl-pay}}
``` ```
</section> </section>
@@ -105,7 +105,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/LnurlPay.cs:lnurl-pay}} {{#include ../../snippets/csharp/LnurlPay.cs:lnurl-pay}}
``` ```
</section> </section>

View File

@@ -15,7 +15,7 @@
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
// Endpoint can also be of the form: // Endpoint can also be of the form:
// lnurlw://domain.com/lnurl-withdraw?key=val // lnurlw://domain.com/lnurl-withdraw?key=val
let lnurlWithdrawUrl = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4exctthd96xserjv9mn7um9wdekjmmw843xxwpexdnxzen9vgunsvfexq6rvdecx93rgdmyxcuxverrvcursenpxvukzv3c8qunsdecx33nzwpnvg6ryc3hv93nzvecxgcxgwp3h33lxk" let lnurlWithdrawUrl = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4exctthd96xserjv9mn7um9wdekjmmw843xxwpexdnxzen9vgunsvfexq6rvdecx93rgdmyxcuxverrvcursenpxvukzv3c8qunsdecx33nzwpnvg6ryc3hv93nzvecxgcxgwp3h33lxk"
@@ -70,7 +70,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/lnurl_withdraw.dart:lnurl-withdraw}} {{#include ../../snippets/dart_snippets/lib/lnurl_withdraw.dart:lnurl-withdraw}}
``` ```
</section> </section>
@@ -78,7 +78,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
# Endpoint can also be of the form: # Endpoint can also be of the form:
# lnurlw://domain.com/lnurl-withdraw?key=val # lnurlw://domain.com/lnurl-withdraw?key=val
lnurl_withdraw_url = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4exctthd96xserjv9mn7um9wdekjmmw843xxwpexdnxzen9vgunsvfexq6rvdecx93rgdmyxcuxverrvcursenpxvukzv3c8qunsdecx33nzwpnvg6ryc3hv93nzvecxgcxgwp3h33lxk" lnurl_withdraw_url = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4exctthd96xserjv9mn7um9wdekjmmw843xxwpexdnxzen9vgunsvfexq6rvdecx93rgdmyxcuxverrvcursenpxvukzv3c8qunsdecx33nzwpnvg6ryc3hv93nzvecxgcxgwp3h33lxk"
@@ -96,7 +96,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/lnurl_withdraw.go:lnurl-withdraw}} {{#include ../../snippets/go/lnurl_withdraw.go:lnurl-withdraw}}
``` ```
</section> </section>
@@ -104,7 +104,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/LnurlWithdraw.cs:lnurl-withdraw}} {{#include ../../snippets/csharp/LnurlWithdraw.cs:lnurl-withdraw}}
``` ```
</section> </section>

View File

@@ -17,7 +17,7 @@ In order to receive funds you first have to be connected to an [LSP](connecting_
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
do { do {
let swapInfo = try sdk.receiveOnchain(req: ReceiveOnchainRequest()) let swapInfo = try sdk.receiveOnchain(req: ReceiveOnchainRequest())
@@ -54,7 +54,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/receive_onchain.dart:generate-receive-onchain-address}} {{#include ../../snippets/dart_snippets/lib/receive_onchain.dart:generate-receive-onchain-address}}
``` ```
</section> </section>
@@ -62,7 +62,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
try: try:
swap_info = sdk_services.receive_onchain(breez_sdk.ReceiveOnchainRequest()) swap_info = sdk_services.receive_onchain(breez_sdk.ReceiveOnchainRequest())
@@ -76,7 +76,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/receive_onchain.go:generate-receive-onchain-address}} {{#include ../../snippets/go/receive_onchain.go:generate-receive-onchain-address}}
``` ```
</section> </section>
@@ -84,7 +84,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/ReceiveOnchain.cs:generate-receive-onchain-address}} {{#include ../../snippets/csharp/ReceiveOnchain.cs:generate-receive-onchain-address}}
``` ```
</section> </section>
@@ -104,7 +104,7 @@ Once you've sent the funds to the above address, the SDK will monitor this addre
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
do { do {
let swapInfo = try sdk.inProgressSwap() let swapInfo = try sdk.inProgressSwap()
} catch { } catch {
@@ -136,7 +136,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/receive_onchain.dart:in-progress-swap}} {{#include ../../snippets/dart_snippets/lib/receive_onchain.dart:in-progress-swap}}
``` ```
</section> </section>
@@ -144,7 +144,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
try: try:
swap_info = sdk_services.in_progress_swap() swap_info = sdk_services.in_progress_swap()
except Exception as error: except Exception as error:
@@ -155,7 +155,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/receive_onchain.go:in-progress-swap}} {{#include ../../snippets/go/receive_onchain.go:in-progress-swap}}
``` ```
@@ -164,7 +164,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/ReceiveOnchain.cs:in-progress-swap}} {{#include ../../snippets/csharp/ReceiveOnchain.cs:in-progress-swap}}
``` ```
</section> </section>
@@ -189,7 +189,7 @@ In order to execute a refund, you need to supply an on-chain address to where th
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
do { do {
let refundables = try sdk.listRefundables() let refundables = try sdk.listRefundables()
} catch { } catch {
@@ -221,7 +221,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/receive_onchain.dart:list-refundables}} {{#include ../../snippets/dart_snippets/lib/receive_onchain.dart:list-refundables}}
``` ```
</section> </section>
@@ -229,7 +229,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
try: try:
refundables = sdk_services.list_refundables() refundables = sdk_services.list_refundables()
except Exception as error: except Exception as error:
@@ -240,7 +240,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/receive_onchain.go:list-refundables}} {{#include ../../snippets/go/receive_onchain.go:list-refundables}}
``` ```
</section> </section>
@@ -248,7 +248,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/ReceiveOnchain.cs:list-refundables}} {{#include ../../snippets/csharp/ReceiveOnchain.cs:list-refundables}}
``` ```
</section> </section>
@@ -268,7 +268,7 @@ Once you have a refundable swap in hand, use the following code to execute a ref
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
let destinationAddress = "..." let destinationAddress = "..."
let satPerVbyte = <refund tx fee rate> let satPerVbyte = <refund tx fee rate>
@@ -309,7 +309,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/receive_onchain.dart:execute-refund}} {{#include ../../snippets/dart_snippets/lib/receive_onchain.dart:execute-refund}}
``` ```
</section> </section>
@@ -317,7 +317,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
destination_address = "..." destination_address = "..."
sat_per_vbyte = 5 sat_per_vbyte = 5
@@ -333,7 +333,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/receive_onchain.go:execute-refund}} {{#include ../../snippets/go/receive_onchain.go:execute-refund}}
``` ```
</section> </section>
@@ -341,7 +341,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/ReceiveOnchain.cs:execute-refund}} {{#include ../../snippets/csharp/ReceiveOnchain.cs:execute-refund}}
``` ```
</section> </section>
@@ -365,7 +365,7 @@ To calculate the fees for a channel being opened by the LSP:
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
let amountMsat = <amount msat> let amountMsat = <amount msat>
do { do {
let channelFees = try sdk.openChannelFee( let channelFees = try sdk.openChannelFee(
@@ -395,7 +395,7 @@ do {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/receive_onchain.dart:get-channel-opening-fees}} {{#include ../../snippets/dart_snippets/lib/receive_onchain.dart:get-channel-opening-fees}}
``` ```
</section> </section>
@@ -403,7 +403,7 @@ do {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
amount_msat = <amount msats> amount_msat = <amount msats>
try: try:
channel_fees = sdk_services.open_channel_fee( channel_fees = sdk_services.open_channel_fee(
@@ -417,7 +417,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/receive_onchain.go:get-channel-opening-fees}} {{#include ../../snippets/go/receive_onchain.go:get-channel-opening-fees}}
``` ```
</section> </section>
@@ -425,14 +425,11 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/ReceiveOnchain.cs:get-channel-opening-fees}} {{#include ../../snippets/csharp/ReceiveOnchain.cs:get-channel-opening-fees}}
``` ```
</section> </section>
</custom-tabs> </custom-tabs>
</custom-tabs>
[^1]: For more details on these fees, see [Channel Opening Fees](connecting_lsp.md#channel-opening-fees) [^1]: For more details on these fees, see [Channel Opening Fees](connecting_lsp.md#channel-opening-fees)

View File

@@ -15,7 +15,7 @@ The Breez SDK automatically connects your node to the LSP peer and you can now r
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
do { do {
let invoice = try sdk.receivePayment( let invoice = try sdk.receivePayment(
req: ReceivePaymentRequest( req: ReceivePaymentRequest(
@@ -53,7 +53,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/receive_payment.dart:receive-payment}} {{#include ../../snippets/dart_snippets/lib/receive_payment.dart:receive-payment}}
``` ```
</section> </section>
@@ -61,7 +61,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
try: try:
receive_payment_response = sdk_services.receive_payment( receive_payment_response = sdk_services.receive_payment(
breez_sdk.ReceivePaymentRequest( breez_sdk.ReceivePaymentRequest(
@@ -75,7 +75,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/receive_payment.go:receive-payment}} {{#include ../../snippets/go/receive_payment.go:receive-payment}}
``` ```
</section> </section>
@@ -83,7 +83,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/ReceivePayment.cs:receive-payment}} {{#include ../../snippets/csharp/ReceivePayment.cs:receive-payment}}
``` ```
</section> </section>

View File

@@ -16,7 +16,7 @@ First, fetch the current reverse swap fees:
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
let sendAmountSat:UInt64? = 50000 let sendAmountSat:UInt64? = 50000
try { try {
let currentFees = try sdk.fetchReverseSwapFees( let currentFees = try sdk.fetchReverseSwapFees(
@@ -52,7 +52,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/send_onchain.dart:estimate-current-reverse-swap-total-fees}} {{#include ../../snippets/dart_snippets/lib/send_onchain.dart:estimate-current-reverse-swap-total-fees}}
``` ```
</section> </section>
@@ -60,7 +60,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
try: try:
current_fees = sdk_services.fetch_reverse_swap_fees( current_fees = sdk_services.fetch_reverse_swap_fees(
breez_sdk.ReverseSwapFeesRequest(send_amount_sat=50000)) breez_sdk.ReverseSwapFeesRequest(send_amount_sat=50000))
@@ -73,7 +73,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/send_onchain.go:estimate-current-reverse-swap-total-fees}} {{#include ../../snippets/go/send_onchain.go:estimate-current-reverse-swap-total-fees}}
``` ```
</section> </section>
@@ -81,7 +81,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/SendOnchain.cs:estimate-current-reverse-swap-total-fees}} {{#include ../../snippets/csharp/SendOnchain.cs:estimate-current-reverse-swap-total-fees}}
``` ```
</section> </section>
@@ -105,7 +105,7 @@ Fetching the fees also tells you what is the range of amounts you can send:
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
println("Minimum amount, in sats: \(current_fees.min)") println("Minimum amount, in sats: \(current_fees.min)")
println("Maximum amount, in sats: \(current_fees.max)") println("Maximum amount, in sats: \(current_fees.max)")
``` ```
@@ -131,7 +131,7 @@ Log.v("Breez", "Maximum amount, in sats: ${fees.max}")
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/send_onchain.dart:get-current-reverse-swap-min-max}} {{#include ../../snippets/dart_snippets/lib/send_onchain.dart:get-current-reverse-swap-min-max}}
``` ```
</section> </section>
@@ -139,7 +139,7 @@ Log.v("Breez", "Maximum amount, in sats: ${fees.max}")
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
print("Minimum amount, in sats: ", current_fees.min) print("Minimum amount, in sats: ", current_fees.min)
print("Maximum amount, in sats: ", current_fees.max) print("Maximum amount, in sats: ", current_fees.max)
``` ```
@@ -148,7 +148,7 @@ print("Maximum amount, in sats: ", current_fees.max)
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/send_onchain.go:get-current-reverse-swap-min-max}} {{#include ../../snippets/go/send_onchain.go:get-current-reverse-swap-min-max}}
``` ```
</section> </section>
@@ -156,7 +156,7 @@ print("Maximum amount, in sats: ", current_fees.max)
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/SendOnchain.cs:get-current-reverse-swap-min-max}} {{#include ../../snippets/csharp/SendOnchain.cs:get-current-reverse-swap-min-max}}
``` ```
</section> </section>
@@ -176,7 +176,7 @@ Once you checked the fees are acceptable, you can start the reverse swap:
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
let destinationAddress = "bc1.." let destinationAddress = "bc1.."
let amountSat = currentFees.min let amountSat = currentFees.min
let satPerVbyte = <fee rate> let satPerVbyte = <fee rate>
@@ -218,7 +218,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/send_onchain.dart:start-reverse-swap}} {{#include ../../snippets/dart_snippets/lib/send_onchain.dart:start-reverse-swap}}
``` ```
</section> </section>
@@ -226,7 +226,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
destination_address = "bc1.." destination_address = "bc1.."
amount_sat = 50000 amount_sat = 50000
sat_per_vbyte = 5 sat_per_vbyte = 5
@@ -243,7 +243,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/send_onchain.go:start-reverse-swap}} {{#include ../../snippets/go/send_onchain.go:start-reverse-swap}}
``` ```
</section> </section>
@@ -251,7 +251,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/SendOnchain.cs:start-reverse-swap}} {{#include ../../snippets/csharp/SendOnchain.cs:start-reverse-swap}}
``` ```
</section> </section>
@@ -275,7 +275,7 @@ You can check its status with:
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
for rs in sdk.inProgressReverseSwaps() { for rs in sdk.inProgressReverseSwaps() {
println("Reverse swap \(rs.id) in progress, status is \(rs.status)") println("Reverse swap \(rs.id) in progress, status is \(rs.status)")
} }
@@ -303,7 +303,7 @@ for (rs in sdk.inProgressReverseSwaps()) {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/send_onchain.dart:check-reverse-swaps-status}} {{#include ../../snippets/dart_snippets/lib/send_onchain.dart:check-reverse-swaps-status}}
``` ```
</section> </section>
@@ -311,7 +311,7 @@ for (rs in sdk.inProgressReverseSwaps()) {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
try: try:
reverse_swaps = sdk_services.in_progress_reverse_swaps() reverse_swaps = sdk_services.in_progress_reverse_swaps()
for rs in reverse_swaps: for rs in reverse_swaps:
@@ -324,7 +324,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/send_onchain.go:check-reverse-swaps-status}} {{#include ../../snippets/go/send_onchain.go:check-reverse-swaps-status}}
``` ```
</section> </section>
@@ -332,7 +332,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/SendOnchain.cs:check-reverse-swaps-status}} {{#include ../../snippets/csharp/SendOnchain.cs:check-reverse-swaps-status}}
``` ```
</section> </section>

View File

@@ -14,7 +14,7 @@ Once you have outbound liquidity you can start sending payments too.
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
do { do {
// The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount. // 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'. // The amountMsat is required in case an amount is not specified in the bolt11 invoice'.
@@ -54,7 +54,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/send_payment.dart:send-payment}} {{#include ../../snippets/dart_snippets/lib/send_payment.dart:send-payment}}
``` ```
</section> </section>
@@ -62,7 +62,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
bolt11 = "..." bolt11 = "..."
try: try:
# The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. # 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:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/send_payment.go:send-payment}} {{#include ../../snippets/go/send_payment.go:send-payment}}
``` ```
</section> </section>
@@ -85,7 +85,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/SendPayment.cs:send-payment}} {{#include ../../snippets/csharp/SendPayment.cs:send-payment}}
``` ```
</section> </section>

View File

@@ -14,7 +14,7 @@ They can even be spontaneous payments to a node without a bolt11 invoice.
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
let nodeId = "..."; let nodeId = "...";
do { do {
let response = try sdk.sendSpontaneousPayment( let response = try sdk.sendSpontaneousPayment(
@@ -53,7 +53,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/send_spontaneous_payment.dart:send-spontaneous-payment}} {{#include ../../snippets/dart_snippets/lib/send_spontaneous_payment.dart:send-spontaneous-payment}}
``` ```
</section> </section>
@@ -61,7 +61,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
try: try:
sdk_services.send_spontaneous_payment( sdk_services.send_spontaneous_payment(
breez_sdk.SendSpontaneousPaymentRequest( breez_sdk.SendSpontaneousPaymentRequest(
@@ -75,7 +75,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/send_spontaneous_payment.go:send-spontaneous-payment}} {{#include ../../snippets/go/send_spontaneous_payment.go:send-spontaneous-payment}}
``` ```
</section> </section>
@@ -83,7 +83,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/SendSpontaneousPayment.cs:send-spontaneous-payment}} {{#include ../../snippets/csharp/SendSpontaneousPayment.cs:send-spontaneous-payment}}
``` ```
</section> </section>

View File

@@ -20,7 +20,7 @@ In order to use the recoverchannel method, the user needs to provide the static
<div slot="title">Swift</div> <div slot="title">Swift</div>
<section> <section>
```swift ```swift,ignore
do { do {
let backupData = breez_sdk.staticBackup(request: StaticBackupRequest(workingDir: "<working directory>")); let backupData = breez_sdk.staticBackup(request: StaticBackupRequest(workingDir: "<working directory>"));
} catch{ } catch{
@@ -55,7 +55,7 @@ try {
<div slot="title">Dart</div> <div slot="title">Dart</div>
<section> <section>
```dart ```dart,ignore
{{#include ../../snippets/dart_snippets/lib/static_channel_backup.dart:static-channel-backup}} {{#include ../../snippets/dart_snippets/lib/static_channel_backup.dart:static-channel-backup}}
``` ```
</section> </section>
@@ -63,7 +63,7 @@ try {
<div slot="title">Python</div> <div slot="title">Python</div>
<section> <section>
```python ```python,ignore
try: try:
backup_data = breez_sdk.static_backup(breez_sdk.StaticBackupRequest(working_dir="<working directory>")) backup_data = breez_sdk.static_backup(breez_sdk.StaticBackupRequest(working_dir="<working directory>"))
except Exception as error: except Exception as error:
@@ -74,7 +74,7 @@ except Exception as error:
<div slot="title">Go</div> <div slot="title">Go</div>
<section> <section>
```go ```go,ignore
{{#include ../../snippets/go/static_channel_backup.go:static-channel-backup}} {{#include ../../snippets/go/static_channel_backup.go:static-channel-backup}}
``` ```
</section> </section>
@@ -82,7 +82,7 @@ except Exception as error:
<div slot="title">C#</div> <div slot="title">C#</div>
<section> <section>
```cs ```cs,ignore
{{#include ../../snippets/csharp/StaticChannelBackup.cs:static-channel-backup}} {{#include ../../snippets/csharp/StaticChannelBackup.cs:static-channel-backup}}
``` ```
</section> </section>