Skip to content

Commit 5fd3c71

Browse files
feat: migrate FeeRate to procedural macros
1 parent f46f743 commit 5fd3c71

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

bdk-ffi/src/bdk.udl

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,19 +1469,7 @@ interface Amount {
14691469
f64 to_btc();
14701470
};
14711471

1472-
interface FeeRate {
1473-
[Name=from_sat_per_vb, Throws=FeeRateError]
1474-
constructor(u64 sat_per_vb);
1475-
1476-
[Name=from_sat_per_kwu]
1477-
constructor(u64 sat_per_kwu);
1478-
1479-
u64 to_sat_per_vb_ceil();
1480-
1481-
u64 to_sat_per_vb_floor();
1482-
1483-
u64 to_sat_per_kwu();
1484-
};
1472+
typedef interface FeeRate;
14851473

14861474
dictionary OutPoint {
14871475
string txid;

bdk-ffi/src/bitcoin.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ impl From<OutPoint> for BdkOutPoint {
5454
}
5555
}
5656

57-
#[derive(Clone, Debug)]
57+
#[derive(Clone, Debug, uniffi::Object)]
5858
pub struct FeeRate(pub BdkFeeRate);
5959

60+
#[uniffi::export]
6061
impl FeeRate {
62+
#[uniffi::constructor]
6163
pub fn from_sat_per_vb(sat_per_vb: u64) -> Result<Self, FeeRateError> {
6264
let fee_rate: Option<BdkFeeRate> = BdkFeeRate::from_sat_per_vb(sat_per_vb);
6365
match fee_rate {
@@ -66,6 +68,7 @@ impl FeeRate {
6668
}
6769
}
6870

71+
#[uniffi::constructor]
6972
pub fn from_sat_per_kwu(sat_per_kwu: u64) -> Self {
7073
FeeRate(BdkFeeRate::from_sat_per_kwu(sat_per_kwu))
7174
}

0 commit comments

Comments
 (0)