Skip to content

Commit

Permalink
Re-generate RN bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
ok300 committed Nov 13, 2024
1 parent bb18d10 commit 4a53177
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
}
Expand Down
6 changes: 4 additions & 2 deletions packages/react-native/ios/BreezSDKLiquidMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
Expand Down Expand Up @@ -3951,7 +3953,7 @@ enum BreezSDKLiquidMapper {
):
return [
"type": "bolt12",
"offer": offer,
"offer": dictionaryOf(lnOffer: offer),
"receiverAmountSat": receiverAmountSat,
]
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ export type SendDestination = {
invoice: LnInvoice
} | {
type: SendDestinationVariant.BOLT12,
offer: string
offer: LnOffer
receiverAmountSat: number
}

Expand Down

0 comments on commit 4a53177

Please sign in to comment.