Skip to content

Commit

Permalink
Bump to 0.7.0-rc4 and update get_payment docs (#80)
Browse files Browse the repository at this point in the history
* Bump to 0.7.0-rc4 and update get_payment docs

* Fix typo

Co-authored-by: Ross Savage <[email protected]>

* Add swap id hash identifier

* Fix sdk version in CI

* Fix go formatting

---------

Co-authored-by: Ross Savage <[email protected]>
  • Loading branch information
danielgranhao and dangeross authored Feb 6, 2025
1 parent d68f037 commit e4d2b9c
Show file tree
Hide file tree
Showing 23 changed files with 457 additions and 449 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ on:
workflow_dispatch:
inputs:
sdk-ref:
description: 'sdk commit/tag/branch reference. Defaults to 0.7.0-rc1'
description: 'sdk commit/tag/branch reference. Defaults to 0.7.0-rc4'
required: false
type: string
default: 0.7.0-rc1
default: 0.7.0-rc4

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -26,9 +26,9 @@ jobs:
runs-on: ubuntu-latest
outputs:
# Used only for Rust snippets
sdk-ref: ${{ inputs.sdk-ref || '0.7.0-rc1' }}
sdk-ref: ${{ inputs.sdk-ref || '0.7.0-rc4' }}
# Used for RN and Flutter snippets
package-version: '0.7.0-rc1'
package-version: '0.7.0-rc4'
steps:
- run: echo "set pre-setup output variables"

Expand Down
9 changes: 7 additions & 2 deletions snippets/csharp/ListPayments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ public void GetPayment(BindingLiquidSdk sdk)
try
{
var paymentHash = "<payment hash>";
var payment = sdk.GetPayment(
new GetPaymentRequest.Lightning(paymentHash)
var paymentByHash = sdk.GetPayment(
new GetPaymentRequest.PaymentHash(paymentHash)
);

var swapId = "<swap id>";
var paymentBySwapId = sdk.GetPayment(
new GetPaymentRequest.SwapId(swapId)
);
}
catch (Exception)
Expand Down
2 changes: 1 addition & 1 deletion snippets/csharp/Snippets.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
<PackageReference Include="Breez.Sdk.Liquid" Version="*" />
</ItemGroup>

</Project>
</Project>
12 changes: 8 additions & 4 deletions snippets/dart_snippets/lib/list_payments.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import 'package:dart_snippets/sdk_instance.dart';
import 'package:flutter_breez_liquid/flutter_breez_liquid.dart';

Future<Payment?> getPayment() async {
Future<(Payment?, Payment?)> getPayment() async {
// ANCHOR: get-payment
String paymentHash = "<payment hash>";
GetPaymentRequest req = GetPaymentRequest.lightning(paymentHash: paymentHash);
Payment? payment = await breezSDKLiquid.instance!.getPayment(req: req);
GetPaymentRequest reqByHash = GetPaymentRequest.paymentHash(paymentHash: paymentHash);
Payment? paymentByHash = await breezSDKLiquid.instance!.getPayment(req: reqByHash);

String swapId = "<swap id>";
GetPaymentRequest reqBySwapId = GetPaymentRequest.swapId(swapId: swapId);
Payment? paymentBySwapId = await breezSDKLiquid.instance!.getPayment(req: reqBySwapId);
// ANCHOR_END: get-payment
return payment;
return (paymentByHash, paymentBySwapId);
}

Future<List<Payment>> listPayments() async {
Expand Down
8 changes: 4 additions & 4 deletions snippets/dart_snippets/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ packages:
description:
path: "."
ref: HEAD
resolved-ref: "0c419e0703d5f37e13a96113e71618afc5c50fd3"
resolved-ref: "0647370f6a2dc26a52f609b942cb3d93f765adae"
url: "https://github.com/breez/breez-sdk-liquid-dart"
source: git
version: "0.7.0-rc1"
version: "0.7.0-rc5"
build_cli_annotations:
dependency: transitive
description:
Expand Down Expand Up @@ -140,10 +140,10 @@ packages:
description:
path: "."
ref: HEAD
resolved-ref: "751cd4525f325b69c0652513b86170cfce480e40"
resolved-ref: "22538ed87b3ad34faeb4c60f0defa10b56235093"
url: "https://github.com/breez/breez-sdk-liquid-flutter"
source: git
version: "0.7.0-rc1"
version: "0.7.0-rc5"
flutter_rust_bridge:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions snippets/dart_snippets/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ dependencies:
breez_liquid:
git:
url: https://github.com/breez/breez-sdk-liquid-dart
tag: 0.7.0-rc1
tag: 0.7.0-rc4
flutter_breez_liquid:
git:
url: https://github.com/breez/breez-sdk-liquid-flutter
tag: 0.7.0-rc1
tag: 0.7.0-rc4
rxdart: ^0.28.0

dependency_overrides:
Expand Down
2 changes: 1 addition & 1 deletion snippets/go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module main

go 1.19

require github.com/breez/breez-sdk-liquid-go v0.7.0-rc1
require github.com/breez/breez-sdk-liquid-go v0.7.0-rc4

// Comment out to use published module
replace github.com/breez/breez-sdk-liquid-go => ./packages/breez-sdk-liquid-go
12 changes: 10 additions & 2 deletions snippets/go/list_payments.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,18 @@ import (
func GetPayment(sdk *breez_sdk_liquid.BindingLiquidSdk) {
// ANCHOR: get-payment
paymentHash := "<payment hash>"
req := breez_sdk_liquid.GetPaymentRequestLightning{
reqByPaymentHash := breez_sdk_liquid.GetPaymentRequestPaymentHash{
PaymentHash: paymentHash,
}
if payment, err := sdk.GetPayment(req); err == nil {
if payment, err := sdk.GetPayment(reqByPaymentHash); err == nil {
log.Printf("%#v", payment)
}

swapId := "<swap id>"
reqBySwapId := breez_sdk_liquid.GetPaymentRequestSwapId{
SwapId: swapId,
}
if payment, err := sdk.GetPayment(reqBySwapId); err == nil {
log.Printf("%#v", payment)
}
// ANCHOR_END: get-payment
Expand Down
2 changes: 1 addition & 1 deletion snippets/kotlin_mpp_lib/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ kotlin {
}
val commonMain by getting {
dependencies {
implementation("technology.breez.liquid:breez-sdk-liquid-kmp:0.7.0-rc1")
implementation("technology.breez.liquid:breez-sdk-liquid-kmp:0.7.0-rc4")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ class ListPayments {
// ANCHOR: get-payment
try {
val paymentHash = "<payment hash>";
val payment = sdk.getPayment(GetPaymentRequest.Lightning(paymentHash))
val paymentByHash = sdk.getPayment(GetPaymentRequest.PaymentHash(paymentHash))

val swapId = "<swap id>";
val paymentBySwapId = sdk.getPayment(GetPaymentRequest.SwapId(swapId))
} catch (e: Exception) {
// handle error
}
Expand Down Expand Up @@ -67,4 +70,4 @@ class ListPayments {
}
// ANCHOR_END: list-payments-details-destination
}
}
}
5 changes: 4 additions & 1 deletion snippets/python/src/list_payments.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ def get_payment(sdk: BindingLiquidSdk):
try:
# ANCHOR: get-payment
payment_hash = "<payment hash>"
sdk.get_payment(GetPaymentRequest.LIGHTNING(payment_hash))
sdk.get_payment(GetPaymentRequest.PAYMENT_HASH(payment_hash))

swap_id = "<swap id>"
sdk.get_payment(GetPaymentRequest.SWAP_ID(swap_id))
# ANCHOR_END: get-payment
except Exception as error:
logging.error(error)
Expand Down
2 changes: 1 addition & 1 deletion snippets/python/src/receive_payment.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from breez_sdk_liquid import BindingLiquidSdk, PrepareReceiveRequest, PaymentMethod, PrepareReceiveResponse, ReceivePaymentRequest
from breez_sdk_liquid import BindingLiquidSdk, PrepareReceiveRequest, PaymentMethod, PrepareReceiveResponse, ReceivePaymentRequest, ReceiveAmount


def prepare_receive_lightning(sdk: BindingLiquidSdk):
Expand Down
10 changes: 8 additions & 2 deletions snippets/react-native/list_payments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ import {
const exampleGetPayment = async () => {
// ANCHOR: get-payment
const paymentHash = '<payment hash>'
const payment = await getPayment({
type: GetPaymentRequestVariant.LIGHTNING,
const paymentByHash = await getPayment({
type: GetPaymentRequestVariant.PAYMENT_HASH,
paymentHash
})

const swapId = '<swap id>'
const paymentBySwapId = await getPayment({
type: GetPaymentRequestVariant.SWAP_ID,
swapId
})
// ANCHOR_END: get-payment
}

Expand Down
2 changes: 1 addition & 1 deletion snippets/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"compile": "tsc"
},
"dependencies": {
"@breeztech/react-native-breez-sdk-liquid": "^0.7.0-rc1",
"@breeztech/react-native-breez-sdk-liquid": "^0.7.0-rc4",
"react": "18.1.0",
"react-native": "0.70.6"
},
Expand Down
Loading

0 comments on commit e4d2b9c

Please sign in to comment.