Skip to content

Commit

Permalink
chore: generate bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
hydra-yse committed Sep 18, 2024
1 parent 91c5ab7 commit c8de986
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ typedef struct wire_cst_pay_onchain_amount {

typedef struct wire_cst_prepare_pay_onchain_request {
struct wire_cst_pay_onchain_amount amount;
uint32_t *sat_per_vbyte;
uint32_t *fee_rate_msat_per_vbyte;
} wire_cst_prepare_pay_onchain_request;

typedef struct wire_cst_prepare_receive_request {
Expand All @@ -159,7 +159,7 @@ typedef struct wire_cst_prepare_receive_request {
typedef struct wire_cst_prepare_refund_request {
struct wire_cst_list_prim_u_8_strict *swap_address;
struct wire_cst_list_prim_u_8_strict *refund_address;
uint32_t sat_per_vbyte;
uint32_t fee_rate_msat_per_vbyte;
} wire_cst_prepare_refund_request;

typedef struct wire_cst_prepare_send_request {
Expand All @@ -182,7 +182,7 @@ typedef struct wire_cst_receive_payment_request {
typedef struct wire_cst_refund_request {
struct wire_cst_list_prim_u_8_strict *swap_address;
struct wire_cst_list_prim_u_8_strict *refund_address;
uint32_t sat_per_vbyte;
uint32_t fee_rate_msat_per_vbyte;
} wire_cst_refund_request;

typedef struct wire_cst_restore_request {
Expand Down
6 changes: 3 additions & 3 deletions lib/bindings/src/breez_sdk_liquid.udl
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ interface PayOnchainAmount {

dictionary PreparePayOnchainRequest {
PayOnchainAmount amount;
u32? sat_per_vbyte = null;
u32? fee_rate_msat_per_vbyte = null;
};

dictionary PreparePayOnchainResponse {
Expand Down Expand Up @@ -519,7 +519,7 @@ dictionary RecommendedFees {
dictionary PrepareRefundRequest {
string swap_address;
string refund_address;
u32 sat_per_vbyte;
u32 fee_rate_msat_per_vbyte;
};

dictionary PrepareRefundResponse {
Expand All @@ -531,7 +531,7 @@ dictionary PrepareRefundResponse {
dictionary RefundRequest {
string swap_address;
string refund_address;
u32 sat_per_vbyte;
u32 fee_rate_msat_per_vbyte;
};

dictionary RefundResponse {
Expand Down
42 changes: 21 additions & 21 deletions lib/core/src/frb_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3331,10 +3331,10 @@ impl SseDecode for crate::model::PreparePayOnchainRequest {
// 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_amount = <crate::model::PayOnchainAmount>::sse_decode(deserializer);
let mut var_satPerVbyte = <Option<u32>>::sse_decode(deserializer);
let mut var_feeRateMsatPerVbyte = <Option<u32>>::sse_decode(deserializer);
return crate::model::PreparePayOnchainRequest {
amount: var_amount,
sat_per_vbyte: var_satPerVbyte,
fee_rate_msat_per_vbyte: var_feeRateMsatPerVbyte,
};
}
}
Expand Down Expand Up @@ -3384,11 +3384,11 @@ impl SseDecode for crate::model::PrepareRefundRequest {
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
let mut var_swapAddress = <String>::sse_decode(deserializer);
let mut var_refundAddress = <String>::sse_decode(deserializer);
let mut var_satPerVbyte = <u32>::sse_decode(deserializer);
let mut var_feeRateMsatPerVbyte = <u32>::sse_decode(deserializer);
return crate::model::PrepareRefundRequest {
swap_address: var_swapAddress,
refund_address: var_refundAddress,
sat_per_vbyte: var_satPerVbyte,
fee_rate_msat_per_vbyte: var_feeRateMsatPerVbyte,
};
}
}
Expand Down Expand Up @@ -3491,11 +3491,11 @@ impl SseDecode for crate::model::RefundRequest {
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
let mut var_swapAddress = <String>::sse_decode(deserializer);
let mut var_refundAddress = <String>::sse_decode(deserializer);
let mut var_satPerVbyte = <u32>::sse_decode(deserializer);
let mut var_feeRateMsatPerVbyte = <u32>::sse_decode(deserializer);
return crate::model::RefundRequest {
swap_address: var_swapAddress,
refund_address: var_refundAddress,
sat_per_vbyte: var_satPerVbyte,
fee_rate_msat_per_vbyte: var_feeRateMsatPerVbyte,
};
}
}
Expand Down Expand Up @@ -5140,7 +5140,7 @@ impl flutter_rust_bridge::IntoDart for crate::model::PreparePayOnchainRequest {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
[
self.amount.into_into_dart().into_dart(),
self.sat_per_vbyte.into_into_dart().into_dart(),
self.fee_rate_msat_per_vbyte.into_into_dart().into_dart(),
]
.into_dart()
}
Expand Down Expand Up @@ -5227,7 +5227,7 @@ impl flutter_rust_bridge::IntoDart for crate::model::PrepareRefundRequest {
[
self.swap_address.into_into_dart().into_dart(),
self.refund_address.into_into_dart().into_dart(),
self.sat_per_vbyte.into_into_dart().into_dart(),
self.fee_rate_msat_per_vbyte.into_into_dart().into_dart(),
]
.into_dart()
}
Expand Down Expand Up @@ -5394,7 +5394,7 @@ impl flutter_rust_bridge::IntoDart for crate::model::RefundRequest {
[
self.swap_address.into_into_dart().into_dart(),
self.refund_address.into_into_dart().into_dart(),
self.sat_per_vbyte.into_into_dart().into_dart(),
self.fee_rate_msat_per_vbyte.into_into_dart().into_dart(),
]
.into_dart()
}
Expand Down Expand Up @@ -6829,7 +6829,7 @@ impl SseEncode for crate::model::PreparePayOnchainRequest {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
<crate::model::PayOnchainAmount>::sse_encode(self.amount, serializer);
<Option<u32>>::sse_encode(self.sat_per_vbyte, serializer);
<Option<u32>>::sse_encode(self.fee_rate_msat_per_vbyte, serializer);
}
}

Expand Down Expand Up @@ -6864,7 +6864,7 @@ impl SseEncode for crate::model::PrepareRefundRequest {
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
<String>::sse_encode(self.swap_address, serializer);
<String>::sse_encode(self.refund_address, serializer);
<u32>::sse_encode(self.sat_per_vbyte, serializer);
<u32>::sse_encode(self.fee_rate_msat_per_vbyte, serializer);
}
}

Expand Down Expand Up @@ -6933,7 +6933,7 @@ impl SseEncode for crate::model::RefundRequest {
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
<String>::sse_encode(self.swap_address, serializer);
<String>::sse_encode(self.refund_address, serializer);
<u32>::sse_encode(self.sat_per_vbyte, serializer);
<u32>::sse_encode(self.fee_rate_msat_per_vbyte, serializer);
}
}

Expand Down Expand Up @@ -8474,7 +8474,7 @@ mod io {
fn cst_decode(self) -> crate::model::PreparePayOnchainRequest {
crate::model::PreparePayOnchainRequest {
amount: self.amount.cst_decode(),
sat_per_vbyte: self.sat_per_vbyte.cst_decode(),
fee_rate_msat_per_vbyte: self.fee_rate_msat_per_vbyte.cst_decode(),
}
}
}
Expand Down Expand Up @@ -8513,7 +8513,7 @@ mod io {
crate::model::PrepareRefundRequest {
swap_address: self.swap_address.cst_decode(),
refund_address: self.refund_address.cst_decode(),
sat_per_vbyte: self.sat_per_vbyte.cst_decode(),
fee_rate_msat_per_vbyte: self.fee_rate_msat_per_vbyte.cst_decode(),
}
}
}
Expand Down Expand Up @@ -8590,7 +8590,7 @@ mod io {
crate::model::RefundRequest {
swap_address: self.swap_address.cst_decode(),
refund_address: self.refund_address.cst_decode(),
sat_per_vbyte: self.sat_per_vbyte.cst_decode(),
fee_rate_msat_per_vbyte: self.fee_rate_msat_per_vbyte.cst_decode(),
}
}
}
Expand Down Expand Up @@ -9464,7 +9464,7 @@ mod io {
fn new_with_null_ptr() -> Self {
Self {
amount: Default::default(),
sat_per_vbyte: core::ptr::null_mut(),
fee_rate_msat_per_vbyte: core::ptr::null_mut(),
}
}
}
Expand Down Expand Up @@ -9519,7 +9519,7 @@ mod io {
Self {
swap_address: core::ptr::null_mut(),
refund_address: core::ptr::null_mut(),
sat_per_vbyte: Default::default(),
fee_rate_msat_per_vbyte: Default::default(),
}
}
}
Expand Down Expand Up @@ -9628,7 +9628,7 @@ mod io {
Self {
swap_address: core::ptr::null_mut(),
refund_address: core::ptr::null_mut(),
sat_per_vbyte: Default::default(),
fee_rate_msat_per_vbyte: Default::default(),
}
}
}
Expand Down Expand Up @@ -11382,7 +11382,7 @@ mod io {
#[derive(Clone, Copy)]
pub struct wire_cst_prepare_pay_onchain_request {
amount: wire_cst_pay_onchain_amount,
sat_per_vbyte: *mut u32,
fee_rate_msat_per_vbyte: *mut u32,
}
#[repr(C)]
#[derive(Clone, Copy)]
Expand All @@ -11409,7 +11409,7 @@ mod io {
pub struct wire_cst_prepare_refund_request {
swap_address: *mut wire_cst_list_prim_u_8_strict,
refund_address: *mut wire_cst_list_prim_u_8_strict,
sat_per_vbyte: u32,
fee_rate_msat_per_vbyte: u32,
}
#[repr(C)]
#[derive(Clone, Copy)]
Expand Down Expand Up @@ -11462,7 +11462,7 @@ mod io {
pub struct wire_cst_refund_request {
swap_address: *mut wire_cst_list_prim_u_8_strict,
refund_address: *mut wire_cst_list_prim_u_8_strict,
sat_per_vbyte: u32,
fee_rate_msat_per_vbyte: u32,
}
#[repr(C)]
#[derive(Clone, Copy)]
Expand Down
4 changes: 2 additions & 2 deletions lib/core/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ pub enum PayOnchainAmount {
#[derive(Debug, Serialize, Clone)]
pub struct PreparePayOnchainRequest {
pub amount: PayOnchainAmount,
/// The optional fee rate of the Bitcoin claim transaction. Defaults to the swapper estimated claim fee.
pub sat_per_vbyte: Option<u32>,
/// The optional fee rate of the Bitcoin claim transaction in msat/vB. Defaults to the swapper estimated claim fee.
pub fee_rate_msat_per_vbyte: Option<u32>,
}

/// Returned when calling [crate::sdk::LiquidSdk::prepare_pay_onchain].
Expand Down
2 changes: 1 addition & 1 deletion lib/core/src/sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ impl LiquidSdk {

let balance_sat = self.get_info().await?.balance_sat;
let pair = self.get_chain_pair(Direction::Outgoing)?;
let claim_fees_sat = match req.sat_per_vbyte {
let claim_fees_sat = match req.fee_rate_msat_per_vbyte {
Some(sat_per_vbyte) => ESTIMATED_BTC_CLAIM_TX_VSIZE * sat_per_vbyte as u64,
None => pair.clone().fees.claim_estimate(),
};
Expand Down
28 changes: 16 additions & 12 deletions packages/dart/lib/src/frb_generated.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2393,7 +2393,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
if (arr.length != 2) throw Exception('unexpected arr length: expect 2 but see ${arr.length}');
return PreparePayOnchainRequest(
amount: dco_decode_pay_onchain_amount(arr[0]),
satPerVbyte: dco_decode_opt_box_autoadd_u_32(arr[1]),
feeRateMsatPerVbyte: dco_decode_opt_box_autoadd_u_32(arr[1]),
);
}

Expand Down Expand Up @@ -2440,7 +2440,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return PrepareRefundRequest(
swapAddress: dco_decode_String(arr[0]),
refundAddress: dco_decode_String(arr[1]),
satPerVbyte: dco_decode_u_32(arr[2]),
feeRateMsatPerVbyte: dco_decode_u_32(arr[2]),
);
}

Expand Down Expand Up @@ -2533,7 +2533,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return RefundRequest(
swapAddress: dco_decode_String(arr[0]),
refundAddress: dco_decode_String(arr[1]),
satPerVbyte: dco_decode_u_32(arr[2]),
feeRateMsatPerVbyte: dco_decode_u_32(arr[2]),
);
}

Expand Down Expand Up @@ -4097,8 +4097,8 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
PreparePayOnchainRequest sse_decode_prepare_pay_onchain_request(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
var var_amount = sse_decode_pay_onchain_amount(deserializer);
var var_satPerVbyte = sse_decode_opt_box_autoadd_u_32(deserializer);
return PreparePayOnchainRequest(amount: var_amount, satPerVbyte: var_satPerVbyte);
var var_feeRateMsatPerVbyte = sse_decode_opt_box_autoadd_u_32(deserializer);
return PreparePayOnchainRequest(amount: var_amount, feeRateMsatPerVbyte: var_feeRateMsatPerVbyte);
}

@protected
Expand Down Expand Up @@ -4136,9 +4136,11 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
// Codec=Sse (Serialization based), see doc to use other codecs
var var_swapAddress = sse_decode_String(deserializer);
var var_refundAddress = sse_decode_String(deserializer);
var var_satPerVbyte = sse_decode_u_32(deserializer);
var var_feeRateMsatPerVbyte = sse_decode_u_32(deserializer);
return PrepareRefundRequest(
swapAddress: var_swapAddress, refundAddress: var_refundAddress, satPerVbyte: var_satPerVbyte);
swapAddress: var_swapAddress,
refundAddress: var_refundAddress,
feeRateMsatPerVbyte: var_feeRateMsatPerVbyte);
}

@protected
Expand Down Expand Up @@ -4214,9 +4216,11 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
// Codec=Sse (Serialization based), see doc to use other codecs
var var_swapAddress = sse_decode_String(deserializer);
var var_refundAddress = sse_decode_String(deserializer);
var var_satPerVbyte = sse_decode_u_32(deserializer);
var var_feeRateMsatPerVbyte = sse_decode_u_32(deserializer);
return RefundRequest(
swapAddress: var_swapAddress, refundAddress: var_refundAddress, satPerVbyte: var_satPerVbyte);
swapAddress: var_swapAddress,
refundAddress: var_refundAddress,
feeRateMsatPerVbyte: var_feeRateMsatPerVbyte);
}

@protected
Expand Down Expand Up @@ -5694,7 +5698,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
void sse_encode_prepare_pay_onchain_request(PreparePayOnchainRequest self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_pay_onchain_amount(self.amount, serializer);
sse_encode_opt_box_autoadd_u_32(self.satPerVbyte, serializer);
sse_encode_opt_box_autoadd_u_32(self.feeRateMsatPerVbyte, serializer);
}

@protected
Expand Down Expand Up @@ -5725,7 +5729,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_String(self.swapAddress, serializer);
sse_encode_String(self.refundAddress, serializer);
sse_encode_u_32(self.satPerVbyte, serializer);
sse_encode_u_32(self.feeRateMsatPerVbyte, serializer);
}

