Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify error handling in golang snippets #158

Closed
wants to merge 40 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
422a248
Add "receive payment" snippet for fees
ok300 Jan 12, 2024
2a89a91
Fix dart issues
ok300 Jan 30, 2024
b08f7dc
Add snippet for receive_onchain fee info
ok300 Feb 7, 2024
ec4f4fb
Simplify get_fee_info_before_receiving_payment snippet
ok300 Feb 26, 2024
e3f7eee
Fix kotlin division
ok300 Apr 13, 2024
1add2ae
Fix kotlin CI error
ok300 Apr 17, 2024
951c84b
Fix RN CI error
ok300 Apr 17, 2024
d8d496e
Fix dart CI errors
ok300 Apr 17, 2024
f4f90dc
Fix golang CI error
ok300 Apr 17, 2024
e95fe7b
Fix RN CI errors
ok300 Apr 17, 2024
2ac462d
Fix kotlin CI error
ok300 Apr 17, 2024
887152f
Fix golang CI error
ok300 Apr 17, 2024
d4c2812
Fix kotlin CI error
ok300 Apr 17, 2024
c6c6760
Fix kotlin CI error
ok300 Apr 17, 2024
9f13aaa
Fix RN CI error
ok300 Apr 18, 2024
965f5b9
Fix kotlin CI error
ok300 Apr 18, 2024
c9c2091
Fix kotlin CI error
ok300 Apr 18, 2024
cb5d26a
Fix indentation for rust snippet
ok300 Apr 19, 2024
d8b496e
Add remaining kotlin snippets
ok300 Apr 19, 2024
ad4651f
Add remaining RN snippets
ok300 Apr 19, 2024
4aed9ed
Add remaining dart snippets
ok300 Apr 19, 2024
43bb2d8
Fix swift snippet CI errors
ok300 Apr 25, 2024
2e85b33
Add remaining swift snippets
ok300 Apr 25, 2024
548bb54
Add missing RN import
ok300 Apr 25, 2024
8c07d6d
Add remaining python snippets
ok300 Apr 25, 2024
9b64837
Add empty default arg in RN openChannelFee call
ok300 Apr 25, 2024
2cd8442
Add remaining golang snippets
ok300 Apr 25, 2024
b06a747
Add remaining csharp snippets
ok300 Apr 25, 2024
f0cd584
Fix golang formatting (tab indentation)
ok300 Apr 25, 2024
0240330
Fix golang formatting of multi-line logs
ok300 Apr 25, 2024
36717c5
Fix golang formatting, add EOF newline
ok300 Apr 25, 2024
f56bd29
Update snippets/go/communicating_fees.go
ok300 Apr 29, 2024
41b49df
Update snippets/go/communicating_fees.go
ok300 Apr 29, 2024
afe570b
Update src/guide/communicating_fees.md
ok300 Apr 29, 2024
c831d4a
Update snippets/go/communicating_fees.go
ok300 Apr 29, 2024
2e5bf79
Update src/guide/communicating_fees.md
ok300 Apr 29, 2024
e084005
Fix error handling in golang snippets
ok300 Apr 29, 2024
a392b75
Fix function name case in Kotlin snippets
ok300 Apr 29, 2024
f1a2683
Update src/guide/communicating_fees.md
ok300 Apr 29, 2024
b4486af
Simplify error handling in golang snippets
ok300 Apr 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix swift snippet CI errors
ok300 committed Apr 25, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 43bb2d8ff4d16f2e2f4b043b78bf06a185305c8a
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -25,8 +25,8 @@ jobs:
name: setup
runs-on: ubuntu-latest
outputs:
sdk-ref: ${{ inputs.sdk-ref || '0.4.0-rc1' }}
package-version: '0.4.0-rc1'
sdk-ref: ${{ inputs.sdk-ref || '0.4.0-rc5' }}
package-version: '0.4.0-rc5'
steps:
- run: echo "set pre-setup output variables"

2 changes: 1 addition & 1 deletion snippets/dart_snippets/pubspec.lock
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ packages:
path: "packages/breez-sdk-flutter"
relative: true
source: path
version: "0.4.0-rc1"
version: "0.4.0-rc5"
build:
dependency: transitive
description:
2 changes: 1 addition & 1 deletion snippets/go/go.mod
Original file line number Diff line number Diff line change
@@ -2,6 +2,6 @@ module main

go 1.19

require github.com/breez/breez-sdk-go v0.4.0-rc1
require github.com/breez/breez-sdk-go v0.4.0-rc5

replace github.com/breez/breez-sdk-go => ./packages/breez-sdk-go
2 changes: 1 addition & 1 deletion snippets/kotlin_mpp_lib/shared/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ kotlin {
}
val commonMain by getting {
dependencies {
implementation("technology.breez:breez-sdk-kmp:0.4.0-rc1")
implementation("technology.breez:breez-sdk-kmp:0.4.0-rc5")
}
}
}
8 changes: 4 additions & 4 deletions snippets/react-native/yarn.lock
Original file line number Diff line number Diff line change
@@ -714,10 +714,10 @@
"@babel/helper-validator-identifier" "^7.22.20"
to-fast-properties "^2.0.0"

