Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import React from "react"
import { Linking, TouchableWithoutFeedback, View, TouchableOpacity, ScrollView } from "react-native"
import {
Linking,
TouchableWithoutFeedback,
View,
TouchableOpacity,
ScrollView,
} from "react-native"
import { makeStyles, Text, useTheme, Card } from "@rneui/themed"
import { StackScreenProps } from "@react-navigation/stack"
import Icon from "react-native-vector-icons/Ionicons"
Expand Down Expand Up @@ -167,8 +173,8 @@ export const BreezTransactionDetailScreen: React.FC<Props> = ({ route }) => {
if (details) {
if (details.tag === PaymentDetails_Tags.Lightning) {
description = details.inner.description ?? undefined
paymentHash = details.inner.paymentHash
preimage = details.inner.preimage ?? undefined
paymentHash = details.inner.htlcDetails.paymentHash
preimage = details.inner.htlcDetails.preimage ?? undefined
invoice = details.inner.invoice
destinationPubkey = details.inner.destinationPubkey
} else if (details.tag === PaymentDetails_Tags.Spark) {
Expand Down
12 changes: 9 additions & 3 deletions app/types/transactions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import type { Payment } from "@breeztech/breez-sdk-spark-react-native"
import { PaymentDetails_Tags } from "@breeztech/breez-sdk-spark-react-native"
import {
PaymentDetails_Tags,
PaymentType,
PaymentStatus,
} from "@breeztech/breez-sdk-spark-react-native"
import type { TransactionFragment } from "@app/graphql/generated"

// ============================================================================
Expand Down Expand Up @@ -87,8 +91,7 @@ export const getTransactionAmount = (tx: UnifiedTransaction): number => {
*/
export const isReceiveTransaction = (tx: UnifiedTransaction): boolean => {
if (isBreezTransaction(tx)) {
// PaymentType.Receive = 1
return tx.payment.paymentType === 1
return tx.payment.paymentType === PaymentType.Receive
}
return tx.transaction.direction === "RECEIVE"
}
Expand All @@ -103,10 +106,13 @@ export const getTransactionStatus = (
// PaymentStatus: Completed = 0, Pending = 1, Failed = 2
switch (tx.payment.status) {
case 0:
case PaymentStatus.Completed:
return "SUCCESS"
case 1:
case PaymentStatus.Pending:
return "PENDING"
case 2:
case PaymentStatus.Failed:
return "FAILURE"
default:
return "PENDING"
Expand Down
22 changes: 18 additions & 4 deletions app/utils/breez-sdk/spark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ export const fetchBreezFee = async (
amount: BigInt(amountSats),
tokenIdentifier: undefined,
conversionOptions: undefined,
feePolicy: undefined,
})
const fee = extractFeeFromPaymentMethod(prepareResponse.paymentMethod)
return { fee: Number(fee), err: null }
Expand All @@ -249,6 +250,7 @@ export const fetchBreezFee = async (
amount: BigInt(amountSats),
tokenIdentifier: undefined,
conversionOptions: undefined,
feePolicy: undefined,
})
const fee = extractFeeFromPaymentMethod(
prepareResponse.paymentMethod,
Expand All @@ -262,10 +264,13 @@ export const fetchBreezFee = async (

if (parsed.tag === InputType_Tags.LightningAddress) {
const prepareResponse = await sdk.prepareLnurlPay({
amountSats: BigInt(amountSats),
amount: BigInt(amountSats),
payRequest: parsed.inner[0].payRequest,
comment: undefined,
validateSuccessActionUrl: undefined,
tokenIdentifier: undefined,
conversionOptions: undefined,
feePolicy: undefined,
})

return { fee: Number(prepareResponse.feeSats), err: null }
Expand Down Expand Up @@ -296,6 +301,7 @@ export const receivePaymentBreez = async (
description: description || "",
amountSats: BigInt(amountSats || 0),
expirySecs: undefined,
paymentHash: undefined,
}),
})

Expand All @@ -306,7 +312,7 @@ export const receiveOnchainBreez = async (): Promise<ReceivePaymentResponse> =>
const sdk = getSDKInstance()

const response = await sdk.receivePayment({
paymentMethod: new ReceivePaymentMethod.BitcoinAddress(),
paymentMethod: new ReceivePaymentMethod.BitcoinAddress({ newAddress: undefined }),
})

return response
Expand All @@ -332,6 +338,7 @@ export const payLightningBreez = async (
amount: amountSats !== undefined ? BigInt(amountSats) : undefined,
tokenIdentifier: undefined,
conversionOptions: undefined,
feePolicy: undefined,
})

const options = new SendPaymentOptions.Bolt11Invoice({
Expand Down Expand Up @@ -366,6 +373,7 @@ export const payOnchainBreez = async (
amount: BigInt(amountSats),
tokenIdentifier: undefined,
conversionOptions: undefined,
feePolicy: undefined,
})

const confirmationSpeed =
Expand Down Expand Up @@ -405,10 +413,13 @@ export const payLnurlBreez = async (
const input = await sdk.parse(lnurl)
if (input.tag === InputType_Tags.LightningAddress) {
const prepareResponse = await sdk.prepareLnurlPay({
amountSats: BigInt(amountSats),
amount: BigInt(amountSats),
payRequest: input.inner[0].payRequest,
comment: memo,
validateSuccessActionUrl: true,
tokenIdentifier: undefined,
conversionOptions: undefined,
feePolicy: undefined,
})

const response = await sdk.lnurlPay({
Expand Down Expand Up @@ -467,10 +478,13 @@ export const onRedeem = async (

if (input.tag === InputType_Tags.LightningAddress) {
const prepareResponse = await sdk.prepareLnurlPay({
amountSats: BigInt(amountSats),
amount: BigInt(amountSats),
payRequest: input.inner[0].payRequest,
comment: memo,
validateSuccessActionUrl: true,
tokenIdentifier: undefined,
conversionOptions: undefined,
feePolicy: undefined,
})

const response = await sdk.lnurlPay({
Expand Down
56 changes: 24 additions & 32 deletions ios/LNFlash.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PODS:
- breez_sdk_liquidFFI (0.11.13)
- BreezSDKLiquid (0.11.13):
- breez_sdk_liquidFFI (= 0.11.13)
- breeztech-breez-sdk-spark-react-native (0.7.21):
- BreezSdkSparkReactNative (0.13.1):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -30,7 +30,7 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- uniffi-bindgen-react-native (= 0.28.3-5)
- uniffi-bindgen-react-native (= 0.29.3-1)
- Yoga
- BVLinearGradient (2.8.3):
- React-Core
Expand Down Expand Up @@ -2581,7 +2581,7 @@ PODS:
- ReactCommon/turbomodule/core
- Yoga
- SocketRocket (0.7.1)
- uniffi-bindgen-react-native (0.28.3-5):
- uniffi-bindgen-react-native (0.29.3-1):
- React-Core
- VisionCamera (4.7.3):
- VisionCamera/Core (= 4.7.3)
Expand All @@ -2597,7 +2597,7 @@ PODS:
DEPENDENCIES:
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
- "breez_sdk_liquid (from `../node_modules/@breeztech/react-native-breez-sdk-liquid`)"
- "breeztech-breez-sdk-spark-react-native (from `../node_modules/@breeztech/breez-sdk-spark-react-native`)"
- "BreezSdkSparkReactNative (from `../node_modules/@breeztech/breez-sdk-spark-react-native`)"
- BVLinearGradient (from `../node_modules/react-native-linear-gradient`)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- fast_float (from `../node_modules/react-native/third-party-podspecs/fast_float.podspec`)
Expand Down Expand Up @@ -2760,7 +2760,7 @@ EXTERNAL SOURCES:
:podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec"
breez_sdk_liquid:
:path: "../node_modules/@breeztech/react-native-breez-sdk-liquid"
breeztech-breez-sdk-spark-react-native:
BreezSdkSparkReactNative:
:path: "../node_modules/@breeztech/breez-sdk-spark-react-native"
BVLinearGradient:
:path: "../node_modules/react-native-linear-gradient"
Expand Down Expand Up @@ -2996,7 +2996,7 @@ SPEC CHECKSUMS:
breez_sdk_liquid: 5c229f9ab3bcf6b648bbf2d512f6fe1eee96d121
breez_sdk_liquidFFI: f05fadc0611126ade76d1fe6761ed8b020aabefb
BreezSDKLiquid: ee6bf5a57f1b2533dc3c14c24c9773496f17b756
breeztech-breez-sdk-spark-react-native: eba27c42dea04fce4dffd9d1a1d3b5bada901010
BreezSdkSparkReactNative: 49a8ce44345bfe5feb1444b98297463320c51b1c
BVLinearGradient: 880f91a7854faff2df62518f0281afb1c60d49a3
DoubleConversion: f16ae600a246532c4020132d54af21d0ddb2a385
fast_float: 06eeec4fe712a76acc9376682e4808b05ce978b6
Expand Down Expand Up @@ -3132,11 +3132,11 @@ SPEC CHECKSUMS:
RNSVG: 94d7e07a850d32026796c828f6afcec7e9d2b6ce
RNVectorIcons: 236ac67eb619ce3e7271cc1434f8120174454f08
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
uniffi-bindgen-react-native: 018090e6c342b31e1189eb4d098860e9d44caa86
uniffi-bindgen-react-native: 125eae9e3a0cf34bf8f3d4b0ceed517df7cc0733
VisionCamera: 3ea10c46a5c612f5f89fb46a54bef4a0de8b58a7
Yoga: feb4910aba9742cfedc059e2b2902e22ffe9954a
ZXingObjC: 8898711ab495761b2dbbdec76d90164a6d7e14c5

PODFILE CHECKSUM: 56d3541bf03e11a1410371ecf954203e85415d3a
PODFILE CHECKSUM: 57beda4ec8637308fafaee3e1a02108e993f2cca

COCOAPODS: 1.16.2
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"dependencies": {
"@apollo/client": "3.9.0-alpha.5",
"@bitcoinerlab/secp256k1": "^1.0.5",
"@breeztech/breez-sdk-spark-react-native": "^0.7.21",
"@breeztech/breez-sdk-spark-react-native": "^0.13.1",
"@breeztech/react-native-breez-sdk-liquid": "^0.11.13",
"@flash/client": "git+https://github.com/lnflash/flash-client.git",
"@formatjs/intl-getcanonicallocales": "^2.3.0",
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1901,12 +1901,12 @@
"@noble/hashes" "^1.1.5"
"@noble/secp256k1" "^1.7.1"

"@breeztech/breez-sdk-spark-react-native@^0.7.21":
version "0.7.21"
resolved "https://registry.yarnpkg.com/@breeztech/breez-sdk-spark-react-native/-/breez-sdk-spark-react-native-0.7.21.tgz#f29e0d76f0c092217a537ffd76b0b5e59c53252e"
integrity sha512-r1fNGg8w4LGZXyJdXCWnLIu1wVhXkTpACo03kA8uGtYp6m4bf8MvrW6UtGrcjtWYpc7I2yH78hTqXTFvGqyQNQ==
"@breeztech/breez-sdk-spark-react-native@^0.13.1":
version "0.13.1"
resolved "https://registry.yarnpkg.com/@breeztech/breez-sdk-spark-react-native/-/breez-sdk-spark-react-native-0.13.1.tgz#4ae1258d9c8f6e00d31b81605c9e309700b42841"
integrity sha512-1DHiCxQ+Bamrd6WWjbxAMrmS9YgFa2+ZHqeQ1h8o3d0jDcdGNtjNb686lU+L6ArGtSqLQnSXGvKUsFjwQupxMA==
dependencies:
uniffi-bindgen-react-native "^0.28.3-5"
uniffi-bindgen-react-native "^0.29.3-1"

"@breeztech/react-native-breez-sdk-liquid@^0.11.13":
version "0.11.13"
Expand Down Expand Up @@ -25156,10 +25156,10 @@ unicode-property-aliases-ecmascript@^2.0.0:
resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz#43d41e3be698bd493ef911077c9b131f827e8ccd"
integrity sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==

uniffi-bindgen-react-native@^0.28.3-5:
version "0.28.3-5"
resolved "https://registry.yarnpkg.com/uniffi-bindgen-react-native/-/uniffi-bindgen-react-native-0.28.3-5.tgz#47827bee008f341507956ef77a8308c96cfa4080"
integrity sha512-IOgKr4D+iHYmigAoV03Yuti94l8egKLADXqw/sE0Oyk7FOVexczFr+Kztnx2aHiCBnNv39gSfRCmLGd3i9AFaw==
uniffi-bindgen-react-native@^0.29.3-1:
version "0.29.3-1"
resolved "https://registry.yarnpkg.com/uniffi-bindgen-react-native/-/uniffi-bindgen-react-native-0.29.3-1.tgz#bcf3a9759ac036a08a983783d3319e0044c98680"
integrity sha512-o6gXZsAh55yuvhwF2WSFdIHV4phyfWcCmg4DuyfJWJ7CvUz1UcIz2S4u9SmXAz1jsuqvu6Xc9hexrRBB0a5osg==

unified-args@^8.0.0:
version "8.1.0"
Expand Down