From ad71cde4637aa02c5890c634f85e59bc8cbb2879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Granh=C3=A3o?= Date: Tue, 7 Jan 2025 15:45:29 +0000 Subject: [PATCH] Fix missing dart bindings --- .../include/breez_sdk_liquid.h | 31 ++ lib/core/src/bindings.rs | 14 + lib/core/src/frb_generated.rs | 362 +++++++++++++++++- packages/dart/lib/src/bindings.dart | 5 + packages/dart/lib/src/frb_generated.dart | 195 +++++++++- packages/dart/lib/src/frb_generated.io.dart | 195 ++++++++++ packages/dart/lib/src/model.dart | 69 ++++ ...utter_breez_liquid_bindings_generated.dart | 89 +++++ 8 files changed, 958 insertions(+), 2 deletions(-) diff --git a/lib/bindings/langs/flutter/breez_sdk_liquid/include/breez_sdk_liquid.h b/lib/bindings/langs/flutter/breez_sdk_liquid/include/breez_sdk_liquid.h index 0ef67bc58..e21bd885e 100644 --- a/lib/bindings/langs/flutter/breez_sdk_liquid/include/breez_sdk_liquid.h +++ b/lib/bindings/langs/flutter/breez_sdk_liquid/include/breez_sdk_liquid.h @@ -44,6 +44,17 @@ typedef struct wire_cst_list_prim_u_8_strict { int32_t len; } wire_cst_list_prim_u_8_strict; +typedef struct wire_cst_fetch_payment_proposed_fees_response { + struct wire_cst_list_prim_u_8_strict *swap_id; + uint64_t fees_sat; + uint64_t payer_amount_sat; + uint64_t receiver_amount_sat; +} wire_cst_fetch_payment_proposed_fees_response; + +typedef struct wire_cst_accept_payment_proposed_fees_request { + struct wire_cst_fetch_payment_proposed_fees_response response; +} wire_cst_accept_payment_proposed_fees_request; + typedef struct wire_cst_backup_request { struct wire_cst_list_prim_u_8_strict *backup_path; } wire_cst_backup_request; @@ -65,6 +76,10 @@ typedef struct wire_cst_check_message_request { struct wire_cst_list_prim_u_8_strict *signature; } wire_cst_check_message_request; +typedef struct wire_cst_fetch_payment_proposed_fees_request { + struct wire_cst_list_prim_u_8_strict *swap_id; +} wire_cst_fetch_payment_proposed_fees_request; + typedef struct wire_cst_GetPaymentRequest_Lightning { struct wire_cst_list_prim_u_8_strict *payment_hash; } wire_cst_GetPaymentRequest_Lightning; @@ -1076,6 +1091,10 @@ typedef struct wire_cst_sign_message_response { struct wire_cst_list_prim_u_8_strict *signature; } wire_cst_sign_message_response; +void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_accept_payment_proposed_fees(int64_t port_, + uintptr_t that, + struct wire_cst_accept_payment_proposed_fees_request *req); + void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_add_event_listener(int64_t port_, uintptr_t that, struct wire_cst_list_prim_u_8_strict *listener); @@ -1104,6 +1123,10 @@ void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_lightning void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_onchain_limits(int64_t port_, uintptr_t that); +void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_payment_proposed_fees(int64_t port_, + uintptr_t that, + struct wire_cst_fetch_payment_proposed_fees_request *req); + void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_get_info(int64_t port_, uintptr_t that); @@ -1218,6 +1241,8 @@ void frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust void frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerBindingLiquidSdk(const void *ptr); +struct wire_cst_accept_payment_proposed_fees_request *frbgen_breez_liquid_cst_new_box_autoadd_accept_payment_proposed_fees_request(void); + struct wire_cst_aes_success_action_data *frbgen_breez_liquid_cst_new_box_autoadd_aes_success_action_data(void); struct wire_cst_aes_success_action_data_decrypted *frbgen_breez_liquid_cst_new_box_autoadd_aes_success_action_data_decrypted(void); @@ -1242,6 +1267,8 @@ struct wire_cst_connect_request *frbgen_breez_liquid_cst_new_box_autoadd_connect double *frbgen_breez_liquid_cst_new_box_autoadd_f_64(double value); +struct wire_cst_fetch_payment_proposed_fees_request *frbgen_breez_liquid_cst_new_box_autoadd_fetch_payment_proposed_fees_request(void); + struct wire_cst_get_payment_request *frbgen_breez_liquid_cst_new_box_autoadd_get_payment_request(void); int64_t *frbgen_breez_liquid_cst_new_box_autoadd_i_64(int64_t value); @@ -1349,6 +1376,7 @@ struct wire_cst_list_route_hint *frbgen_breez_liquid_cst_new_list_route_hint(int struct wire_cst_list_route_hint_hop *frbgen_breez_liquid_cst_new_list_route_hint_hop(int32_t len); static int64_t dummy_method_to_enforce_bundling(void) { int64_t dummy_var = 0; + dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_accept_payment_proposed_fees_request); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_aes_success_action_data); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_aes_success_action_data_decrypted); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_aes_success_action_data_result); @@ -1361,6 +1389,7 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_check_message_request); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_connect_request); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_f_64); + dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_fetch_payment_proposed_fees_request); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_get_payment_request); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_i_64); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_liquid_address_data); @@ -1416,6 +1445,7 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_list_route_hint_hop); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerBindingLiquidSdk); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerBindingLiquidSdk); + dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_accept_payment_proposed_fees); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_add_event_listener); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_backup); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_buy_bitcoin); @@ -1425,6 +1455,7 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_fiat_rates); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_lightning_limits); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_onchain_limits); + dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_payment_proposed_fees); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_get_info); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_get_payment); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_list_fiat_currencies); diff --git a/lib/core/src/bindings.rs b/lib/core/src/bindings.rs index 3717cb96a..2b2753575 100644 --- a/lib/core/src/bindings.rs +++ b/lib/core/src/bindings.rs @@ -183,6 +183,20 @@ impl BindingLiquidSdk { self.sdk.get_payment(&req).await } + pub async fn fetch_payment_proposed_fees( + &self, + req: FetchPaymentProposedFeesRequest, + ) -> Result { + self.sdk.fetch_payment_proposed_fees(&req).await + } + + pub async fn accept_payment_proposed_fees( + &self, + req: AcceptPaymentProposedFeesRequest, + ) -> Result<(), PaymentError> { + self.sdk.accept_payment_proposed_fees(&req).await + } + pub async fn prepare_lnurl_pay( &self, req: PrepareLnUrlPayRequest, diff --git a/lib/core/src/frb_generated.rs b/lib/core/src/frb_generated.rs index c8c117dd3..2b74d2909 100644 --- a/lib/core/src/frb_generated.rs +++ b/lib/core/src/frb_generated.rs @@ -39,7 +39,7 @@ flutter_rust_bridge::frb_generated_boilerplate!( default_rust_auto_opaque = RustAutoOpaqueNom, ); pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.7.0"; -pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = -2032324171; +pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = 1264782025; // Section: executor @@ -47,6 +47,56 @@ flutter_rust_bridge::frb_generated_default_handler!(); // Section: wire_funcs +fn wire__crate__bindings__BindingLiquidSdk_accept_payment_proposed_fees_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + that: impl CstDecode< + RustOpaqueNom>, + >, + req: impl CstDecode, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "BindingLiquidSdk_accept_payment_proposed_fees", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let api_that = that.cst_decode(); + let api_req = req.cst_decode(); + move |context| async move { + transform_result_dco::<_, _, crate::error::PaymentError>( + (move || async move { + let mut api_that_guard = None; + let decode_indices_ = + flutter_rust_bridge::for_generated::lockable_compute_decode_order( + vec![flutter_rust_bridge::for_generated::LockableOrderInfo::new( + &api_that, 0, false, + )], + ); + for i in decode_indices_ { + match i { + 0 => { + api_that_guard = + Some(api_that.lockable_decode_async_ref().await) + } + _ => unreachable!(), + } + } + let api_that_guard = api_that_guard.unwrap(); + let output_ok = + crate::bindings::BindingLiquidSdk::accept_payment_proposed_fees( + &*api_that_guard, + api_req, + ) + .await?; + Ok(output_ok) + })() + .await, + ) + } + }, + ) +} fn wire__crate__bindings__BindingLiquidSdk_add_event_listener_impl( port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode< @@ -437,6 +487,56 @@ fn wire__crate__bindings__BindingLiquidSdk_fetch_onchain_limits_impl( }, ) } +fn wire__crate__bindings__BindingLiquidSdk_fetch_payment_proposed_fees_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + that: impl CstDecode< + RustOpaqueNom>, + >, + req: impl CstDecode, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "BindingLiquidSdk_fetch_payment_proposed_fees", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let api_that = that.cst_decode(); + let api_req = req.cst_decode(); + move |context| async move { + transform_result_dco::<_, _, crate::error::SdkError>( + (move || async move { + let mut api_that_guard = None; + let decode_indices_ = + flutter_rust_bridge::for_generated::lockable_compute_decode_order( + vec![flutter_rust_bridge::for_generated::LockableOrderInfo::new( + &api_that, 0, false, + )], + ); + for i in decode_indices_ { + match i { + 0 => { + api_that_guard = + Some(api_that.lockable_decode_async_ref().await) + } + _ => unreachable!(), + } + } + let api_that_guard = api_that_guard.unwrap(); + let output_ok = + crate::bindings::BindingLiquidSdk::fetch_payment_proposed_fees( + &*api_that_guard, + api_req, + ) + .await?; + Ok(output_ok) + })() + .await, + ) + } + }, + ) +} fn wire__crate__bindings__BindingLiquidSdk_get_info_impl( port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode< @@ -2193,6 +2293,17 @@ impl SseDecode for String { } } +impl SseDecode for crate::model::AcceptPaymentProposedFeesRequest { + // 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_response = + ::sse_decode(deserializer); + return crate::model::AcceptPaymentProposedFeesRequest { + response: var_response, + }; + } +} + impl SseDecode for crate::bindings::AesSuccessActionData { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -2455,6 +2566,32 @@ impl SseDecode for f64 { } } +impl SseDecode for crate::model::FetchPaymentProposedFeesRequest { + // 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_swapId = ::sse_decode(deserializer); + return crate::model::FetchPaymentProposedFeesRequest { + swap_id: var_swapId, + }; + } +} + +impl SseDecode for crate::model::FetchPaymentProposedFeesResponse { + // 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_swapId = ::sse_decode(deserializer); + let mut var_feesSat = ::sse_decode(deserializer); + let mut var_payerAmountSat = ::sse_decode(deserializer); + let mut var_receiverAmountSat = ::sse_decode(deserializer); + return crate::model::FetchPaymentProposedFeesResponse { + swap_id: var_swapId, + fees_sat: var_feesSat, + payer_amount_sat: var_payerAmountSat, + receiver_amount_sat: var_receiverAmountSat, + }; + } +} + impl SseDecode for crate::bindings::FiatCurrency { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -4428,6 +4565,23 @@ impl flutter_rust_bridge::IntoIntoDart> for Binding } } +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::model::AcceptPaymentProposedFeesRequest { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [self.response.into_into_dart().into_dart()].into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::model::AcceptPaymentProposedFeesRequest +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::model::AcceptPaymentProposedFeesRequest +{ + fn into_into_dart(self) -> crate::model::AcceptPaymentProposedFeesRequest { + 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 { @@ -4767,6 +4921,46 @@ impl flutter_rust_bridge::IntoIntoDart flutter_rust_bridge::for_generated::DartAbi { + [self.swap_id.into_into_dart().into_dart()].into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::model::FetchPaymentProposedFeesRequest +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::model::FetchPaymentProposedFeesRequest +{ + fn into_into_dart(self) -> crate::model::FetchPaymentProposedFeesRequest { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::model::FetchPaymentProposedFeesResponse { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.swap_id.into_into_dart().into_dart(), + self.fees_sat.into_into_dart().into_dart(), + self.payer_amount_sat.into_into_dart().into_dart(), + self.receiver_amount_sat.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::model::FetchPaymentProposedFeesResponse +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::model::FetchPaymentProposedFeesResponse +{ + fn into_into_dart(self) -> crate::model::FetchPaymentProposedFeesResponse { + 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 { [ @@ -6655,6 +6849,13 @@ impl SseEncode for String { } } +impl SseEncode for crate::model::AcceptPaymentProposedFeesRequest { + // 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.response, serializer); + } +} + impl SseEncode for crate::bindings::AesSuccessActionData { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -6845,6 +7046,23 @@ impl SseEncode for f64 { } } +impl SseEncode for crate::model::FetchPaymentProposedFeesRequest { + // 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.swap_id, serializer); + } +} + +impl SseEncode for crate::model::FetchPaymentProposedFeesResponse { + // 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.swap_id, serializer); + ::sse_encode(self.fees_sat, serializer); + ::sse_encode(self.payer_amount_sat, serializer); + ::sse_encode(self.receiver_amount_sat, serializer); + } +} + impl SseEncode for crate::bindings::FiatCurrency { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -8465,6 +8683,16 @@ mod io { String::from_utf8(vec).unwrap() } } + impl CstDecode + for wire_cst_accept_payment_proposed_fees_request + { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::model::AcceptPaymentProposedFeesRequest { + crate::model::AcceptPaymentProposedFeesRequest { + response: self.response.cst_decode(), + } + } + } impl CstDecode for wire_cst_aes_success_action_data { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> crate::bindings::AesSuccessActionData { @@ -8557,6 +8785,15 @@ mod io { } } } + impl CstDecode + for *mut wire_cst_accept_payment_proposed_fees_request + { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::model::AcceptPaymentProposedFeesRequest { + let wrap = unsafe { flutter_rust_bridge::for_generated::box_from_leak_ptr(self) }; + CstDecode::::cst_decode(*wrap).into() + } + } impl CstDecode for *mut wire_cst_aes_success_action_data { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> crate::bindings::AesSuccessActionData { @@ -8643,6 +8880,15 @@ mod io { unsafe { *flutter_rust_bridge::for_generated::box_from_leak_ptr(self) } } } + impl CstDecode + for *mut wire_cst_fetch_payment_proposed_fees_request + { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::model::FetchPaymentProposedFeesRequest { + let wrap = unsafe { flutter_rust_bridge::for_generated::box_from_leak_ptr(self) }; + CstDecode::::cst_decode(*wrap).into() + } + } impl CstDecode for *mut wire_cst_get_payment_request { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> crate::model::GetPaymentRequest { @@ -9009,6 +9255,29 @@ mod io { } } } + impl CstDecode + for wire_cst_fetch_payment_proposed_fees_request + { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::model::FetchPaymentProposedFeesRequest { + crate::model::FetchPaymentProposedFeesRequest { + swap_id: self.swap_id.cst_decode(), + } + } + } + impl CstDecode + for wire_cst_fetch_payment_proposed_fees_response + { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::model::FetchPaymentProposedFeesResponse { + crate::model::FetchPaymentProposedFeesResponse { + swap_id: self.swap_id.cst_decode(), + fees_sat: self.fees_sat.cst_decode(), + payer_amount_sat: self.payer_amount_sat.cst_decode(), + receiver_amount_sat: self.receiver_amount_sat.cst_decode(), + } + } + } impl CstDecode for wire_cst_fiat_currency { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> crate::bindings::FiatCurrency { @@ -10321,6 +10590,18 @@ mod io { } } } + impl NewWithNullPtr for wire_cst_accept_payment_proposed_fees_request { + fn new_with_null_ptr() -> Self { + Self { + response: Default::default(), + } + } + } + impl Default for wire_cst_accept_payment_proposed_fees_request { + fn default() -> Self { + Self::new_with_null_ptr() + } + } impl NewWithNullPtr for wire_cst_aes_success_action_data { fn new_with_null_ptr() -> Self { Self { @@ -10523,6 +10804,33 @@ mod io { Self::new_with_null_ptr() } } + impl NewWithNullPtr for wire_cst_fetch_payment_proposed_fees_request { + fn new_with_null_ptr() -> Self { + Self { + swap_id: core::ptr::null_mut(), + } + } + } + impl Default for wire_cst_fetch_payment_proposed_fees_request { + fn default() -> Self { + Self::new_with_null_ptr() + } + } + impl NewWithNullPtr for wire_cst_fetch_payment_proposed_fees_response { + fn new_with_null_ptr() -> Self { + Self { + swap_id: core::ptr::null_mut(), + fees_sat: Default::default(), + payer_amount_sat: Default::default(), + receiver_amount_sat: Default::default(), + } + } + } + impl Default for wire_cst_fetch_payment_proposed_fees_response { + fn default() -> Self { + Self::new_with_null_ptr() + } + } impl NewWithNullPtr for wire_cst_fiat_currency { fn new_with_null_ptr() -> Self { Self { @@ -11517,6 +11825,15 @@ mod io { } } + #[no_mangle] + pub extern "C" fn frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_accept_payment_proposed_fees( + port_: i64, + that: usize, + req: *mut wire_cst_accept_payment_proposed_fees_request, + ) { + wire__crate__bindings__BindingLiquidSdk_accept_payment_proposed_fees_impl(port_, that, req) + } + #[no_mangle] pub extern "C" fn frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_add_event_listener( port_: i64, @@ -11590,6 +11907,15 @@ mod io { wire__crate__bindings__BindingLiquidSdk_fetch_onchain_limits_impl(port_, that) } + #[no_mangle] + pub extern "C" fn frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_payment_proposed_fees( + port_: i64, + that: usize, + req: *mut wire_cst_fetch_payment_proposed_fees_request, + ) { + wire__crate__bindings__BindingLiquidSdk_fetch_payment_proposed_fees_impl(port_, that, req) + } + #[no_mangle] pub extern "C" fn frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_get_info( port_: i64, @@ -11873,6 +12199,14 @@ mod io { } } + #[no_mangle] + pub extern "C" fn frbgen_breez_liquid_cst_new_box_autoadd_accept_payment_proposed_fees_request( + ) -> *mut wire_cst_accept_payment_proposed_fees_request { + flutter_rust_bridge::for_generated::new_leak_box_ptr( + wire_cst_accept_payment_proposed_fees_request::new_with_null_ptr(), + ) + } + #[no_mangle] pub extern "C" fn frbgen_breez_liquid_cst_new_box_autoadd_aes_success_action_data( ) -> *mut wire_cst_aes_success_action_data { @@ -11960,6 +12294,14 @@ mod io { flutter_rust_bridge::for_generated::new_leak_box_ptr(value) } + #[no_mangle] + pub extern "C" fn frbgen_breez_liquid_cst_new_box_autoadd_fetch_payment_proposed_fees_request( + ) -> *mut wire_cst_fetch_payment_proposed_fees_request { + flutter_rust_bridge::for_generated::new_leak_box_ptr( + wire_cst_fetch_payment_proposed_fees_request::new_with_null_ptr(), + ) + } + #[no_mangle] pub extern "C" fn frbgen_breez_liquid_cst_new_box_autoadd_get_payment_request( ) -> *mut wire_cst_get_payment_request { @@ -12437,6 +12779,11 @@ mod io { flutter_rust_bridge::for_generated::new_leak_box_ptr(wrap) } + #[repr(C)] + #[derive(Clone, Copy)] + pub struct wire_cst_accept_payment_proposed_fees_request { + response: wire_cst_fetch_payment_proposed_fees_response, + } #[repr(C)] #[derive(Clone, Copy)] pub struct wire_cst_aes_success_action_data { @@ -12578,6 +12925,19 @@ mod io { } #[repr(C)] #[derive(Clone, Copy)] + pub struct wire_cst_fetch_payment_proposed_fees_request { + swap_id: *mut wire_cst_list_prim_u_8_strict, + } + #[repr(C)] + #[derive(Clone, Copy)] + pub struct wire_cst_fetch_payment_proposed_fees_response { + swap_id: *mut wire_cst_list_prim_u_8_strict, + fees_sat: u64, + payer_amount_sat: u64, + receiver_amount_sat: u64, + } + #[repr(C)] + #[derive(Clone, Copy)] pub struct wire_cst_fiat_currency { id: *mut wire_cst_list_prim_u_8_strict, info: wire_cst_currency_info, diff --git a/packages/dart/lib/src/bindings.dart b/packages/dart/lib/src/bindings.dart index 93b7b96d5..23aebdf84 100644 --- a/packages/dart/lib/src/bindings.dart +++ b/packages/dart/lib/src/bindings.dart @@ -29,6 +29,8 @@ LNInvoice parseInvoice({required String input}) => // Rust type: RustOpaqueNom> abstract class BindingLiquidSdk implements RustOpaqueInterface { + Future acceptPaymentProposedFees({required AcceptPaymentProposedFeesRequest req}); + Stream addEventListener(); void backup({required BackupRequest req}); @@ -47,6 +49,9 @@ abstract class BindingLiquidSdk implements RustOpaqueInterface { Future fetchOnchainLimits(); + Future fetchPaymentProposedFees( + {required FetchPaymentProposedFeesRequest req}); + Future getInfo(); Future getPayment({required GetPaymentRequest req}); diff --git a/packages/dart/lib/src/frb_generated.dart b/packages/dart/lib/src/frb_generated.dart index 749492009..26f9c0653 100644 --- a/packages/dart/lib/src/frb_generated.dart +++ b/packages/dart/lib/src/frb_generated.dart @@ -65,7 +65,7 @@ class RustLib extends BaseEntrypoint { String get codegenVersion => '2.7.0'; @override - int get rustContentHash => -2032324171; + int get rustContentHash => 1264782025; static const kDefaultExternalLibraryLoaderConfig = ExternalLibraryLoaderConfig( stem: 'breez_sdk_liquid', @@ -75,6 +75,9 @@ class RustLib extends BaseEntrypoint { } abstract class RustLibApi extends BaseApi { + Future crateBindingsBindingLiquidSdkAcceptPaymentProposedFees( + {required BindingLiquidSdk that, required AcceptPaymentProposedFeesRequest req}); + Stream crateBindingsBindingLiquidSdkAddEventListener({required BindingLiquidSdk that}); void crateBindingsBindingLiquidSdkBackup({required BindingLiquidSdk that, required BackupRequest req}); @@ -97,6 +100,9 @@ abstract class RustLibApi extends BaseApi { Future crateBindingsBindingLiquidSdkFetchOnchainLimits( {required BindingLiquidSdk that}); + Future crateBindingsBindingLiquidSdkFetchPaymentProposedFees( + {required BindingLiquidSdk that, required FetchPaymentProposedFeesRequest req}); + Future crateBindingsBindingLiquidSdkGetInfo({required BindingLiquidSdk that}); Future crateBindingsBindingLiquidSdkGetPayment( @@ -194,6 +200,32 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { required super.portManager, }); + @override + Future crateBindingsBindingLiquidSdkAcceptPaymentProposedFees( + {required BindingLiquidSdk that, required AcceptPaymentProposedFeesRequest req}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + var arg0 = + cst_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerBindingLiquidSdk( + that); + var arg1 = cst_encode_box_autoadd_accept_payment_proposed_fees_request(req); + return wire.wire__crate__bindings__BindingLiquidSdk_accept_payment_proposed_fees(port_, arg0, arg1); + }, + codec: DcoCodec( + decodeSuccessData: dco_decode_unit, + decodeErrorData: dco_decode_payment_error, + ), + constMeta: kCrateBindingsBindingLiquidSdkAcceptPaymentProposedFeesConstMeta, + argValues: [that, req], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateBindingsBindingLiquidSdkAcceptPaymentProposedFeesConstMeta => const TaskConstMeta( + debugName: "BindingLiquidSdk_accept_payment_proposed_fees", + argNames: ["that", "req"], + ); + @override Stream crateBindingsBindingLiquidSdkAddEventListener({required BindingLiquidSdk that}) { final listener = RustStreamSink(); @@ -420,6 +452,32 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { argNames: ["that"], ); + @override + Future crateBindingsBindingLiquidSdkFetchPaymentProposedFees( + {required BindingLiquidSdk that, required FetchPaymentProposedFeesRequest req}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + var arg0 = + cst_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerBindingLiquidSdk( + that); + var arg1 = cst_encode_box_autoadd_fetch_payment_proposed_fees_request(req); + return wire.wire__crate__bindings__BindingLiquidSdk_fetch_payment_proposed_fees(port_, arg0, arg1); + }, + codec: DcoCodec( + decodeSuccessData: dco_decode_fetch_payment_proposed_fees_response, + decodeErrorData: dco_decode_sdk_error, + ), + constMeta: kCrateBindingsBindingLiquidSdkFetchPaymentProposedFeesConstMeta, + argValues: [that, req], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateBindingsBindingLiquidSdkFetchPaymentProposedFeesConstMeta => const TaskConstMeta( + debugName: "BindingLiquidSdk_fetch_payment_proposed_fees", + argNames: ["that", "req"], + ); + @override Future crateBindingsBindingLiquidSdkGetInfo({required BindingLiquidSdk that}) { return handler.executeNormal(NormalTask( @@ -1252,6 +1310,16 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return raw as String; } + @protected + AcceptPaymentProposedFeesRequest dco_decode_accept_payment_proposed_fees_request(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 1) throw Exception('unexpected arr length: expect 1 but see ${arr.length}'); + return AcceptPaymentProposedFeesRequest( + response: dco_decode_fetch_payment_proposed_fees_response(arr[0]), + ); + } + @protected AesSuccessActionData dco_decode_aes_success_action_data(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -1350,6 +1418,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return raw as bool; } + @protected + AcceptPaymentProposedFeesRequest dco_decode_box_autoadd_accept_payment_proposed_fees_request(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_accept_payment_proposed_fees_request(raw); + } + @protected AesSuccessActionData dco_decode_box_autoadd_aes_success_action_data(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -1422,6 +1496,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return raw as double; } + @protected + FetchPaymentProposedFeesRequest dco_decode_box_autoadd_fetch_payment_proposed_fees_request(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_fetch_payment_proposed_fees_request(raw); + } + @protected GetPaymentRequest dco_decode_box_autoadd_get_payment_request(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -1763,6 +1843,29 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return raw as double; } + @protected + FetchPaymentProposedFeesRequest dco_decode_fetch_payment_proposed_fees_request(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 1) throw Exception('unexpected arr length: expect 1 but see ${arr.length}'); + return FetchPaymentProposedFeesRequest( + swapId: dco_decode_String(arr[0]), + ); + } + + @protected + FetchPaymentProposedFeesResponse dco_decode_fetch_payment_proposed_fees_response(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 4) throw Exception('unexpected arr length: expect 4 but see ${arr.length}'); + return FetchPaymentProposedFeesResponse( + swapId: dco_decode_String(arr[0]), + feesSat: dco_decode_u_64(arr[1]), + payerAmountSat: dco_decode_u_64(arr[2]), + receiverAmountSat: dco_decode_u_64(arr[3]), + ); + } + @protected FiatCurrency dco_decode_fiat_currency(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -3232,6 +3335,14 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return utf8.decoder.convert(inner); } + @protected + AcceptPaymentProposedFeesRequest sse_decode_accept_payment_proposed_fees_request( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_response = sse_decode_fetch_payment_proposed_fees_response(deserializer); + return AcceptPaymentProposedFeesRequest(response: var_response); + } + @protected AesSuccessActionData sse_decode_aes_success_action_data(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -3320,6 +3431,13 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return deserializer.buffer.getUint8() != 0; } + @protected + AcceptPaymentProposedFeesRequest sse_decode_box_autoadd_accept_payment_proposed_fees_request( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_accept_payment_proposed_fees_request(deserializer)); + } + @protected AesSuccessActionData sse_decode_box_autoadd_aes_success_action_data(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -3394,6 +3512,13 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return (sse_decode_f_64(deserializer)); } + @protected + FetchPaymentProposedFeesRequest sse_decode_box_autoadd_fetch_payment_proposed_fees_request( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_fetch_payment_proposed_fees_request(deserializer)); + } + @protected GetPaymentRequest sse_decode_box_autoadd_get_payment_request(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -3737,6 +3862,29 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return deserializer.buffer.getFloat64(); } + @protected + FetchPaymentProposedFeesRequest sse_decode_fetch_payment_proposed_fees_request( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_swapId = sse_decode_String(deserializer); + return FetchPaymentProposedFeesRequest(swapId: var_swapId); + } + + @protected + FetchPaymentProposedFeesResponse sse_decode_fetch_payment_proposed_fees_response( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_swapId = sse_decode_String(deserializer); + var var_feesSat = sse_decode_u_64(deserializer); + var var_payerAmountSat = sse_decode_u_64(deserializer); + var var_receiverAmountSat = sse_decode_u_64(deserializer); + return FetchPaymentProposedFeesResponse( + swapId: var_swapId, + feesSat: var_feesSat, + payerAmountSat: var_payerAmountSat, + receiverAmountSat: var_receiverAmountSat); + } + @protected FiatCurrency sse_decode_fiat_currency(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -5403,6 +5551,13 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { sse_encode_list_prim_u_8_strict(utf8.encoder.convert(self), serializer); } + @protected + void sse_encode_accept_payment_proposed_fees_request( + AcceptPaymentProposedFeesRequest self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_fetch_payment_proposed_fees_response(self.response, serializer); + } + @protected void sse_encode_aes_success_action_data(AesSuccessActionData self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -5474,6 +5629,13 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { serializer.buffer.putUint8(self ? 1 : 0); } + @protected + void sse_encode_box_autoadd_accept_payment_proposed_fees_request( + AcceptPaymentProposedFeesRequest self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_accept_payment_proposed_fees_request(self, serializer); + } + @protected void sse_encode_box_autoadd_aes_success_action_data(AesSuccessActionData self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -5548,6 +5710,13 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { sse_encode_f_64(self, serializer); } + @protected + void sse_encode_box_autoadd_fetch_payment_proposed_fees_request( + FetchPaymentProposedFeesRequest self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_fetch_payment_proposed_fees_request(self, serializer); + } + @protected void sse_encode_box_autoadd_get_payment_request(GetPaymentRequest self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -5868,6 +6037,23 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { serializer.buffer.putFloat64(self); } + @protected + void sse_encode_fetch_payment_proposed_fees_request( + FetchPaymentProposedFeesRequest self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_String(self.swapId, serializer); + } + + @protected + void sse_encode_fetch_payment_proposed_fees_response( + FetchPaymentProposedFeesResponse self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_String(self.swapId, serializer); + sse_encode_u_64(self.feesSat, serializer); + sse_encode_u_64(self.payerAmountSat, serializer); + sse_encode_u_64(self.receiverAmountSat, serializer); + } + @protected void sse_encode_fiat_currency(FiatCurrency self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -7105,6 +7291,9 @@ class BindingLiquidSdkImpl extends RustOpaque implements BindingLiquidSdk { rustArcDecrementStrongCountPtr: RustLib.instance.api.rust_arc_decrement_strong_count_BindingLiquidSdkPtr, ); + Future acceptPaymentProposedFees({required AcceptPaymentProposedFeesRequest req}) => + RustLib.instance.api.crateBindingsBindingLiquidSdkAcceptPaymentProposedFees(that: this, req: req); + Stream addEventListener() => RustLib.instance.api.crateBindingsBindingLiquidSdkAddEventListener( that: this, ); @@ -7140,6 +7329,10 @@ class BindingLiquidSdkImpl extends RustOpaque implements BindingLiquidSdk { that: this, ); + Future fetchPaymentProposedFees( + {required FetchPaymentProposedFeesRequest req}) => + RustLib.instance.api.crateBindingsBindingLiquidSdkFetchPaymentProposedFees(that: this, req: req); + Future getInfo() => RustLib.instance.api.crateBindingsBindingLiquidSdkGetInfo( that: this, ); diff --git a/packages/dart/lib/src/frb_generated.io.dart b/packages/dart/lib/src/frb_generated.io.dart index 59c5e0670..6a82a980a 100644 --- a/packages/dart/lib/src/frb_generated.io.dart +++ b/packages/dart/lib/src/frb_generated.io.dart @@ -50,6 +50,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected String dco_decode_String(dynamic raw); + @protected + AcceptPaymentProposedFeesRequest dco_decode_accept_payment_proposed_fees_request(dynamic raw); + @protected AesSuccessActionData dco_decode_aes_success_action_data(dynamic raw); @@ -74,6 +77,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected bool dco_decode_bool(dynamic raw); + @protected + AcceptPaymentProposedFeesRequest dco_decode_box_autoadd_accept_payment_proposed_fees_request(dynamic raw); + @protected AesSuccessActionData dco_decode_box_autoadd_aes_success_action_data(dynamic raw); @@ -110,6 +116,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected double dco_decode_box_autoadd_f_64(dynamic raw); + @protected + FetchPaymentProposedFeesRequest dco_decode_box_autoadd_fetch_payment_proposed_fees_request(dynamic raw); + @protected GetPaymentRequest dco_decode_box_autoadd_get_payment_request(dynamic raw); @@ -254,6 +263,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected double dco_decode_f_64(dynamic raw); + @protected + FetchPaymentProposedFeesRequest dco_decode_fetch_payment_proposed_fees_request(dynamic raw); + + @protected + FetchPaymentProposedFeesResponse dco_decode_fetch_payment_proposed_fees_response(dynamic raw); + @protected FiatCurrency dco_decode_fiat_currency(dynamic raw); @@ -625,6 +640,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected String sse_decode_String(SseDeserializer deserializer); + @protected + AcceptPaymentProposedFeesRequest sse_decode_accept_payment_proposed_fees_request( + SseDeserializer deserializer); + @protected AesSuccessActionData sse_decode_aes_success_action_data(SseDeserializer deserializer); @@ -649,6 +668,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected bool sse_decode_bool(SseDeserializer deserializer); + @protected + AcceptPaymentProposedFeesRequest sse_decode_box_autoadd_accept_payment_proposed_fees_request( + SseDeserializer deserializer); + @protected AesSuccessActionData sse_decode_box_autoadd_aes_success_action_data(SseDeserializer deserializer); @@ -687,6 +710,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected double sse_decode_box_autoadd_f_64(SseDeserializer deserializer); + @protected + FetchPaymentProposedFeesRequest sse_decode_box_autoadd_fetch_payment_proposed_fees_request( + SseDeserializer deserializer); + @protected GetPaymentRequest sse_decode_box_autoadd_get_payment_request(SseDeserializer deserializer); @@ -831,6 +858,14 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected double sse_decode_f_64(SseDeserializer deserializer); + @protected + FetchPaymentProposedFeesRequest sse_decode_fetch_payment_proposed_fees_request( + SseDeserializer deserializer); + + @protected + FetchPaymentProposedFeesResponse sse_decode_fetch_payment_proposed_fees_response( + SseDeserializer deserializer); + @protected FiatCurrency sse_decode_fiat_currency(SseDeserializer deserializer); @@ -1210,6 +1245,15 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { return cst_encode_list_prim_u_8_strict(utf8.encoder.convert(raw)); } + @protected + ffi.Pointer + cst_encode_box_autoadd_accept_payment_proposed_fees_request(AcceptPaymentProposedFeesRequest raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + final ptr = wire.cst_new_box_autoadd_accept_payment_proposed_fees_request(); + cst_api_fill_to_wire_accept_payment_proposed_fees_request(raw, ptr.ref); + return ptr; + } + @protected ffi.Pointer cst_encode_box_autoadd_aes_success_action_data( AesSuccessActionData raw) { @@ -1309,6 +1353,15 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { return wire.cst_new_box_autoadd_f_64(cst_encode_f_64(raw)); } + @protected + ffi.Pointer + cst_encode_box_autoadd_fetch_payment_proposed_fees_request(FetchPaymentProposedFeesRequest raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + final ptr = wire.cst_new_box_autoadd_fetch_payment_proposed_fees_request(); + cst_api_fill_to_wire_fetch_payment_proposed_fees_request(raw, ptr.ref); + return ptr; + } + @protected ffi.Pointer cst_encode_box_autoadd_get_payment_request( GetPaymentRequest raw) { @@ -1902,6 +1955,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { return raw.toSigned(64).toInt(); } + @protected + void cst_api_fill_to_wire_accept_payment_proposed_fees_request( + AcceptPaymentProposedFeesRequest apiObj, wire_cst_accept_payment_proposed_fees_request wireObj) { + cst_api_fill_to_wire_fetch_payment_proposed_fees_response(apiObj.response, wireObj.response); + } + @protected void cst_api_fill_to_wire_aes_success_action_data( AesSuccessActionData apiObj, wire_cst_aes_success_action_data wireObj) { @@ -1973,6 +2032,13 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { wireObj.message = cst_encode_opt_String(apiObj.message); } + @protected + void cst_api_fill_to_wire_box_autoadd_accept_payment_proposed_fees_request( + AcceptPaymentProposedFeesRequest apiObj, + ffi.Pointer wireObj) { + cst_api_fill_to_wire_accept_payment_proposed_fees_request(apiObj, wireObj.ref); + } + @protected void cst_api_fill_to_wire_box_autoadd_aes_success_action_data( AesSuccessActionData apiObj, ffi.Pointer wireObj) { @@ -2032,6 +2098,13 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { cst_api_fill_to_wire_connect_request(apiObj, wireObj.ref); } + @protected + void cst_api_fill_to_wire_box_autoadd_fetch_payment_proposed_fees_request( + FetchPaymentProposedFeesRequest apiObj, + ffi.Pointer wireObj) { + cst_api_fill_to_wire_fetch_payment_proposed_fees_request(apiObj, wireObj.ref); + } + @protected void cst_api_fill_to_wire_box_autoadd_get_payment_request( GetPaymentRequest apiObj, ffi.Pointer wireObj) { @@ -2309,6 +2382,21 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { wireObj.parser_url = cst_encode_String(apiObj.parserUrl); } + @protected + void cst_api_fill_to_wire_fetch_payment_proposed_fees_request( + FetchPaymentProposedFeesRequest apiObj, wire_cst_fetch_payment_proposed_fees_request wireObj) { + wireObj.swap_id = cst_encode_String(apiObj.swapId); + } + + @protected + void cst_api_fill_to_wire_fetch_payment_proposed_fees_response( + FetchPaymentProposedFeesResponse apiObj, wire_cst_fetch_payment_proposed_fees_response wireObj) { + wireObj.swap_id = cst_encode_String(apiObj.swapId); + wireObj.fees_sat = cst_encode_u_64(apiObj.feesSat); + wireObj.payer_amount_sat = cst_encode_u_64(apiObj.payerAmountSat); + wireObj.receiver_amount_sat = cst_encode_u_64(apiObj.receiverAmountSat); + } + @protected void cst_api_fill_to_wire_fiat_currency(FiatCurrency apiObj, wire_cst_fiat_currency wireObj) { wireObj.id = cst_encode_String(apiObj.id); @@ -3415,6 +3503,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_String(String self, SseSerializer serializer); + @protected + void sse_encode_accept_payment_proposed_fees_request( + AcceptPaymentProposedFeesRequest self, SseSerializer serializer); + @protected void sse_encode_aes_success_action_data(AesSuccessActionData self, SseSerializer serializer); @@ -3440,6 +3532,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_bool(bool self, SseSerializer serializer); + @protected + void sse_encode_box_autoadd_accept_payment_proposed_fees_request( + AcceptPaymentProposedFeesRequest self, SseSerializer serializer); + @protected void sse_encode_box_autoadd_aes_success_action_data(AesSuccessActionData self, SseSerializer serializer); @@ -3478,6 +3574,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_box_autoadd_f_64(double self, SseSerializer serializer); + @protected + void sse_encode_box_autoadd_fetch_payment_proposed_fees_request( + FetchPaymentProposedFeesRequest self, SseSerializer serializer); + @protected void sse_encode_box_autoadd_get_payment_request(GetPaymentRequest self, SseSerializer serializer); @@ -3628,6 +3728,14 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_f_64(double self, SseSerializer serializer); + @protected + void sse_encode_fetch_payment_proposed_fees_request( + FetchPaymentProposedFeesRequest self, SseSerializer serializer); + + @protected + void sse_encode_fetch_payment_proposed_fees_response( + FetchPaymentProposedFeesResponse self, SseSerializer serializer); + @protected void sse_encode_fiat_currency(FiatCurrency self, SseSerializer serializer); @@ -4012,6 +4120,27 @@ class RustLibWire implements BaseWire { late final _store_dart_post_cobject = _store_dart_post_cobjectPtr.asFunction(); + void wire__crate__bindings__BindingLiquidSdk_accept_payment_proposed_fees( + int port_, + int that, + ffi.Pointer req, + ) { + return _wire__crate__bindings__BindingLiquidSdk_accept_payment_proposed_fees( + port_, + that, + req, + ); + } + + late final _wire__crate__bindings__BindingLiquidSdk_accept_payment_proposed_feesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, ffi.UintPtr, ffi.Pointer)>>( + 'frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_accept_payment_proposed_fees'); + late final _wire__crate__bindings__BindingLiquidSdk_accept_payment_proposed_fees = + _wire__crate__bindings__BindingLiquidSdk_accept_payment_proposed_feesPtr + .asFunction)>(); + void wire__crate__bindings__BindingLiquidSdk_add_event_listener( int port_, int that, @@ -4168,6 +4297,27 @@ class RustLibWire implements BaseWire { late final _wire__crate__bindings__BindingLiquidSdk_fetch_onchain_limits = _wire__crate__bindings__BindingLiquidSdk_fetch_onchain_limitsPtr.asFunction(); + void wire__crate__bindings__BindingLiquidSdk_fetch_payment_proposed_fees( + int port_, + int that, + ffi.Pointer req, + ) { + return _wire__crate__bindings__BindingLiquidSdk_fetch_payment_proposed_fees( + port_, + that, + req, + ); + } + + late final _wire__crate__bindings__BindingLiquidSdk_fetch_payment_proposed_feesPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, ffi.UintPtr, ffi.Pointer)>>( + 'frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_payment_proposed_fees'); + late final _wire__crate__bindings__BindingLiquidSdk_fetch_payment_proposed_fees = + _wire__crate__bindings__BindingLiquidSdk_fetch_payment_proposed_feesPtr + .asFunction)>(); + void wire__crate__bindings__BindingLiquidSdk_get_info( int port_, int that, @@ -4773,6 +4923,18 @@ class RustLibWire implements BaseWire { _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerBindingLiquidSdkPtr .asFunction)>(); + ffi.Pointer + cst_new_box_autoadd_accept_payment_proposed_fees_request() { + return _cst_new_box_autoadd_accept_payment_proposed_fees_request(); + } + + late final _cst_new_box_autoadd_accept_payment_proposed_fees_requestPtr = + _lookup Function()>>( + 'frbgen_breez_liquid_cst_new_box_autoadd_accept_payment_proposed_fees_request'); + late final _cst_new_box_autoadd_accept_payment_proposed_fees_request = + _cst_new_box_autoadd_accept_payment_proposed_fees_requestPtr + .asFunction Function()>(); + ffi.Pointer cst_new_box_autoadd_aes_success_action_data() { return _cst_new_box_autoadd_aes_success_action_data(); } @@ -4904,6 +5066,18 @@ class RustLibWire implements BaseWire { late final _cst_new_box_autoadd_f_64 = _cst_new_box_autoadd_f_64Ptr.asFunction Function(double)>(); + ffi.Pointer + cst_new_box_autoadd_fetch_payment_proposed_fees_request() { + return _cst_new_box_autoadd_fetch_payment_proposed_fees_request(); + } + + late final _cst_new_box_autoadd_fetch_payment_proposed_fees_requestPtr = + _lookup Function()>>( + 'frbgen_breez_liquid_cst_new_box_autoadd_fetch_payment_proposed_fees_request'); + late final _cst_new_box_autoadd_fetch_payment_proposed_fees_request = + _cst_new_box_autoadd_fetch_payment_proposed_fees_requestPtr + .asFunction Function()>(); + ffi.Pointer cst_new_box_autoadd_get_payment_request() { return _cst_new_box_autoadd_get_payment_request(); } @@ -5532,6 +5706,23 @@ final class wire_cst_list_prim_u_8_strict extends ffi.Struct { external int len; } +final class wire_cst_fetch_payment_proposed_fees_response extends ffi.Struct { + external ffi.Pointer swap_id; + + @ffi.Uint64() + external int fees_sat; + + @ffi.Uint64() + external int payer_amount_sat; + + @ffi.Uint64() + external int receiver_amount_sat; +} + +final class wire_cst_accept_payment_proposed_fees_request extends ffi.Struct { + external wire_cst_fetch_payment_proposed_fees_response response; +} + final class wire_cst_backup_request extends ffi.Struct { external ffi.Pointer backup_path; } @@ -5561,6 +5752,10 @@ final class wire_cst_check_message_request extends ffi.Struct { external ffi.Pointer signature; } +final class wire_cst_fetch_payment_proposed_fees_request extends ffi.Struct { + external ffi.Pointer swap_id; +} + final class wire_cst_GetPaymentRequest_Lightning extends ffi.Struct { external ffi.Pointer payment_hash; } diff --git a/packages/dart/lib/src/model.dart b/packages/dart/lib/src/model.dart index 9934ef3b4..97237af56 100644 --- a/packages/dart/lib/src/model.dart +++ b/packages/dart/lib/src/model.dart @@ -9,6 +9,25 @@ import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; import 'package:freezed_annotation/freezed_annotation.dart' hide protected; part 'model.freezed.dart'; +/// An argument when calling [crate::sdk::LiquidSdk::accept_payment_proposed_fees]. +class AcceptPaymentProposedFeesRequest { + final FetchPaymentProposedFeesResponse response; + + const AcceptPaymentProposedFeesRequest({ + required this.response, + }); + + @override + int get hashCode => response.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AcceptPaymentProposedFeesRequest && + runtimeType == other.runtimeType && + response == other.response; +} + /// An argument when calling [crate::sdk::LiquidSdk::backup]. class BackupRequest { /// Path to the backup. @@ -239,6 +258,56 @@ class ConnectRequest { mnemonic == other.mnemonic; } +/// An argument when calling [crate::sdk::LiquidSdk::fetch_payment_proposed_fees]. +class FetchPaymentProposedFeesRequest { + final String swapId; + + const FetchPaymentProposedFeesRequest({ + required this.swapId, + }); + + @override + int get hashCode => swapId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is FetchPaymentProposedFeesRequest && runtimeType == other.runtimeType && swapId == other.swapId; +} + +/// Returned when calling [crate::sdk::LiquidSdk::fetch_payment_proposed_fees]. +class FetchPaymentProposedFeesResponse { + final String swapId; + final BigInt feesSat; + + /// Amount sent by the swap payer + final BigInt payerAmountSat; + + /// Amount that will be received if these fees are accepted + final BigInt receiverAmountSat; + + const FetchPaymentProposedFeesResponse({ + required this.swapId, + required this.feesSat, + required this.payerAmountSat, + required this.receiverAmountSat, + }); + + @override + int get hashCode => + swapId.hashCode ^ feesSat.hashCode ^ payerAmountSat.hashCode ^ receiverAmountSat.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is FetchPaymentProposedFeesResponse && + runtimeType == other.runtimeType && + swapId == other.swapId && + feesSat == other.feesSat && + payerAmountSat == other.payerAmountSat && + receiverAmountSat == other.receiverAmountSat; +} + /// Returned when calling [crate::sdk::LiquidSdk::get_info]. class GetInfoResponse { /// Usable balance. This is the confirmed onchain balance minus `pending_send_sat`. diff --git a/packages/flutter/lib/flutter_breez_liquid_bindings_generated.dart b/packages/flutter/lib/flutter_breez_liquid_bindings_generated.dart index cfeca5161..7a7a1ceb5 100644 --- a/packages/flutter/lib/flutter_breez_liquid_bindings_generated.dart +++ b/packages/flutter/lib/flutter_breez_liquid_bindings_generated.dart @@ -37,6 +37,28 @@ class FlutterBreezLiquidBindings { late final _store_dart_post_cobject = _store_dart_post_cobjectPtr.asFunction(); + void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_accept_payment_proposed_fees( + int port_, + int that, + ffi.Pointer req, + ) { + return _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_accept_payment_proposed_fees( + port_, + that, + req, + ); + } + + late final _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_accept_payment_proposed_feesPtr = + _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, ffi.UintPtr, ffi.Pointer)>>( + 'frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_accept_payment_proposed_fees'); + late final _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_accept_payment_proposed_fees = + _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_accept_payment_proposed_feesPtr + .asFunction)>(); + void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_add_event_listener( int port_, int that, @@ -196,6 +218,28 @@ class FlutterBreezLiquidBindings { _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_onchain_limitsPtr .asFunction(); + void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_payment_proposed_fees( + int port_, + int that, + ffi.Pointer req, + ) { + return _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_payment_proposed_fees( + port_, + that, + req, + ); + } + + late final _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_payment_proposed_feesPtr = + _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, ffi.UintPtr, ffi.Pointer)>>( + 'frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_payment_proposed_fees'); + late final _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_payment_proposed_fees = + _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_payment_proposed_feesPtr + .asFunction)>(); + void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_get_info( int port_, int that, @@ -813,6 +857,18 @@ class FlutterBreezLiquidBindings { _frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerBindingLiquidSdkPtr .asFunction)>(); + ffi.Pointer + frbgen_breez_liquid_cst_new_box_autoadd_accept_payment_proposed_fees_request() { + return _frbgen_breez_liquid_cst_new_box_autoadd_accept_payment_proposed_fees_request(); + } + + late final _frbgen_breez_liquid_cst_new_box_autoadd_accept_payment_proposed_fees_requestPtr = + _lookup Function()>>( + 'frbgen_breez_liquid_cst_new_box_autoadd_accept_payment_proposed_fees_request'); + late final _frbgen_breez_liquid_cst_new_box_autoadd_accept_payment_proposed_fees_request = + _frbgen_breez_liquid_cst_new_box_autoadd_accept_payment_proposed_fees_requestPtr + .asFunction Function()>(); + ffi.Pointer frbgen_breez_liquid_cst_new_box_autoadd_aes_success_action_data() { return _frbgen_breez_liquid_cst_new_box_autoadd_aes_success_action_data(); @@ -956,6 +1012,18 @@ class FlutterBreezLiquidBindings { late final _frbgen_breez_liquid_cst_new_box_autoadd_f_64 = _frbgen_breez_liquid_cst_new_box_autoadd_f_64Ptr.asFunction Function(double)>(); + ffi.Pointer + frbgen_breez_liquid_cst_new_box_autoadd_fetch_payment_proposed_fees_request() { + return _frbgen_breez_liquid_cst_new_box_autoadd_fetch_payment_proposed_fees_request(); + } + + late final _frbgen_breez_liquid_cst_new_box_autoadd_fetch_payment_proposed_fees_requestPtr = + _lookup Function()>>( + 'frbgen_breez_liquid_cst_new_box_autoadd_fetch_payment_proposed_fees_request'); + late final _frbgen_breez_liquid_cst_new_box_autoadd_fetch_payment_proposed_fees_request = + _frbgen_breez_liquid_cst_new_box_autoadd_fetch_payment_proposed_fees_requestPtr + .asFunction Function()>(); + ffi.Pointer frbgen_breez_liquid_cst_new_box_autoadd_get_payment_request() { return _frbgen_breez_liquid_cst_new_box_autoadd_get_payment_request(); } @@ -4008,6 +4076,23 @@ final class wire_cst_list_prim_u_8_strict extends ffi.Struct { external int len; } +final class wire_cst_fetch_payment_proposed_fees_response extends ffi.Struct { + external ffi.Pointer swap_id; + + @ffi.Uint64() + external int fees_sat; + + @ffi.Uint64() + external int payer_amount_sat; + + @ffi.Uint64() + external int receiver_amount_sat; +} + +final class wire_cst_accept_payment_proposed_fees_request extends ffi.Struct { + external wire_cst_fetch_payment_proposed_fees_response response; +} + final class wire_cst_backup_request extends ffi.Struct { external ffi.Pointer backup_path; } @@ -4037,6 +4122,10 @@ final class wire_cst_check_message_request extends ffi.Struct { external ffi.Pointer signature; } +final class wire_cst_fetch_payment_proposed_fees_request extends ffi.Struct { + external ffi.Pointer swap_id; +} + final class wire_cst_GetPaymentRequest_Lightning extends ffi.Struct { external ffi.Pointer payment_hash; }