Generate Dart bindings & C Headers

- Enable full dependencies
This commit is contained in:
Erdem Yerebasmaz
2024-04-29 21:05:25 +03:00
parent 1b0d915a7a
commit d5ae712568
13 changed files with 6056 additions and 1 deletions

View File

@@ -0,0 +1,581 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.32.
// Section: imports
use super::*;
use crate::bindings::*;
use flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt};
use flutter_rust_bridge::for_generated::transform_result_dco;
use flutter_rust_bridge::{Handler, IntoIntoDart};
// Section: boilerplate
flutter_rust_bridge::frb_generated_boilerplate_io!();
// Section: dart2rust
impl CstDecode<flutter_rust_bridge::for_generated::anyhow::Error>
for *mut wire_cst_list_prim_u_8_strict
{
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> flutter_rust_bridge::for_generated::anyhow::Error {
unimplemented!()
}
}
impl CstDecode<LBtcReverseRecovery> for usize {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> LBtcReverseRecovery {
CstDecode::<
RustOpaqueNom<
flutter_rust_bridge::for_generated::rust_async::RwLock<LBtcReverseRecovery>,
>,
>::cst_decode(self)
.rust_auto_opaque_decode_owned()
}
}
impl
CstDecode<
RustOpaqueNom<flutter_rust_bridge::for_generated::rust_async::RwLock<LBtcReverseRecovery>>,
> for usize
{
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(
self,
) -> RustOpaqueNom<flutter_rust_bridge::for_generated::rust_async::RwLock<LBtcReverseRecovery>>
{
unsafe { decode_rust_opaque_nom(self as _) }
}
}
impl CstDecode<String> for *mut wire_cst_list_prim_u_8_strict {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> String {
let vec: Vec<u8> = self.cst_decode();
String::from_utf8(vec).unwrap()
}
}
impl CstDecode<crate::model::PrepareReceiveRequest> for *mut wire_cst_prepare_receive_request {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> crate::model::PrepareReceiveRequest {
let wrap = unsafe { flutter_rust_bridge::for_generated::box_from_leak_ptr(self) };
CstDecode::<crate::model::PrepareReceiveRequest>::cst_decode(*wrap).into()
}
}
impl CstDecode<crate::model::PrepareReceiveResponse> for *mut wire_cst_prepare_receive_response {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> crate::model::PrepareReceiveResponse {
let wrap = unsafe { flutter_rust_bridge::for_generated::box_from_leak_ptr(self) };
CstDecode::<crate::model::PrepareReceiveResponse>::cst_decode(*wrap).into()
}
}
impl CstDecode<crate::model::PrepareSendResponse> for *mut wire_cst_prepare_send_response {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> crate::model::PrepareSendResponse {
let wrap = unsafe { flutter_rust_bridge::for_generated::box_from_leak_ptr(self) };
CstDecode::<crate::model::PrepareSendResponse>::cst_decode(*wrap).into()
}
}
impl CstDecode<u32> for *mut u32 {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> u32 {
unsafe { *flutter_rust_bridge::for_generated::box_from_leak_ptr(self) }
}
}
impl CstDecode<u64> for *mut u64 {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> u64 {
unsafe { *flutter_rust_bridge::for_generated::box_from_leak_ptr(self) }
}
}
impl CstDecode<Vec<crate::model::Payment>> for *mut wire_cst_list_payment {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> Vec<crate::model::Payment> {
let vec = unsafe {
let wrap = flutter_rust_bridge::for_generated::box_from_leak_ptr(self);
flutter_rust_bridge::for_generated::vec_from_leak_ptr(wrap.ptr, wrap.len)
};
vec.into_iter().map(CstDecode::cst_decode).collect()
}
}
impl CstDecode<Vec<u8>> for *mut wire_cst_list_prim_u_8_strict {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> Vec<u8> {
unsafe {
let wrap = flutter_rust_bridge::for_generated::box_from_leak_ptr(self);
flutter_rust_bridge::for_generated::vec_from_leak_ptr(wrap.ptr, wrap.len)
}
}
}
impl CstDecode<crate::model::Payment> for wire_cst_payment {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> crate::model::Payment {
crate::model::Payment {
id: self.id.cst_decode(),
timestamp: self.timestamp.cst_decode(),
amount_sat: self.amount_sat.cst_decode(),
fees_sat: self.fees_sat.cst_decode(),
payment_type: self.payment_type.cst_decode(),
invoice: self.invoice.cst_decode(),
}
}
}
impl CstDecode<crate::error::PaymentError> for wire_cst_payment_error {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> crate::error::PaymentError {
match self.tag {
0 => crate::error::PaymentError::AmountOutOfRange,
1 => crate::error::PaymentError::AlreadyClaimed,
2 => {
let ans = unsafe { self.kind.Generic };
crate::error::PaymentError::Generic {
err: ans.err.cst_decode(),
}
}
3 => crate::error::PaymentError::InvalidInvoice,
4 => crate::error::PaymentError::InvalidPreimage,
5 => {
let ans = unsafe { self.kind.LwkError };
crate::error::PaymentError::LwkError {
err: ans.err.cst_decode(),
}
}
6 => crate::error::PaymentError::PairsNotFound,
7 => crate::error::PaymentError::PersistError,
8 => {
let ans = unsafe { self.kind.SendError };
crate::error::PaymentError::SendError {
err: ans.err.cst_decode(),
}
}
9 => {
let ans = unsafe { self.kind.SignerError };
crate::error::PaymentError::SignerError {
err: ans.err.cst_decode(),
}
}
_ => unreachable!(),
}
}
}
impl CstDecode<crate::model::PrepareReceiveRequest> for wire_cst_prepare_receive_request {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> crate::model::PrepareReceiveRequest {
crate::model::PrepareReceiveRequest {
payer_amount_sat: self.payer_amount_sat.cst_decode(),
receiver_amount_sat: self.receiver_amount_sat.cst_decode(),
}
}
}
impl CstDecode<crate::model::PrepareReceiveResponse> for wire_cst_prepare_receive_response {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> crate::model::PrepareReceiveResponse {
crate::model::PrepareReceiveResponse {
pair_hash: self.pair_hash.cst_decode(),
payer_amount_sat: self.payer_amount_sat.cst_decode(),
fees_sat: self.fees_sat.cst_decode(),
}
}
}
impl CstDecode<crate::model::PrepareSendResponse> for wire_cst_prepare_send_response {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> crate::model::PrepareSendResponse {
crate::model::PrepareSendResponse {
id: self.id.cst_decode(),
payer_amount_sat: self.payer_amount_sat.cst_decode(),
receiver_amount_sat: self.receiver_amount_sat.cst_decode(),
total_fees: self.total_fees.cst_decode(),
funding_address: self.funding_address.cst_decode(),
invoice: self.invoice.cst_decode(),
}
}
}
impl CstDecode<crate::model::ReceivePaymentResponse> for wire_cst_receive_payment_response {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> crate::model::ReceivePaymentResponse {
crate::model::ReceivePaymentResponse {
id: self.id.cst_decode(),
invoice: self.invoice.cst_decode(),
}
}
}
impl CstDecode<crate::model::SendPaymentResponse> for wire_cst_send_payment_response {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> crate::model::SendPaymentResponse {
crate::model::SendPaymentResponse {
txid: self.txid.cst_decode(),
}
}
}
impl CstDecode<crate::model::WalletInfo> for wire_cst_wallet_info {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> crate::model::WalletInfo {
crate::model::WalletInfo {
balance_sat: self.balance_sat.cst_decode(),
pubkey: self.pubkey.cst_decode(),
}
}
}
impl NewWithNullPtr for wire_cst_payment {
fn new_with_null_ptr() -> Self {
Self {
id: core::ptr::null_mut(),
timestamp: core::ptr::null_mut(),
amount_sat: Default::default(),
fees_sat: core::ptr::null_mut(),
payment_type: Default::default(),
invoice: core::ptr::null_mut(),
}
}
}
impl Default for wire_cst_payment {
fn default() -> Self {
Self::new_with_null_ptr()
}
}
impl NewWithNullPtr for wire_cst_payment_error {
fn new_with_null_ptr() -> Self {
Self {
tag: -1,
kind: PaymentErrorKind { nil__: () },
}
}
}
impl Default for wire_cst_payment_error {
fn default() -> Self {
Self::new_with_null_ptr()
}
}
impl NewWithNullPtr for wire_cst_prepare_receive_request {
fn new_with_null_ptr() -> Self {
Self {
payer_amount_sat: core::ptr::null_mut(),
receiver_amount_sat: core::ptr::null_mut(),
}
}
}
impl Default for wire_cst_prepare_receive_request {
fn default() -> Self {
Self::new_with_null_ptr()
}
}
impl NewWithNullPtr for wire_cst_prepare_receive_response {
fn new_with_null_ptr() -> Self {
Self {
pair_hash: core::ptr::null_mut(),
payer_amount_sat: Default::default(),
fees_sat: Default::default(),
}
}
}
impl Default for wire_cst_prepare_receive_response {
fn default() -> Self {
Self::new_with_null_ptr()
}
}
impl NewWithNullPtr for wire_cst_prepare_send_response {
fn new_with_null_ptr() -> Self {
Self {
id: core::ptr::null_mut(),
payer_amount_sat: Default::default(),
receiver_amount_sat: Default::default(),
total_fees: Default::default(),
funding_address: core::ptr::null_mut(),
invoice: core::ptr::null_mut(),
}
}
}
impl Default for wire_cst_prepare_send_response {
fn default() -> Self {
Self::new_with_null_ptr()
}
}
impl NewWithNullPtr for wire_cst_receive_payment_response {
fn new_with_null_ptr() -> Self {
Self {
id: core::ptr::null_mut(),
invoice: core::ptr::null_mut(),
}
}
}
impl Default for wire_cst_receive_payment_response {
fn default() -> Self {
Self::new_with_null_ptr()
}
}
impl NewWithNullPtr for wire_cst_send_payment_response {
fn new_with_null_ptr() -> Self {
Self {
txid: core::ptr::null_mut(),
}
}
}
impl Default for wire_cst_send_payment_response {
fn default() -> Self {
Self::new_with_null_ptr()
}
}
impl NewWithNullPtr for wire_cst_wallet_info {
fn new_with_null_ptr() -> Self {
Self {
balance_sat: Default::default(),
pubkey: core::ptr::null_mut(),
}
}
}
impl Default for wire_cst_wallet_info {
fn default() -> Self {
Self::new_with_null_ptr()
}
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_wire_backup(port_: i64) {
wire_backup_impl(port_)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_wire_connect(
port_: i64,
mnemonic: *mut wire_cst_list_prim_u_8_strict,
data_dir: *mut wire_cst_list_prim_u_8_strict,
network: i32,
) {
wire_connect_impl(port_, mnemonic, data_dir, network)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_wire_empty_wallet_cache(port_: i64) {
wire_empty_wallet_cache_impl(port_)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_wire_get_info(port_: i64, with_scan: bool) {
wire_get_info_impl(port_, with_scan)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_wire_list_payments(
port_: i64,
with_scan: bool,
include_pending: bool,
) {
wire_list_payments_impl(port_, with_scan, include_pending)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_wire_prepare_receive_payment(
port_: i64,
req: *mut wire_cst_prepare_receive_request,
) {
wire_prepare_receive_payment_impl(port_, req)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_wire_prepare_send_payment(
port_: i64,
invoice: *mut wire_cst_list_prim_u_8_strict,
) {
wire_prepare_send_payment_impl(port_, invoice)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_wire_receive_payment(
port_: i64,
req: *mut wire_cst_prepare_receive_response,
) {
wire_receive_payment_impl(port_, req)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_wire_recover_funds(port_: i64, recovery: usize) {
wire_recover_funds_impl(port_, recovery)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_wire_restore(
port_: i64,
backup_path: *mut wire_cst_list_prim_u_8_strict,
) {
wire_restore_impl(port_, backup_path)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_wire_send_payment(
port_: i64,
req: *mut wire_cst_prepare_send_response,
) {
wire_send_payment_impl(port_, req)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery(
ptr: *const std::ffi::c_void,
) {
unsafe {
StdArc::<flutter_rust_bridge::for_generated::rust_async::RwLock<LBtcReverseRecovery>>::increment_strong_count(ptr as _);
}
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery(
ptr: *const std::ffi::c_void,
) {
unsafe {
StdArc::<flutter_rust_bridge::for_generated::rust_async::RwLock<LBtcReverseRecovery>>::decrement_strong_count(ptr as _);
}
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_request(
) -> *mut wire_cst_prepare_receive_request {
flutter_rust_bridge::for_generated::new_leak_box_ptr(
wire_cst_prepare_receive_request::new_with_null_ptr(),
)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_response(
) -> *mut wire_cst_prepare_receive_response {
flutter_rust_bridge::for_generated::new_leak_box_ptr(
wire_cst_prepare_receive_response::new_with_null_ptr(),
)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_cst_new_box_autoadd_prepare_send_response(
) -> *mut wire_cst_prepare_send_response {
flutter_rust_bridge::for_generated::new_leak_box_ptr(
wire_cst_prepare_send_response::new_with_null_ptr(),
)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_cst_new_box_autoadd_u_32(value: u32) -> *mut u32 {
flutter_rust_bridge::for_generated::new_leak_box_ptr(value)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_cst_new_box_autoadd_u_64(value: u64) -> *mut u64 {
flutter_rust_bridge::for_generated::new_leak_box_ptr(value)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_cst_new_list_payment(len: i32) -> *mut wire_cst_list_payment {
let wrap = wire_cst_list_payment {
ptr: flutter_rust_bridge::for_generated::new_leak_vec_ptr(
<wire_cst_payment>::new_with_null_ptr(),
len,
),
len,
};
flutter_rust_bridge::for_generated::new_leak_box_ptr(wrap)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_cst_new_list_prim_u_8_strict(
len: i32,
) -> *mut wire_cst_list_prim_u_8_strict {
let ans = wire_cst_list_prim_u_8_strict {
ptr: flutter_rust_bridge::for_generated::new_leak_vec_ptr(Default::default(), len),
len,
};
flutter_rust_bridge::for_generated::new_leak_box_ptr(ans)
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_list_payment {
ptr: *mut wire_cst_payment,
len: i32,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_list_prim_u_8_strict {
ptr: *mut u8,
len: i32,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_payment {
id: *mut wire_cst_list_prim_u_8_strict,
timestamp: *mut u32,
amount_sat: u64,
fees_sat: *mut u64,
payment_type: i32,
invoice: *mut wire_cst_list_prim_u_8_strict,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_payment_error {
tag: i32,
kind: PaymentErrorKind,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union PaymentErrorKind {
Generic: wire_cst_PaymentError_Generic,
LwkError: wire_cst_PaymentError_LwkError,
SendError: wire_cst_PaymentError_SendError,
SignerError: wire_cst_PaymentError_SignerError,
nil__: (),
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_PaymentError_Generic {
err: *mut wire_cst_list_prim_u_8_strict,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_PaymentError_LwkError {
err: *mut wire_cst_list_prim_u_8_strict,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_PaymentError_SendError {
err: *mut wire_cst_list_prim_u_8_strict,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_PaymentError_SignerError {
err: *mut wire_cst_list_prim_u_8_strict,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_prepare_receive_request {
payer_amount_sat: *mut u64,
receiver_amount_sat: *mut u64,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_prepare_receive_response {
pair_hash: *mut wire_cst_list_prim_u_8_strict,
payer_amount_sat: u64,
fees_sat: u64,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_prepare_send_response {
id: *mut wire_cst_list_prim_u_8_strict,
payer_amount_sat: u64,
receiver_amount_sat: u64,
total_fees: u64,
funding_address: *mut wire_cst_list_prim_u_8_strict,
invoice: *mut wire_cst_list_prim_u_8_strict,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_receive_payment_response {
id: *mut wire_cst_list_prim_u_8_strict,
invoice: *mut wire_cst_list_prim_u_8_strict,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_send_payment_response {
txid: *mut wire_cst_list_prim_u_8_strict,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_wallet_info {
balance_sat: u64,
pubkey: *mut wire_cst_list_prim_u_8_strict,
}

File diff suppressed because it is too large Load Diff

View File

@@ -4,6 +4,6 @@ rust_output: ../ls-sdk-core/src/frb/bridge.rs
c_output: ls_sdk/include/ls_sdk.h
duplicated_c_output: [packages/flutter_breez_liquid/macos/Classes/ls_sdk.h, packages/flutter_breez_liquid/ios/Classes/ls_sdk.h]
web: false
full_dep: false
full_dep: true
add_mod_to_lib: false
deps_check: false

View File

@@ -0,0 +1,175 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
// EXTRA BEGIN
typedef struct DartCObject *WireSyncRust2DartDco;
typedef struct WireSyncRust2DartSse {
uint8_t *ptr;
int32_t len;
} WireSyncRust2DartSse;
typedef int64_t DartPort;
typedef bool (*DartPostCObjectFnType)(DartPort port_id, void *message);
void store_dart_post_cobject(DartPostCObjectFnType ptr);
// EXTRA END
typedef struct _Dart_Handle* Dart_Handle;
/**
* Claim tx feerate for Receive, in sats per vbyte.
* Since the Liquid blocks are consistently empty for now, we hardcode the minimum feerate.
*/
#define LIQUID_CLAIM_TX_FEERATE 0.1
typedef struct wire_cst_list_prim_u_8_strict {
uint8_t *ptr;
int32_t len;
} wire_cst_list_prim_u_8_strict;
typedef struct wire_cst_prepare_receive_request {
uint64_t *payer_amount_sat;
uint64_t *receiver_amount_sat;
} wire_cst_prepare_receive_request;
typedef struct wire_cst_prepare_receive_response {
struct wire_cst_list_prim_u_8_strict *pair_hash;
uint64_t payer_amount_sat;
uint64_t fees_sat;
} wire_cst_prepare_receive_response;
typedef struct wire_cst_prepare_send_response {
struct wire_cst_list_prim_u_8_strict *id;
uint64_t payer_amount_sat;
uint64_t receiver_amount_sat;
uint64_t total_fees;
struct wire_cst_list_prim_u_8_strict *funding_address;
struct wire_cst_list_prim_u_8_strict *invoice;
} wire_cst_prepare_send_response;
typedef struct wire_cst_payment {
struct wire_cst_list_prim_u_8_strict *id;
uint32_t *timestamp;
uint64_t amount_sat;
uint64_t *fees_sat;
int32_t payment_type;
struct wire_cst_list_prim_u_8_strict *invoice;
} wire_cst_payment;
typedef struct wire_cst_list_payment {
struct wire_cst_payment *ptr;
int32_t len;
} wire_cst_list_payment;
typedef struct wire_cst_PaymentError_Generic {
struct wire_cst_list_prim_u_8_strict *err;
} wire_cst_PaymentError_Generic;
typedef struct wire_cst_PaymentError_LwkError {
struct wire_cst_list_prim_u_8_strict *err;
} wire_cst_PaymentError_LwkError;
typedef struct wire_cst_PaymentError_SendError {
struct wire_cst_list_prim_u_8_strict *err;
} wire_cst_PaymentError_SendError;
typedef struct wire_cst_PaymentError_SignerError {
struct wire_cst_list_prim_u_8_strict *err;
} wire_cst_PaymentError_SignerError;
typedef union PaymentErrorKind {
struct wire_cst_PaymentError_Generic Generic;
struct wire_cst_PaymentError_LwkError LwkError;
struct wire_cst_PaymentError_SendError SendError;
struct wire_cst_PaymentError_SignerError SignerError;
} PaymentErrorKind;
typedef struct wire_cst_payment_error {
int32_t tag;
union PaymentErrorKind kind;
} wire_cst_payment_error;
typedef struct wire_cst_receive_payment_response {
struct wire_cst_list_prim_u_8_strict *id;
struct wire_cst_list_prim_u_8_strict *invoice;
} wire_cst_receive_payment_response;
typedef struct wire_cst_send_payment_response {
struct wire_cst_list_prim_u_8_strict *txid;
} wire_cst_send_payment_response;
typedef struct wire_cst_wallet_info {
uint64_t balance_sat;
struct wire_cst_list_prim_u_8_strict *pubkey;
} wire_cst_wallet_info;
void frbgen_breez_liquid_wire_backup(int64_t port_);
void frbgen_breez_liquid_wire_connect(int64_t port_,
struct wire_cst_list_prim_u_8_strict *mnemonic,
struct wire_cst_list_prim_u_8_strict *data_dir,
int32_t network);
void frbgen_breez_liquid_wire_empty_wallet_cache(int64_t port_);
void frbgen_breez_liquid_wire_get_info(int64_t port_, bool with_scan);
void frbgen_breez_liquid_wire_list_payments(int64_t port_, bool with_scan, bool include_pending);
void frbgen_breez_liquid_wire_prepare_receive_payment(int64_t port_,
struct wire_cst_prepare_receive_request *req);
void frbgen_breez_liquid_wire_prepare_send_payment(int64_t port_,
struct wire_cst_list_prim_u_8_strict *invoice);
void frbgen_breez_liquid_wire_receive_payment(int64_t port_,
struct wire_cst_prepare_receive_response *req);
void frbgen_breez_liquid_wire_recover_funds(int64_t port_, uintptr_t recovery);
void frbgen_breez_liquid_wire_restore(int64_t port_,
struct wire_cst_list_prim_u_8_strict *backup_path);
void frbgen_breez_liquid_wire_send_payment(int64_t port_,
struct wire_cst_prepare_send_response *req);
void frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery(const void *ptr);
void frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery(const void *ptr);
struct wire_cst_prepare_receive_request *frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_request(void);
struct wire_cst_prepare_receive_response *frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_response(void);
struct wire_cst_prepare_send_response *frbgen_breez_liquid_cst_new_box_autoadd_prepare_send_response(void);
uint32_t *frbgen_breez_liquid_cst_new_box_autoadd_u_32(uint32_t value);
uint64_t *frbgen_breez_liquid_cst_new_box_autoadd_u_64(uint64_t value);
struct wire_cst_list_payment *frbgen_breez_liquid_cst_new_list_payment(int32_t len);
struct wire_cst_list_prim_u_8_strict *frbgen_breez_liquid_cst_new_list_prim_u_8_strict(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_prepare_receive_request);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_response);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_prepare_send_response);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_u_32);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_u_64);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_list_payment);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_list_prim_u_8_strict);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_backup);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_connect);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_empty_wallet_cache);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_get_info);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_list_payments);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_prepare_receive_payment);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_prepare_send_payment);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_receive_payment);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_recover_funds);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_restore);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_send_payment);
dummy_var ^= ((int64_t) (void*) store_dart_post_cobject);
return dummy_var;
}

View File

@@ -0,0 +1,72 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.32.
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
import 'error.dart';
import 'frb_generated.dart';
import 'model.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
Future<void> connect(
{required String mnemonic,
String? dataDir,
required Network network,
dynamic hint}) =>
RustLib.instance.api.connect(
mnemonic: mnemonic, dataDir: dataDir, network: network, hint: hint);
Future<WalletInfo> getInfo({required bool withScan, dynamic hint}) =>
RustLib.instance.api.getInfo(withScan: withScan, hint: hint);
Future<PrepareSendResponse> prepareSendPayment(
{required String invoice, dynamic hint}) =>
RustLib.instance.api.prepareSendPayment(invoice: invoice, hint: hint);
Future<SendPaymentResponse> sendPayment(
{required PrepareSendResponse req, dynamic hint}) =>
RustLib.instance.api.sendPayment(req: req, hint: hint);
Future<PrepareReceiveResponse> prepareReceivePayment(
{required PrepareReceiveRequest req, dynamic hint}) =>
RustLib.instance.api.prepareReceivePayment(req: req, hint: hint);
Future<ReceivePaymentResponse> receivePayment(
{required PrepareReceiveResponse req, dynamic hint}) =>
RustLib.instance.api.receivePayment(req: req, hint: hint);
Future<List<Payment>> listPayments(
{required bool withScan, required bool includePending, dynamic hint}) =>
RustLib.instance.api.listPayments(
withScan: withScan, includePending: includePending, hint: hint);
Future<String> recoverFunds(
{required LBtcReverseRecovery recovery, dynamic hint}) =>
RustLib.instance.api.recoverFunds(recovery: recovery, hint: hint);
Future<void> emptyWalletCache({dynamic hint}) =>
RustLib.instance.api.emptyWalletCache(hint: hint);
Future<void> backup({dynamic hint}) => RustLib.instance.api.backup(hint: hint);
Future<void> restore({String? backupPath, dynamic hint}) =>
RustLib.instance.api.restore(backupPath: backupPath, hint: hint);
// Rust type: RustOpaqueNom<flutter_rust_bridge::for_generated::rust_async::RwLock<LBtcReverseRecovery>>
@sealed
class LBtcReverseRecovery extends RustOpaque {
LBtcReverseRecovery.dcoDecode(List<dynamic> wire)
: super.dcoDecode(wire, _kStaticData);
LBtcReverseRecovery.sseDecode(int ptr, int externalSizeOnNative)
: super.sseDecode(ptr, externalSizeOnNative, _kStaticData);
static final _kStaticData = RustArcStaticData(
rustArcIncrementStrongCount: RustLib
.instance.api.rust_arc_increment_strong_count_LBtcReverseRecovery,
rustArcDecrementStrongCount: RustLib
.instance.api.rust_arc_decrement_strong_count_LBtcReverseRecovery,
rustArcDecrementStrongCountPtr: RustLib
.instance.api.rust_arc_decrement_strong_count_LBtcReverseRecoveryPtr,
);
}

View File

@@ -0,0 +1,33 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.32.
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
import 'frb_generated.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
import 'package:freezed_annotation/freezed_annotation.dart' hide protected;
part 'error.freezed.dart';
@freezed
sealed class PaymentError with _$PaymentError implements FrbException {
const PaymentError._();
const factory PaymentError.amountOutOfRange() = PaymentError_AmountOutOfRange;
const factory PaymentError.alreadyClaimed() = PaymentError_AlreadyClaimed;
const factory PaymentError.generic({
required String err,
}) = PaymentError_Generic;
const factory PaymentError.invalidInvoice() = PaymentError_InvalidInvoice;
const factory PaymentError.invalidPreimage() = PaymentError_InvalidPreimage;
const factory PaymentError.lwkError({
required String err,
}) = PaymentError_LwkError;
const factory PaymentError.pairsNotFound() = PaymentError_PairsNotFound;
const factory PaymentError.persistError() = PaymentError_PersistError;
const factory PaymentError.sendError({
required String err,
}) = PaymentError_SendError;
const factory PaymentError.signerError({
required String err,
}) = PaymentError_SignerError;
}

View File

@@ -0,0 +1,608 @@
// 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 'error.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(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 _$PaymentError {}
/// @nodoc
abstract class $PaymentErrorCopyWith<$Res> {
factory $PaymentErrorCopyWith(
PaymentError value, $Res Function(PaymentError) then) =
_$PaymentErrorCopyWithImpl<$Res, PaymentError>;
}
/// @nodoc
class _$PaymentErrorCopyWithImpl<$Res, $Val extends PaymentError>
implements $PaymentErrorCopyWith<$Res> {
_$PaymentErrorCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
}
/// @nodoc
abstract class _$$PaymentError_AmountOutOfRangeImplCopyWith<$Res> {
factory _$$PaymentError_AmountOutOfRangeImplCopyWith(
_$PaymentError_AmountOutOfRangeImpl value,
$Res Function(_$PaymentError_AmountOutOfRangeImpl) then) =
__$$PaymentError_AmountOutOfRangeImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$PaymentError_AmountOutOfRangeImplCopyWithImpl<$Res>
extends _$PaymentErrorCopyWithImpl<$Res,
_$PaymentError_AmountOutOfRangeImpl>
implements _$$PaymentError_AmountOutOfRangeImplCopyWith<$Res> {
__$$PaymentError_AmountOutOfRangeImplCopyWithImpl(
_$PaymentError_AmountOutOfRangeImpl _value,
$Res Function(_$PaymentError_AmountOutOfRangeImpl) _then)
: super(_value, _then);
}
/// @nodoc
class _$PaymentError_AmountOutOfRangeImpl
extends PaymentError_AmountOutOfRange {
const _$PaymentError_AmountOutOfRangeImpl() : super._();
@override
String toString() {
return 'PaymentError.amountOutOfRange()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PaymentError_AmountOutOfRangeImpl);
}
@override
int get hashCode => runtimeType.hashCode;
}
abstract class PaymentError_AmountOutOfRange extends PaymentError {
const factory PaymentError_AmountOutOfRange() =
_$PaymentError_AmountOutOfRangeImpl;
const PaymentError_AmountOutOfRange._() : super._();
}
/// @nodoc
abstract class _$$PaymentError_AlreadyClaimedImplCopyWith<$Res> {
factory _$$PaymentError_AlreadyClaimedImplCopyWith(
_$PaymentError_AlreadyClaimedImpl value,
$Res Function(_$PaymentError_AlreadyClaimedImpl) then) =
__$$PaymentError_AlreadyClaimedImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$PaymentError_AlreadyClaimedImplCopyWithImpl<$Res>
extends _$PaymentErrorCopyWithImpl<$Res, _$PaymentError_AlreadyClaimedImpl>
implements _$$PaymentError_AlreadyClaimedImplCopyWith<$Res> {
__$$PaymentError_AlreadyClaimedImplCopyWithImpl(
_$PaymentError_AlreadyClaimedImpl _value,
$Res Function(_$PaymentError_AlreadyClaimedImpl) _then)
: super(_value, _then);
}
/// @nodoc
class _$PaymentError_AlreadyClaimedImpl extends PaymentError_AlreadyClaimed {
const _$PaymentError_AlreadyClaimedImpl() : super._();
@override
String toString() {
return 'PaymentError.alreadyClaimed()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PaymentError_AlreadyClaimedImpl);
}
@override
int get hashCode => runtimeType.hashCode;
}
abstract class PaymentError_AlreadyClaimed extends PaymentError {
const factory PaymentError_AlreadyClaimed() =
_$PaymentError_AlreadyClaimedImpl;
const PaymentError_AlreadyClaimed._() : super._();
}
/// @nodoc
abstract class _$$PaymentError_GenericImplCopyWith<$Res> {
factory _$$PaymentError_GenericImplCopyWith(_$PaymentError_GenericImpl value,
$Res Function(_$PaymentError_GenericImpl) then) =
__$$PaymentError_GenericImplCopyWithImpl<$Res>;
@useResult
$Res call({String err});
}
/// @nodoc
class __$$PaymentError_GenericImplCopyWithImpl<$Res>
extends _$PaymentErrorCopyWithImpl<$Res, _$PaymentError_GenericImpl>
implements _$$PaymentError_GenericImplCopyWith<$Res> {
__$$PaymentError_GenericImplCopyWithImpl(_$PaymentError_GenericImpl _value,
$Res Function(_$PaymentError_GenericImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? err = null,
}) {
return _then(_$PaymentError_GenericImpl(
err: null == err
? _value.err
: err // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
class _$PaymentError_GenericImpl extends PaymentError_Generic {
const _$PaymentError_GenericImpl({required this.err}) : super._();
@override
final String err;
@override
String toString() {
return 'PaymentError.generic(err: $err)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PaymentError_GenericImpl &&
(identical(other.err, err) || other.err == err));
}
@override
int get hashCode => Object.hash(runtimeType, err);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$PaymentError_GenericImplCopyWith<_$PaymentError_GenericImpl>
get copyWith =>
__$$PaymentError_GenericImplCopyWithImpl<_$PaymentError_GenericImpl>(
this, _$identity);
}
abstract class PaymentError_Generic extends PaymentError {
const factory PaymentError_Generic({required final String err}) =
_$PaymentError_GenericImpl;
const PaymentError_Generic._() : super._();
String get err;
@JsonKey(ignore: true)
_$$PaymentError_GenericImplCopyWith<_$PaymentError_GenericImpl>
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$PaymentError_InvalidInvoiceImplCopyWith<$Res> {
factory _$$PaymentError_InvalidInvoiceImplCopyWith(
_$PaymentError_InvalidInvoiceImpl value,
$Res Function(_$PaymentError_InvalidInvoiceImpl) then) =
__$$PaymentError_InvalidInvoiceImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$PaymentError_InvalidInvoiceImplCopyWithImpl<$Res>
extends _$PaymentErrorCopyWithImpl<$Res, _$PaymentError_InvalidInvoiceImpl>
implements _$$PaymentError_InvalidInvoiceImplCopyWith<$Res> {
__$$PaymentError_InvalidInvoiceImplCopyWithImpl(
_$PaymentError_InvalidInvoiceImpl _value,
$Res Function(_$PaymentError_InvalidInvoiceImpl) _then)
: super(_value, _then);
}
/// @nodoc
class _$PaymentError_InvalidInvoiceImpl extends PaymentError_InvalidInvoice {
const _$PaymentError_InvalidInvoiceImpl() : super._();
@override
String toString() {
return 'PaymentError.invalidInvoice()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PaymentError_InvalidInvoiceImpl);
}
@override
int get hashCode => runtimeType.hashCode;
}
abstract class PaymentError_InvalidInvoice extends PaymentError {
const factory PaymentError_InvalidInvoice() =
_$PaymentError_InvalidInvoiceImpl;
const PaymentError_InvalidInvoice._() : super._();
}
/// @nodoc
abstract class _$$PaymentError_InvalidPreimageImplCopyWith<$Res> {
factory _$$PaymentError_InvalidPreimageImplCopyWith(
_$PaymentError_InvalidPreimageImpl value,
$Res Function(_$PaymentError_InvalidPreimageImpl) then) =
__$$PaymentError_InvalidPreimageImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$PaymentError_InvalidPreimageImplCopyWithImpl<$Res>
extends _$PaymentErrorCopyWithImpl<$Res, _$PaymentError_InvalidPreimageImpl>
implements _$$PaymentError_InvalidPreimageImplCopyWith<$Res> {
__$$PaymentError_InvalidPreimageImplCopyWithImpl(
_$PaymentError_InvalidPreimageImpl _value,
$Res Function(_$PaymentError_InvalidPreimageImpl) _then)
: super(_value, _then);
}
/// @nodoc
class _$PaymentError_InvalidPreimageImpl extends PaymentError_InvalidPreimage {
const _$PaymentError_InvalidPreimageImpl() : super._();
@override
String toString() {
return 'PaymentError.invalidPreimage()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PaymentError_InvalidPreimageImpl);
}
@override
int get hashCode => runtimeType.hashCode;
}
abstract class PaymentError_InvalidPreimage extends PaymentError {
const factory PaymentError_InvalidPreimage() =
_$PaymentError_InvalidPreimageImpl;
const PaymentError_InvalidPreimage._() : super._();
}
/// @nodoc
abstract class _$$PaymentError_LwkErrorImplCopyWith<$Res> {
factory _$$PaymentError_LwkErrorImplCopyWith(
_$PaymentError_LwkErrorImpl value,
$Res Function(_$PaymentError_LwkErrorImpl) then) =
__$$PaymentError_LwkErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String err});
}
/// @nodoc
class __$$PaymentError_LwkErrorImplCopyWithImpl<$Res>
extends _$PaymentErrorCopyWithImpl<$Res, _$PaymentError_LwkErrorImpl>
implements _$$PaymentError_LwkErrorImplCopyWith<$Res> {
__$$PaymentError_LwkErrorImplCopyWithImpl(_$PaymentError_LwkErrorImpl _value,
$Res Function(_$PaymentError_LwkErrorImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? err = null,
}) {
return _then(_$PaymentError_LwkErrorImpl(
err: null == err
? _value.err
: err // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
class _$PaymentError_LwkErrorImpl extends PaymentError_LwkError {
const _$PaymentError_LwkErrorImpl({required this.err}) : super._();
@override
final String err;
@override
String toString() {
return 'PaymentError.lwkError(err: $err)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PaymentError_LwkErrorImpl &&
(identical(other.err, err) || other.err == err));
}
@override
int get hashCode => Object.hash(runtimeType, err);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$PaymentError_LwkErrorImplCopyWith<_$PaymentError_LwkErrorImpl>
get copyWith => __$$PaymentError_LwkErrorImplCopyWithImpl<
_$PaymentError_LwkErrorImpl>(this, _$identity);
}
abstract class PaymentError_LwkError extends PaymentError {
const factory PaymentError_LwkError({required final String err}) =
_$PaymentError_LwkErrorImpl;
const PaymentError_LwkError._() : super._();
String get err;
@JsonKey(ignore: true)
_$$PaymentError_LwkErrorImplCopyWith<_$PaymentError_LwkErrorImpl>
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$PaymentError_PairsNotFoundImplCopyWith<$Res> {
factory _$$PaymentError_PairsNotFoundImplCopyWith(
_$PaymentError_PairsNotFoundImpl value,
$Res Function(_$PaymentError_PairsNotFoundImpl) then) =
__$$PaymentError_PairsNotFoundImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$PaymentError_PairsNotFoundImplCopyWithImpl<$Res>
extends _$PaymentErrorCopyWithImpl<$Res, _$PaymentError_PairsNotFoundImpl>
implements _$$PaymentError_PairsNotFoundImplCopyWith<$Res> {
__$$PaymentError_PairsNotFoundImplCopyWithImpl(
_$PaymentError_PairsNotFoundImpl _value,
$Res Function(_$PaymentError_PairsNotFoundImpl) _then)
: super(_value, _then);
}
/// @nodoc
class _$PaymentError_PairsNotFoundImpl extends PaymentError_PairsNotFound {
const _$PaymentError_PairsNotFoundImpl() : super._();
@override
String toString() {
return 'PaymentError.pairsNotFound()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PaymentError_PairsNotFoundImpl);
}
@override
int get hashCode => runtimeType.hashCode;
}
abstract class PaymentError_PairsNotFound extends PaymentError {
const factory PaymentError_PairsNotFound() = _$PaymentError_PairsNotFoundImpl;
const PaymentError_PairsNotFound._() : super._();
}
/// @nodoc
abstract class _$$PaymentError_PersistErrorImplCopyWith<$Res> {
factory _$$PaymentError_PersistErrorImplCopyWith(
_$PaymentError_PersistErrorImpl value,
$Res Function(_$PaymentError_PersistErrorImpl) then) =
__$$PaymentError_PersistErrorImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$PaymentError_PersistErrorImplCopyWithImpl<$Res>
extends _$PaymentErrorCopyWithImpl<$Res, _$PaymentError_PersistErrorImpl>
implements _$$PaymentError_PersistErrorImplCopyWith<$Res> {
__$$PaymentError_PersistErrorImplCopyWithImpl(
_$PaymentError_PersistErrorImpl _value,
$Res Function(_$PaymentError_PersistErrorImpl) _then)
: super(_value, _then);
}
/// @nodoc
class _$PaymentError_PersistErrorImpl extends PaymentError_PersistError {
const _$PaymentError_PersistErrorImpl() : super._();
@override
String toString() {
return 'PaymentError.persistError()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PaymentError_PersistErrorImpl);
}
@override
int get hashCode => runtimeType.hashCode;
}
abstract class PaymentError_PersistError extends PaymentError {
const factory PaymentError_PersistError() = _$PaymentError_PersistErrorImpl;
const PaymentError_PersistError._() : super._();
}
/// @nodoc
abstract class _$$PaymentError_SendErrorImplCopyWith<$Res> {
factory _$$PaymentError_SendErrorImplCopyWith(
_$PaymentError_SendErrorImpl value,
$Res Function(_$PaymentError_SendErrorImpl) then) =
__$$PaymentError_SendErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String err});
}
/// @nodoc
class __$$PaymentError_SendErrorImplCopyWithImpl<$Res>
extends _$PaymentErrorCopyWithImpl<$Res, _$PaymentError_SendErrorImpl>
implements _$$PaymentError_SendErrorImplCopyWith<$Res> {
__$$PaymentError_SendErrorImplCopyWithImpl(
_$PaymentError_SendErrorImpl _value,
$Res Function(_$PaymentError_SendErrorImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? err = null,
}) {
return _then(_$PaymentError_SendErrorImpl(
err: null == err
? _value.err
: err // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
class _$PaymentError_SendErrorImpl extends PaymentError_SendError {
const _$PaymentError_SendErrorImpl({required this.err}) : super._();
@override
final String err;
@override
String toString() {
return 'PaymentError.sendError(err: $err)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PaymentError_SendErrorImpl &&
(identical(other.err, err) || other.err == err));
}
@override
int get hashCode => Object.hash(runtimeType, err);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$PaymentError_SendErrorImplCopyWith<_$PaymentError_SendErrorImpl>
get copyWith => __$$PaymentError_SendErrorImplCopyWithImpl<
_$PaymentError_SendErrorImpl>(this, _$identity);
}
abstract class PaymentError_SendError extends PaymentError {
const factory PaymentError_SendError({required final String err}) =
_$PaymentError_SendErrorImpl;
const PaymentError_SendError._() : super._();
String get err;
@JsonKey(ignore: true)
_$$PaymentError_SendErrorImplCopyWith<_$PaymentError_SendErrorImpl>
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$PaymentError_SignerErrorImplCopyWith<$Res> {
factory _$$PaymentError_SignerErrorImplCopyWith(
_$PaymentError_SignerErrorImpl value,
$Res Function(_$PaymentError_SignerErrorImpl) then) =
__$$PaymentError_SignerErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String err});
}
/// @nodoc
class __$$PaymentError_SignerErrorImplCopyWithImpl<$Res>
extends _$PaymentErrorCopyWithImpl<$Res, _$PaymentError_SignerErrorImpl>
implements _$$PaymentError_SignerErrorImplCopyWith<$Res> {
__$$PaymentError_SignerErrorImplCopyWithImpl(
_$PaymentError_SignerErrorImpl _value,
$Res Function(_$PaymentError_SignerErrorImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? err = null,
}) {
return _then(_$PaymentError_SignerErrorImpl(
err: null == err
? _value.err
: err // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
class _$PaymentError_SignerErrorImpl extends PaymentError_SignerError {
const _$PaymentError_SignerErrorImpl({required this.err}) : super._();
@override
final String err;
@override
String toString() {
return 'PaymentError.signerError(err: $err)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PaymentError_SignerErrorImpl &&
(identical(other.err, err) || other.err == err));
}
@override
int get hashCode => Object.hash(runtimeType, err);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$PaymentError_SignerErrorImplCopyWith<_$PaymentError_SignerErrorImpl>
get copyWith => __$$PaymentError_SignerErrorImplCopyWithImpl<
_$PaymentError_SignerErrorImpl>(this, _$identity);
}
abstract class PaymentError_SignerError extends PaymentError {
const factory PaymentError_SignerError({required final String err}) =
_$PaymentError_SignerErrorImpl;
const PaymentError_SignerError._() : super._();
String get err;
@JsonKey(ignore: true)
_$$PaymentError_SignerErrorImplCopyWith<_$PaymentError_SignerErrorImpl>
get copyWith => throw _privateConstructorUsedError;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,207 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.32.
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
import 'frb_generated.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
enum Network {
liquid,
liquidTestnet,
;
}
class Payment {
final String? id;
final int? timestamp;
final int amountSat;
final int? feesSat;
final PaymentType paymentType;
/// Only for [PaymentType::PendingReceive]
final String? invoice;
const Payment({
this.id,
this.timestamp,
required this.amountSat,
this.feesSat,
required this.paymentType,
this.invoice,
});
@override
int get hashCode =>
id.hashCode ^
timestamp.hashCode ^
amountSat.hashCode ^
feesSat.hashCode ^
paymentType.hashCode ^
invoice.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is Payment &&
runtimeType == other.runtimeType &&
id == other.id &&
timestamp == other.timestamp &&
amountSat == other.amountSat &&
feesSat == other.feesSat &&
paymentType == other.paymentType &&
invoice == other.invoice;
}
enum PaymentType {
sent,
received,
pendingReceive,
pendingSend,
;
}
class PrepareReceiveRequest {
final int? payerAmountSat;
final int? receiverAmountSat;
const PrepareReceiveRequest({
this.payerAmountSat,
this.receiverAmountSat,
});
@override
int get hashCode => payerAmountSat.hashCode ^ receiverAmountSat.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is PrepareReceiveRequest &&
runtimeType == other.runtimeType &&
payerAmountSat == other.payerAmountSat &&
receiverAmountSat == other.receiverAmountSat;
}
class PrepareReceiveResponse {
final String pairHash;
final int payerAmountSat;
final int feesSat;
const PrepareReceiveResponse({
required this.pairHash,
required this.payerAmountSat,
required this.feesSat,
});
@override
int get hashCode =>
pairHash.hashCode ^ payerAmountSat.hashCode ^ feesSat.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is PrepareReceiveResponse &&
runtimeType == other.runtimeType &&
pairHash == other.pairHash &&
payerAmountSat == other.payerAmountSat &&
feesSat == other.feesSat;
}
class PrepareSendResponse {
final String id;
final int payerAmountSat;
final int receiverAmountSat;
final int totalFees;
final String fundingAddress;
final String invoice;
const PrepareSendResponse({
required this.id,
required this.payerAmountSat,
required this.receiverAmountSat,
required this.totalFees,
required this.fundingAddress,
required this.invoice,
});
@override
int get hashCode =>
id.hashCode ^
payerAmountSat.hashCode ^
receiverAmountSat.hashCode ^
totalFees.hashCode ^
fundingAddress.hashCode ^
invoice.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is PrepareSendResponse &&
runtimeType == other.runtimeType &&
id == other.id &&
payerAmountSat == other.payerAmountSat &&
receiverAmountSat == other.receiverAmountSat &&
totalFees == other.totalFees &&
fundingAddress == other.fundingAddress &&
invoice == other.invoice;
}
class ReceivePaymentResponse {
final String id;
final String invoice;
const ReceivePaymentResponse({
required this.id,
required this.invoice,
});
@override
int get hashCode => id.hashCode ^ invoice.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is ReceivePaymentResponse &&
runtimeType == other.runtimeType &&
id == other.id &&
invoice == other.invoice;
}
class SendPaymentResponse {
final String txid;
const SendPaymentResponse({
required this.txid,
});
@override
int get hashCode => txid.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is SendPaymentResponse &&
runtimeType == other.runtimeType &&
txid == other.txid;
}
class WalletInfo {
final int balanceSat;
final String pubkey;
const WalletInfo({
required this.balanceSat,
required this.pubkey,
});
@override
int get hashCode => balanceSat.hashCode ^ pubkey.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is WalletInfo &&
runtimeType == other.runtimeType &&
balanceSat == other.balanceSat &&
pubkey == other.pubkey;
}

View File

@@ -0,0 +1,175 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
// EXTRA BEGIN
typedef struct DartCObject *WireSyncRust2DartDco;
typedef struct WireSyncRust2DartSse {
uint8_t *ptr;
int32_t len;
} WireSyncRust2DartSse;
typedef int64_t DartPort;
typedef bool (*DartPostCObjectFnType)(DartPort port_id, void *message);
void store_dart_post_cobject(DartPostCObjectFnType ptr);
// EXTRA END
typedef struct _Dart_Handle* Dart_Handle;
/**
* Claim tx feerate for Receive, in sats per vbyte.
* Since the Liquid blocks are consistently empty for now, we hardcode the minimum feerate.
*/
#define LIQUID_CLAIM_TX_FEERATE 0.1
typedef struct wire_cst_list_prim_u_8_strict {
uint8_t *ptr;
int32_t len;
} wire_cst_list_prim_u_8_strict;
typedef struct wire_cst_prepare_receive_request {
uint64_t *payer_amount_sat;
uint64_t *receiver_amount_sat;
} wire_cst_prepare_receive_request;
typedef struct wire_cst_prepare_receive_response {
struct wire_cst_list_prim_u_8_strict *pair_hash;
uint64_t payer_amount_sat;
uint64_t fees_sat;
} wire_cst_prepare_receive_response;
typedef struct wire_cst_prepare_send_response {
struct wire_cst_list_prim_u_8_strict *id;
uint64_t payer_amount_sat;
uint64_t receiver_amount_sat;
uint64_t total_fees;
struct wire_cst_list_prim_u_8_strict *funding_address;
struct wire_cst_list_prim_u_8_strict *invoice;
} wire_cst_prepare_send_response;
typedef struct wire_cst_payment {
struct wire_cst_list_prim_u_8_strict *id;
uint32_t *timestamp;
uint64_t amount_sat;
uint64_t *fees_sat;
int32_t payment_type;
struct wire_cst_list_prim_u_8_strict *invoice;
} wire_cst_payment;
typedef struct wire_cst_list_payment {
struct wire_cst_payment *ptr;
int32_t len;
} wire_cst_list_payment;
typedef struct wire_cst_PaymentError_Generic {
struct wire_cst_list_prim_u_8_strict *err;
} wire_cst_PaymentError_Generic;
typedef struct wire_cst_PaymentError_LwkError {
struct wire_cst_list_prim_u_8_strict *err;
} wire_cst_PaymentError_LwkError;
typedef struct wire_cst_PaymentError_SendError {
struct wire_cst_list_prim_u_8_strict *err;
} wire_cst_PaymentError_SendError;
typedef struct wire_cst_PaymentError_SignerError {
struct wire_cst_list_prim_u_8_strict *err;
} wire_cst_PaymentError_SignerError;
typedef union PaymentErrorKind {
struct wire_cst_PaymentError_Generic Generic;
struct wire_cst_PaymentError_LwkError LwkError;
struct wire_cst_PaymentError_SendError SendError;
struct wire_cst_PaymentError_SignerError SignerError;
} PaymentErrorKind;
typedef struct wire_cst_payment_error {
int32_t tag;
union PaymentErrorKind kind;
} wire_cst_payment_error;
typedef struct wire_cst_receive_payment_response {
struct wire_cst_list_prim_u_8_strict *id;
struct wire_cst_list_prim_u_8_strict *invoice;
} wire_cst_receive_payment_response;
typedef struct wire_cst_send_payment_response {
struct wire_cst_list_prim_u_8_strict *txid;
} wire_cst_send_payment_response;
typedef struct wire_cst_wallet_info {
uint64_t balance_sat;
struct wire_cst_list_prim_u_8_strict *pubkey;
} wire_cst_wallet_info;
void frbgen_breez_liquid_wire_backup(int64_t port_);
void frbgen_breez_liquid_wire_connect(int64_t port_,
struct wire_cst_list_prim_u_8_strict *mnemonic,
struct wire_cst_list_prim_u_8_strict *data_dir,
int32_t network);
void frbgen_breez_liquid_wire_empty_wallet_cache(int64_t port_);
void frbgen_breez_liquid_wire_get_info(int64_t port_, bool with_scan);
void frbgen_breez_liquid_wire_list_payments(int64_t port_, bool with_scan, bool include_pending);
void frbgen_breez_liquid_wire_prepare_receive_payment(int64_t port_,
struct wire_cst_prepare_receive_request *req);
void frbgen_breez_liquid_wire_prepare_send_payment(int64_t port_,
struct wire_cst_list_prim_u_8_strict *invoice);
void frbgen_breez_liquid_wire_receive_payment(int64_t port_,
struct wire_cst_prepare_receive_response *req);
void frbgen_breez_liquid_wire_recover_funds(int64_t port_, uintptr_t recovery);
void frbgen_breez_liquid_wire_restore(int64_t port_,
struct wire_cst_list_prim_u_8_strict *backup_path);
void frbgen_breez_liquid_wire_send_payment(int64_t port_,
struct wire_cst_prepare_send_response *req);
void frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery(const void *ptr);
void frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery(const void *ptr);
struct wire_cst_prepare_receive_request *frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_request(void);
struct wire_cst_prepare_receive_response *frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_response(void);
struct wire_cst_prepare_send_response *frbgen_breez_liquid_cst_new_box_autoadd_prepare_send_response(void);
uint32_t *frbgen_breez_liquid_cst_new_box_autoadd_u_32(uint32_t value);
uint64_t *frbgen_breez_liquid_cst_new_box_autoadd_u_64(uint64_t value);
struct wire_cst_list_payment *frbgen_breez_liquid_cst_new_list_payment(int32_t len);
struct wire_cst_list_prim_u_8_strict *frbgen_breez_liquid_cst_new_list_prim_u_8_strict(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_prepare_receive_request);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_response);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_prepare_send_response);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_u_32);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_u_64);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_list_payment);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_list_prim_u_8_strict);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_backup);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_connect);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_empty_wallet_cache);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_get_info);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_list_payments);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_prepare_receive_payment);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_prepare_send_payment);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_receive_payment);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_recover_funds);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_restore);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_send_payment);
dummy_var ^= ((int64_t) (void*) store_dart_post_cobject);
return dummy_var;
}

View File

@@ -0,0 +1,530 @@
// ignore_for_file: always_specify_types
// ignore_for_file: camel_case_types
// ignore_for_file: non_constant_identifier_names
// AUTO GENERATED FILE, DO NOT EDIT.
//
// Generated by `package:ffigen`.
// ignore_for_file: type=lint
import 'dart:ffi' as ffi;
/// Bindings for `src/flutter_breez_liquid.h`.
///
/// Regenerate bindings with `flutter pub run ffigen --config ffigen.yaml`.
///
class FlutterBreezLiquidBindings {
/// Holds the symbol lookup function.
final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
_lookup;
/// The symbols are looked up in [dynamicLibrary].
FlutterBreezLiquidBindings(ffi.DynamicLibrary dynamicLibrary)
: _lookup = dynamicLibrary.lookup;
/// The symbols are looked up with [lookup].
FlutterBreezLiquidBindings.fromLookup(
ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
lookup)
: _lookup = lookup;
void store_dart_post_cobject(
DartPostCObjectFnType ptr,
) {
return _store_dart_post_cobject(
ptr,
);
}
late final _store_dart_post_cobjectPtr =
_lookup<ffi.NativeFunction<ffi.Void Function(DartPostCObjectFnType)>>(
'store_dart_post_cobject');
late final _store_dart_post_cobject = _store_dart_post_cobjectPtr
.asFunction<void Function(DartPostCObjectFnType)>();
void frbgen_breez_liquid_wire_backup(
int port_,
) {
return _frbgen_breez_liquid_wire_backup(
port_,
);
}
late final _frbgen_breez_liquid_wire_backupPtr =
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64)>>(
'frbgen_breez_liquid_wire_backup');
late final _frbgen_breez_liquid_wire_backup =
_frbgen_breez_liquid_wire_backupPtr.asFunction<void Function(int)>();
void frbgen_breez_liquid_wire_connect(
int port_,
ffi.Pointer<wire_cst_list_prim_u_8_strict> mnemonic,
ffi.Pointer<wire_cst_list_prim_u_8_strict> data_dir,
int network,
) {
return _frbgen_breez_liquid_wire_connect(
port_,
mnemonic,
data_dir,
network,
);
}
late final _frbgen_breez_liquid_wire_connectPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(
ffi.Int64,
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
ffi.Int32)>>('frbgen_breez_liquid_wire_connect');
late final _frbgen_breez_liquid_wire_connect =
_frbgen_breez_liquid_wire_connectPtr.asFunction<
void Function(int, ffi.Pointer<wire_cst_list_prim_u_8_strict>,
ffi.Pointer<wire_cst_list_prim_u_8_strict>, int)>();
void frbgen_breez_liquid_wire_empty_wallet_cache(
int port_,
) {
return _frbgen_breez_liquid_wire_empty_wallet_cache(
port_,
);
}
late final _frbgen_breez_liquid_wire_empty_wallet_cachePtr =
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64)>>(
'frbgen_breez_liquid_wire_empty_wallet_cache');
late final _frbgen_breez_liquid_wire_empty_wallet_cache =
_frbgen_breez_liquid_wire_empty_wallet_cachePtr
.asFunction<void Function(int)>();
void frbgen_breez_liquid_wire_get_info(
int port_,
bool with_scan,
) {
return _frbgen_breez_liquid_wire_get_info(
port_,
with_scan,
);
}
late final _frbgen_breez_liquid_wire_get_infoPtr =
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.Bool)>>(
'frbgen_breez_liquid_wire_get_info');
late final _frbgen_breez_liquid_wire_get_info =
_frbgen_breez_liquid_wire_get_infoPtr
.asFunction<void Function(int, bool)>();
void frbgen_breez_liquid_wire_list_payments(
int port_,
bool with_scan,
bool include_pending,
) {
return _frbgen_breez_liquid_wire_list_payments(
port_,
with_scan,
include_pending,
);
}
late final _frbgen_breez_liquid_wire_list_paymentsPtr = _lookup<
ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.Bool, ffi.Bool)>>(
'frbgen_breez_liquid_wire_list_payments');
late final _frbgen_breez_liquid_wire_list_payments =
_frbgen_breez_liquid_wire_list_paymentsPtr
.asFunction<void Function(int, bool, bool)>();
void frbgen_breez_liquid_wire_prepare_receive_payment(
int port_,
ffi.Pointer<wire_cst_prepare_receive_request> req,
) {
return _frbgen_breez_liquid_wire_prepare_receive_payment(
port_,
req,
);
}
late final _frbgen_breez_liquid_wire_prepare_receive_paymentPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(
ffi.Int64, ffi.Pointer<wire_cst_prepare_receive_request>)>>(
'frbgen_breez_liquid_wire_prepare_receive_payment');
late final _frbgen_breez_liquid_wire_prepare_receive_payment =
_frbgen_breez_liquid_wire_prepare_receive_paymentPtr.asFunction<
void Function(int, ffi.Pointer<wire_cst_prepare_receive_request>)>();
void frbgen_breez_liquid_wire_prepare_send_payment(
int port_,
ffi.Pointer<wire_cst_list_prim_u_8_strict> invoice,
) {
return _frbgen_breez_liquid_wire_prepare_send_payment(
port_,
invoice,
);
}
late final _frbgen_breez_liquid_wire_prepare_send_paymentPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(
ffi.Int64, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>>(
'frbgen_breez_liquid_wire_prepare_send_payment');
late final _frbgen_breez_liquid_wire_prepare_send_payment =
_frbgen_breez_liquid_wire_prepare_send_paymentPtr.asFunction<
void Function(int, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>();
void frbgen_breez_liquid_wire_receive_payment(
int port_,
ffi.Pointer<wire_cst_prepare_receive_response> req,
) {
return _frbgen_breez_liquid_wire_receive_payment(
port_,
req,
);
}
late final _frbgen_breez_liquid_wire_receive_paymentPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(
ffi.Int64, ffi.Pointer<wire_cst_prepare_receive_response>)>>(
'frbgen_breez_liquid_wire_receive_payment');
late final _frbgen_breez_liquid_wire_receive_payment =
_frbgen_breez_liquid_wire_receive_paymentPtr.asFunction<
void Function(int, ffi.Pointer<wire_cst_prepare_receive_response>)>();
void frbgen_breez_liquid_wire_recover_funds(
int port_,
int recovery,
) {
return _frbgen_breez_liquid_wire_recover_funds(
port_,
recovery,
);
}
late final _frbgen_breez_liquid_wire_recover_fundsPtr =
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.UintPtr)>>(
'frbgen_breez_liquid_wire_recover_funds');
late final _frbgen_breez_liquid_wire_recover_funds =
_frbgen_breez_liquid_wire_recover_fundsPtr
.asFunction<void Function(int, int)>();
void frbgen_breez_liquid_wire_restore(
int port_,
ffi.Pointer<wire_cst_list_prim_u_8_strict> backup_path,
) {
return _frbgen_breez_liquid_wire_restore(
port_,
backup_path,
);
}
late final _frbgen_breez_liquid_wire_restorePtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(
ffi.Int64, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>>(
'frbgen_breez_liquid_wire_restore');
late final _frbgen_breez_liquid_wire_restore =
_frbgen_breez_liquid_wire_restorePtr.asFunction<
void Function(int, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>();
void frbgen_breez_liquid_wire_send_payment(
int port_,
ffi.Pointer<wire_cst_prepare_send_response> req,
) {
return _frbgen_breez_liquid_wire_send_payment(
port_,
req,
);
}
late final _frbgen_breez_liquid_wire_send_paymentPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(
ffi.Int64, ffi.Pointer<wire_cst_prepare_send_response>)>>(
'frbgen_breez_liquid_wire_send_payment');
late final _frbgen_breez_liquid_wire_send_payment =
_frbgen_breez_liquid_wire_send_paymentPtr.asFunction<
void Function(int, ffi.Pointer<wire_cst_prepare_send_response>)>();
void
frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery(
ffi.Pointer<ffi.Void> ptr,
) {
return _frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery(
ptr,
);
}
late final _frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecoveryPtr =
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>(
'frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery');
late final _frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery =
_frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecoveryPtr
.asFunction<void Function(ffi.Pointer<ffi.Void>)>();
void
frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery(
ffi.Pointer<ffi.Void> ptr,
) {
return _frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery(
ptr,
);
}
late final _frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecoveryPtr =
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>(
'frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery');
late final _frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery =
_frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecoveryPtr
.asFunction<void Function(ffi.Pointer<ffi.Void>)>();
ffi.Pointer<wire_cst_prepare_receive_request>
frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_request() {
return _frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_request();
}
late final _frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_requestPtr =
_lookup<
ffi.NativeFunction<
ffi.Pointer<wire_cst_prepare_receive_request> Function()>>(
'frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_request');
late final _frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_request =
_frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_requestPtr
.asFunction<
ffi.Pointer<wire_cst_prepare_receive_request> Function()>();
ffi.Pointer<wire_cst_prepare_receive_response>
frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_response() {
return _frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_response();
}
late final _frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_responsePtr =
_lookup<
ffi.NativeFunction<
ffi.Pointer<wire_cst_prepare_receive_response> Function()>>(
'frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_response');
late final _frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_response =
_frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_responsePtr
.asFunction<
ffi.Pointer<wire_cst_prepare_receive_response> Function()>();
ffi.Pointer<wire_cst_prepare_send_response>
frbgen_breez_liquid_cst_new_box_autoadd_prepare_send_response() {
return _frbgen_breez_liquid_cst_new_box_autoadd_prepare_send_response();
}
late final _frbgen_breez_liquid_cst_new_box_autoadd_prepare_send_responsePtr =
_lookup<
ffi.NativeFunction<
ffi.Pointer<wire_cst_prepare_send_response> Function()>>(
'frbgen_breez_liquid_cst_new_box_autoadd_prepare_send_response');
late final _frbgen_breez_liquid_cst_new_box_autoadd_prepare_send_response =
_frbgen_breez_liquid_cst_new_box_autoadd_prepare_send_responsePtr
.asFunction<ffi.Pointer<wire_cst_prepare_send_response> Function()>();
ffi.Pointer<ffi.Uint32> frbgen_breez_liquid_cst_new_box_autoadd_u_32(
int value,
) {
return _frbgen_breez_liquid_cst_new_box_autoadd_u_32(
value,
);
}
late final _frbgen_breez_liquid_cst_new_box_autoadd_u_32Ptr =
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Uint32> Function(ffi.Uint32)>>(
'frbgen_breez_liquid_cst_new_box_autoadd_u_32');
late final _frbgen_breez_liquid_cst_new_box_autoadd_u_32 =
_frbgen_breez_liquid_cst_new_box_autoadd_u_32Ptr
.asFunction<ffi.Pointer<ffi.Uint32> Function(int)>();
ffi.Pointer<ffi.Uint64> frbgen_breez_liquid_cst_new_box_autoadd_u_64(
int value,
) {
return _frbgen_breez_liquid_cst_new_box_autoadd_u_64(
value,
);
}
late final _frbgen_breez_liquid_cst_new_box_autoadd_u_64Ptr =
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Uint64> Function(ffi.Uint64)>>(
'frbgen_breez_liquid_cst_new_box_autoadd_u_64');
late final _frbgen_breez_liquid_cst_new_box_autoadd_u_64 =
_frbgen_breez_liquid_cst_new_box_autoadd_u_64Ptr
.asFunction<ffi.Pointer<ffi.Uint64> Function(int)>();
ffi.Pointer<wire_cst_list_payment> frbgen_breez_liquid_cst_new_list_payment(
int len,
) {
return _frbgen_breez_liquid_cst_new_list_payment(
len,
);
}
late final _frbgen_breez_liquid_cst_new_list_paymentPtr = _lookup<
ffi.NativeFunction<
ffi.Pointer<wire_cst_list_payment> Function(
ffi.Int32)>>('frbgen_breez_liquid_cst_new_list_payment');
late final _frbgen_breez_liquid_cst_new_list_payment =
_frbgen_breez_liquid_cst_new_list_paymentPtr
.asFunction<ffi.Pointer<wire_cst_list_payment> Function(int)>();
ffi.Pointer<wire_cst_list_prim_u_8_strict>
frbgen_breez_liquid_cst_new_list_prim_u_8_strict(
int len,
) {
return _frbgen_breez_liquid_cst_new_list_prim_u_8_strict(
len,
);
}
late final _frbgen_breez_liquid_cst_new_list_prim_u_8_strictPtr = _lookup<
ffi.NativeFunction<
ffi.Pointer<wire_cst_list_prim_u_8_strict> Function(
ffi.Int32)>>('frbgen_breez_liquid_cst_new_list_prim_u_8_strict');
late final _frbgen_breez_liquid_cst_new_list_prim_u_8_strict =
_frbgen_breez_liquid_cst_new_list_prim_u_8_strictPtr.asFunction<
ffi.Pointer<wire_cst_list_prim_u_8_strict> Function(int)>();
int dummy_method_to_enforce_bundling() {
return _dummy_method_to_enforce_bundling();
}
late final _dummy_method_to_enforce_bundlingPtr =
_lookup<ffi.NativeFunction<ffi.Int64 Function()>>(
'dummy_method_to_enforce_bundling');
late final _dummy_method_to_enforce_bundling =
_dummy_method_to_enforce_bundlingPtr.asFunction<int Function()>();
}
final class DartCObject extends ffi.Opaque {}
final class WireSyncRust2DartSse extends ffi.Struct {
external ffi.Pointer<ffi.Uint8> ptr;
@ffi.Int32()
external int len;
}
typedef DartPostCObjectFnType
= ffi.Pointer<ffi.NativeFunction<DartPostCObjectFnTypeFunction>>;
typedef DartPostCObjectFnTypeFunction = ffi.Bool Function(
DartPort port_id, ffi.Pointer<ffi.Void> message);
typedef DartDartPostCObjectFnTypeFunction = bool Function(
DartDartPort port_id, ffi.Pointer<ffi.Void> message);
typedef DartPort = ffi.Int64;
typedef DartDartPort = int;
final class _Dart_Handle extends ffi.Opaque {}
final class wire_cst_list_prim_u_8_strict extends ffi.Struct {
external ffi.Pointer<ffi.Uint8> ptr;
@ffi.Int32()
external int len;
}
final class wire_cst_prepare_receive_request extends ffi.Struct {
external ffi.Pointer<ffi.Uint64> payer_amount_sat;
external ffi.Pointer<ffi.Uint64> receiver_amount_sat;
}
final class wire_cst_prepare_receive_response extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> pair_hash;
@ffi.Uint64()
external int payer_amount_sat;
@ffi.Uint64()
external int fees_sat;
}
final class wire_cst_prepare_send_response extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> id;
@ffi.Uint64()
external int payer_amount_sat;
@ffi.Uint64()
external int receiver_amount_sat;
@ffi.Uint64()
external int total_fees;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> funding_address;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> invoice;
}
final class wire_cst_payment extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> id;
external ffi.Pointer<ffi.Uint32> timestamp;
@ffi.Uint64()
external int amount_sat;
external ffi.Pointer<ffi.Uint64> fees_sat;
@ffi.Int32()
external int payment_type;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> invoice;
}
final class wire_cst_list_payment extends ffi.Struct {
external ffi.Pointer<wire_cst_payment> ptr;
@ffi.Int32()
external int len;
}
final class wire_cst_PaymentError_Generic extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> err;
}
final class wire_cst_PaymentError_LwkError extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> err;
}
final class wire_cst_PaymentError_SendError extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> err;
}
final class wire_cst_PaymentError_SignerError extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> err;
}
final class PaymentErrorKind extends ffi.Union {
external wire_cst_PaymentError_Generic Generic;
external wire_cst_PaymentError_LwkError LwkError;
external wire_cst_PaymentError_SendError SendError;
external wire_cst_PaymentError_SignerError SignerError;
}
final class wire_cst_payment_error extends ffi.Struct {
@ffi.Int32()
external int tag;
external PaymentErrorKind kind;
}
final class wire_cst_receive_payment_response extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> id;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> invoice;
}
final class wire_cst_send_payment_response extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> txid;
}
final class wire_cst_wallet_info extends ffi.Struct {
@ffi.Uint64()
external int balance_sat;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> pubkey;
}
const double LIQUID_CLAIM_TX_FEERATE = 0.1;

View File

@@ -0,0 +1,175 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
// EXTRA BEGIN
typedef struct DartCObject *WireSyncRust2DartDco;
typedef struct WireSyncRust2DartSse {
uint8_t *ptr;
int32_t len;
} WireSyncRust2DartSse;
typedef int64_t DartPort;
typedef bool (*DartPostCObjectFnType)(DartPort port_id, void *message);
void store_dart_post_cobject(DartPostCObjectFnType ptr);
// EXTRA END
typedef struct _Dart_Handle* Dart_Handle;
/**
* Claim tx feerate for Receive, in sats per vbyte.
* Since the Liquid blocks are consistently empty for now, we hardcode the minimum feerate.
*/
#define LIQUID_CLAIM_TX_FEERATE 0.1
typedef struct wire_cst_list_prim_u_8_strict {
uint8_t *ptr;
int32_t len;
} wire_cst_list_prim_u_8_strict;
typedef struct wire_cst_prepare_receive_request {
uint64_t *payer_amount_sat;
uint64_t *receiver_amount_sat;
} wire_cst_prepare_receive_request;
typedef struct wire_cst_prepare_receive_response {
struct wire_cst_list_prim_u_8_strict *pair_hash;
uint64_t payer_amount_sat;
uint64_t fees_sat;
} wire_cst_prepare_receive_response;
typedef struct wire_cst_prepare_send_response {
struct wire_cst_list_prim_u_8_strict *id;
uint64_t payer_amount_sat;
uint64_t receiver_amount_sat;
uint64_t total_fees;
struct wire_cst_list_prim_u_8_strict *funding_address;
struct wire_cst_list_prim_u_8_strict *invoice;
} wire_cst_prepare_send_response;
typedef struct wire_cst_payment {
struct wire_cst_list_prim_u_8_strict *id;
uint32_t *timestamp;
uint64_t amount_sat;
uint64_t *fees_sat;
int32_t payment_type;
struct wire_cst_list_prim_u_8_strict *invoice;
} wire_cst_payment;
typedef struct wire_cst_list_payment {
struct wire_cst_payment *ptr;
int32_t len;
} wire_cst_list_payment;
typedef struct wire_cst_PaymentError_Generic {
struct wire_cst_list_prim_u_8_strict *err;
} wire_cst_PaymentError_Generic;
typedef struct wire_cst_PaymentError_LwkError {
struct wire_cst_list_prim_u_8_strict *err;
} wire_cst_PaymentError_LwkError;
typedef struct wire_cst_PaymentError_SendError {
struct wire_cst_list_prim_u_8_strict *err;
} wire_cst_PaymentError_SendError;
typedef struct wire_cst_PaymentError_SignerError {
struct wire_cst_list_prim_u_8_strict *err;
} wire_cst_PaymentError_SignerError;
typedef union PaymentErrorKind {
struct wire_cst_PaymentError_Generic Generic;
struct wire_cst_PaymentError_LwkError LwkError;
struct wire_cst_PaymentError_SendError SendError;
struct wire_cst_PaymentError_SignerError SignerError;
} PaymentErrorKind;
typedef struct wire_cst_payment_error {
int32_t tag;
union PaymentErrorKind kind;
} wire_cst_payment_error;
typedef struct wire_cst_receive_payment_response {
struct wire_cst_list_prim_u_8_strict *id;
struct wire_cst_list_prim_u_8_strict *invoice;
} wire_cst_receive_payment_response;
typedef struct wire_cst_send_payment_response {
struct wire_cst_list_prim_u_8_strict *txid;
} wire_cst_send_payment_response;
typedef struct wire_cst_wallet_info {
uint64_t balance_sat;
struct wire_cst_list_prim_u_8_strict *pubkey;
} wire_cst_wallet_info;
void frbgen_breez_liquid_wire_backup(int64_t port_);
void frbgen_breez_liquid_wire_connect(int64_t port_,
struct wire_cst_list_prim_u_8_strict *mnemonic,
struct wire_cst_list_prim_u_8_strict *data_dir,
int32_t network);
void frbgen_breez_liquid_wire_empty_wallet_cache(int64_t port_);
void frbgen_breez_liquid_wire_get_info(int64_t port_, bool with_scan);
void frbgen_breez_liquid_wire_list_payments(int64_t port_, bool with_scan, bool include_pending);
void frbgen_breez_liquid_wire_prepare_receive_payment(int64_t port_,
struct wire_cst_prepare_receive_request *req);
void frbgen_breez_liquid_wire_prepare_send_payment(int64_t port_,
struct wire_cst_list_prim_u_8_strict *invoice);
void frbgen_breez_liquid_wire_receive_payment(int64_t port_,
struct wire_cst_prepare_receive_response *req);
void frbgen_breez_liquid_wire_recover_funds(int64_t port_, uintptr_t recovery);
void frbgen_breez_liquid_wire_restore(int64_t port_,
struct wire_cst_list_prim_u_8_strict *backup_path);
void frbgen_breez_liquid_wire_send_payment(int64_t port_,
struct wire_cst_prepare_send_response *req);
void frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery(const void *ptr);
void frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery(const void *ptr);
struct wire_cst_prepare_receive_request *frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_request(void);
struct wire_cst_prepare_receive_response *frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_response(void);
struct wire_cst_prepare_send_response *frbgen_breez_liquid_cst_new_box_autoadd_prepare_send_response(void);
uint32_t *frbgen_breez_liquid_cst_new_box_autoadd_u_32(uint32_t value);
uint64_t *frbgen_breez_liquid_cst_new_box_autoadd_u_64(uint64_t value);
struct wire_cst_list_payment *frbgen_breez_liquid_cst_new_list_payment(int32_t len);
struct wire_cst_list_prim_u_8_strict *frbgen_breez_liquid_cst_new_list_prim_u_8_strict(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_prepare_receive_request);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_prepare_receive_response);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_prepare_send_response);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_u_32);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_u_64);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_list_payment);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_list_prim_u_8_strict);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockLBtcReverseRecovery);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_backup);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_connect);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_empty_wallet_cache);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_get_info);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_list_payments);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_prepare_receive_payment);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_prepare_send_payment);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_receive_payment);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_recover_funds);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_restore);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_send_payment);
dummy_var ^= ((int64_t) (void*) store_dart_post_cobject);
return dummy_var;
}