From 4a5317724b884de2d273edd67ec1bf47813884a7 Mon Sep 17 00:00:00 2001 From: ok300 <106775972+ok300@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:22:51 +0100 Subject: [PATCH] Re-generate RN bindings --- .../main/java/com/breezsdkliquid/BreezSDKLiquidMapper.kt | 4 ++-- packages/react-native/ios/BreezSDKLiquidMapper.swift | 6 ++++-- packages/react-native/src/index.ts | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/react-native/android/src/main/java/com/breezsdkliquid/BreezSDKLiquidMapper.kt b/packages/react-native/android/src/main/java/com/breezsdkliquid/BreezSDKLiquidMapper.kt index fb611f6f..daa9b006 100644 --- a/packages/react-native/android/src/main/java/com/breezsdkliquid/BreezSDKLiquidMapper.kt +++ b/packages/react-native/android/src/main/java/com/breezsdkliquid/BreezSDKLiquidMapper.kt @@ -3054,7 +3054,7 @@ fun asSendDestination(sendDestination: ReadableMap): SendDestination? { return SendDestination.Bolt11(invoice) } if (type == "bolt12") { - val offer = sendDestination.getString("offer")!! + val offer = sendDestination.getMap("offer")?.let { asLnOffer(it) }!! val receiverAmountSat = sendDestination.getDouble("receiverAmountSat").toULong() return SendDestination.Bolt12(offer, receiverAmountSat) } @@ -3074,7 +3074,7 @@ fun readableMapOf(sendDestination: SendDestination): ReadableMap? { } is SendDestination.Bolt12 -> { pushToMap(map, "type", "bolt12") - pushToMap(map, "offer", sendDestination.offer) + pushToMap(map, "offer", readableMapOf(sendDestination.offer)) pushToMap(map, "receiverAmountSat", sendDestination.receiverAmountSat) } } diff --git a/packages/react-native/ios/BreezSDKLiquidMapper.swift b/packages/react-native/ios/BreezSDKLiquidMapper.swift index ab80b141..a9b847cf 100644 --- a/packages/react-native/ios/BreezSDKLiquidMapper.swift +++ b/packages/react-native/ios/BreezSDKLiquidMapper.swift @@ -3916,9 +3916,11 @@ enum BreezSDKLiquidMapper { return SendDestination.bolt11(invoice: _invoice) } if type == "bolt12" { - guard let _offer = sendDestination["offer"] as? String else { + guard let offerTmp = sendDestination["offer"] as? [String: Any?] else { throw SdkError.Generic(message: errMissingMandatoryField(fieldName: "offer", typeName: "SendDestination")) } + let _offer = try asLnOffer(lnOffer: offerTmp) + guard let _receiverAmountSat = sendDestination["receiverAmountSat"] as? UInt64 else { throw SdkError.Generic(message: errMissingMandatoryField(fieldName: "receiverAmountSat", typeName: "SendDestination")) } @@ -3951,7 +3953,7 @@ enum BreezSDKLiquidMapper { ): return [ "type": "bolt12", - "offer": offer, + "offer": dictionaryOf(lnOffer: offer), "receiverAmountSat": receiverAmountSat, ] } diff --git a/packages/react-native/src/index.ts b/packages/react-native/src/index.ts index 530aa1da..bcd2dc11 100644 --- a/packages/react-native/src/index.ts +++ b/packages/react-native/src/index.ts @@ -667,7 +667,7 @@ export type SendDestination = { invoice: LnInvoice } | { type: SendDestinationVariant.BOLT12, - offer: string + offer: LnOffer receiverAmountSat: number }