From c7abd3d4dcec1d8ac0fe05b844e7c75b9cd1d59a Mon Sep 17 00:00:00 2001 From: ok300 <106775972+ok300@users.noreply.github.com> Date: Wed, 13 Nov 2024 14:12:44 +0100 Subject: [PATCH] Expose Bolt12Offer input type behind "liquid" feature --- libs/sdk-bindings/src/breez_sdk.udl | 17 - libs/sdk-bindings/src/uniffi_binding.rs | 4 +- libs/sdk-common/src/input_parser.rs | 35 +- libs/sdk-common/src/invoice.rs | 42 -- libs/sdk-core/src/binding.rs | 35 +- libs/sdk-core/src/bridge_generated.rs | 90 +-- libs/sdk-flutter/lib/bridge_generated.dart | 90 +-- .../lib/bridge_generated.freezed.dart | 556 ------------------ .../main/java/com/breezsdk/BreezSDKMapper.kt | 99 ---- .../sdk-react-native/ios/BreezSDKMapper.swift | 145 ----- libs/sdk-react-native/src/index.ts | 28 - 11 files changed, 21 insertions(+), 1120 deletions(-) diff --git a/libs/sdk-bindings/src/breez_sdk.udl b/libs/sdk-bindings/src/breez_sdk.udl index f89659def..07310ef7f 100644 --- a/libs/sdk-bindings/src/breez_sdk.udl +++ b/libs/sdk-bindings/src/breez_sdk.udl @@ -730,27 +730,10 @@ dictionary RecommendedFees { u64 minimum_fee; }; -[Enum] -interface Amount { - Bitcoin(u64 amount_msat); - Currency(string iso4217_code, u64 fractional_amount); -}; - -dictionary LNOffer { - string bolt12; - sequence chains; - string description; - string signing_pubkey; - Amount? amount; - u64? absolute_expiry; - string? issuer; -}; - [Enum] interface InputType { BitcoinAddress(BitcoinAddressData address); Bolt11(LNInvoice invoice); - Bolt12(LNOffer offer); NodeId(string node_id); Url(string url); LnUrlPay(LnUrlPayRequestData data); diff --git a/libs/sdk-bindings/src/uniffi_binding.rs b/libs/sdk-bindings/src/uniffi_binding.rs index ccc4dcd7a..1de3ff14d 100644 --- a/libs/sdk-bindings/src/uniffi_binding.rs +++ b/libs/sdk-bindings/src/uniffi_binding.rs @@ -5,12 +5,12 @@ use breez_sdk_core::lnurl::pay::{LnUrlPayResult, LnUrlPaySuccessData}; use breez_sdk_core::{ error::*, mnemonic_to_seed as sdk_mnemonic_to_seed, parse as sdk_parse_input, parse_invoice as sdk_parse_invoice, AesSuccessActionDataDecrypted, AesSuccessActionDataResult, - Amount, BackupFailedData, BackupStatus, BitcoinAddressData, BreezEvent, BreezServices, + BackupFailedData, BackupStatus, BitcoinAddressData, BreezEvent, BreezServices, BuyBitcoinProvider, BuyBitcoinRequest, BuyBitcoinResponse, ChannelState, CheckMessageRequest, CheckMessageResponse, ClosedChannelPaymentDetails, Config, ConfigureNodeRequest, ConnectRequest, CurrencyInfo, EnvironmentType, EventListener, FeeratePreset, FiatCurrency, GreenlightCredentials, GreenlightDeviceCredentials, GreenlightNodeConfig, HealthCheckStatus, - InputType, InvoicePaidDetails, LNInvoice, LNOffer, ListPaymentsRequest, LnPaymentDetails, + InputType, InvoicePaidDetails, LNInvoice, ListPaymentsRequest, LnPaymentDetails, LnUrlAuthError, LnUrlAuthRequestData, LnUrlCallbackStatus, LnUrlErrorData, LnUrlPayError, LnUrlPayErrorData, LnUrlPayRequest, LnUrlPayRequestData, LnUrlWithdrawError, LnUrlWithdrawRequest, LnUrlWithdrawRequestData, LnUrlWithdrawResult, LnUrlWithdrawSuccessData, diff --git a/libs/sdk-common/src/input_parser.rs b/libs/sdk-common/src/input_parser.rs index 5d2753eb9..d642cc268 100644 --- a/libs/sdk-common/src/input_parser.rs +++ b/libs/sdk-common/src/input_parser.rs @@ -1,12 +1,11 @@ +use std::collections::HashMap; use std::str::FromStr; use ::bip21::Uri; use anyhow::{anyhow, Result}; use bitcoin::bech32; use bitcoin::bech32::FromBase32; -use lightning::offers::offer::Offer; use serde::{Deserialize, Serialize}; -use std::collections::HashMap; use LnUrlRequestData::*; use crate::prelude::*; @@ -186,24 +185,6 @@ pub async fn parse(input: &str) -> Result { return Ok(InputType::Bolt11 { invoice }); } - if let Ok(offer) = input.parse::() { - return Ok(InputType::Bolt12 { - offer: LNOffer { - bolt12: input.to_string(), - chains: offer - .chains() - .iter() - .map(|chain| chain.to_string()) - .collect(), - amount: offer.amount().map(|amount| amount.clone().into()), - description: offer.description().to_string(), - absolute_expiry: offer.absolute_expiry().map(|expiry| expiry.as_secs()), - issuer: offer.issuer().map(|s| s.to_string()), - signing_pubkey: offer.signing_pubkey().to_string(), - }, - }); - } - // Public key serialized in compressed form (66 hex chars) if let Ok(_node_id) = bitcoin::secp256k1::PublicKey::from_str(input) { return Ok(InputType::NodeId { @@ -437,6 +418,7 @@ pub enum InputType { Bolt11 { invoice: LNInvoice, }, + #[cfg(feature = "liquid")] Bolt12 { offer: LNOffer, }, @@ -948,19 +930,6 @@ pub(crate) mod tests { Ok(()) } - #[tokio::test] - async fn test_bolt12_offer() -> Result<()> { - let bolt12_offer = "lno1pqpzwyq2p32x2um5ypmx2cm5dae8x93pqthvwfzadd7jejes8q9lhc4rvjxd022zv5l44g6qah82ru5rdpnpj"; - - assert!(matches!( - parse(bolt12_offer).await?, - InputType::Bolt12 { offer } - if offer == bolt12_offer - )); - - Ok(()) - } - #[tokio::test] async fn test_url() -> Result<()> { assert!(matches!( diff --git a/libs/sdk-common/src/invoice.rs b/libs/sdk-common/src/invoice.rs index c59a6de78..fe6b4c390 100644 --- a/libs/sdk-common/src/invoice.rs +++ b/libs/sdk-common/src/invoice.rs @@ -101,48 +101,6 @@ fn format_short_channel_id(id: u64) -> String { format!("{block_num}x{tx_num}x{tx_out}") } -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] -pub enum Amount { - Bitcoin { - amount_msat: u64, - }, - Currency { - // Reference to [FiatCurrency.id] - iso4217_code: String, - fractional_amount: u64, - }, -} - -impl From for Amount { - fn from(amount: lightning::offers::offer::Amount) -> Self { - match amount { - lightning::offers::offer::Amount::Bitcoin { amount_msats } => Amount::Bitcoin { - amount_msat: amount_msats, - }, - lightning::offers::offer::Amount::Currency { - iso4217_code, - amount, - } => Amount::Currency { - iso4217_code: String::from_utf8(iso4217_code.to_vec()) - .expect("Expecting a valid ISO 4217 character sequence"), - fractional_amount: amount, - }, - } - } -} - -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] -pub struct LNOffer { - pub bolt12: String, - pub chains: Vec, - pub amount: Option, - pub description: String, - pub absolute_expiry: Option, - pub issuer: Option, - pub signing_pubkey: String, - // pub paths: Vec, -} - /// Wrapper for a BOLT11 LN invoice #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] pub struct LNInvoice { diff --git a/libs/sdk-core/src/binding.rs b/libs/sdk-core/src/binding.rs index 8c74cd0b2..d4636cce8 100644 --- a/libs/sdk-core/src/binding.rs +++ b/libs/sdk-core/src/binding.rs @@ -19,12 +19,12 @@ use log::{Level, LevelFilter, Metadata, Record}; use once_cell::sync::{Lazy, OnceCell}; use sdk_common::invoice; pub use sdk_common::prelude::{ - parse, AesSuccessActionDataDecrypted, AesSuccessActionDataResult, Amount, BitcoinAddressData, - CurrencyInfo, FiatCurrency, InputType, LNInvoice, LNOffer, LnUrlAuthRequestData, - LnUrlCallbackStatus, LnUrlError, LnUrlErrorData, LnUrlPayErrorData, LnUrlPayRequest, - LnUrlPayRequestData, LnUrlWithdrawRequest, LnUrlWithdrawRequestData, LnUrlWithdrawResult, - LnUrlWithdrawSuccessData, LocaleOverrides, LocalizedName, MessageSuccessActionData, Network, - Rate, RouteHint, RouteHintHop, SuccessActionProcessed, Symbol, UrlSuccessActionData, + parse, AesSuccessActionDataDecrypted, AesSuccessActionDataResult, BitcoinAddressData, + CurrencyInfo, FiatCurrency, InputType, LNInvoice, LnUrlAuthRequestData, LnUrlCallbackStatus, + LnUrlError, LnUrlErrorData, LnUrlPayErrorData, LnUrlPayRequest, LnUrlPayRequestData, + LnUrlWithdrawRequest, LnUrlWithdrawRequestData, LnUrlWithdrawResult, LnUrlWithdrawSuccessData, + LocaleOverrides, LocalizedName, MessageSuccessActionData, Network, Rate, RouteHint, + RouteHintHop, SuccessActionProcessed, Symbol, UrlSuccessActionData, }; use tokio::sync::Mutex; @@ -158,33 +158,10 @@ pub struct _LnUrlWithdrawRequestData { pub max_withdrawable: u64, } -#[frb(mirror(Amount))] -pub enum _Amount { - Bitcoin { - amount_msat: u64, - }, - Currency { - iso4217_code: String, - fractional_amount: u64, - }, -} - -#[frb(mirror(LNOffer))] -pub struct _LNOffer { - pub bolt12: String, - pub chains: Vec, - pub amount: Option, - pub description: String, - pub absolute_expiry: Option, - pub issuer: Option, - pub signing_pubkey: String, -} - #[frb(mirror(InputType))] pub enum _InputType { BitcoinAddress { address: BitcoinAddressData }, Bolt11 { invoice: LNInvoice }, - Bolt12 { offer: LNOffer }, NodeId { node_id: String }, Url { url: String }, LnUrlPay { data: LnUrlPayRequestData }, diff --git a/libs/sdk-core/src/bridge_generated.rs b/libs/sdk-core/src/bridge_generated.rs index 55680ab57..5d6c32529 100644 --- a/libs/sdk-core/src/bridge_generated.rs +++ b/libs/sdk-core/src/bridge_generated.rs @@ -910,9 +910,6 @@ pub struct mirror_AesSuccessActionDataDecrypted(AesSuccessActionDataDecrypted); #[derive(Clone)] pub struct mirror_AesSuccessActionDataResult(AesSuccessActionDataResult); -#[derive(Clone)] -pub struct mirror_Amount(Amount); - #[derive(Clone)] pub struct mirror_BitcoinAddressData(BitcoinAddressData); @@ -928,9 +925,6 @@ pub struct mirror_InputType(InputType); #[derive(Clone)] pub struct mirror_LNInvoice(LNInvoice); -#[derive(Clone)] -pub struct mirror_LNOffer(LNOffer); - #[derive(Clone)] pub struct mirror_LnUrlAuthRequestData(LnUrlAuthRequestData); @@ -1001,18 +995,6 @@ const _: fn() = || { let _: String = reason; } } - match None::.unwrap() { - Amount::Bitcoin { amount_msat } => { - let _: u64 = amount_msat; - } - Amount::Currency { - iso4217_code, - fractional_amount, - } => { - let _: String = iso4217_code; - let _: u64 = fractional_amount; - } - } { let BitcoinAddressData = None::.unwrap(); let _: String = BitcoinAddressData.address; @@ -1043,9 +1025,6 @@ const _: fn() = || { InputType::Bolt11 { invoice } => { let _: LNInvoice = invoice; } - InputType::Bolt12 { offer } => { - let _: LNOffer = offer; - } InputType::NodeId { node_id } => { let _: String = node_id; } @@ -1080,16 +1059,6 @@ const _: fn() = || { let _: Vec = LNInvoice.payment_secret; let _: u64 = LNInvoice.min_final_cltv_expiry_delta; } - { - let LNOffer = None::.unwrap(); - let _: String = LNOffer.bolt12; - let _: Vec = LNOffer.chains; - let _: Option = LNOffer.amount; - let _: String = LNOffer.description; - let _: Option = LNOffer.absolute_expiry; - let _: Option = LNOffer.issuer; - let _: String = LNOffer.signing_pubkey; - } { let LnUrlAuthRequestData = None::.unwrap(); let _: String = LnUrlAuthRequestData.k1; @@ -1365,31 +1334,6 @@ impl rust2dart::IntoIntoDart for AesSuccessAc } } -impl support::IntoDart for mirror_Amount { - fn into_dart(self) -> support::DartAbi { - match self.0 { - Amount::Bitcoin { amount_msat } => { - vec![0.into_dart(), amount_msat.into_into_dart().into_dart()] - } - Amount::Currency { - iso4217_code, - fractional_amount, - } => vec![ - 1.into_dart(), - iso4217_code.into_into_dart().into_dart(), - fractional_amount.into_into_dart().into_dart(), - ], - } - .into_dart() - } -} -impl support::IntoDartExceptPrimitive for mirror_Amount {} -impl rust2dart::IntoIntoDart for Amount { - fn into_into_dart(self) -> mirror_Amount { - mirror_Amount(self) - } -} - impl support::IntoDart for BackupFailedData { fn into_dart(self) -> support::DartAbi { vec![self.error.into_into_dart().into_dart()].into_dart() @@ -1669,18 +1613,17 @@ impl support::IntoDart for mirror_InputType { InputType::Bolt11 { invoice } => { vec![1.into_dart(), invoice.into_into_dart().into_dart()] } - InputType::Bolt12 { offer } => vec![2.into_dart(), offer.into_into_dart().into_dart()], InputType::NodeId { node_id } => { - vec![3.into_dart(), node_id.into_into_dart().into_dart()] + vec![2.into_dart(), node_id.into_into_dart().into_dart()] } - InputType::Url { url } => vec![4.into_dart(), url.into_into_dart().into_dart()], - InputType::LnUrlPay { data } => vec![5.into_dart(), data.into_into_dart().into_dart()], + InputType::Url { url } => vec![3.into_dart(), url.into_into_dart().into_dart()], + InputType::LnUrlPay { data } => vec![4.into_dart(), data.into_into_dart().into_dart()], InputType::LnUrlWithdraw { data } => { - vec![6.into_dart(), data.into_into_dart().into_dart()] + vec![5.into_dart(), data.into_into_dart().into_dart()] } - InputType::LnUrlAuth { data } => vec![7.into_dart(), data.into_into_dart().into_dart()], + InputType::LnUrlAuth { data } => vec![6.into_dart(), data.into_into_dart().into_dart()], InputType::LnUrlError { data } => { - vec![8.into_dart(), data.into_into_dart().into_dart()] + vec![7.into_dart(), data.into_into_dart().into_dart()] } } .into_dart() @@ -1739,27 +1682,6 @@ impl rust2dart::IntoIntoDart for LNInvoice { } } -impl support::IntoDart for mirror_LNOffer { - fn into_dart(self) -> support::DartAbi { - vec![ - self.0.bolt12.into_into_dart().into_dart(), - self.0.chains.into_into_dart().into_dart(), - self.0.amount.map(|v| mirror_Amount(v)).into_dart(), - self.0.description.into_into_dart().into_dart(), - self.0.absolute_expiry.into_dart(), - self.0.issuer.into_dart(), - self.0.signing_pubkey.into_into_dart().into_dart(), - ] - .into_dart() - } -} -impl support::IntoDartExceptPrimitive for mirror_LNOffer {} -impl rust2dart::IntoIntoDart for LNOffer { - fn into_into_dart(self) -> mirror_LNOffer { - mirror_LNOffer(self) - } -} - impl support::IntoDart for LnPaymentDetails { fn into_dart(self) -> support::DartAbi { vec![ diff --git a/libs/sdk-flutter/lib/bridge_generated.dart b/libs/sdk-flutter/lib/bridge_generated.dart index 30d9cdb21..7ac7d374a 100644 --- a/libs/sdk-flutter/lib/bridge_generated.dart +++ b/libs/sdk-flutter/lib/bridge_generated.dart @@ -349,17 +349,6 @@ sealed class AesSuccessActionDataResult with _$AesSuccessActionDataResult { }) = AesSuccessActionDataResult_ErrorStatus; } -@freezed -sealed class Amount with _$Amount { - const factory Amount.bitcoin({ - required int amountMsat, - }) = Amount_Bitcoin; - const factory Amount.currency({ - required String iso4217Code, - required int fractionalAmount, - }) = Amount_Currency; -} - class BackupFailedData { final String error; @@ -681,9 +670,6 @@ sealed class InputType with _$InputType { const factory InputType.bolt11({ required LNInvoice invoice, }) = InputType_Bolt11; - const factory InputType.bolt12({ - required LNOffer offer, - }) = InputType_Bolt12; const factory InputType.nodeId({ required String nodeId, }) = InputType_NodeId; @@ -772,26 +758,6 @@ class LNInvoice { }); } -class LNOffer { - final String bolt12; - final List chains; - final Amount? amount; - final String description; - final int? absoluteExpiry; - final String? issuer; - final String signingPubkey; - - const LNOffer({ - required this.bolt12, - required this.chains, - this.amount, - required this.description, - this.absoluteExpiry, - this.issuer, - required this.signingPubkey, - }); -} - /// Details of a LN payment, as included in a [Payment] class LnPaymentDetails { final String paymentHash; @@ -3127,22 +3093,6 @@ class BreezSdkCoreImpl implements BreezSdkCore { } } - Amount _wire2api_amount(dynamic raw) { - switch (raw[0]) { - case 0: - return Amount_Bitcoin( - amountMsat: _wire2api_u64(raw[1]), - ); - case 1: - return Amount_Currency( - iso4217Code: _wire2api_String(raw[1]), - fractionalAmount: _wire2api_u64(raw[2]), - ); - default: - throw Exception("unreachable"); - } - } - BackupFailedData _wire2api_backup_failed_data(dynamic raw) { final arr = raw as List; if (arr.length != 1) throw Exception('unexpected arr length: expect 1 but see ${arr.length}'); @@ -3184,10 +3134,6 @@ class BreezSdkCoreImpl implements BreezSdkCore { return _wire2api_aes_success_action_data_result(raw); } - Amount _wire2api_box_autoadd_amount(dynamic raw) { - return _wire2api_amount(raw); - } - BackupFailedData _wire2api_box_autoadd_backup_failed_data(dynamic raw) { return _wire2api_backup_failed_data(raw); } @@ -3224,10 +3170,6 @@ class BreezSdkCoreImpl implements BreezSdkCore { return _wire2api_ln_invoice(raw); } - LNOffer _wire2api_box_autoadd_ln_offer(dynamic raw) { - return _wire2api_ln_offer(raw); - } - LnPaymentDetails _wire2api_box_autoadd_ln_payment_details(dynamic raw) { return _wire2api_ln_payment_details(raw); } @@ -3479,30 +3421,26 @@ class BreezSdkCoreImpl implements BreezSdkCore { invoice: _wire2api_box_autoadd_ln_invoice(raw[1]), ); case 2: - return InputType_Bolt12( - offer: _wire2api_box_autoadd_ln_offer(raw[1]), - ); - case 3: return InputType_NodeId( nodeId: _wire2api_String(raw[1]), ); - case 4: + case 3: return InputType_Url( url: _wire2api_String(raw[1]), ); - case 5: + case 4: return InputType_LnUrlPay( data: _wire2api_box_autoadd_ln_url_pay_request_data(raw[1]), ); - case 6: + case 5: return InputType_LnUrlWithdraw( data: _wire2api_box_autoadd_ln_url_withdraw_request_data(raw[1]), ); - case 7: + case 6: return InputType_LnUrlAuth( data: _wire2api_box_autoadd_ln_url_auth_request_data(raw[1]), ); - case 8: + case 7: return InputType_LnUrlError( data: _wire2api_box_autoadd_ln_url_error_data(raw[1]), ); @@ -3588,20 +3526,6 @@ class BreezSdkCoreImpl implements BreezSdkCore { ); } - LNOffer _wire2api_ln_offer(dynamic raw) { - final arr = raw as List; - if (arr.length != 7) throw Exception('unexpected arr length: expect 7 but see ${arr.length}'); - return LNOffer( - bolt12: _wire2api_String(arr[0]), - chains: _wire2api_StringList(arr[1]), - amount: _wire2api_opt_box_autoadd_amount(arr[2]), - description: _wire2api_String(arr[3]), - absoluteExpiry: _wire2api_opt_box_autoadd_u64(arr[4]), - issuer: _wire2api_opt_String(arr[5]), - signingPubkey: _wire2api_String(arr[6]), - ); - } - LnPaymentDetails _wire2api_ln_payment_details(dynamic raw) { final arr = raw as List; if (arr.length != 16) throw Exception('unexpected arr length: expect 16 but see ${arr.length}'); @@ -3905,10 +3829,6 @@ class BreezSdkCoreImpl implements BreezSdkCore { return raw == null ? null : _wire2api_StringList(raw); } - Amount? _wire2api_opt_box_autoadd_amount(dynamic raw) { - return raw == null ? null : _wire2api_box_autoadd_amount(raw); - } - bool? _wire2api_opt_box_autoadd_bool(dynamic raw) { return raw == null ? null : _wire2api_box_autoadd_bool(raw); } diff --git a/libs/sdk-flutter/lib/bridge_generated.freezed.dart b/libs/sdk-flutter/lib/bridge_generated.freezed.dart index e37ad2035..15ddfc256 100644 --- a/libs/sdk-flutter/lib/bridge_generated.freezed.dart +++ b/libs/sdk-flutter/lib/bridge_generated.freezed.dart @@ -347,335 +347,6 @@ abstract class AesSuccessActionDataResult_ErrorStatus implements AesSuccessActio get copyWith => throw _privateConstructorUsedError; } -/// @nodoc -mixin _$Amount { - @optionalTypeArgs - TResult when({ - required TResult Function(int amountMsat) bitcoin, - required TResult Function(String iso4217Code, int fractionalAmount) currency, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(int amountMsat)? bitcoin, - TResult? Function(String iso4217Code, int fractionalAmount)? currency, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(int amountMsat)? bitcoin, - TResult Function(String iso4217Code, int fractionalAmount)? currency, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(Amount_Bitcoin value) bitcoin, - required TResult Function(Amount_Currency value) currency, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(Amount_Bitcoin value)? bitcoin, - TResult? Function(Amount_Currency value)? currency, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Amount_Bitcoin value)? bitcoin, - TResult Function(Amount_Currency value)? currency, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $AmountCopyWith<$Res> { - factory $AmountCopyWith(Amount value, $Res Function(Amount) then) = _$AmountCopyWithImpl<$Res, Amount>; -} - -/// @nodoc -class _$AmountCopyWithImpl<$Res, $Val extends Amount> implements $AmountCopyWith<$Res> { - _$AmountCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; -} - -/// @nodoc -abstract class _$$Amount_BitcoinImplCopyWith<$Res> { - factory _$$Amount_BitcoinImplCopyWith( - _$Amount_BitcoinImpl value, $Res Function(_$Amount_BitcoinImpl) then) = - __$$Amount_BitcoinImplCopyWithImpl<$Res>; - @useResult - $Res call({int amountMsat}); -} - -/// @nodoc -class __$$Amount_BitcoinImplCopyWithImpl<$Res> extends _$AmountCopyWithImpl<$Res, _$Amount_BitcoinImpl> - implements _$$Amount_BitcoinImplCopyWith<$Res> { - __$$Amount_BitcoinImplCopyWithImpl(_$Amount_BitcoinImpl _value, $Res Function(_$Amount_BitcoinImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? amountMsat = null, - }) { - return _then(_$Amount_BitcoinImpl( - amountMsat: null == amountMsat - ? _value.amountMsat - : amountMsat // ignore: cast_nullable_to_non_nullable - as int, - )); - } -} - -/// @nodoc - -class _$Amount_BitcoinImpl implements Amount_Bitcoin { - const _$Amount_BitcoinImpl({required this.amountMsat}); - - @override - final int amountMsat; - - @override - String toString() { - return 'Amount.bitcoin(amountMsat: $amountMsat)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$Amount_BitcoinImpl && - (identical(other.amountMsat, amountMsat) || other.amountMsat == amountMsat)); - } - - @override - int get hashCode => Object.hash(runtimeType, amountMsat); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$Amount_BitcoinImplCopyWith<_$Amount_BitcoinImpl> get copyWith => - __$$Amount_BitcoinImplCopyWithImpl<_$Amount_BitcoinImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(int amountMsat) bitcoin, - required TResult Function(String iso4217Code, int fractionalAmount) currency, - }) { - return bitcoin(amountMsat); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(int amountMsat)? bitcoin, - TResult? Function(String iso4217Code, int fractionalAmount)? currency, - }) { - return bitcoin?.call(amountMsat); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(int amountMsat)? bitcoin, - TResult Function(String iso4217Code, int fractionalAmount)? currency, - required TResult orElse(), - }) { - if (bitcoin != null) { - return bitcoin(amountMsat); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(Amount_Bitcoin value) bitcoin, - required TResult Function(Amount_Currency value) currency, - }) { - return bitcoin(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(Amount_Bitcoin value)? bitcoin, - TResult? Function(Amount_Currency value)? currency, - }) { - return bitcoin?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Amount_Bitcoin value)? bitcoin, - TResult Function(Amount_Currency value)? currency, - required TResult orElse(), - }) { - if (bitcoin != null) { - return bitcoin(this); - } - return orElse(); - } -} - -abstract class Amount_Bitcoin implements Amount { - const factory Amount_Bitcoin({required final int amountMsat}) = _$Amount_BitcoinImpl; - - int get amountMsat; - @JsonKey(ignore: true) - _$$Amount_BitcoinImplCopyWith<_$Amount_BitcoinImpl> get copyWith => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class _$$Amount_CurrencyImplCopyWith<$Res> { - factory _$$Amount_CurrencyImplCopyWith( - _$Amount_CurrencyImpl value, $Res Function(_$Amount_CurrencyImpl) then) = - __$$Amount_CurrencyImplCopyWithImpl<$Res>; - @useResult - $Res call({String iso4217Code, int fractionalAmount}); -} - -/// @nodoc -class __$$Amount_CurrencyImplCopyWithImpl<$Res> extends _$AmountCopyWithImpl<$Res, _$Amount_CurrencyImpl> - implements _$$Amount_CurrencyImplCopyWith<$Res> { - __$$Amount_CurrencyImplCopyWithImpl( - _$Amount_CurrencyImpl _value, $Res Function(_$Amount_CurrencyImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? iso4217Code = null, - Object? fractionalAmount = null, - }) { - return _then(_$Amount_CurrencyImpl( - iso4217Code: null == iso4217Code - ? _value.iso4217Code - : iso4217Code // ignore: cast_nullable_to_non_nullable - as String, - fractionalAmount: null == fractionalAmount - ? _value.fractionalAmount - : fractionalAmount // ignore: cast_nullable_to_non_nullable - as int, - )); - } -} - -/// @nodoc - -class _$Amount_CurrencyImpl implements Amount_Currency { - const _$Amount_CurrencyImpl({required this.iso4217Code, required this.fractionalAmount}); - - @override - final String iso4217Code; - @override - final int fractionalAmount; - - @override - String toString() { - return 'Amount.currency(iso4217Code: $iso4217Code, fractionalAmount: $fractionalAmount)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$Amount_CurrencyImpl && - (identical(other.iso4217Code, iso4217Code) || other.iso4217Code == iso4217Code) && - (identical(other.fractionalAmount, fractionalAmount) || - other.fractionalAmount == fractionalAmount)); - } - - @override - int get hashCode => Object.hash(runtimeType, iso4217Code, fractionalAmount); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$Amount_CurrencyImplCopyWith<_$Amount_CurrencyImpl> get copyWith => - __$$Amount_CurrencyImplCopyWithImpl<_$Amount_CurrencyImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(int amountMsat) bitcoin, - required TResult Function(String iso4217Code, int fractionalAmount) currency, - }) { - return currency(iso4217Code, fractionalAmount); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(int amountMsat)? bitcoin, - TResult? Function(String iso4217Code, int fractionalAmount)? currency, - }) { - return currency?.call(iso4217Code, fractionalAmount); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(int amountMsat)? bitcoin, - TResult Function(String iso4217Code, int fractionalAmount)? currency, - required TResult orElse(), - }) { - if (currency != null) { - return currency(iso4217Code, fractionalAmount); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(Amount_Bitcoin value) bitcoin, - required TResult Function(Amount_Currency value) currency, - }) { - return currency(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(Amount_Bitcoin value)? bitcoin, - TResult? Function(Amount_Currency value)? currency, - }) { - return currency?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Amount_Bitcoin value)? bitcoin, - TResult Function(Amount_Currency value)? currency, - required TResult orElse(), - }) { - if (currency != null) { - return currency(this); - } - return orElse(); - } -} - -abstract class Amount_Currency implements Amount { - const factory Amount_Currency({required final String iso4217Code, required final int fractionalAmount}) = - _$Amount_CurrencyImpl; - - String get iso4217Code; - int get fractionalAmount; - @JsonKey(ignore: true) - _$$Amount_CurrencyImplCopyWith<_$Amount_CurrencyImpl> get copyWith => throw _privateConstructorUsedError; -} - /// @nodoc mixin _$BreezEvent { @optionalTypeArgs @@ -2509,7 +2180,6 @@ mixin _$InputType { TResult when({ required TResult Function(BitcoinAddressData address) bitcoinAddress, required TResult Function(LNInvoice invoice) bolt11, - required TResult Function(LNOffer offer) bolt12, required TResult Function(String nodeId) nodeId, required TResult Function(String url) url, required TResult Function(LnUrlPayRequestData data) lnUrlPay, @@ -2522,7 +2192,6 @@ mixin _$InputType { TResult? whenOrNull({ TResult? Function(BitcoinAddressData address)? bitcoinAddress, TResult? Function(LNInvoice invoice)? bolt11, - TResult? Function(LNOffer offer)? bolt12, TResult? Function(String nodeId)? nodeId, TResult? Function(String url)? url, TResult? Function(LnUrlPayRequestData data)? lnUrlPay, @@ -2535,7 +2204,6 @@ mixin _$InputType { TResult maybeWhen({ TResult Function(BitcoinAddressData address)? bitcoinAddress, TResult Function(LNInvoice invoice)? bolt11, - TResult Function(LNOffer offer)? bolt12, TResult Function(String nodeId)? nodeId, TResult Function(String url)? url, TResult Function(LnUrlPayRequestData data)? lnUrlPay, @@ -2549,7 +2217,6 @@ mixin _$InputType { TResult map({ required TResult Function(InputType_BitcoinAddress value) bitcoinAddress, required TResult Function(InputType_Bolt11 value) bolt11, - required TResult Function(InputType_Bolt12 value) bolt12, required TResult Function(InputType_NodeId value) nodeId, required TResult Function(InputType_Url value) url, required TResult Function(InputType_LnUrlPay value) lnUrlPay, @@ -2562,7 +2229,6 @@ mixin _$InputType { TResult? mapOrNull({ TResult? Function(InputType_BitcoinAddress value)? bitcoinAddress, TResult? Function(InputType_Bolt11 value)? bolt11, - TResult? Function(InputType_Bolt12 value)? bolt12, TResult? Function(InputType_NodeId value)? nodeId, TResult? Function(InputType_Url value)? url, TResult? Function(InputType_LnUrlPay value)? lnUrlPay, @@ -2575,7 +2241,6 @@ mixin _$InputType { TResult maybeMap({ TResult Function(InputType_BitcoinAddress value)? bitcoinAddress, TResult Function(InputType_Bolt11 value)? bolt11, - TResult Function(InputType_Bolt12 value)? bolt12, TResult Function(InputType_NodeId value)? nodeId, TResult Function(InputType_Url value)? url, TResult Function(InputType_LnUrlPay value)? lnUrlPay, @@ -2669,7 +2334,6 @@ class _$InputType_BitcoinAddressImpl implements InputType_BitcoinAddress { TResult when({ required TResult Function(BitcoinAddressData address) bitcoinAddress, required TResult Function(LNInvoice invoice) bolt11, - required TResult Function(LNOffer offer) bolt12, required TResult Function(String nodeId) nodeId, required TResult Function(String url) url, required TResult Function(LnUrlPayRequestData data) lnUrlPay, @@ -2685,7 +2349,6 @@ class _$InputType_BitcoinAddressImpl implements InputType_BitcoinAddress { TResult? whenOrNull({ TResult? Function(BitcoinAddressData address)? bitcoinAddress, TResult? Function(LNInvoice invoice)? bolt11, - TResult? Function(LNOffer offer)? bolt12, TResult? Function(String nodeId)? nodeId, TResult? Function(String url)? url, TResult? Function(LnUrlPayRequestData data)? lnUrlPay, @@ -2701,7 +2364,6 @@ class _$InputType_BitcoinAddressImpl implements InputType_BitcoinAddress { TResult maybeWhen({ TResult Function(BitcoinAddressData address)? bitcoinAddress, TResult Function(LNInvoice invoice)? bolt11, - TResult Function(LNOffer offer)? bolt12, TResult Function(String nodeId)? nodeId, TResult Function(String url)? url, TResult Function(LnUrlPayRequestData data)? lnUrlPay, @@ -2721,7 +2383,6 @@ class _$InputType_BitcoinAddressImpl implements InputType_BitcoinAddress { TResult map({ required TResult Function(InputType_BitcoinAddress value) bitcoinAddress, required TResult Function(InputType_Bolt11 value) bolt11, - required TResult Function(InputType_Bolt12 value) bolt12, required TResult Function(InputType_NodeId value) nodeId, required TResult Function(InputType_Url value) url, required TResult Function(InputType_LnUrlPay value) lnUrlPay, @@ -2737,7 +2398,6 @@ class _$InputType_BitcoinAddressImpl implements InputType_BitcoinAddress { TResult? mapOrNull({ TResult? Function(InputType_BitcoinAddress value)? bitcoinAddress, TResult? Function(InputType_Bolt11 value)? bolt11, - TResult? Function(InputType_Bolt12 value)? bolt12, TResult? Function(InputType_NodeId value)? nodeId, TResult? Function(InputType_Url value)? url, TResult? Function(InputType_LnUrlPay value)? lnUrlPay, @@ -2753,7 +2413,6 @@ class _$InputType_BitcoinAddressImpl implements InputType_BitcoinAddress { TResult maybeMap({ TResult Function(InputType_BitcoinAddress value)? bitcoinAddress, TResult Function(InputType_Bolt11 value)? bolt11, - TResult Function(InputType_Bolt12 value)? bolt12, TResult Function(InputType_NodeId value)? nodeId, TResult Function(InputType_Url value)? url, TResult Function(InputType_LnUrlPay value)? lnUrlPay, @@ -2844,7 +2503,6 @@ class _$InputType_Bolt11Impl implements InputType_Bolt11 { TResult when({ required TResult Function(BitcoinAddressData address) bitcoinAddress, required TResult Function(LNInvoice invoice) bolt11, - required TResult Function(LNOffer offer) bolt12, required TResult Function(String nodeId) nodeId, required TResult Function(String url) url, required TResult Function(LnUrlPayRequestData data) lnUrlPay, @@ -2860,7 +2518,6 @@ class _$InputType_Bolt11Impl implements InputType_Bolt11 { TResult? whenOrNull({ TResult? Function(BitcoinAddressData address)? bitcoinAddress, TResult? Function(LNInvoice invoice)? bolt11, - TResult? Function(LNOffer offer)? bolt12, TResult? Function(String nodeId)? nodeId, TResult? Function(String url)? url, TResult? Function(LnUrlPayRequestData data)? lnUrlPay, @@ -2876,7 +2533,6 @@ class _$InputType_Bolt11Impl implements InputType_Bolt11 { TResult maybeWhen({ TResult Function(BitcoinAddressData address)? bitcoinAddress, TResult Function(LNInvoice invoice)? bolt11, - TResult Function(LNOffer offer)? bolt12, TResult Function(String nodeId)? nodeId, TResult Function(String url)? url, TResult Function(LnUrlPayRequestData data)? lnUrlPay, @@ -2896,7 +2552,6 @@ class _$InputType_Bolt11Impl implements InputType_Bolt11 { TResult map({ required TResult Function(InputType_BitcoinAddress value) bitcoinAddress, required TResult Function(InputType_Bolt11 value) bolt11, - required TResult Function(InputType_Bolt12 value) bolt12, required TResult Function(InputType_NodeId value) nodeId, required TResult Function(InputType_Url value) url, required TResult Function(InputType_LnUrlPay value) lnUrlPay, @@ -2912,7 +2567,6 @@ class _$InputType_Bolt11Impl implements InputType_Bolt11 { TResult? mapOrNull({ TResult? Function(InputType_BitcoinAddress value)? bitcoinAddress, TResult? Function(InputType_Bolt11 value)? bolt11, - TResult? Function(InputType_Bolt12 value)? bolt12, TResult? Function(InputType_NodeId value)? nodeId, TResult? Function(InputType_Url value)? url, TResult? Function(InputType_LnUrlPay value)? lnUrlPay, @@ -2928,7 +2582,6 @@ class _$InputType_Bolt11Impl implements InputType_Bolt11 { TResult maybeMap({ TResult Function(InputType_BitcoinAddress value)? bitcoinAddress, TResult Function(InputType_Bolt11 value)? bolt11, - TResult Function(InputType_Bolt12 value)? bolt12, TResult Function(InputType_NodeId value)? nodeId, TResult Function(InputType_Url value)? url, TResult Function(InputType_LnUrlPay value)? lnUrlPay, @@ -2952,179 +2605,6 @@ abstract class InputType_Bolt11 implements InputType { _$$InputType_Bolt11ImplCopyWith<_$InputType_Bolt11Impl> get copyWith => throw _privateConstructorUsedError; } -/// @nodoc -abstract class _$$InputType_Bolt12ImplCopyWith<$Res> { - factory _$$InputType_Bolt12ImplCopyWith( - _$InputType_Bolt12Impl value, $Res Function(_$InputType_Bolt12Impl) then) = - __$$InputType_Bolt12ImplCopyWithImpl<$Res>; - @useResult - $Res call({LNOffer offer}); -} - -/// @nodoc -class __$$InputType_Bolt12ImplCopyWithImpl<$Res> extends _$InputTypeCopyWithImpl<$Res, _$InputType_Bolt12Impl> - implements _$$InputType_Bolt12ImplCopyWith<$Res> { - __$$InputType_Bolt12ImplCopyWithImpl( - _$InputType_Bolt12Impl _value, $Res Function(_$InputType_Bolt12Impl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? offer = null, - }) { - return _then(_$InputType_Bolt12Impl( - offer: null == offer - ? _value.offer - : offer // ignore: cast_nullable_to_non_nullable - as LNOffer, - )); - } -} - -/// @nodoc - -class _$InputType_Bolt12Impl implements InputType_Bolt12 { - const _$InputType_Bolt12Impl({required this.offer}); - - @override - final LNOffer offer; - - @override - String toString() { - return 'InputType.bolt12(offer: $offer)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$InputType_Bolt12Impl && - (identical(other.offer, offer) || other.offer == offer)); - } - - @override - int get hashCode => Object.hash(runtimeType, offer); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$InputType_Bolt12ImplCopyWith<_$InputType_Bolt12Impl> get copyWith => - __$$InputType_Bolt12ImplCopyWithImpl<_$InputType_Bolt12Impl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(BitcoinAddressData address) bitcoinAddress, - required TResult Function(LNInvoice invoice) bolt11, - required TResult Function(LNOffer offer) bolt12, - required TResult Function(String nodeId) nodeId, - required TResult Function(String url) url, - required TResult Function(LnUrlPayRequestData data) lnUrlPay, - required TResult Function(LnUrlWithdrawRequestData data) lnUrlWithdraw, - required TResult Function(LnUrlAuthRequestData data) lnUrlAuth, - required TResult Function(LnUrlErrorData data) lnUrlError, - }) { - return bolt12(offer); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(BitcoinAddressData address)? bitcoinAddress, - TResult? Function(LNInvoice invoice)? bolt11, - TResult? Function(LNOffer offer)? bolt12, - TResult? Function(String nodeId)? nodeId, - TResult? Function(String url)? url, - TResult? Function(LnUrlPayRequestData data)? lnUrlPay, - TResult? Function(LnUrlWithdrawRequestData data)? lnUrlWithdraw, - TResult? Function(LnUrlAuthRequestData data)? lnUrlAuth, - TResult? Function(LnUrlErrorData data)? lnUrlError, - }) { - return bolt12?.call(offer); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(BitcoinAddressData address)? bitcoinAddress, - TResult Function(LNInvoice invoice)? bolt11, - TResult Function(LNOffer offer)? bolt12, - TResult Function(String nodeId)? nodeId, - TResult Function(String url)? url, - TResult Function(LnUrlPayRequestData data)? lnUrlPay, - TResult Function(LnUrlWithdrawRequestData data)? lnUrlWithdraw, - TResult Function(LnUrlAuthRequestData data)? lnUrlAuth, - TResult Function(LnUrlErrorData data)? lnUrlError, - required TResult orElse(), - }) { - if (bolt12 != null) { - return bolt12(offer); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(InputType_BitcoinAddress value) bitcoinAddress, - required TResult Function(InputType_Bolt11 value) bolt11, - required TResult Function(InputType_Bolt12 value) bolt12, - required TResult Function(InputType_NodeId value) nodeId, - required TResult Function(InputType_Url value) url, - required TResult Function(InputType_LnUrlPay value) lnUrlPay, - required TResult Function(InputType_LnUrlWithdraw value) lnUrlWithdraw, - required TResult Function(InputType_LnUrlAuth value) lnUrlAuth, - required TResult Function(InputType_LnUrlError value) lnUrlError, - }) { - return bolt12(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(InputType_BitcoinAddress value)? bitcoinAddress, - TResult? Function(InputType_Bolt11 value)? bolt11, - TResult? Function(InputType_Bolt12 value)? bolt12, - TResult? Function(InputType_NodeId value)? nodeId, - TResult? Function(InputType_Url value)? url, - TResult? Function(InputType_LnUrlPay value)? lnUrlPay, - TResult? Function(InputType_LnUrlWithdraw value)? lnUrlWithdraw, - TResult? Function(InputType_LnUrlAuth value)? lnUrlAuth, - TResult? Function(InputType_LnUrlError value)? lnUrlError, - }) { - return bolt12?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(InputType_BitcoinAddress value)? bitcoinAddress, - TResult Function(InputType_Bolt11 value)? bolt11, - TResult Function(InputType_Bolt12 value)? bolt12, - TResult Function(InputType_NodeId value)? nodeId, - TResult Function(InputType_Url value)? url, - TResult Function(InputType_LnUrlPay value)? lnUrlPay, - TResult Function(InputType_LnUrlWithdraw value)? lnUrlWithdraw, - TResult Function(InputType_LnUrlAuth value)? lnUrlAuth, - TResult Function(InputType_LnUrlError value)? lnUrlError, - required TResult orElse(), - }) { - if (bolt12 != null) { - return bolt12(this); - } - return orElse(); - } -} - -abstract class InputType_Bolt12 implements InputType { - const factory InputType_Bolt12({required final LNOffer offer}) = _$InputType_Bolt12Impl; - - LNOffer get offer; - @JsonKey(ignore: true) - _$$InputType_Bolt12ImplCopyWith<_$InputType_Bolt12Impl> get copyWith => throw _privateConstructorUsedError; -} - /// @nodoc abstract class _$$InputType_NodeIdImplCopyWith<$Res> { factory _$$InputType_NodeIdImplCopyWith( @@ -3190,7 +2670,6 @@ class _$InputType_NodeIdImpl implements InputType_NodeId { TResult when({ required TResult Function(BitcoinAddressData address) bitcoinAddress, required TResult Function(LNInvoice invoice) bolt11, - required TResult Function(LNOffer offer) bolt12, required TResult Function(String nodeId) nodeId, required TResult Function(String url) url, required TResult Function(LnUrlPayRequestData data) lnUrlPay, @@ -3206,7 +2685,6 @@ class _$InputType_NodeIdImpl implements InputType_NodeId { TResult? whenOrNull({ TResult? Function(BitcoinAddressData address)? bitcoinAddress, TResult? Function(LNInvoice invoice)? bolt11, - TResult? Function(LNOffer offer)? bolt12, TResult? Function(String nodeId)? nodeId, TResult? Function(String url)? url, TResult? Function(LnUrlPayRequestData data)? lnUrlPay, @@ -3222,7 +2700,6 @@ class _$InputType_NodeIdImpl implements InputType_NodeId { TResult maybeWhen({ TResult Function(BitcoinAddressData address)? bitcoinAddress, TResult Function(LNInvoice invoice)? bolt11, - TResult Function(LNOffer offer)? bolt12, TResult Function(String nodeId)? nodeId, TResult Function(String url)? url, TResult Function(LnUrlPayRequestData data)? lnUrlPay, @@ -3242,7 +2719,6 @@ class _$InputType_NodeIdImpl implements InputType_NodeId { TResult map({ required TResult Function(InputType_BitcoinAddress value) bitcoinAddress, required TResult Function(InputType_Bolt11 value) bolt11, - required TResult Function(InputType_Bolt12 value) bolt12, required TResult Function(InputType_NodeId value) nodeId, required TResult Function(InputType_Url value) url, required TResult Function(InputType_LnUrlPay value) lnUrlPay, @@ -3258,7 +2734,6 @@ class _$InputType_NodeIdImpl implements InputType_NodeId { TResult? mapOrNull({ TResult? Function(InputType_BitcoinAddress value)? bitcoinAddress, TResult? Function(InputType_Bolt11 value)? bolt11, - TResult? Function(InputType_Bolt12 value)? bolt12, TResult? Function(InputType_NodeId value)? nodeId, TResult? Function(InputType_Url value)? url, TResult? Function(InputType_LnUrlPay value)? lnUrlPay, @@ -3274,7 +2749,6 @@ class _$InputType_NodeIdImpl implements InputType_NodeId { TResult maybeMap({ TResult Function(InputType_BitcoinAddress value)? bitcoinAddress, TResult Function(InputType_Bolt11 value)? bolt11, - TResult Function(InputType_Bolt12 value)? bolt12, TResult Function(InputType_NodeId value)? nodeId, TResult Function(InputType_Url value)? url, TResult Function(InputType_LnUrlPay value)? lnUrlPay, @@ -3361,7 +2835,6 @@ class _$InputType_UrlImpl implements InputType_Url { TResult when({ required TResult Function(BitcoinAddressData address) bitcoinAddress, required TResult Function(LNInvoice invoice) bolt11, - required TResult Function(LNOffer offer) bolt12, required TResult Function(String nodeId) nodeId, required TResult Function(String url) url, required TResult Function(LnUrlPayRequestData data) lnUrlPay, @@ -3377,7 +2850,6 @@ class _$InputType_UrlImpl implements InputType_Url { TResult? whenOrNull({ TResult? Function(BitcoinAddressData address)? bitcoinAddress, TResult? Function(LNInvoice invoice)? bolt11, - TResult? Function(LNOffer offer)? bolt12, TResult? Function(String nodeId)? nodeId, TResult? Function(String url)? url, TResult? Function(LnUrlPayRequestData data)? lnUrlPay, @@ -3393,7 +2865,6 @@ class _$InputType_UrlImpl implements InputType_Url { TResult maybeWhen({ TResult Function(BitcoinAddressData address)? bitcoinAddress, TResult Function(LNInvoice invoice)? bolt11, - TResult Function(LNOffer offer)? bolt12, TResult Function(String nodeId)? nodeId, TResult Function(String url)? url, TResult Function(LnUrlPayRequestData data)? lnUrlPay, @@ -3413,7 +2884,6 @@ class _$InputType_UrlImpl implements InputType_Url { TResult map({ required TResult Function(InputType_BitcoinAddress value) bitcoinAddress, required TResult Function(InputType_Bolt11 value) bolt11, - required TResult Function(InputType_Bolt12 value) bolt12, required TResult Function(InputType_NodeId value) nodeId, required TResult Function(InputType_Url value) url, required TResult Function(InputType_LnUrlPay value) lnUrlPay, @@ -3429,7 +2899,6 @@ class _$InputType_UrlImpl implements InputType_Url { TResult? mapOrNull({ TResult? Function(InputType_BitcoinAddress value)? bitcoinAddress, TResult? Function(InputType_Bolt11 value)? bolt11, - TResult? Function(InputType_Bolt12 value)? bolt12, TResult? Function(InputType_NodeId value)? nodeId, TResult? Function(InputType_Url value)? url, TResult? Function(InputType_LnUrlPay value)? lnUrlPay, @@ -3445,7 +2914,6 @@ class _$InputType_UrlImpl implements InputType_Url { TResult maybeMap({ TResult Function(InputType_BitcoinAddress value)? bitcoinAddress, TResult Function(InputType_Bolt11 value)? bolt11, - TResult Function(InputType_Bolt12 value)? bolt12, TResult Function(InputType_NodeId value)? nodeId, TResult Function(InputType_Url value)? url, TResult Function(InputType_LnUrlPay value)? lnUrlPay, @@ -3535,7 +3003,6 @@ class _$InputType_LnUrlPayImpl implements InputType_LnUrlPay { TResult when({ required TResult Function(BitcoinAddressData address) bitcoinAddress, required TResult Function(LNInvoice invoice) bolt11, - required TResult Function(LNOffer offer) bolt12, required TResult Function(String nodeId) nodeId, required TResult Function(String url) url, required TResult Function(LnUrlPayRequestData data) lnUrlPay, @@ -3551,7 +3018,6 @@ class _$InputType_LnUrlPayImpl implements InputType_LnUrlPay { TResult? whenOrNull({ TResult? Function(BitcoinAddressData address)? bitcoinAddress, TResult? Function(LNInvoice invoice)? bolt11, - TResult? Function(LNOffer offer)? bolt12, TResult? Function(String nodeId)? nodeId, TResult? Function(String url)? url, TResult? Function(LnUrlPayRequestData data)? lnUrlPay, @@ -3567,7 +3033,6 @@ class _$InputType_LnUrlPayImpl implements InputType_LnUrlPay { TResult maybeWhen({ TResult Function(BitcoinAddressData address)? bitcoinAddress, TResult Function(LNInvoice invoice)? bolt11, - TResult Function(LNOffer offer)? bolt12, TResult Function(String nodeId)? nodeId, TResult Function(String url)? url, TResult Function(LnUrlPayRequestData data)? lnUrlPay, @@ -3587,7 +3052,6 @@ class _$InputType_LnUrlPayImpl implements InputType_LnUrlPay { TResult map({ required TResult Function(InputType_BitcoinAddress value) bitcoinAddress, required TResult Function(InputType_Bolt11 value) bolt11, - required TResult Function(InputType_Bolt12 value) bolt12, required TResult Function(InputType_NodeId value) nodeId, required TResult Function(InputType_Url value) url, required TResult Function(InputType_LnUrlPay value) lnUrlPay, @@ -3603,7 +3067,6 @@ class _$InputType_LnUrlPayImpl implements InputType_LnUrlPay { TResult? mapOrNull({ TResult? Function(InputType_BitcoinAddress value)? bitcoinAddress, TResult? Function(InputType_Bolt11 value)? bolt11, - TResult? Function(InputType_Bolt12 value)? bolt12, TResult? Function(InputType_NodeId value)? nodeId, TResult? Function(InputType_Url value)? url, TResult? Function(InputType_LnUrlPay value)? lnUrlPay, @@ -3619,7 +3082,6 @@ class _$InputType_LnUrlPayImpl implements InputType_LnUrlPay { TResult maybeMap({ TResult Function(InputType_BitcoinAddress value)? bitcoinAddress, TResult Function(InputType_Bolt11 value)? bolt11, - TResult Function(InputType_Bolt12 value)? bolt12, TResult Function(InputType_NodeId value)? nodeId, TResult Function(InputType_Url value)? url, TResult Function(InputType_LnUrlPay value)? lnUrlPay, @@ -3710,7 +3172,6 @@ class _$InputType_LnUrlWithdrawImpl implements InputType_LnUrlWithdraw { TResult when({ required TResult Function(BitcoinAddressData address) bitcoinAddress, required TResult Function(LNInvoice invoice) bolt11, - required TResult Function(LNOffer offer) bolt12, required TResult Function(String nodeId) nodeId, required TResult Function(String url) url, required TResult Function(LnUrlPayRequestData data) lnUrlPay, @@ -3726,7 +3187,6 @@ class _$InputType_LnUrlWithdrawImpl implements InputType_LnUrlWithdraw { TResult? whenOrNull({ TResult? Function(BitcoinAddressData address)? bitcoinAddress, TResult? Function(LNInvoice invoice)? bolt11, - TResult? Function(LNOffer offer)? bolt12, TResult? Function(String nodeId)? nodeId, TResult? Function(String url)? url, TResult? Function(LnUrlPayRequestData data)? lnUrlPay, @@ -3742,7 +3202,6 @@ class _$InputType_LnUrlWithdrawImpl implements InputType_LnUrlWithdraw { TResult maybeWhen({ TResult Function(BitcoinAddressData address)? bitcoinAddress, TResult Function(LNInvoice invoice)? bolt11, - TResult Function(LNOffer offer)? bolt12, TResult Function(String nodeId)? nodeId, TResult Function(String url)? url, TResult Function(LnUrlPayRequestData data)? lnUrlPay, @@ -3762,7 +3221,6 @@ class _$InputType_LnUrlWithdrawImpl implements InputType_LnUrlWithdraw { TResult map({ required TResult Function(InputType_BitcoinAddress value) bitcoinAddress, required TResult Function(InputType_Bolt11 value) bolt11, - required TResult Function(InputType_Bolt12 value) bolt12, required TResult Function(InputType_NodeId value) nodeId, required TResult Function(InputType_Url value) url, required TResult Function(InputType_LnUrlPay value) lnUrlPay, @@ -3778,7 +3236,6 @@ class _$InputType_LnUrlWithdrawImpl implements InputType_LnUrlWithdraw { TResult? mapOrNull({ TResult? Function(InputType_BitcoinAddress value)? bitcoinAddress, TResult? Function(InputType_Bolt11 value)? bolt11, - TResult? Function(InputType_Bolt12 value)? bolt12, TResult? Function(InputType_NodeId value)? nodeId, TResult? Function(InputType_Url value)? url, TResult? Function(InputType_LnUrlPay value)? lnUrlPay, @@ -3794,7 +3251,6 @@ class _$InputType_LnUrlWithdrawImpl implements InputType_LnUrlWithdraw { TResult maybeMap({ TResult Function(InputType_BitcoinAddress value)? bitcoinAddress, TResult Function(InputType_Bolt11 value)? bolt11, - TResult Function(InputType_Bolt12 value)? bolt12, TResult Function(InputType_NodeId value)? nodeId, TResult Function(InputType_Url value)? url, TResult Function(InputType_LnUrlPay value)? lnUrlPay, @@ -3886,7 +3342,6 @@ class _$InputType_LnUrlAuthImpl implements InputType_LnUrlAuth { TResult when({ required TResult Function(BitcoinAddressData address) bitcoinAddress, required TResult Function(LNInvoice invoice) bolt11, - required TResult Function(LNOffer offer) bolt12, required TResult Function(String nodeId) nodeId, required TResult Function(String url) url, required TResult Function(LnUrlPayRequestData data) lnUrlPay, @@ -3902,7 +3357,6 @@ class _$InputType_LnUrlAuthImpl implements InputType_LnUrlAuth { TResult? whenOrNull({ TResult? Function(BitcoinAddressData address)? bitcoinAddress, TResult? Function(LNInvoice invoice)? bolt11, - TResult? Function(LNOffer offer)? bolt12, TResult? Function(String nodeId)? nodeId, TResult? Function(String url)? url, TResult? Function(LnUrlPayRequestData data)? lnUrlPay, @@ -3918,7 +3372,6 @@ class _$InputType_LnUrlAuthImpl implements InputType_LnUrlAuth { TResult maybeWhen({ TResult Function(BitcoinAddressData address)? bitcoinAddress, TResult Function(LNInvoice invoice)? bolt11, - TResult Function(LNOffer offer)? bolt12, TResult Function(String nodeId)? nodeId, TResult Function(String url)? url, TResult Function(LnUrlPayRequestData data)? lnUrlPay, @@ -3938,7 +3391,6 @@ class _$InputType_LnUrlAuthImpl implements InputType_LnUrlAuth { TResult map({ required TResult Function(InputType_BitcoinAddress value) bitcoinAddress, required TResult Function(InputType_Bolt11 value) bolt11, - required TResult Function(InputType_Bolt12 value) bolt12, required TResult Function(InputType_NodeId value) nodeId, required TResult Function(InputType_Url value) url, required TResult Function(InputType_LnUrlPay value) lnUrlPay, @@ -3954,7 +3406,6 @@ class _$InputType_LnUrlAuthImpl implements InputType_LnUrlAuth { TResult? mapOrNull({ TResult? Function(InputType_BitcoinAddress value)? bitcoinAddress, TResult? Function(InputType_Bolt11 value)? bolt11, - TResult? Function(InputType_Bolt12 value)? bolt12, TResult? Function(InputType_NodeId value)? nodeId, TResult? Function(InputType_Url value)? url, TResult? Function(InputType_LnUrlPay value)? lnUrlPay, @@ -3970,7 +3421,6 @@ class _$InputType_LnUrlAuthImpl implements InputType_LnUrlAuth { TResult maybeMap({ TResult Function(InputType_BitcoinAddress value)? bitcoinAddress, TResult Function(InputType_Bolt11 value)? bolt11, - TResult Function(InputType_Bolt12 value)? bolt12, TResult Function(InputType_NodeId value)? nodeId, TResult Function(InputType_Url value)? url, TResult Function(InputType_LnUrlPay value)? lnUrlPay, @@ -4061,7 +3511,6 @@ class _$InputType_LnUrlErrorImpl implements InputType_LnUrlError { TResult when({ required TResult Function(BitcoinAddressData address) bitcoinAddress, required TResult Function(LNInvoice invoice) bolt11, - required TResult Function(LNOffer offer) bolt12, required TResult Function(String nodeId) nodeId, required TResult Function(String url) url, required TResult Function(LnUrlPayRequestData data) lnUrlPay, @@ -4077,7 +3526,6 @@ class _$InputType_LnUrlErrorImpl implements InputType_LnUrlError { TResult? whenOrNull({ TResult? Function(BitcoinAddressData address)? bitcoinAddress, TResult? Function(LNInvoice invoice)? bolt11, - TResult? Function(LNOffer offer)? bolt12, TResult? Function(String nodeId)? nodeId, TResult? Function(String url)? url, TResult? Function(LnUrlPayRequestData data)? lnUrlPay, @@ -4093,7 +3541,6 @@ class _$InputType_LnUrlErrorImpl implements InputType_LnUrlError { TResult maybeWhen({ TResult Function(BitcoinAddressData address)? bitcoinAddress, TResult Function(LNInvoice invoice)? bolt11, - TResult Function(LNOffer offer)? bolt12, TResult Function(String nodeId)? nodeId, TResult Function(String url)? url, TResult Function(LnUrlPayRequestData data)? lnUrlPay, @@ -4113,7 +3560,6 @@ class _$InputType_LnUrlErrorImpl implements InputType_LnUrlError { TResult map({ required TResult Function(InputType_BitcoinAddress value) bitcoinAddress, required TResult Function(InputType_Bolt11 value) bolt11, - required TResult Function(InputType_Bolt12 value) bolt12, required TResult Function(InputType_NodeId value) nodeId, required TResult Function(InputType_Url value) url, required TResult Function(InputType_LnUrlPay value) lnUrlPay, @@ -4129,7 +3575,6 @@ class _$InputType_LnUrlErrorImpl implements InputType_LnUrlError { TResult? mapOrNull({ TResult? Function(InputType_BitcoinAddress value)? bitcoinAddress, TResult? Function(InputType_Bolt11 value)? bolt11, - TResult? Function(InputType_Bolt12 value)? bolt12, TResult? Function(InputType_NodeId value)? nodeId, TResult? Function(InputType_Url value)? url, TResult? Function(InputType_LnUrlPay value)? lnUrlPay, @@ -4145,7 +3590,6 @@ class _$InputType_LnUrlErrorImpl implements InputType_LnUrlError { TResult maybeMap({ TResult Function(InputType_BitcoinAddress value)? bitcoinAddress, TResult Function(InputType_Bolt11 value)? bolt11, - TResult Function(InputType_Bolt12 value)? bolt12, TResult Function(InputType_NodeId value)? nodeId, TResult Function(InputType_Url value)? url, TResult Function(InputType_LnUrlPay value)? lnUrlPay, diff --git a/libs/sdk-react-native/android/src/main/java/com/breezsdk/BreezSDKMapper.kt b/libs/sdk-react-native/android/src/main/java/com/breezsdk/BreezSDKMapper.kt index 069f6a232..27f2a4945 100644 --- a/libs/sdk-react-native/android/src/main/java/com/breezsdk/BreezSDKMapper.kt +++ b/libs/sdk-react-native/android/src/main/java/com/breezsdk/BreezSDKMapper.kt @@ -830,59 +830,6 @@ fun asLnInvoiceList(arr: ReadableArray): List { return list } -fun asLnOffer(lnOffer: ReadableMap): LnOffer? { - if (!validateMandatoryFields( - lnOffer, - arrayOf( - "bolt12", - "chains", - "description", - "signingPubkey", - ), - ) - ) { - return null - } - val bolt12 = lnOffer.getString("bolt12")!! - val chains = lnOffer.getArray("chains")?.let { asStringList(it) }!! - val description = lnOffer.getString("description")!! - val signingPubkey = lnOffer.getString("signingPubkey")!! - val amount = if (hasNonNullKey(lnOffer, "amount")) lnOffer.getMap("amount")?.let { asAmount(it) } else null - val absoluteExpiry = if (hasNonNullKey(lnOffer, "absoluteExpiry")) lnOffer.getDouble("absoluteExpiry").toULong() else null - val issuer = if (hasNonNullKey(lnOffer, "issuer")) lnOffer.getString("issuer") else null - return LnOffer( - bolt12, - chains, - description, - signingPubkey, - amount, - absoluteExpiry, - issuer, - ) -} - -fun readableMapOf(lnOffer: LnOffer): ReadableMap = - readableMapOf( - "bolt12" to lnOffer.bolt12, - "chains" to readableArrayOf(lnOffer.chains), - "description" to lnOffer.description, - "signingPubkey" to lnOffer.signingPubkey, - "amount" to lnOffer.amount?.let { readableMapOf(it) }, - "absoluteExpiry" to lnOffer.absoluteExpiry, - "issuer" to lnOffer.issuer, - ) - -fun asLnOfferList(arr: ReadableArray): List { - val list = ArrayList() - for (value in arr.toArrayList()) { - when (value) { - is ReadableMap -> list.add(asLnOffer(value)!!) - else -> throw SdkException.Generic(errUnexpectedType("${value::class.java.name}")) - } - } - return list -} - fun asListPaymentsRequest(listPaymentsRequest: ReadableMap): ListPaymentsRequest? { if (!validateMandatoryFields( listPaymentsRequest, @@ -3875,45 +3822,6 @@ fun asAesSuccessActionDataResultList(arr: ReadableArray): List { - pushToMap(map, "type", "bitcoin") - pushToMap(map, "amountMsat", amount.amountMsat) - } - is Amount.Currency -> { - pushToMap(map, "type", "currency") - pushToMap(map, "iso4217Code", amount.iso4217Code) - pushToMap(map, "fractionalAmount", amount.fractionalAmount) - } - } - return map -} - -fun asAmountList(arr: ReadableArray): List { - val list = ArrayList() - for (value in arr.toArrayList()) { - when (value) { - is ReadableMap -> list.add(asAmount(value)!!) - else -> throw SdkException.Generic(errUnexpectedType("${value::class.java.name}")) - } - } - return list -} - fun asBreezEvent(breezEvent: ReadableMap): BreezEvent? { val type = breezEvent.getString("type") @@ -4079,9 +3987,6 @@ fun asInputType(inputType: ReadableMap): InputType? { if (type == "bolt11") { return InputType.Bolt11(inputType.getMap("invoice")?.let { asLnInvoice(it) }!!) } - if (type == "bolt12") { - return InputType.Bolt12(inputType.getMap("offer")?.let { asLnOffer(it) }!!) - } if (type == "nodeId") { return InputType.NodeId(inputType.getString("nodeId")!!) } @@ -4114,10 +4019,6 @@ fun readableMapOf(inputType: InputType): ReadableMap? { pushToMap(map, "type", "bolt11") pushToMap(map, "invoice", readableMapOf(inputType.invoice)) } - is InputType.Bolt12 -> { - pushToMap(map, "type", "bolt12") - pushToMap(map, "offer", readableMapOf(inputType.offer)) - } is InputType.NodeId -> { pushToMap(map, "type", "nodeId") pushToMap(map, "nodeId", inputType.nodeId) diff --git a/libs/sdk-react-native/ios/BreezSDKMapper.swift b/libs/sdk-react-native/ios/BreezSDKMapper.swift index 2e72bb743..012eecd30 100644 --- a/libs/sdk-react-native/ios/BreezSDKMapper.swift +++ b/libs/sdk-react-native/ios/BreezSDKMapper.swift @@ -962,79 +962,6 @@ enum BreezSDKMapper { return lnInvoiceList.map { v -> [String: Any?] in return dictionaryOf(lnInvoice: v) } } - static func asLnOffer(lnOffer: [String: Any?]) throws -> LnOffer { - guard let bolt12 = lnOffer["bolt12"] as? String else { - throw SdkError.Generic(message: errMissingMandatoryField(fieldName: "bolt12", typeName: "LnOffer")) - } - guard let chains = lnOffer["chains"] as? [String] else { - throw SdkError.Generic(message: errMissingMandatoryField(fieldName: "chains", typeName: "LnOffer")) - } - guard let description = lnOffer["description"] as? String else { - throw SdkError.Generic(message: errMissingMandatoryField(fieldName: "description", typeName: "LnOffer")) - } - guard let signingPubkey = lnOffer["signingPubkey"] as? String else { - throw SdkError.Generic(message: errMissingMandatoryField(fieldName: "signingPubkey", typeName: "LnOffer")) - } - var amount: Amount? - if let amountTmp = lnOffer["amount"] as? [String: Any?] { - amount = try asAmount(amount: amountTmp) - } - - var absoluteExpiry: UInt64? - if hasNonNilKey(data: lnOffer, key: "absoluteExpiry") { - guard let absoluteExpiryTmp = lnOffer["absoluteExpiry"] as? UInt64 else { - throw SdkError.Generic(message: errUnexpectedValue(fieldName: "absoluteExpiry")) - } - absoluteExpiry = absoluteExpiryTmp - } - var issuer: String? - if hasNonNilKey(data: lnOffer, key: "issuer") { - guard let issuerTmp = lnOffer["issuer"] as? String else { - throw SdkError.Generic(message: errUnexpectedValue(fieldName: "issuer")) - } - issuer = issuerTmp - } - - return LnOffer( - bolt12: bolt12, - chains: chains, - description: description, - signingPubkey: signingPubkey, - amount: amount, - absoluteExpiry: absoluteExpiry, - issuer: issuer - ) - } - - static func dictionaryOf(lnOffer: LnOffer) -> [String: Any?] { - return [ - "bolt12": lnOffer.bolt12, - "chains": lnOffer.chains, - "description": lnOffer.description, - "signingPubkey": lnOffer.signingPubkey, - "amount": lnOffer.amount == nil ? nil : dictionaryOf(amount: lnOffer.amount!), - "absoluteExpiry": lnOffer.absoluteExpiry == nil ? nil : lnOffer.absoluteExpiry, - "issuer": lnOffer.issuer == nil ? nil : lnOffer.issuer, - ] - } - - static func asLnOfferList(arr: [Any]) throws -> [LnOffer] { - var list = [LnOffer]() - for value in arr { - if let val = value as? [String: Any?] { - var lnOffer = try asLnOffer(lnOffer: val) - list.append(lnOffer) - } else { - throw SdkError.Generic(message: errUnexpectedType(typeName: "LnOffer")) - } - } - return list - } - - static func arrayOf(lnOfferList: [LnOffer]) -> [Any] { - return lnOfferList.map { v -> [String: Any?] in return dictionaryOf(lnOffer: v) } - } - static func asListPaymentsRequest(listPaymentsRequest: [String: Any?]) throws -> ListPaymentsRequest { var filters: [PaymentTypeFilter]? if let filtersTmp = listPaymentsRequest["filters"] as? [String] { @@ -4403,62 +4330,6 @@ enum BreezSDKMapper { return list } - static func asAmount(amount: [String: Any?]) throws -> Amount { - let type = amount["type"] as! String - if type == "bitcoin" { - guard let _amountMsat = amount["amountMsat"] as? UInt64 else { - throw SdkError.Generic(message: errMissingMandatoryField(fieldName: "amountMsat", typeName: "Amount")) - } - return Amount.bitcoin(amountMsat: _amountMsat) - } - if type == "currency" { - guard let _iso4217Code = amount["iso4217Code"] as? String else { - throw SdkError.Generic(message: errMissingMandatoryField(fieldName: "iso4217Code", typeName: "Amount")) - } - return Amount.currency(iso4217Code: _iso4217Code) - } - - throw SdkError.Generic(message: "Unexpected type \(type) for enum Amount") - } - - static func dictionaryOf(amount: Amount) -> [String: Any?] { - switch amount { - case let .bitcoin( - amountMsat - ): - return [ - "type": "bitcoin", - "amountMsat": amountMsat, - ] - - case let .currency( - iso4217Code, fractionalAmount - ): - return [ - "type": "currency", - "iso4217Code": iso4217Code, - "fractionalAmount": fractionalAmount, - ] - } - } - - static func arrayOf(amountList: [Amount]) -> [Any] { - return amountList.map { v -> [String: Any?] in return dictionaryOf(amount: v) } - } - - static func asAmountList(arr: [Any]) throws -> [Amount] { - var list = [Amount]() - for value in arr { - if let val = value as? [String: Any?] { - var amount = try asAmount(amount: val) - list.append(amount) - } else { - throw SdkError.Generic(message: errUnexpectedType(typeName: "Amount")) - } - } - return list - } - static func asBreezEvent(breezEvent: [String: Any?]) throws -> BreezEvent { let type = breezEvent["type"] as! String if type == "newBlock" { @@ -4851,14 +4722,6 @@ enum BreezSDKMapper { return InputType.bolt11(invoice: _invoice) } - if type == "bolt12" { - guard let offerTmp = inputType["offer"] as? [String: Any?] else { - throw SdkError.Generic(message: errMissingMandatoryField(fieldName: "offer", typeName: "InputType")) - } - let _offer = try asLnOffer(lnOffer: offerTmp) - - return InputType.bolt12(offer: _offer) - } if type == "nodeId" { guard let _nodeId = inputType["nodeId"] as? String else { throw SdkError.Generic(message: errMissingMandatoryField(fieldName: "nodeId", typeName: "InputType")) @@ -4925,14 +4788,6 @@ enum BreezSDKMapper { "invoice": dictionaryOf(lnInvoice: invoice), ] - case let .bolt12( - offer - ): - return [ - "type": "bolt12", - "offer": dictionaryOf(lnOffer: offer), - ] - case let .nodeId( nodeId ): diff --git a/libs/sdk-react-native/src/index.ts b/libs/sdk-react-native/src/index.ts index f514c2177..5225c062e 100644 --- a/libs/sdk-react-native/src/index.ts +++ b/libs/sdk-react-native/src/index.ts @@ -143,16 +143,6 @@ export interface LnInvoice { minFinalCltvExpiryDelta: number } -export interface LnOffer { - bolt12: string - chains: string[] - description: string - signingPubkey: string - amount?: Amount - absoluteExpiry?: number - issuer?: string -} - export interface ListPaymentsRequest { filters?: PaymentTypeFilter[] metadataFilters?: MetadataFilter[] @@ -611,20 +601,6 @@ export type AesSuccessActionDataResult = { reason: string } -export enum AmountVariant { - BITCOIN = "bitcoin", - CURRENCY = "currency" -} - -export type Amount = { - type: AmountVariant.BITCOIN, - amountMsat: number -} | { - type: AmountVariant.CURRENCY, - iso4217Code: string - fractionalAmount: number -} - export enum BreezEventVariant { NEW_BLOCK = "newBlock", INVOICE_PAID = "invoicePaid", @@ -698,7 +674,6 @@ export enum HealthCheckStatus { export enum InputTypeVariant { BITCOIN_ADDRESS = "bitcoinAddress", BOLT11 = "bolt11", - BOLT12 = "bolt12", NODE_ID = "nodeId", URL = "url", LN_URL_PAY = "lnUrlPay", @@ -713,9 +688,6 @@ export type InputType = { } | { type: InputTypeVariant.BOLT11, invoice: LnInvoice -} | { - type: InputTypeVariant.BOLT12, - offer: LnOffer } | { type: InputTypeVariant.NODE_ID, nodeId: string