Update Go and RN snippets to 0.2.9

This commit is contained in:
Ross Savage
2023-11-13 12:16:00 +01:00
committed by ok300
parent 01ef82a696
commit 751468285c
6 changed files with 14 additions and 12 deletions

View File

@@ -2,5 +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 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"