"@breeztech/[email protected]rc1":
version "0.4.0-rc1"
resolved "https://registry.yarnpkg.com/@breeztech/react-native-breez-sdk/-/react-native-breez-sdk-0.4.0-rc1.tgz#3dbd522dbd87cb4dde93ef570e985f7cb4b421de"
integrity sha512-ssZb9WTilZUWSjP+Bq+gY8efb1YN0aD5KNpFtY3GeDRgD4Y/H8jtYYdExcQKN22dsImNTo9WRGSy1R26byraJg==
"@breeztech/[email protected]rc5":
version "0.4.0-rc5"
resolved "https://registry.yarnpkg.com/@breeztech/react-native-breez-sdk/-/react-native-breez-sdk-0.4.0-rc5.tgz#764329fe2482f553b4d8be57b6f65c111d9fdd47"
integrity sha512-HMAd+vUKLIJt8vjbBpKEV1y07sktb4prpQRiKSuGsKlrchlanE4OgnC+OeejrwvraiQgC/UoyISW6C3VN2IF8A==

"@esbuild/[email protected]":
version "0.18.20"
4 changes: 2 additions & 2 deletions snippets/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion snippets/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -6,6 +6,6 @@ edition = "2021"
[dependencies]
anyhow = "1"
bip39 = { version = "2", features = ["rand"] }
breez-sdk-core = { git = "https://github.com/breez/breez-sdk", tag = "0.4.0-rc1" }
breez-sdk-core = { git = "https://github.com/breez/breez-sdk", tag = "0.4.0-rc5" }
log = "0.4"
tokio = "1.29"
4 changes: 2 additions & 2 deletions snippets/swift/BreezSDKExamples/Package.resolved
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/breez/breez-sdk-swift",
"state" : {
"revision" : "ef92aa5e009564fd4b0e4380ad36c788f25fb18f",
"version" : "0.4.0-rc1"
"revision" : "7431e35877003a310da3871cccd0048c5f233bab",
"version" : "0.4.0-rc5"
}
},
{
2 changes: 1 addition & 1 deletion snippets/swift/BreezSDKExamples/Package.swift
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ let package = Package(
platforms: [.macOS(.v13)],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.3"),
.package(url: "https://github.com/breez/breez-sdk-swift", from:"0.4.0-rc1")
.package(url: "https://github.com/breez/breez-sdk-swift", from:"0.4.0-rc5")
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
22 changes: 13 additions & 9 deletions snippets/swift/BreezSDKExamples/Sources/SendOnchain.swift
Original file line number Diff line number Diff line change
@@ -8,13 +8,15 @@
import BreezSDK
import Foundation

func GetCurrentLimits(sdk: BlockingBreezServices) -> ReverseSwapPairInfo? {
func GetCurrentLimits(sdk: BlockingBreezServices) -> OnchainPaymentLimitsResponse?? {
// ANCHOR: get-current-reverse-swap-limits
let currentLimits = try? sdk.onchainPaymentLimits()
print("Minimum amount, in sats: \(currentLimits.minSat)")
print("Maximum amount, in sats: \(currentLimits.maxSat)")
if let limits = currentLimits {
print("Minimum amount, in sats: \(limits.minSat)")
print("Maximum amount, in sats: \(limits.maxSat)")
}
// ANCHOR_END: get-current-reverse-swap-limits
return currentFees
return currentLimits
}

func PreparePayOnchain(sdk: BlockingBreezServices, currentLimits: OnchainPaymentLimitsResponse) -> PrepareOnchainPaymentResponse? {
@@ -25,14 +27,16 @@ func PreparePayOnchain(sdk: BlockingBreezServices, currentLimits: OnchainPayment
let prepareRequest = PrepareOnchainPaymentRequest(amountSat: amountSat, amountType: .send, claimTxFeerate: satPerVbyte);
let prepareResponse = try? sdk.prepareOnchainPayment(req: prepareRequest)

print("Sender amount, in sats: \(prepareResponse.senderAmountSat)")
print("Recipient amount, in sats: \(prepareResponse.recipientAmountSat)")
print("Total fees, in sats: \(prepareResponse.totalFees)")
if let response = prepareResponse {
print("Sender amount, in sats: \(response.senderAmountSat)")
print("Recipient amount, in sats: \(response.recipientAmountSat)")
print("Total fees, in sats: \(response.totalFees)")
}
// ANCHOR_END: prepare-pay-onchain
return prepareResponse
}

func StartReverseSwap(sdk: BlockingBreezServices, prepareResponse: PrepareOnchainPaymentRequest) -> SendOnchainResponse? {
func StartReverseSwap(sdk: BlockingBreezServices, prepareResponse: PrepareOnchainPaymentResponse) -> PayOnchainResponse? {
// ANCHOR: start-reverse-swap
let destinationAddress = "bc1.."

@@ -44,7 +48,7 @@ func StartReverseSwap(sdk: BlockingBreezServices, prepareResponse: PrepareOnchai
func checkReverseSwap(sdk: BlockingBreezServices) {
// ANCHOR: check-reverse-swaps-status
if let inProgressOnchainPayments = try? sdk.inProgressOnchainPayments() {
for rs in inProgressReverseSwaps {
for rs in inProgressOnchainPayments {
print("Onchain payment \(rs.id) in progress, status is \(rs.status)")
}
}
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ import Foundation

func getServiceStatus() {
// ANCHOR: health-check-status
if let healthCheck = try? serviceHealthCheck("<api key>") {
if let healthCheck = try? serviceHealthCheck(apiKey: "<api key>") {
print("Current service status is: \(healthCheck.status)")
}
// ANCHOR_END: health-check-status
2 changes: 1 addition & 1 deletion src/guide/install.md
Original file line number Diff line number Diff line change
@@ -93,7 +93,7 @@ Check https://github.com/breez/breez-sdk/releases for the latest version.

```toml
[dependencies]
breez-sdk-core = { git = "https://github.com/breez/breez-sdk", tag = "0.4.0-rc1" }
breez-sdk-core = { git = "https://github.com/breez/breez-sdk", tag = "0.4.0-rc5" }
```

## Flutter/Dart