From 4b3113754c50386cf2ebf58a4d0b5beb3dfb9664 Mon Sep 17 00:00:00 2001 From: Erdem Yerebasmaz Date: Mon, 24 Jun 2024 14:07:49 +0300 Subject: [PATCH] Re-add lnurl module after fixing imports on bindings cargo fmt --- libs/sdk-core/src/binding.rs | 12 +- libs/sdk-core/src/frb_generated.io.rs | 196 +++++-- libs/sdk-core/src/frb_generated.rs | 246 ++++++--- libs/sdk-core/src/lib.rs | 3 +- libs/sdk-flutter/ios/Classes/frb_generated.h | 45 +- libs/sdk-flutter/lib/generated/binding.dart | 27 +- .../lib/generated/frb_generated.dart | 261 +++++---- .../lib/generated/frb_generated.io.dart | 255 ++++++--- libs/sdk-flutter/lib/generated/lnurl/pay.dart | 47 ++ .../lib/generated/lnurl/pay.freezed.dart | 508 ++++++++++++++++++ libs/sdk-flutter/lib/sdk.dart | 1 + 11 files changed, 1269 insertions(+), 332 deletions(-) create mode 100644 libs/sdk-flutter/lib/generated/lnurl/pay.dart create mode 100644 libs/sdk-flutter/lib/generated/lnurl/pay.freezed.dart diff --git a/libs/sdk-core/src/binding.rs b/libs/sdk-core/src/binding.rs index 2a41a1076..e23931cb1 100644 --- a/libs/sdk-core/src/binding.rs +++ b/libs/sdk-core/src/binding.rs @@ -14,6 +14,7 @@ use std::future::Future; use std::sync::Arc; use crate::frb_generated::StreamSink; +use crate::lnurl::pay::LnUrlPayResult; use anyhow::{anyhow, Result}; use log::{Level, LevelFilter, Metadata, Record}; use once_cell::sync::{Lazy, OnceCell}; @@ -26,6 +27,7 @@ pub use sdk_common::prelude::{ LocaleOverrides, LocalizedName, MessageSuccessActionData, Network, Rate, RouteHint, RouteHintHop, SuccessActionProcessed, Symbol, UrlSuccessActionData, }; +use sdk_common::prelude::{LnUrlPayError, LnUrlWithdrawError}; use tokio::sync::Mutex; use crate::breez_services::{self, BreezEvent, BreezServices, EventListener}; @@ -171,7 +173,7 @@ pub enum _InputType { #[frb(mirror(BitcoinAddressData))] pub struct _BitcoinAddressData { pub address: String, - pub network: crate::prelude::Network, + pub network: Network, pub amount_sat: Option, pub label: Option, pub message: Option, @@ -561,19 +563,19 @@ pub fn receive_payment(req: ReceivePaymentRequest) -> Result Result { +pub fn lnurl_pay(req: LnUrlPayRequest) -> Result { block_on(async { get_breez_services().await?.lnurl_pay(req).await }) - .map_err(anyhow::Error::new::) + .map_err(anyhow::Error::new::) } /// See [BreezServices::lnurl_withdraw] pub fn lnurl_withdraw(req: LnUrlWithdrawRequest) -> Result { block_on(async { get_breez_services().await?.lnurl_withdraw(req).await }) - .map_err(anyhow::Error::new::) + .map_err(anyhow::Error::new::) } /// See [BreezServices::lnurl_auth] -pub fn lnurl_auth(req_data: crate::LnUrlAuthRequestData) -> Result { +pub fn lnurl_auth(req_data: LnUrlAuthRequestData) -> Result { block_on(async { get_breez_services().await?.lnurl_auth(req_data).await }) .map_err(anyhow::Error::new::) } diff --git a/libs/sdk-core/src/frb_generated.io.rs b/libs/sdk-core/src/frb_generated.io.rs index fcf8d29ca..8dc84ab10 100644 --- a/libs/sdk-core/src/frb_generated.io.rs +++ b/libs/sdk-core/src/frb_generated.io.rs @@ -4,7 +4,6 @@ // Section: imports use super::*; -use crate::binding::*; use crate::breez_services::EventListener; use flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt}; use flutter_rust_bridge::for_generated::{transform_result_dco, Lifetimeable, Lockable}; @@ -24,29 +23,6 @@ impl CstDecode unimplemented!() } } -impl CstDecode for usize { - // Codec=Cst (C-struct based), see doc to use other codecs - fn cst_decode(self) -> LnUrlPayResult { - flutter_rust_bridge::for_generated::rust_auto_opaque_decode_owned(CstDecode::< - RustOpaqueNom>, - >::cst_decode( - self - )) - } -} -impl - CstDecode< - RustOpaqueNom>, - > for usize -{ - // Codec=Cst (C-struct based), see doc to use other codecs - fn cst_decode( - self, - ) -> RustOpaqueNom> - { - unsafe { decode_rust_opaque_nom(self as _) } - } -} impl CstDecode< StreamSink, @@ -307,6 +283,13 @@ impl CstDecode for *mut wire_cst_ln_url_error_da CstDecode::::cst_decode(*wrap).into() } } +impl CstDecode for *mut wire_cst_ln_url_pay_error_data { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::binding::LnUrlPayErrorData { + let wrap = unsafe { flutter_rust_bridge::for_generated::box_from_leak_ptr(self) }; + CstDecode::::cst_decode(*wrap).into() + } +} impl CstDecode for *mut wire_cst_ln_url_pay_request { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> crate::binding::LnUrlPayRequest { @@ -321,6 +304,13 @@ impl CstDecode for *mut wire_cst_ln_url_pay CstDecode::::cst_decode(*wrap).into() } } +impl CstDecode for *mut wire_cst_ln_url_pay_success_data { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::lnurl::pay::LnUrlPaySuccessData { + let wrap = unsafe { flutter_rust_bridge::for_generated::box_from_leak_ptr(self) }; + CstDecode::::cst_decode(*wrap).into() + } +} impl CstDecode for *mut wire_cst_ln_url_withdraw_request { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> crate::binding::LnUrlWithdrawRequest { @@ -1083,6 +1073,15 @@ impl CstDecode for wire_cst_ln_url_error_data { } } } +impl CstDecode for wire_cst_ln_url_pay_error_data { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::binding::LnUrlPayErrorData { + crate::binding::LnUrlPayErrorData { + payment_hash: self.payment_hash.cst_decode(), + reason: self.reason.cst_decode(), + } + } +} impl CstDecode for wire_cst_ln_url_pay_request { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> crate::binding::LnUrlPayRequest { @@ -1110,6 +1109,41 @@ impl CstDecode for wire_cst_ln_url_pay_requ } } } +impl CstDecode for wire_cst_ln_url_pay_result { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::lnurl::pay::LnUrlPayResult { + match self.tag { + 0 => { + let ans = unsafe { self.kind.EndpointSuccess }; + crate::lnurl::pay::LnUrlPayResult::EndpointSuccess { + data: ans.data.cst_decode(), + } + } + 1 => { + let ans = unsafe { self.kind.EndpointError }; + crate::lnurl::pay::LnUrlPayResult::EndpointError { + data: ans.data.cst_decode(), + } + } + 2 => { + let ans = unsafe { self.kind.PayError }; + crate::lnurl::pay::LnUrlPayResult::PayError { + data: ans.data.cst_decode(), + } + } + _ => unreachable!(), + } + } +} +impl CstDecode for wire_cst_ln_url_pay_success_data { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::lnurl::pay::LnUrlPaySuccessData { + crate::lnurl::pay::LnUrlPaySuccessData { + payment: self.payment.cst_decode(), + success_action: self.success_action.cst_decode(), + } + } +} impl CstDecode for wire_cst_ln_url_withdraw_request { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> crate::binding::LnUrlWithdrawRequest { @@ -2236,6 +2270,19 @@ impl Default for wire_cst_ln_url_error_data { Self::new_with_null_ptr() } } +impl NewWithNullPtr for wire_cst_ln_url_pay_error_data { + fn new_with_null_ptr() -> Self { + Self { + payment_hash: core::ptr::null_mut(), + reason: core::ptr::null_mut(), + } + } +} +impl Default for wire_cst_ln_url_pay_error_data { + fn default() -> Self { + Self::new_with_null_ptr() + } +} impl NewWithNullPtr for wire_cst_ln_url_pay_request { fn new_with_null_ptr() -> Self { Self { @@ -2271,6 +2318,32 @@ impl Default for wire_cst_ln_url_pay_request_data { Self::new_with_null_ptr() } } +impl NewWithNullPtr for wire_cst_ln_url_pay_result { + fn new_with_null_ptr() -> Self { + Self { + tag: -1, + kind: LnUrlPayResultKind { nil__: () }, + } + } +} +impl Default for wire_cst_ln_url_pay_result { + fn default() -> Self { + Self::new_with_null_ptr() + } +} +impl NewWithNullPtr for wire_cst_ln_url_pay_success_data { + fn new_with_null_ptr() -> Self { + Self { + payment: Default::default(), + success_action: core::ptr::null_mut(), + } + } +} +impl Default for wire_cst_ln_url_pay_success_data { + fn default() -> Self { + Self::new_with_null_ptr() + } +} impl NewWithNullPtr for wire_cst_ln_url_withdraw_request { fn new_with_null_ptr() -> Self { Self { @@ -3597,24 +3670,6 @@ pub extern "C" fn frbgen_breez_sdk_wire__crate__binding__unregister_webhook( wire__crate__binding__unregister_webhook_impl(port_, webhook_url) } -#[no_mangle] -pub extern "C" fn frbgen_breez_sdk_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult( - ptr: *const std::ffi::c_void, -) { - unsafe { - StdArc::>::increment_strong_count(ptr as _); - } -} - -#[no_mangle] -pub extern "C" fn frbgen_breez_sdk_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult( - ptr: *const std::ffi::c_void, -) { - unsafe { - StdArc::>::decrement_strong_count(ptr as _); - } -} - #[no_mangle] pub extern "C" fn frbgen_breez_sdk_cst_new_box_autoadd_aes_success_action_data_decrypted( ) -> *mut wire_cst_aes_success_action_data_decrypted { @@ -3779,6 +3834,14 @@ pub extern "C" fn frbgen_breez_sdk_cst_new_box_autoadd_ln_url_error_data( ) } +#[no_mangle] +pub extern "C" fn frbgen_breez_sdk_cst_new_box_autoadd_ln_url_pay_error_data( +) -> *mut wire_cst_ln_url_pay_error_data { + flutter_rust_bridge::for_generated::new_leak_box_ptr( + wire_cst_ln_url_pay_error_data::new_with_null_ptr(), + ) +} + #[no_mangle] pub extern "C" fn frbgen_breez_sdk_cst_new_box_autoadd_ln_url_pay_request( ) -> *mut wire_cst_ln_url_pay_request { @@ -3795,6 +3858,14 @@ pub extern "C" fn frbgen_breez_sdk_cst_new_box_autoadd_ln_url_pay_request_data( ) } +#[no_mangle] +pub extern "C" fn frbgen_breez_sdk_cst_new_box_autoadd_ln_url_pay_success_data( +) -> *mut wire_cst_ln_url_pay_success_data { + flutter_rust_bridge::for_generated::new_leak_box_ptr( + wire_cst_ln_url_pay_success_data::new_with_null_ptr(), + ) +} + #[no_mangle] pub extern "C" fn frbgen_breez_sdk_cst_new_box_autoadd_ln_url_withdraw_request( ) -> *mut wire_cst_ln_url_withdraw_request { @@ -4714,6 +4785,12 @@ pub struct wire_cst_ln_url_error_data { } #[repr(C)] #[derive(Clone, Copy)] +pub struct wire_cst_ln_url_pay_error_data { + payment_hash: *mut wire_cst_list_prim_u_8_strict, + reason: *mut wire_cst_list_prim_u_8_strict, +} +#[repr(C)] +#[derive(Clone, Copy)] pub struct wire_cst_ln_url_pay_request { data: wire_cst_ln_url_pay_request_data, amount_msat: u64, @@ -4735,6 +4812,41 @@ pub struct wire_cst_ln_url_pay_request_data { } #[repr(C)] #[derive(Clone, Copy)] +pub struct wire_cst_ln_url_pay_result { + tag: i32, + kind: LnUrlPayResultKind, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub union LnUrlPayResultKind { + EndpointSuccess: wire_cst_LnUrlPayResult_EndpointSuccess, + EndpointError: wire_cst_LnUrlPayResult_EndpointError, + PayError: wire_cst_LnUrlPayResult_PayError, + nil__: (), +} +#[repr(C)] +#[derive(Clone, Copy)] +pub struct wire_cst_LnUrlPayResult_EndpointSuccess { + data: *mut wire_cst_ln_url_pay_success_data, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub struct wire_cst_LnUrlPayResult_EndpointError { + data: *mut wire_cst_ln_url_error_data, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub struct wire_cst_LnUrlPayResult_PayError { + data: *mut wire_cst_ln_url_pay_error_data, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub struct wire_cst_ln_url_pay_success_data { + payment: wire_cst_payment, + success_action: *mut wire_cst_success_action_processed, +} +#[repr(C)] +#[derive(Clone, Copy)] pub struct wire_cst_ln_url_withdraw_request { data: wire_cst_ln_url_withdraw_request_data, amount_msat: u64, diff --git a/libs/sdk-core/src/frb_generated.rs b/libs/sdk-core/src/frb_generated.rs index a73c82e95..9a7d6a83e 100644 --- a/libs/sdk-core/src/frb_generated.rs +++ b/libs/sdk-core/src/frb_generated.rs @@ -25,7 +25,6 @@ // Section: imports -use crate::binding::*; use crate::breez_services::EventListener; use flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt}; use flutter_rust_bridge::for_generated::{transform_result_dco, Lifetimeable, Lockable}; @@ -1524,6 +1523,11 @@ const _: fn() = || { let LnUrlErrorData = None::.unwrap(); let _: String = LnUrlErrorData.reason; } + { + let LnUrlPayErrorData = None::.unwrap(); + let _: String = LnUrlPayErrorData.payment_hash; + let _: String = LnUrlPayErrorData.reason; + } { let LnUrlPayRequest = None::.unwrap(); let _: crate::binding::LnUrlPayRequestData = LnUrlPayRequest.data; @@ -1802,12 +1806,6 @@ impl CstDecode for u8 { self } } -impl CstDecode for usize { - // Codec=Cst (C-struct based), see doc to use other codecs - fn cst_decode(self) -> usize { - self - } -} impl SseDecode for flutter_rust_bridge::for_generated::anyhow::Error { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -1816,26 +1814,6 @@ impl SseDecode for flutter_rust_bridge::for_generated::anyhow::Error { } } -impl SseDecode for LnUrlPayResult { - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { - let mut inner = , - >>::sse_decode(deserializer); - return flutter_rust_bridge::for_generated::rust_auto_opaque_decode_owned(inner); - } -} - -impl SseDecode - for RustOpaqueNom> -{ - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { - let mut inner = ::sse_decode(deserializer); - return unsafe { decode_rust_opaque_nom(inner) }; - } -} - impl SseDecode for StreamSink { @@ -2681,6 +2659,18 @@ impl SseDecode for crate::binding::LnUrlErrorData { } } +impl SseDecode for crate::binding::LnUrlPayErrorData { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_paymentHash = ::sse_decode(deserializer); + let mut var_reason = ::sse_decode(deserializer); + return crate::binding::LnUrlPayErrorData { + payment_hash: var_paymentHash, + reason: var_reason, + }; + } +} + impl SseDecode for crate::binding::LnUrlPayRequest { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -2723,6 +2713,44 @@ impl SseDecode for crate::binding::LnUrlPayRequestData { } } +impl SseDecode for crate::lnurl::pay::LnUrlPayResult { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut tag_ = ::sse_decode(deserializer); + match tag_ { + 0 => { + let mut var_data = + ::sse_decode(deserializer); + return crate::lnurl::pay::LnUrlPayResult::EndpointSuccess { data: var_data }; + } + 1 => { + let mut var_data = ::sse_decode(deserializer); + return crate::lnurl::pay::LnUrlPayResult::EndpointError { data: var_data }; + } + 2 => { + let mut var_data = ::sse_decode(deserializer); + return crate::lnurl::pay::LnUrlPayResult::PayError { data: var_data }; + } + _ => { + unimplemented!(""); + } + } + } +} + +impl SseDecode for crate::lnurl::pay::LnUrlPaySuccessData { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_payment = ::sse_decode(deserializer); + let mut var_successAction = + >::sse_decode(deserializer); + return crate::lnurl::pay::LnUrlPaySuccessData { + payment: var_payment, + success_action: var_successAction, + }; + } +} + impl SseDecode for crate::binding::LnUrlWithdrawRequest { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -4040,13 +4068,6 @@ impl SseDecode for crate::binding::UrlSuccessActionData { } } -impl SseDecode for usize { - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { - deserializer.cursor.read_u64::().unwrap() as _ - } -} - fn pde_ffi_dispatcher_primary_impl( func_id: i32, port: flutter_rust_bridge::for_generated::MessagePort, @@ -4074,21 +4095,6 @@ fn pde_ffi_dispatcher_sync_impl( // Section: rust2dart -// Codec=Dco (DartCObject based), see doc to use other codecs -impl flutter_rust_bridge::IntoDart for FrbWrapper { - fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { - flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, StdArc<_>>(self.0) - .into_dart() - } -} -impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive for FrbWrapper {} - -impl flutter_rust_bridge::IntoIntoDart> for LnUrlPayResult { - fn into_into_dart(self) -> FrbWrapper { - self.into() - } -} - // Codec=Dco (DartCObject based), see doc to use other codecs impl flutter_rust_bridge::IntoDart for FrbWrapper { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { @@ -4837,6 +4843,27 @@ impl flutter_rust_bridge::IntoIntoDart { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.0.payment_hash.into_into_dart().into_dart(), + self.0.reason.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for FrbWrapper +{ +} +impl flutter_rust_bridge::IntoIntoDart> + for crate::binding::LnUrlPayErrorData +{ + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs impl flutter_rust_bridge::IntoDart for FrbWrapper { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { [ @@ -4888,6 +4915,57 @@ impl flutter_rust_bridge::IntoIntoDart flutter_rust_bridge::for_generated::DartAbi { + match self { + crate::lnurl::pay::LnUrlPayResult::EndpointSuccess { data } => { + [0.into_dart(), data.into_into_dart().into_dart()].into_dart() + } + crate::lnurl::pay::LnUrlPayResult::EndpointError { data } => { + [1.into_dart(), data.into_into_dart().into_dart()].into_dart() + } + crate::lnurl::pay::LnUrlPayResult::PayError { data } => { + [2.into_dart(), data.into_into_dart().into_dart()].into_dart() + } + _ => { + unimplemented!(""); + } + } + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::lnurl::pay::LnUrlPayResult +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::lnurl::pay::LnUrlPayResult +{ + fn into_into_dart(self) -> crate::lnurl::pay::LnUrlPayResult { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::lnurl::pay::LnUrlPaySuccessData { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.payment.into_into_dart().into_dart(), + self.success_action.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::lnurl::pay::LnUrlPaySuccessData +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::lnurl::pay::LnUrlPaySuccessData +{ + fn into_into_dart(self) -> crate::lnurl::pay::LnUrlPaySuccessData { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs impl flutter_rust_bridge::IntoDart for FrbWrapper { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { [ @@ -6362,24 +6440,6 @@ impl SseEncode for flutter_rust_bridge::for_generated::anyhow::Error { } } -impl SseEncode for LnUrlPayResult { - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { - >>::sse_encode(flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, StdArc<_>>(self), serializer); - } -} - -impl SseEncode - for RustOpaqueNom> -{ - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { - let (ptr, size) = self.sse_encode_raw(); - ::sse_encode(ptr, serializer); - ::sse_encode(size, serializer); - } -} - impl SseEncode for StreamSink { @@ -7036,6 +7096,14 @@ impl SseEncode for crate::binding::LnUrlErrorData { } } +impl SseEncode for crate::binding::LnUrlPayErrorData { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.payment_hash, serializer); + ::sse_encode(self.reason, serializer); + } +} + impl SseEncode for crate::binding::LnUrlPayRequest { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -7061,6 +7129,40 @@ impl SseEncode for crate::binding::LnUrlPayRequestData { } } +impl SseEncode for crate::lnurl::pay::LnUrlPayResult { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + match self { + crate::lnurl::pay::LnUrlPayResult::EndpointSuccess { data } => { + ::sse_encode(0, serializer); + ::sse_encode(data, serializer); + } + crate::lnurl::pay::LnUrlPayResult::EndpointError { data } => { + ::sse_encode(1, serializer); + ::sse_encode(data, serializer); + } + crate::lnurl::pay::LnUrlPayResult::PayError { data } => { + ::sse_encode(2, serializer); + ::sse_encode(data, serializer); + } + _ => { + unimplemented!(""); + } + } + } +} + +impl SseEncode for crate::lnurl::pay::LnUrlPaySuccessData { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.payment, serializer); + >::sse_encode( + self.success_action, + serializer, + ); + } +} + impl SseEncode for crate::binding::LnUrlWithdrawRequest { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -8060,16 +8162,6 @@ impl SseEncode for crate::binding::UrlSuccessActionData { } } -impl SseEncode for usize { - // Codec=Sse (Serialization based), see doc to use other codecs - fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { - serializer - .cursor - .write_u64::(self as _) - .unwrap(); - } -} - #[cfg(not(target_family = "wasm"))] #[path = "frb_generated.io.rs"] mod io; diff --git a/libs/sdk-core/src/lib.rs b/libs/sdk-core/src/lib.rs index e0647e15f..3fbdb1993 100644 --- a/libs/sdk-core/src/lib.rs +++ b/libs/sdk-core/src/lib.rs @@ -171,14 +171,13 @@ pub mod error; mod node_api; // flutter_rust_bridge_codegen: has to be defined before greenlight; greenlight::node_api mod greenlight; #[rustfmt::skip] -/// flutter_rust_bridge:ignore pub mod lnurl; mod lsp; mod lsps0; /// flutter_rust_bridge:ignore mod lsps2; -mod moonpay; mod models; +mod moonpay; mod persist; mod support; mod swap_in; diff --git a/libs/sdk-flutter/ios/Classes/frb_generated.h b/libs/sdk-flutter/ios/Classes/frb_generated.h index 87a34bbf9..a3765a58e 100644 --- a/libs/sdk-flutter/ios/Classes/frb_generated.h +++ b/libs/sdk-flutter/ios/Classes/frb_generated.h @@ -553,6 +553,16 @@ typedef struct wire_cst_ln_url_error_data { struct wire_cst_list_prim_u_8_strict *reason; } wire_cst_ln_url_error_data; +typedef struct wire_cst_ln_url_pay_error_data { + struct wire_cst_list_prim_u_8_strict *payment_hash; + struct wire_cst_list_prim_u_8_strict *reason; +} wire_cst_ln_url_pay_error_data; + +typedef struct wire_cst_ln_url_pay_success_data { + struct wire_cst_payment payment; + struct wire_cst_success_action_processed *success_action; +} wire_cst_ln_url_pay_success_data; + typedef struct wire_cst_ln_url_withdraw_success_data { struct wire_cst_ln_invoice invoice; } wire_cst_ln_url_withdraw_success_data; @@ -759,6 +769,29 @@ typedef struct wire_cst_ln_url_callback_status { union LnUrlCallbackStatusKind kind; } wire_cst_ln_url_callback_status; +typedef struct wire_cst_LnUrlPayResult_EndpointSuccess { + struct wire_cst_ln_url_pay_success_data *data; +} wire_cst_LnUrlPayResult_EndpointSuccess; + +typedef struct wire_cst_LnUrlPayResult_EndpointError { + struct wire_cst_ln_url_error_data *data; +} wire_cst_LnUrlPayResult_EndpointError; + +typedef struct wire_cst_LnUrlPayResult_PayError { + struct wire_cst_ln_url_pay_error_data *data; +} wire_cst_LnUrlPayResult_PayError; + +typedef union LnUrlPayResultKind { + struct wire_cst_LnUrlPayResult_EndpointSuccess EndpointSuccess; + struct wire_cst_LnUrlPayResult_EndpointError EndpointError; + struct wire_cst_LnUrlPayResult_PayError PayError; +} LnUrlPayResultKind; + +typedef struct wire_cst_ln_url_pay_result { + int32_t tag; + union LnUrlPayResultKind kind; +} wire_cst_ln_url_pay_result; + typedef struct wire_cst_LnUrlWithdrawResult_Ok { struct wire_cst_ln_url_withdraw_success_data *data; } wire_cst_LnUrlWithdrawResult_Ok; @@ -1045,10 +1078,6 @@ void frbgen_breez_sdk_wire__crate__binding__sync(int64_t port_); void frbgen_breez_sdk_wire__crate__binding__unregister_webhook(int64_t port_, struct wire_cst_list_prim_u_8_strict *webhook_url); -void frbgen_breez_sdk_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult(const void *ptr); - -void frbgen_breez_sdk_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult(const void *ptr); - struct wire_cst_aes_success_action_data_decrypted *frbgen_breez_sdk_cst_new_box_autoadd_aes_success_action_data_decrypted(void); struct wire_cst_aes_success_action_data_result *frbgen_breez_sdk_cst_new_box_autoadd_aes_success_action_data_result(void); @@ -1093,10 +1122,14 @@ struct wire_cst_ln_url_auth_request_data *frbgen_breez_sdk_cst_new_box_autoadd_l struct wire_cst_ln_url_error_data *frbgen_breez_sdk_cst_new_box_autoadd_ln_url_error_data(void); +struct wire_cst_ln_url_pay_error_data *frbgen_breez_sdk_cst_new_box_autoadd_ln_url_pay_error_data(void); + struct wire_cst_ln_url_pay_request *frbgen_breez_sdk_cst_new_box_autoadd_ln_url_pay_request(void); struct wire_cst_ln_url_pay_request_data *frbgen_breez_sdk_cst_new_box_autoadd_ln_url_pay_request_data(void); +struct wire_cst_ln_url_pay_success_data *frbgen_breez_sdk_cst_new_box_autoadd_ln_url_pay_success_data(void); + struct wire_cst_ln_url_withdraw_request *frbgen_breez_sdk_cst_new_box_autoadd_ln_url_withdraw_request(void); struct wire_cst_ln_url_withdraw_request_data *frbgen_breez_sdk_cst_new_box_autoadd_ln_url_withdraw_request_data(void); @@ -1222,8 +1255,10 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_breez_sdk_cst_new_box_autoadd_ln_payment_details); dummy_var ^= ((int64_t) (void*) frbgen_breez_sdk_cst_new_box_autoadd_ln_url_auth_request_data); dummy_var ^= ((int64_t) (void*) frbgen_breez_sdk_cst_new_box_autoadd_ln_url_error_data); + dummy_var ^= ((int64_t) (void*) frbgen_breez_sdk_cst_new_box_autoadd_ln_url_pay_error_data); dummy_var ^= ((int64_t) (void*) frbgen_breez_sdk_cst_new_box_autoadd_ln_url_pay_request); dummy_var ^= ((int64_t) (void*) frbgen_breez_sdk_cst_new_box_autoadd_ln_url_pay_request_data); + dummy_var ^= ((int64_t) (void*) frbgen_breez_sdk_cst_new_box_autoadd_ln_url_pay_success_data); dummy_var ^= ((int64_t) (void*) frbgen_breez_sdk_cst_new_box_autoadd_ln_url_withdraw_request); dummy_var ^= ((int64_t) (void*) frbgen_breez_sdk_cst_new_box_autoadd_ln_url_withdraw_request_data); dummy_var ^= ((int64_t) (void*) frbgen_breez_sdk_cst_new_box_autoadd_ln_url_withdraw_success_data); @@ -1275,8 +1310,6 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_breez_sdk_cst_new_list_swap_info); dummy_var ^= ((int64_t) (void*) frbgen_breez_sdk_cst_new_list_tlv_entry); dummy_var ^= ((int64_t) (void*) frbgen_breez_sdk_cst_new_list_unspent_transaction_output); - dummy_var ^= ((int64_t) (void*) frbgen_breez_sdk_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult); - dummy_var ^= ((int64_t) (void*) frbgen_breez_sdk_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult); dummy_var ^= ((int64_t) (void*) frbgen_breez_sdk_wire__crate__binding__backup); dummy_var ^= ((int64_t) (void*) frbgen_breez_sdk_wire__crate__binding__backup_status); dummy_var ^= ((int64_t) (void*) frbgen_breez_sdk_wire__crate__binding__binding_event_listener_on_event); diff --git a/libs/sdk-flutter/lib/generated/binding.dart b/libs/sdk-flutter/lib/generated/binding.dart index a82e7ac29..060e15390 100644 --- a/libs/sdk-flutter/lib/generated/binding.dart +++ b/libs/sdk-flutter/lib/generated/binding.dart @@ -6,6 +6,7 @@ import 'breez_services.dart'; import 'chain.dart'; import 'frb_generated.dart'; +import 'lnurl/pay.dart'; import 'lsp.dart'; import 'models.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; @@ -13,7 +14,7 @@ import 'package:freezed_annotation/freezed_annotation.dart' hide protected; part 'binding.freezed.dart'; // These functions are ignored because they are not marked as `pub`: `block_on`, `get_breez_services`, `init`, `new`, `rt` -// These types are ignored because they are not used by any `pub` functions: `BindingLogger`, `LnUrlPayErrorData`, `LnUrlPayError` +// These types are ignored because they are not used by any `pub` functions: `BindingLogger`, `LnUrlPayError` // These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `enabled`, `flush`, `log` /// Wrapper around [BreezServices::connect] which also initializes SDK logging @@ -240,9 +241,6 @@ Future executeCommand({required String command}) => /// See [BreezServices::generate_diagnostic_data] Future generateDiagnosticData() => BreezSdkBindings.instance.api.crateBindingGenerateDiagnosticData(); -// Rust type: RustOpaqueNom> -abstract class LnUrlPayResult implements RustOpaqueInterface {} - class AesSuccessActionDataDecrypted { final String description; final String plaintext; @@ -528,6 +526,27 @@ class LnUrlErrorData { other is LnUrlErrorData && runtimeType == other.runtimeType && reason == other.reason; } +class LnUrlPayErrorData { + final String paymentHash; + final String reason; + + const LnUrlPayErrorData({ + required this.paymentHash, + required this.reason, + }); + + @override + int get hashCode => paymentHash.hashCode ^ reason.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is LnUrlPayErrorData && + runtimeType == other.runtimeType && + paymentHash == other.paymentHash && + reason == other.reason; +} + class LnUrlPayRequest { final LnUrlPayRequestData data; final BigInt amountMsat; diff --git a/libs/sdk-flutter/lib/generated/frb_generated.dart b/libs/sdk-flutter/lib/generated/frb_generated.dart index 767ebfac5..2ac58a617 100644 --- a/libs/sdk-flutter/lib/generated/frb_generated.dart +++ b/libs/sdk-flutter/lib/generated/frb_generated.dart @@ -10,6 +10,7 @@ import 'dart:async'; import 'dart:convert'; import 'frb_generated.dart'; import 'frb_generated.io.dart' if (dart.library.js_interop) 'frb_generated.web.dart'; +import 'lnurl/pay.dart'; import 'lsp.dart'; import 'models.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; @@ -196,12 +197,6 @@ abstract class BreezSdkBindingsApi extends BaseApi { Future crateBindingSync(); Future crateBindingUnregisterWebhook({required String webhookUrl}); - - RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_LnUrlPayResult; - - RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_LnUrlPayResult; - - CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_LnUrlPayResultPtr; } class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements BreezSdkBindingsApi { @@ -810,8 +805,7 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements return wire.wire__crate__binding__lnurl_pay(port_, arg0); }, codec: DcoCodec( - decodeSuccessData: - dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult, + decodeSuccessData: dco_decode_ln_url_pay_result, decodeErrorData: dco_decode_AnyhowException, ), constMeta: kCrateBindingLnurlPayConstMeta, @@ -1569,33 +1563,12 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements argNames: ["webhookUrl"], ); - RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_LnUrlPayResult => wire - .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult; - - RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_LnUrlPayResult => wire - .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult; - @protected AnyhowException dco_decode_AnyhowException(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs return AnyhowException(raw as String); } - @protected - LnUrlPayResult - dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult( - dynamic raw) { - // Codec=Dco (DartCObject based), see doc to use other codecs - return LnUrlPayResultImpl.frbInternalDcoDecode(raw as List); - } - - @protected - LnUrlPayResult dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult( - dynamic raw) { - // Codec=Dco (DartCObject based), see doc to use other codecs - return LnUrlPayResultImpl.frbInternalDcoDecode(raw as List); - } - @protected RustStreamSink dco_decode_StreamSink_breez_event_Dco(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -1823,6 +1796,12 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements return dco_decode_ln_url_error_data(raw); } + @protected + LnUrlPayErrorData dco_decode_box_autoadd_ln_url_pay_error_data(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_ln_url_pay_error_data(raw); + } + @protected LnUrlPayRequest dco_decode_box_autoadd_ln_url_pay_request(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -1835,6 +1814,12 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements return dco_decode_ln_url_pay_request_data(raw); } + @protected + LnUrlPaySuccessData dco_decode_box_autoadd_ln_url_pay_success_data(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_ln_url_pay_success_data(raw); + } + @protected LnUrlWithdrawRequest dco_decode_box_autoadd_ln_url_withdraw_request(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -2533,6 +2518,17 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements ); } + @protected + LnUrlPayErrorData dco_decode_ln_url_pay_error_data(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 2) throw Exception('unexpected arr length: expect 2 but see ${arr.length}'); + return LnUrlPayErrorData( + paymentHash: dco_decode_String(arr[0]), + reason: dco_decode_String(arr[1]), + ); + } + @protected LnUrlPayRequest dco_decode_ln_url_pay_request(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -2564,6 +2560,38 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements ); } + @protected + LnUrlPayResult dco_decode_ln_url_pay_result(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + switch (raw[0]) { + case 0: + return LnUrlPayResult_EndpointSuccess( + data: dco_decode_box_autoadd_ln_url_pay_success_data(raw[1]), + ); + case 1: + return LnUrlPayResult_EndpointError( + data: dco_decode_box_autoadd_ln_url_error_data(raw[1]), + ); + case 2: + return LnUrlPayResult_PayError( + data: dco_decode_box_autoadd_ln_url_pay_error_data(raw[1]), + ); + default: + throw Exception("unreachable"); + } + } + + @protected + LnUrlPaySuccessData dco_decode_ln_url_pay_success_data(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 2) throw Exception('unexpected arr length: expect 2 but see ${arr.length}'); + return LnUrlPaySuccessData( + payment: dco_decode_payment(arr[0]), + successAction: dco_decode_opt_box_autoadd_success_action_processed(arr[1]), + ); + } + @protected LnUrlWithdrawRequest dco_decode_ln_url_withdraw_request(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -3551,12 +3579,6 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements ); } - @protected - BigInt dco_decode_usize(dynamic raw) { - // Codec=Dco (DartCObject based), see doc to use other codecs - return dcoDecodeU64(raw); - } - @protected AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -3564,23 +3586,6 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements return AnyhowException(inner); } - @protected - LnUrlPayResult - sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult( - SseDeserializer deserializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - return LnUrlPayResultImpl.frbInternalSseDecode( - sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); - } - - @protected - LnUrlPayResult sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult( - SseDeserializer deserializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - return LnUrlPayResultImpl.frbInternalSseDecode( - sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); - } - @protected RustStreamSink sse_decode_StreamSink_breez_event_Dco(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -3804,6 +3809,12 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements return (sse_decode_ln_url_error_data(deserializer)); } + @protected + LnUrlPayErrorData sse_decode_box_autoadd_ln_url_pay_error_data(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_ln_url_pay_error_data(deserializer)); + } + @protected LnUrlPayRequest sse_decode_box_autoadd_ln_url_pay_request(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -3816,6 +3827,12 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements return (sse_decode_ln_url_pay_request_data(deserializer)); } + @protected + LnUrlPaySuccessData sse_decode_box_autoadd_ln_url_pay_success_data(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_ln_url_pay_success_data(deserializer)); + } + @protected LnUrlWithdrawRequest sse_decode_box_autoadd_ln_url_withdraw_request(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -4611,6 +4628,14 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements return LnUrlErrorData(reason: var_reason); } + @protected + LnUrlPayErrorData sse_decode_ln_url_pay_error_data(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_paymentHash = sse_decode_String(deserializer); + var var_reason = sse_decode_String(deserializer); + return LnUrlPayErrorData(paymentHash: var_paymentHash, reason: var_reason); + } + @protected LnUrlPayRequest sse_decode_ln_url_pay_request(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -4646,6 +4671,34 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements lnAddress: var_lnAddress); } + @protected + LnUrlPayResult sse_decode_ln_url_pay_result(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var tag_ = sse_decode_i_32(deserializer); + switch (tag_) { + case 0: + var var_data = sse_decode_box_autoadd_ln_url_pay_success_data(deserializer); + return LnUrlPayResult_EndpointSuccess(data: var_data); + case 1: + var var_data = sse_decode_box_autoadd_ln_url_error_data(deserializer); + return LnUrlPayResult_EndpointError(data: var_data); + case 2: + var var_data = sse_decode_box_autoadd_ln_url_pay_error_data(deserializer); + return LnUrlPayResult_PayError(data: var_data); + default: + throw UnimplementedError(''); + } + } + + @protected + LnUrlPaySuccessData sse_decode_ln_url_pay_success_data(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_payment = sse_decode_payment(deserializer); + var var_successAction = sse_decode_opt_box_autoadd_success_action_processed(deserializer); + return LnUrlPaySuccessData(payment: var_payment, successAction: var_successAction); + } + @protected LnUrlWithdrawRequest sse_decode_ln_url_withdraw_request(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -5696,28 +5749,6 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements return UrlSuccessActionData(description: var_description, url: var_url); } - @protected - BigInt sse_decode_usize(SseDeserializer deserializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - return deserializer.buffer.getBigUint64(); - } - - @protected - int cst_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult( - LnUrlPayResult raw) { - // Codec=Cst (C-struct based), see doc to use other codecs -// ignore: invalid_use_of_internal_member - return (raw as LnUrlPayResultImpl).frbInternalCstEncode(move: true); - } - - @protected - int cst_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult( - LnUrlPayResult raw) { - // Codec=Cst (C-struct based), see doc to use other codecs -// ignore: invalid_use_of_internal_member - return (raw as LnUrlPayResultImpl).frbInternalCstEncode(); - } - @protected bool cst_encode_bool(bool raw) { // Codec=Cst (C-struct based), see doc to use other codecs @@ -5832,20 +5863,6 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements sse_encode_String(self.message, serializer); } - @protected - void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult( - LnUrlPayResult self, SseSerializer serializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - sse_encode_usize((self as LnUrlPayResultImpl).frbInternalSseEncode(move: true), serializer); - } - - @protected - void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult( - LnUrlPayResult self, SseSerializer serializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - sse_encode_usize((self as LnUrlPayResultImpl).frbInternalSseEncode(move: null), serializer); - } - @protected void sse_encode_StreamSink_breez_event_Dco(RustStreamSink self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -6069,6 +6086,12 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements sse_encode_ln_url_error_data(self, serializer); } + @protected + void sse_encode_box_autoadd_ln_url_pay_error_data(LnUrlPayErrorData self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_ln_url_pay_error_data(self, serializer); + } + @protected void sse_encode_box_autoadd_ln_url_pay_request(LnUrlPayRequest self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -6081,6 +6104,12 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements sse_encode_ln_url_pay_request_data(self, serializer); } + @protected + void sse_encode_box_autoadd_ln_url_pay_success_data(LnUrlPaySuccessData self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_ln_url_pay_success_data(self, serializer); + } + @protected void sse_encode_box_autoadd_ln_url_withdraw_request(LnUrlWithdrawRequest self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -6748,6 +6777,13 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements sse_encode_String(self.reason, serializer); } + @protected + void sse_encode_ln_url_pay_error_data(LnUrlPayErrorData self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_String(self.paymentHash, serializer); + sse_encode_String(self.reason, serializer); + } + @protected void sse_encode_ln_url_pay_request(LnUrlPayRequest self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -6771,6 +6807,31 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements sse_encode_opt_String(self.lnAddress, serializer); } + @protected + void sse_encode_ln_url_pay_result(LnUrlPayResult self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + switch (self) { + case LnUrlPayResult_EndpointSuccess(data: final data): + sse_encode_i_32(0, serializer); + sse_encode_box_autoadd_ln_url_pay_success_data(data, serializer); + case LnUrlPayResult_EndpointError(data: final data): + sse_encode_i_32(1, serializer); + sse_encode_box_autoadd_ln_url_error_data(data, serializer); + case LnUrlPayResult_PayError(data: final data): + sse_encode_i_32(2, serializer); + sse_encode_box_autoadd_ln_url_pay_error_data(data, serializer); + default: + throw UnimplementedError(''); + } + } + + @protected + void sse_encode_ln_url_pay_success_data(LnUrlPaySuccessData self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_payment(self.payment, serializer); + sse_encode_opt_box_autoadd_success_action_processed(self.successAction, serializer); + } + @protected void sse_encode_ln_url_withdraw_request(LnUrlWithdrawRequest self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -7611,28 +7672,4 @@ class BreezSdkBindingsApiImpl extends BreezSdkBindingsApiImplPlatform implements sse_encode_String(self.description, serializer); sse_encode_String(self.url, serializer); } - - @protected - void sse_encode_usize(BigInt self, SseSerializer serializer) { - // Codec=Sse (Serialization based), see doc to use other codecs - serializer.buffer.putBigUint64(self); - } -} - -@sealed -class LnUrlPayResultImpl extends RustOpaque implements LnUrlPayResult { - // Not to be used by end users - LnUrlPayResultImpl.frbInternalDcoDecode(List wire) - : super.frbInternalDcoDecode(wire, _kStaticData); - - // Not to be used by end users - LnUrlPayResultImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative) - : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); - - static final _kStaticData = RustArcStaticData( - rustArcIncrementStrongCount: BreezSdkBindings.instance.api.rust_arc_increment_strong_count_LnUrlPayResult, - rustArcDecrementStrongCount: BreezSdkBindings.instance.api.rust_arc_decrement_strong_count_LnUrlPayResult, - rustArcDecrementStrongCountPtr: - BreezSdkBindings.instance.api.rust_arc_decrement_strong_count_LnUrlPayResultPtr, - ); } diff --git a/libs/sdk-flutter/lib/generated/frb_generated.io.dart b/libs/sdk-flutter/lib/generated/frb_generated.io.dart index bdc2b7de2..63824be8b 100644 --- a/libs/sdk-flutter/lib/generated/frb_generated.io.dart +++ b/libs/sdk-flutter/lib/generated/frb_generated.io.dart @@ -10,6 +10,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:ffi' as ffi; import 'frb_generated.dart'; +import 'lnurl/pay.dart'; import 'lsp.dart'; import 'models.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_io.dart'; @@ -22,21 +23,9 @@ abstract class BreezSdkBindingsApiImplPlatform extends BaseApiImpl wire - ._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResultPtr; - @protected AnyhowException dco_decode_AnyhowException(dynamic raw); - @protected - LnUrlPayResult - dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult( - dynamic raw); - - @protected - LnUrlPayResult dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult( - dynamic raw); - @protected RustStreamSink dco_decode_StreamSink_breez_event_Dco(dynamic raw); @@ -133,12 +122,18 @@ abstract class BreezSdkBindingsApiImplPlatform extends BaseApiImpl sse_decode_StreamSink_breez_event_Dco(SseDeserializer deserializer); @@ -782,12 +774,18 @@ abstract class BreezSdkBindingsApiImplPlatform extends BaseApiImpl cst_encode_AnyhowException(AnyhowException raw) { // Codec=Cst (C-struct based), see doc to use other codecs @@ -1545,6 +1549,15 @@ abstract class BreezSdkBindingsApiImplPlatform extends BaseApiImpl cst_encode_box_autoadd_ln_url_pay_error_data( + LnUrlPayErrorData raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + final ptr = wire.cst_new_box_autoadd_ln_url_pay_error_data(); + cst_api_fill_to_wire_ln_url_pay_error_data(raw, ptr.ref); + return ptr; + } + @protected ffi.Pointer cst_encode_box_autoadd_ln_url_pay_request(LnUrlPayRequest raw) { // Codec=Cst (C-struct based), see doc to use other codecs @@ -1562,6 +1575,15 @@ abstract class BreezSdkBindingsApiImplPlatform extends BaseApiImpl cst_encode_box_autoadd_ln_url_pay_success_data( + LnUrlPaySuccessData raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + final ptr = wire.cst_new_box_autoadd_ln_url_pay_success_data(); + cst_api_fill_to_wire_ln_url_pay_success_data(raw, ptr.ref); + return ptr; + } + @protected ffi.Pointer cst_encode_box_autoadd_ln_url_withdraw_request( LnUrlWithdrawRequest raw) { @@ -2160,12 +2182,6 @@ abstract class BreezSdkBindingsApiImplPlatform extends BaseApiImpl wireObj) { + cst_api_fill_to_wire_ln_url_pay_error_data(apiObj, wireObj.ref); + } + @protected void cst_api_fill_to_wire_box_autoadd_ln_url_pay_request( LnUrlPayRequest apiObj, ffi.Pointer wireObj) { @@ -2341,6 +2363,12 @@ abstract class BreezSdkBindingsApiImplPlatform extends BaseApiImpl wireObj) { + cst_api_fill_to_wire_ln_url_pay_success_data(apiObj, wireObj.ref); + } + @protected void cst_api_fill_to_wire_box_autoadd_ln_url_withdraw_request( LnUrlWithdrawRequest apiObj, ffi.Pointer wireObj) { @@ -2824,6 +2852,13 @@ abstract class BreezSdkBindingsApiImplPlatform extends BaseApiImpl self, SseSerializer serializer); @@ -3567,12 +3615,18 @@ abstract class BreezSdkBindingsApiImplPlatform extends BaseApiImpl)>(); - void - rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult( - ffi.Pointer ptr, - ) { - return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult( - ptr, - ); - } - - late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResultPtr = - _lookup)>>( - 'frbgen_breez_sdk_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult'); - late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult = - _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResultPtr - .asFunction)>(); - - void - rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult( - ffi.Pointer ptr, - ) { - return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult( - ptr, - ); - } - - late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResultPtr = - _lookup)>>( - 'frbgen_breez_sdk_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult'); - late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResult = - _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLnUrlPayResultPtr - .asFunction)>(); - ffi.Pointer cst_new_box_autoadd_aes_success_action_data_decrypted() { return _cst_new_box_autoadd_aes_success_action_data_decrypted(); @@ -5391,6 +5419,16 @@ class BreezSdkBindingsWire implements BaseWire { late final _cst_new_box_autoadd_ln_url_error_data = _cst_new_box_autoadd_ln_url_error_dataPtr .asFunction Function()>(); + ffi.Pointer cst_new_box_autoadd_ln_url_pay_error_data() { + return _cst_new_box_autoadd_ln_url_pay_error_data(); + } + + late final _cst_new_box_autoadd_ln_url_pay_error_dataPtr = + _lookup Function()>>( + 'frbgen_breez_sdk_cst_new_box_autoadd_ln_url_pay_error_data'); + late final _cst_new_box_autoadd_ln_url_pay_error_data = _cst_new_box_autoadd_ln_url_pay_error_dataPtr + .asFunction Function()>(); + ffi.Pointer cst_new_box_autoadd_ln_url_pay_request() { return _cst_new_box_autoadd_ln_url_pay_request(); } @@ -5411,6 +5449,16 @@ class BreezSdkBindingsWire implements BaseWire { late final _cst_new_box_autoadd_ln_url_pay_request_data = _cst_new_box_autoadd_ln_url_pay_request_dataPtr .asFunction Function()>(); + ffi.Pointer cst_new_box_autoadd_ln_url_pay_success_data() { + return _cst_new_box_autoadd_ln_url_pay_success_data(); + } + + late final _cst_new_box_autoadd_ln_url_pay_success_dataPtr = + _lookup Function()>>( + 'frbgen_breez_sdk_cst_new_box_autoadd_ln_url_pay_success_data'); + late final _cst_new_box_autoadd_ln_url_pay_success_data = _cst_new_box_autoadd_ln_url_pay_success_dataPtr + .asFunction Function()>(); + ffi.Pointer cst_new_box_autoadd_ln_url_withdraw_request() { return _cst_new_box_autoadd_ln_url_withdraw_request(); } @@ -6812,6 +6860,18 @@ final class wire_cst_ln_url_error_data extends ffi.Struct { external ffi.Pointer reason; } +final class wire_cst_ln_url_pay_error_data extends ffi.Struct { + external ffi.Pointer payment_hash; + + external ffi.Pointer reason; +} + +final class wire_cst_ln_url_pay_success_data extends ffi.Struct { + external wire_cst_payment payment; + + external ffi.Pointer success_action; +} + final class wire_cst_ln_url_withdraw_success_data extends ffi.Struct { external wire_cst_ln_invoice invoice; } @@ -7092,6 +7152,33 @@ final class wire_cst_ln_url_callback_status extends ffi.Struct { external LnUrlCallbackStatusKind kind; } +final class wire_cst_LnUrlPayResult_EndpointSuccess extends ffi.Struct { + external ffi.Pointer data; +} + +final class wire_cst_LnUrlPayResult_EndpointError extends ffi.Struct { + external ffi.Pointer data; +} + +final class wire_cst_LnUrlPayResult_PayError extends ffi.Struct { + external ffi.Pointer data; +} + +final class LnUrlPayResultKind extends ffi.Union { + external wire_cst_LnUrlPayResult_EndpointSuccess EndpointSuccess; + + external wire_cst_LnUrlPayResult_EndpointError EndpointError; + + external wire_cst_LnUrlPayResult_PayError PayError; +} + +final class wire_cst_ln_url_pay_result extends ffi.Struct { + @ffi.Int32() + external int tag; + + external LnUrlPayResultKind kind; +} + final class wire_cst_LnUrlWithdrawResult_Ok extends ffi.Struct { external ffi.Pointer data; } diff --git a/libs/sdk-flutter/lib/generated/lnurl/pay.dart b/libs/sdk-flutter/lib/generated/lnurl/pay.dart new file mode 100644 index 000000000..ae8095aed --- /dev/null +++ b/libs/sdk-flutter/lib/generated/lnurl/pay.dart @@ -0,0 +1,47 @@ +// This file is automatically generated, so please do not edit it. +// Generated by `flutter_rust_bridge`@ 2.0.0. + +// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import + +import '../binding.dart'; +import '../frb_generated.dart'; +import '../models.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; +import 'package:freezed_annotation/freezed_annotation.dart' hide protected; +part 'pay.freezed.dart'; + +@freezed +sealed class LnUrlPayResult with _$LnUrlPayResult { + const LnUrlPayResult._(); + + const factory LnUrlPayResult.endpointSuccess({ + required LnUrlPaySuccessData data, + }) = LnUrlPayResult_EndpointSuccess; + const factory LnUrlPayResult.endpointError({ + required LnUrlErrorData data, + }) = LnUrlPayResult_EndpointError; + const factory LnUrlPayResult.payError({ + required LnUrlPayErrorData data, + }) = LnUrlPayResult_PayError; +} + +class LnUrlPaySuccessData { + final Payment payment; + final SuccessActionProcessed? successAction; + + const LnUrlPaySuccessData({ + required this.payment, + this.successAction, + }); + + @override + int get hashCode => payment.hashCode ^ successAction.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is LnUrlPaySuccessData && + runtimeType == other.runtimeType && + payment == other.payment && + successAction == other.successAction; +} diff --git a/libs/sdk-flutter/lib/generated/lnurl/pay.freezed.dart b/libs/sdk-flutter/lib/generated/lnurl/pay.freezed.dart new file mode 100644 index 000000000..f4eaaa03d --- /dev/null +++ b/libs/sdk-flutter/lib/generated/lnurl/pay.freezed.dart @@ -0,0 +1,508 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'pay.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +/// @nodoc +mixin _$LnUrlPayResult { + Object get data => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult when({ + required TResult Function(LnUrlPaySuccessData data) endpointSuccess, + required TResult Function(LnUrlErrorData data) endpointError, + required TResult Function(LnUrlPayErrorData data) payError, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(LnUrlPaySuccessData data)? endpointSuccess, + TResult? Function(LnUrlErrorData data)? endpointError, + TResult? Function(LnUrlPayErrorData data)? payError, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(LnUrlPaySuccessData data)? endpointSuccess, + TResult Function(LnUrlErrorData data)? endpointError, + TResult Function(LnUrlPayErrorData data)? payError, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(LnUrlPayResult_EndpointSuccess value) endpointSuccess, + required TResult Function(LnUrlPayResult_EndpointError value) endpointError, + required TResult Function(LnUrlPayResult_PayError value) payError, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(LnUrlPayResult_EndpointSuccess value)? endpointSuccess, + TResult? Function(LnUrlPayResult_EndpointError value)? endpointError, + TResult? Function(LnUrlPayResult_PayError value)? payError, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(LnUrlPayResult_EndpointSuccess value)? endpointSuccess, + TResult Function(LnUrlPayResult_EndpointError value)? endpointError, + TResult Function(LnUrlPayResult_PayError value)? payError, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $LnUrlPayResultCopyWith<$Res> { + factory $LnUrlPayResultCopyWith(LnUrlPayResult value, $Res Function(LnUrlPayResult) then) = + _$LnUrlPayResultCopyWithImpl<$Res, LnUrlPayResult>; +} + +/// @nodoc +class _$LnUrlPayResultCopyWithImpl<$Res, $Val extends LnUrlPayResult> + implements $LnUrlPayResultCopyWith<$Res> { + _$LnUrlPayResultCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; +} + +/// @nodoc +abstract class _$$LnUrlPayResult_EndpointSuccessImplCopyWith<$Res> { + factory _$$LnUrlPayResult_EndpointSuccessImplCopyWith(_$LnUrlPayResult_EndpointSuccessImpl value, + $Res Function(_$LnUrlPayResult_EndpointSuccessImpl) then) = + __$$LnUrlPayResult_EndpointSuccessImplCopyWithImpl<$Res>; + @useResult + $Res call({LnUrlPaySuccessData data}); +} + +/// @nodoc +class __$$LnUrlPayResult_EndpointSuccessImplCopyWithImpl<$Res> + extends _$LnUrlPayResultCopyWithImpl<$Res, _$LnUrlPayResult_EndpointSuccessImpl> + implements _$$LnUrlPayResult_EndpointSuccessImplCopyWith<$Res> { + __$$LnUrlPayResult_EndpointSuccessImplCopyWithImpl( + _$LnUrlPayResult_EndpointSuccessImpl _value, $Res Function(_$LnUrlPayResult_EndpointSuccessImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? data = null, + }) { + return _then(_$LnUrlPayResult_EndpointSuccessImpl( + data: null == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as LnUrlPaySuccessData, + )); + } +} + +/// @nodoc + +class _$LnUrlPayResult_EndpointSuccessImpl extends LnUrlPayResult_EndpointSuccess { + const _$LnUrlPayResult_EndpointSuccessImpl({required this.data}) : super._(); + + @override + final LnUrlPaySuccessData data; + + @override + String toString() { + return 'LnUrlPayResult.endpointSuccess(data: $data)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$LnUrlPayResult_EndpointSuccessImpl && + (identical(other.data, data) || other.data == data)); + } + + @override + int get hashCode => Object.hash(runtimeType, data); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$LnUrlPayResult_EndpointSuccessImplCopyWith<_$LnUrlPayResult_EndpointSuccessImpl> get copyWith => + __$$LnUrlPayResult_EndpointSuccessImplCopyWithImpl<_$LnUrlPayResult_EndpointSuccessImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(LnUrlPaySuccessData data) endpointSuccess, + required TResult Function(LnUrlErrorData data) endpointError, + required TResult Function(LnUrlPayErrorData data) payError, + }) { + return endpointSuccess(data); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(LnUrlPaySuccessData data)? endpointSuccess, + TResult? Function(LnUrlErrorData data)? endpointError, + TResult? Function(LnUrlPayErrorData data)? payError, + }) { + return endpointSuccess?.call(data); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(LnUrlPaySuccessData data)? endpointSuccess, + TResult Function(LnUrlErrorData data)? endpointError, + TResult Function(LnUrlPayErrorData data)? payError, + required TResult orElse(), + }) { + if (endpointSuccess != null) { + return endpointSuccess(data); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(LnUrlPayResult_EndpointSuccess value) endpointSuccess, + required TResult Function(LnUrlPayResult_EndpointError value) endpointError, + required TResult Function(LnUrlPayResult_PayError value) payError, + }) { + return endpointSuccess(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(LnUrlPayResult_EndpointSuccess value)? endpointSuccess, + TResult? Function(LnUrlPayResult_EndpointError value)? endpointError, + TResult? Function(LnUrlPayResult_PayError value)? payError, + }) { + return endpointSuccess?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(LnUrlPayResult_EndpointSuccess value)? endpointSuccess, + TResult Function(LnUrlPayResult_EndpointError value)? endpointError, + TResult Function(LnUrlPayResult_PayError value)? payError, + required TResult orElse(), + }) { + if (endpointSuccess != null) { + return endpointSuccess(this); + } + return orElse(); + } +} + +abstract class LnUrlPayResult_EndpointSuccess extends LnUrlPayResult { + const factory LnUrlPayResult_EndpointSuccess({required final LnUrlPaySuccessData data}) = + _$LnUrlPayResult_EndpointSuccessImpl; + const LnUrlPayResult_EndpointSuccess._() : super._(); + + @override + LnUrlPaySuccessData get data; + @JsonKey(ignore: true) + _$$LnUrlPayResult_EndpointSuccessImplCopyWith<_$LnUrlPayResult_EndpointSuccessImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$LnUrlPayResult_EndpointErrorImplCopyWith<$Res> { + factory _$$LnUrlPayResult_EndpointErrorImplCopyWith( + _$LnUrlPayResult_EndpointErrorImpl value, $Res Function(_$LnUrlPayResult_EndpointErrorImpl) then) = + __$$LnUrlPayResult_EndpointErrorImplCopyWithImpl<$Res>; + @useResult + $Res call({LnUrlErrorData data}); +} + +/// @nodoc +class __$$LnUrlPayResult_EndpointErrorImplCopyWithImpl<$Res> + extends _$LnUrlPayResultCopyWithImpl<$Res, _$LnUrlPayResult_EndpointErrorImpl> + implements _$$LnUrlPayResult_EndpointErrorImplCopyWith<$Res> { + __$$LnUrlPayResult_EndpointErrorImplCopyWithImpl( + _$LnUrlPayResult_EndpointErrorImpl _value, $Res Function(_$LnUrlPayResult_EndpointErrorImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? data = null, + }) { + return _then(_$LnUrlPayResult_EndpointErrorImpl( + data: null == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as LnUrlErrorData, + )); + } +} + +/// @nodoc + +class _$LnUrlPayResult_EndpointErrorImpl extends LnUrlPayResult_EndpointError { + const _$LnUrlPayResult_EndpointErrorImpl({required this.data}) : super._(); + + @override + final LnUrlErrorData data; + + @override + String toString() { + return 'LnUrlPayResult.endpointError(data: $data)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$LnUrlPayResult_EndpointErrorImpl && + (identical(other.data, data) || other.data == data)); + } + + @override + int get hashCode => Object.hash(runtimeType, data); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$LnUrlPayResult_EndpointErrorImplCopyWith<_$LnUrlPayResult_EndpointErrorImpl> get copyWith => + __$$LnUrlPayResult_EndpointErrorImplCopyWithImpl<_$LnUrlPayResult_EndpointErrorImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(LnUrlPaySuccessData data) endpointSuccess, + required TResult Function(LnUrlErrorData data) endpointError, + required TResult Function(LnUrlPayErrorData data) payError, + }) { + return endpointError(data); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(LnUrlPaySuccessData data)? endpointSuccess, + TResult? Function(LnUrlErrorData data)? endpointError, + TResult? Function(LnUrlPayErrorData data)? payError, + }) { + return endpointError?.call(data); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(LnUrlPaySuccessData data)? endpointSuccess, + TResult Function(LnUrlErrorData data)? endpointError, + TResult Function(LnUrlPayErrorData data)? payError, + required TResult orElse(), + }) { + if (endpointError != null) { + return endpointError(data); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(LnUrlPayResult_EndpointSuccess value) endpointSuccess, + required TResult Function(LnUrlPayResult_EndpointError value) endpointError, + required TResult Function(LnUrlPayResult_PayError value) payError, + }) { + return endpointError(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(LnUrlPayResult_EndpointSuccess value)? endpointSuccess, + TResult? Function(LnUrlPayResult_EndpointError value)? endpointError, + TResult? Function(LnUrlPayResult_PayError value)? payError, + }) { + return endpointError?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(LnUrlPayResult_EndpointSuccess value)? endpointSuccess, + TResult Function(LnUrlPayResult_EndpointError value)? endpointError, + TResult Function(LnUrlPayResult_PayError value)? payError, + required TResult orElse(), + }) { + if (endpointError != null) { + return endpointError(this); + } + return orElse(); + } +} + +abstract class LnUrlPayResult_EndpointError extends LnUrlPayResult { + const factory LnUrlPayResult_EndpointError({required final LnUrlErrorData data}) = + _$LnUrlPayResult_EndpointErrorImpl; + const LnUrlPayResult_EndpointError._() : super._(); + + @override + LnUrlErrorData get data; + @JsonKey(ignore: true) + _$$LnUrlPayResult_EndpointErrorImplCopyWith<_$LnUrlPayResult_EndpointErrorImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$LnUrlPayResult_PayErrorImplCopyWith<$Res> { + factory _$$LnUrlPayResult_PayErrorImplCopyWith( + _$LnUrlPayResult_PayErrorImpl value, $Res Function(_$LnUrlPayResult_PayErrorImpl) then) = + __$$LnUrlPayResult_PayErrorImplCopyWithImpl<$Res>; + @useResult + $Res call({LnUrlPayErrorData data}); +} + +/// @nodoc +class __$$LnUrlPayResult_PayErrorImplCopyWithImpl<$Res> + extends _$LnUrlPayResultCopyWithImpl<$Res, _$LnUrlPayResult_PayErrorImpl> + implements _$$LnUrlPayResult_PayErrorImplCopyWith<$Res> { + __$$LnUrlPayResult_PayErrorImplCopyWithImpl( + _$LnUrlPayResult_PayErrorImpl _value, $Res Function(_$LnUrlPayResult_PayErrorImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? data = null, + }) { + return _then(_$LnUrlPayResult_PayErrorImpl( + data: null == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as LnUrlPayErrorData, + )); + } +} + +/// @nodoc + +class _$LnUrlPayResult_PayErrorImpl extends LnUrlPayResult_PayError { + const _$LnUrlPayResult_PayErrorImpl({required this.data}) : super._(); + + @override + final LnUrlPayErrorData data; + + @override + String toString() { + return 'LnUrlPayResult.payError(data: $data)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$LnUrlPayResult_PayErrorImpl && + (identical(other.data, data) || other.data == data)); + } + + @override + int get hashCode => Object.hash(runtimeType, data); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$LnUrlPayResult_PayErrorImplCopyWith<_$LnUrlPayResult_PayErrorImpl> get copyWith => + __$$LnUrlPayResult_PayErrorImplCopyWithImpl<_$LnUrlPayResult_PayErrorImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(LnUrlPaySuccessData data) endpointSuccess, + required TResult Function(LnUrlErrorData data) endpointError, + required TResult Function(LnUrlPayErrorData data) payError, + }) { + return payError(data); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(LnUrlPaySuccessData data)? endpointSuccess, + TResult? Function(LnUrlErrorData data)? endpointError, + TResult? Function(LnUrlPayErrorData data)? payError, + }) { + return payError?.call(data); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(LnUrlPaySuccessData data)? endpointSuccess, + TResult Function(LnUrlErrorData data)? endpointError, + TResult Function(LnUrlPayErrorData data)? payError, + required TResult orElse(), + }) { + if (payError != null) { + return payError(data); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(LnUrlPayResult_EndpointSuccess value) endpointSuccess, + required TResult Function(LnUrlPayResult_EndpointError value) endpointError, + required TResult Function(LnUrlPayResult_PayError value) payError, + }) { + return payError(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(LnUrlPayResult_EndpointSuccess value)? endpointSuccess, + TResult? Function(LnUrlPayResult_EndpointError value)? endpointError, + TResult? Function(LnUrlPayResult_PayError value)? payError, + }) { + return payError?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(LnUrlPayResult_EndpointSuccess value)? endpointSuccess, + TResult Function(LnUrlPayResult_EndpointError value)? endpointError, + TResult Function(LnUrlPayResult_PayError value)? payError, + required TResult orElse(), + }) { + if (payError != null) { + return payError(this); + } + return orElse(); + } +} + +abstract class LnUrlPayResult_PayError extends LnUrlPayResult { + const factory LnUrlPayResult_PayError({required final LnUrlPayErrorData data}) = + _$LnUrlPayResult_PayErrorImpl; + const LnUrlPayResult_PayError._() : super._(); + + @override + LnUrlPayErrorData get data; + @JsonKey(ignore: true) + _$$LnUrlPayResult_PayErrorImplCopyWith<_$LnUrlPayResult_PayErrorImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/libs/sdk-flutter/lib/sdk.dart b/libs/sdk-flutter/lib/sdk.dart index e62b19944..540832134 100644 --- a/libs/sdk-flutter/lib/sdk.dart +++ b/libs/sdk-flutter/lib/sdk.dart @@ -4,5 +4,6 @@ export 'generated/chain.dart'; export 'generated/frb_generated.dart'; export 'generated/frb_generated.io.dart'; export 'generated/lsp.dart'; +export 'generated/lnurl/pay.dart'; export 'generated/models.dart'; export 'exceptions.dart';