Skip to content

Commit

Permalink
bump sdk to 0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
JssDWt committed Sep 30, 2024
1 parent bab7bce commit 4c7a87d
Show file tree
Hide file tree
Showing 32 changed files with 745 additions and 306 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
name: setup
runs-on: ubuntu-latest
outputs:
sdk-ref: ${{ inputs.sdk-ref || '10a4cd62fc39c1e0c56ab2bac3a26210f5515204' }}
package-version: '0.5.2'
sdk-ref: ${{ inputs.sdk-ref || '0.6.1' }}
package-version: '0.6.1'
steps:
- run: echo "set pre-setup output variables"

Expand Down
4 changes: 2 additions & 2 deletions snippets/csharp/CommunicatingFees.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public void getFeeInfoBeforeInvoiceCreated(BlockingBreezServices sdk)
{
var nodeInfo = sdk.NodeInfo();

var inboundLiquiditySat = nodeInfo?.inboundLiquidityMsats / 1_000;
var inboundLiquiditySat = nodeInfo?.maxReceivableSinglePaymentAmountMsat / 1_000;

var openingFeeResponse = sdk.OpenChannelFee(new OpenChannelFeeRequest(null));
var openingFees = openingFeeResponse?.feeParams;
Expand Down Expand Up @@ -59,7 +59,7 @@ public void getFeeInfoReceiveOnchain(BlockingBreezServices sdk)
var maxDepositSat = swapInfo?.maxAllowedDeposit;

var nodeInfo = sdk.NodeInfo();
var inboundLiquiditySat = nodeInfo?.inboundLiquidityMsats / 1_000;
var inboundLiquiditySat = nodeInfo?.maxReceivableSinglePaymentAmountMsat / 1_000;

var swapOpeningFees = swapInfo?.channelOpeningFees;
if (swapOpeningFees != null)
Expand Down
4 changes: 3 additions & 1 deletion snippets/csharp/LnurlPay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ public void LnurlPay(BlockingBreezServices sdk)
if (input is InputType.LnUrlPay lnurlp)
{
var amountMsat = lnurlp.data.minSendable;
var useTrampoline = false;
var optionalComment = "<comment>";
var optionalPaymentLabel = "<label>";
var req = new LnUrlPayRequest(lnurlp.data, amountMsat, optionalComment, optionalPaymentLabel);

var req = new LnUrlPayRequest(lnurlp.data, amountMsat, useTrampoline, optionalComment, optionalPaymentLabel);
var result = sdk.PayLnurl(req);
}
}
Expand Down
4 changes: 3 additions & 1 deletion snippets/csharp/SendPayment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ public void SendPayment(BlockingBreezServices sdk)
{
// ANCHOR: send-payment
var bolt11 = "...";
var useTrampoline = false;
ulong optionalAmountMsat = 3_000_000;
var optionalLabel = "<label>";


try
{
// The `amountMsat` param is optional and should only passed if the
// bolt11 doesn't specify an amount.
// The amountMsat is required in case an amount is not specified in
// the bolt11 invoice.
var response = sdk.SendPayment(
new SendPaymentRequest(bolt11, optionalAmountMsat, optionalLabel));
new SendPaymentRequest(bolt11, useTrampoline, optionalAmountMsat, optionalLabel));
}
catch (Exception)
{
Expand Down
4 changes: 2 additions & 2 deletions snippets/dart_snippets/lib/communicating_fees.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Future<void> getFeeInfoBeforeInvoiceCreated() async {
// ANCHOR: get-fee-info-before-receiving-payment
NodeState? nodeInfo = await breezSDK.nodeInfo();
if (nodeInfo != null) {
int inboundLiquiditySat = nodeInfo.inboundLiquidityMsats ~/ 1000;
int inboundLiquiditySat = nodeInfo.maxReceivableSinglePaymentAmountMsat ~/ 1000;

OpenChannelFeeResponse openingFeeResponse = await breezSDK.openChannelFee(req: OpenChannelFeeRequest());

Expand Down Expand Up @@ -38,7 +38,7 @@ Future<void> getFeeInfoReceiveOnchain() async {

NodeState? nodeInfo = await breezSDK.nodeInfo();
if (nodeInfo != null) {
int inboundLiquiditySat = nodeInfo.inboundLiquidityMsats ~/ 1000;
int inboundLiquiditySat = nodeInfo.maxReceivableSinglePaymentAmountMsat ~/ 1000;

OpeningFeeParams? swapOpeningFees = swapInfo.channelOpeningFees;
if (swapOpeningFees != null) {
Expand Down
2 changes: 2 additions & 0 deletions snippets/dart_snippets/lib/lnurl_pay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ Future<void> lnurlPay() async {
InputType inputType = await breezSDK.parseInput(input: lnurlPayUrl);
if (inputType is InputType_LnUrlPay) {
int amountMsat = inputType.data.minSendable;
bool useTrampoline = false;
String optionalComment = "<comment>";
String optionalPaymentLabel = "<label>";
LnUrlPayRequest req = LnUrlPayRequest(
data: inputType.data,
amountMsat: amountMsat,
useTrampoline: useTrampoline,
comment: optionalComment,
paymentLabel: optionalPaymentLabel,
);
Expand Down
4 changes: 3 additions & 1 deletion snippets/dart_snippets/lib/send_payment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ Future<SendPaymentResponse> sendPayment({required String bolt11}) async {
// ANCHOR: send-payment
// 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'.
bool useTrampoline = false;
int optionalAmountMsat = 3000000;
String optionalLabel = "<label>";
SendPaymentRequest req = SendPaymentRequest(bolt11: bolt11, amountMsat: optionalAmountMsat, label: optionalLabel);

SendPaymentRequest req = SendPaymentRequest(bolt11: bolt11, useTrampoline: useTrampoline, amountMsat: optionalAmountMsat, label: optionalLabel);
SendPaymentResponse resp = await breezSDK.sendPayment(req: req);
// ANCHOR_END: send-payment
return resp;
Expand Down
4 changes: 2 additions & 2 deletions snippets/go/communicating_fees.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func getFeeInfoBeforeInvoiceCreated() {
// ANCHOR: get-fee-info-before-receiving-payment
if nodeInfo, err := sdk.NodeInfo(); err == nil {
var inboundLiquiditySat = nodeInfo.InboundLiquidityMsats / 1_000
var inboundLiquiditySat = nodeInfo.MaxReceivableSinglePaymentAmountMsat / 1_000

if openingFeeResponse, err := sdk.OpenChannelFee(breez_sdk.OpenChannelFeeRequest{}); err == nil {
var openingFees = openingFeeResponse.FeeParams
Expand Down Expand Up @@ -49,7 +49,7 @@ func getFeeInfoReceiveOnchain() {
var maxDepositSat = swapInfo.MaxAllowedDeposit

if nodeInfo, err := sdk.NodeInfo(); err == nil {
var inboundLiquiditySat = nodeInfo.InboundLiquidityMsats / 1_000
var inboundLiquiditySat = nodeInfo.MaxReceivableSinglePaymentAmountMsat / 1_000

var swapOpeningFees = swapInfo.ChannelOpeningFees
var feePercentage = (swapOpeningFees.Proportional * 100) / 1_000_000.0
Expand Down
10 changes: 6 additions & 4 deletions snippets/go/lnurl_pay.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ func LnurlPay() {
if input, err := breez_sdk.ParseInput(lnurlPayUrl); err != nil {
switch inputType := input.(type) {
case breez_sdk.InputTypeLnUrlPay:
useTrampoline := false
amountMsat := inputType.Data.MinSendable
optionalComment := "<comment>"
optionalPaymentLabel := "<label>"
lnUrlPayRequest := breez_sdk.LnUrlPayRequest{
Data: inputType.Data,
AmountMsat: amountMsat,
Comment: &optionalComment,
PaymentLabel: &optionalPaymentLabel,
Data: inputType.Data,
UseTrampoline: useTrampoline,
AmountMsat: amountMsat,
Comment: &optionalComment,
PaymentLabel: &optionalPaymentLabel,
}
if result, err := sdk.PayLnurl(lnUrlPayRequest); err != nil {
switch result.(type) {
Expand Down
8 changes: 5 additions & 3 deletions snippets/go/send_payment.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ import (
func SendPayment() {
// ANCHOR: send-payment
bolt11 := "bolt11 invoice"
useTrampoline := false
// 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'.
optionalAmountMsat := uint64(3_000_000)
optionalLabel := "<label>"
sendPaymentRequest := breez_sdk.SendPaymentRequest{
Bolt11: bolt11,
AmountMsat: &optionalAmountMsat,
Label: &optionalLabel,
Bolt11: bolt11,
UseTrampoline: useTrampoline,
AmountMsat: &optionalAmountMsat,
Label: &optionalLabel,
}
if response, err := sdk.SendPayment(sendPaymentRequest); err == nil {
log.Printf("%#v", response)
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 @@ -34,7 +34,7 @@ kotlin {
}
val commonMain by getting {
dependencies {
implementation("technology.breez:breez-sdk-kmp:0.5.0")
implementation("technology.breez:breez-sdk-kmp:0.6.1")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import breez_sdk.*
class CommunicatingFees {
fun getFeeInfoBeforeInvoiceCreated(sdk: BlockingBreezServices) {
// ANCHOR: get-fee-info-before-receiving-payment
val inboundLiquidityMsat = sdk.nodeInfo()?.inboundLiquidityMsats ?: 0u
val inboundLiquidityMsat = sdk.nodeInfo()?.maxReceivableSinglePaymentAmountMsat ?: 0u
val inboundLiquiditySat = inboundLiquidityMsat / 1_000u

val openingFeeResponse = sdk.openChannelFee(OpenChannelFeeRequest(null))
Expand Down Expand Up @@ -34,7 +34,7 @@ class CommunicatingFees {

val minDepositSat = swapInfo.minAllowedDeposit
val maxDepositSat = swapInfo.maxAllowedDeposit
val inboundLiquiditySat = (sdk.nodeInfo()?.inboundLiquidityMsats ?: 0u) / 1_000u
val inboundLiquiditySat = (sdk.nodeInfo()?.maxReceivableSinglePaymentAmountMsat ?: 0u) / 1_000u

val swapOpeningFees = swapInfo.channelOpeningFees
if (swapOpeningFees != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ class LnurlPay {
val inputType = parseInput(lnurlPayUrl)
if (inputType is InputType.LnUrlPay) {
val requestData = inputType.data
val useTrampoline = false;
val amountMsat = requestData.minSendable
val optionalComment = "<comment>";
val optionalPaymentLabel = "<label>";
val req = LnUrlPayRequest(requestData, amountMsat, optionalComment, optionalPaymentLabel)

val req = LnUrlPayRequest(requestData, amountMsat, useTrampoline, optionalComment, optionalPaymentLabel)
sdk.payLnurl(req)
}
} catch (e: Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ class SendPayment {
// ANCHOR: send-payment
val bolt11 = "..."
try {
val useTrampoline = false
// 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'.
val optionalAmountMsat = 3_000_000.toULong()
val optionalLabel = "<label>"
val req = SendPaymentRequest(bolt11, optionalAmountMsat, optionalLabel)
val req = SendPaymentRequest(bolt11, useTrampoline, optionalAmountMsat, optionalLabel)
val response = sdk.sendPayment(req)
} catch (e: Exception) {
// handle error
Expand Down
4 changes: 2 additions & 2 deletions snippets/python/src/communicating_fees.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
def get_fee_info_before_receiving_payment(sdk_services):
try:
# ANCHOR: get-fee-info-before-receiving-payment
inbound_liquidity_msat = sdk_services.node_info().inbound_liquidity_msats
inbound_liquidity_msat = sdk_services.node_info().max_receivable_single_payment_amount_msat
inbound_liquidity_sat = inbound_liquidity_msat / 1_000

opening_fee_response = sdk_services.open_channel_fee()
Expand Down Expand Up @@ -43,7 +43,7 @@ def get_fee_info_receive_onchain(sdk_services):

min_deposit_sat = swap_info.min_allowed_deposit
max_deposit_sat = swap_info.max_allowed_deposit
inbound_liquidity_sat = sdk_services.node_info().inbound_liquidity_msats / 1_000
inbound_liquidity_sat = sdk_services.node_info().max_receivable_single_payment_amount_msat / 1_000

swap_opening_fees = swap_info.channel_opening_fees
if swap_opening_fees is not None:
Expand Down
3 changes: 2 additions & 1 deletion snippets/python/src/lnurl_pay.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ def pay(sdk_services):
parsed_input = breez_sdk.parse_input(lnurl_pay_url)
if isinstance(parsed_input, breez_sdk.InputType.LN_URL_PAY):
amount_msat = parsed_input.data.min_sendable
use_trampoline = False
optional_comment = "<comment>"
optional_payment_label = "<label>"
req = breez_sdk.LnUrlPayRequest(parsed_input.data, amount_msat, optional_comment, optional_payment_label)
req = breez_sdk.LnUrlPayRequest(parsed_input.data, amount_msat, use_trampoline, optional_comment, optional_payment_label)
result = sdk_services.pay_lnurl(req)
return result
except Exception as error:
Expand Down
3 changes: 2 additions & 1 deletion snippets/python/src/send_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ def send_payment(sdk_services):
# ANCHOR: send-payment
bolt11 = "..."
try:
use_trampoline = False
# The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount.
# The amount_msat is required in case an amount is not specified in the bolt11 invoice'.
optional_amount_msat = 3000000
optional_label = "<label>"
req = breez_sdk.SendPaymentRequest(bolt11=bolt11, amount_msat=optional_amount_msat, label=optional_label)
req = breez_sdk.SendPaymentRequest(bolt11=bolt11, use_trampoline=use_trampoline, amount_msat=optional_amount_msat, label=optional_label)
sdk_services.send_payment(req=req)
except Exception as error:
print(error)
Expand Down
4 changes: 2 additions & 2 deletions snippets/react-native/communicating_fees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
const getFeeInfoBeforeInvoiceCreated = async () => {
// ANCHOR: get-fee-info-before-receiving-payment
const nodeState = await nodeInfo()
const inboundLiquidityMsat = nodeState.inboundLiquidityMsats
const inboundLiquidityMsat = nodeState.maxReceivableSinglePaymentAmountMsat
const inboundLiquiditySat = inboundLiquidityMsat != null ? inboundLiquidityMsat / 1_000 : 0

const openChannelFeeResponse = await openChannelFee({})
Expand Down Expand Up @@ -41,7 +41,7 @@ const getFeeInfoReceiveOnchain = async () => {

const minDepositSat = swapInfo.minAllowedDeposit
const maxDepositSat = swapInfo.maxAllowedDeposit
const inboundLiquidityMsat = nodeState?.inboundLiquidityMsats
const inboundLiquidityMsat = nodeState?.maxReceivableSinglePaymentAmountMsat
const inboundLiquiditySat = inboundLiquidityMsat != null ? (inboundLiquidityMsat / 1_000) : 0

const swapOpeningFees = swapInfo.channelOpeningFees
Expand Down
2 changes: 2 additions & 0 deletions snippets/react-native/lnurl_pay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ const exampleLnurlPay = async () => {
const input = await parseInput(lnurlPayUrl)
if (input.type === InputTypeVariant.LN_URL_PAY) {
const amountMsat = input.data.minSendable
const useTrampoline = false
const optionalComment = '<comment>'
const optionalPaymentLabel = '<label>'
const lnUrlPayResult = await payLnurl({
data: input.data,
amountMsat,
useTrampoline,
comment: optionalComment,
paymentLabel: optionalPaymentLabel
})
Expand Down
2 changes: 2 additions & 0 deletions snippets/react-native/send_payment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ const exampleSendLightningPayment = async () => {
// ANCHOR: send-payment
try {
const bolt11 = 'bolt11 invoice'
const useTrampoline = false
// 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 optionalAmountMsat = 3000000
const optionalLabel = '<label>'
const response = await sendPayment({
bolt11,
useTrampoline,
amountMsat: optionalAmountMsat,
label: optionalLabel
})
Expand Down
Loading

0 comments on commit 4c7a87d

Please sign in to comment.