@protected
Expand Down Expand Up @@ -5786,7 +5790,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_String(self.swapAddress, serializer);
sse_encode_String(self.refundAddress, serializer);
sse_encode_u_32(self.satPerVbyte, serializer);
sse_encode_u_32(self.feeRateMsatPerVbyte, serializer);
}

@protected
Expand Down
12 changes: 6 additions & 6 deletions packages/dart/lib/src/frb_generated.io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2462,7 +2462,7 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
void cst_api_fill_to_wire_prepare_pay_onchain_request(
PreparePayOnchainRequest apiObj, wire_cst_prepare_pay_onchain_request wireObj) {
cst_api_fill_to_wire_pay_onchain_amount(apiObj.amount, wireObj.amount);
wireObj.sat_per_vbyte = cst_encode_opt_box_autoadd_u_32(apiObj.satPerVbyte);
wireObj.fee_rate_msat_per_vbyte = cst_encode_opt_box_autoadd_u_32(apiObj.feeRateMsatPerVbyte);
}

@protected
Expand Down Expand Up @@ -2493,7 +2493,7 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
PrepareRefundRequest apiObj, wire_cst_prepare_refund_request wireObj) {
wireObj.swap_address = cst_encode_String(apiObj.swapAddress);
wireObj.refund_address = cst_encode_String(apiObj.refundAddress);
wireObj.sat_per_vbyte = cst_encode_u_32(apiObj.satPerVbyte);
wireObj.fee_rate_msat_per_vbyte = cst_encode_u_32(apiObj.feeRateMsatPerVbyte);
}

@protected
Expand Down Expand Up @@ -2551,7 +2551,7 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
void cst_api_fill_to_wire_refund_request(RefundRequest apiObj, wire_cst_refund_request wireObj) {
wireObj.swap_address = cst_encode_String(apiObj.swapAddress);
wireObj.refund_address = cst_encode_String(apiObj.refundAddress);
wireObj.sat_per_vbyte = cst_encode_u_32(apiObj.satPerVbyte);
wireObj.fee_rate_msat_per_vbyte = cst_encode_u_32(apiObj.feeRateMsatPerVbyte);
}

@protected
Expand Down Expand Up @@ -4777,7 +4777,7 @@ final class wire_cst_pay_onchain_amount extends ffi.Struct {
final class wire_cst_prepare_pay_onchain_request extends ffi.Struct {
external wire_cst_pay_onchain_amount amount;

external ffi.Pointer<ffi.Uint32> sat_per_vbyte;
external ffi.Pointer<ffi.Uint32> fee_rate_msat_per_vbyte;
}

final class wire_cst_prepare_receive_request extends ffi.Struct {
Expand All @@ -4793,7 +4793,7 @@ final class wire_cst_prepare_refund_request extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> refund_address;

@ffi.Uint32()
external int sat_per_vbyte;
external int fee_rate_msat_per_vbyte;
}

final class wire_cst_prepare_send_request extends ffi.Struct {
Expand Down Expand Up @@ -4826,7 +4826,7 @@ final class wire_cst_refund_request extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> refund_address;

@ffi.Uint32()
external int sat_per_vbyte;
external int fee_rate_msat_per_vbyte;
}

final class wire_cst_restore_request extends ffi.Struct {
Expand Down
Loading

0 comments on commit c8de986

Please sign in to comment.