Skip to content

Commit 3187533

Browse files
committed
Remove imported bitcoin_ffi package
After migrating to primitive types on the FFI layer we no longer need to import the bitcoin_ffi package. Also cleans up any API changes made during the transition.
1 parent cc45199 commit 3187533

File tree

9 files changed

+7
-124
lines changed

9 files changed

+7
-124
lines changed

Cargo-minimal.lock

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -470,16 +470,6 @@ dependencies = [
470470
"serde",
471471
]
472472

473-
[[package]]
474-
name = "bitcoin-ffi"
475-
version = "0.1.3"
476-
source = "git+https://github.com/bitcoindevkit/bitcoin-ffi?rev=39cc12b#39cc12bd32d6adf889b48354adcdb0f3c475aad2"
477-
dependencies = [
478-
"bitcoin 0.32.7",
479-
"thiserror 1.0.63",
480-
"uniffi",
481-
]
482-
483473
[[package]]
484474
name = "bitcoin-hpke"
485475
version = "0.13.0"
@@ -2525,7 +2515,6 @@ name = "payjoin-ffi"
25252515
version = "0.24.0"
25262516
dependencies = [
25272517
"bdk",
2528-
"bitcoin-ffi",
25292518
"bitcoin-ohttp",
25302519
"getrandom 0.2.15",
25312520
"lazy_static",

Cargo-recent.lock

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -470,16 +470,6 @@ dependencies = [
470470
"serde",
471471
]
472472

473-
[[package]]
474-
name = "bitcoin-ffi"
475-
version = "0.1.3"
476-
source = "git+https://github.com/bitcoindevkit/bitcoin-ffi?rev=39cc12b#39cc12bd32d6adf889b48354adcdb0f3c475aad2"
477-
dependencies = [
478-
"bitcoin 0.32.7",
479-
"thiserror 1.0.63",
480-
"uniffi",
481-
]
482-
483473
[[package]]
484474
name = "bitcoin-hpke"
485475
version = "0.13.0"
@@ -2525,7 +2515,6 @@ name = "payjoin-ffi"
25252515
version = "0.24.0"
25262516
dependencies = [
25272517
"bdk",
2528-
"bitcoin-ffi",
25292518
"bitcoin-ohttp",
25302519
"getrandom 0.2.15",
25312520
"lazy_static",

payjoin-ffi/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ name = "uniffi-bindgen"
2222
path = "uniffi-bindgen.rs"
2323

2424
[dependencies]
25-
bitcoin-ffi = { git = "https://github.com/bitcoindevkit/bitcoin-ffi", rev = "39cc12b" }
2625
getrandom = "0.2"
2726
lazy_static = "1.5.0"
2827
ohttp = { package = "bitcoin-ohttp", version = "0.6.0" }
@@ -32,7 +31,7 @@ serde = { version = "1.0.219", features = ["derive"] }
3231
serde_json = "1.0.142"
3332
thiserror = "2.0.14"
3433
tokio = { version = "1.47.1", features = ["full"], optional = true }
35-
uniffi = { version = "0.30.0" }
34+
uniffi = { version = "0.30.0", features = ["cli"] }
3635
uniffi-dart = { git = "https://github.com/Uniffi-Dart/uniffi-dart.git", rev = "5bdcc79", optional = true }
3736
url = "2.5.4"
3837

payjoin-ffi/javascript/src/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
// Export the generated bindings to the app.
22
export * as payjoin from "./generated/payjoin.js";
3-
export * as bitcoin from "./generated/bitcoin.js";
43

54
// Now import the bindings so we can:
65
// - initialize them
76
// - export them as namespaced objects as the default export.
8-
import * as bitcoin from "./generated/bitcoin.js";
97
import * as payjoin from "./generated/payjoin.js";
108

119
let initialized = false;
@@ -19,14 +17,12 @@ export async function uniffiInitAsync() {
1917
// Initialize the generated bindings: mostly checksums, but also callbacks.
2018
// - the boolean flag ensures this loads exactly once, even if the JS code
2119
// is reloaded (e.g. during development with metro).
22-
bitcoin.default.initialize();
2320
payjoin.default.initialize();
2421

2522
initialized = true;
2623
}
2724

2825
// Export the crates as individually namespaced objects.
2926
export default {
30-
bitcoin,
3127
payjoin,
3228
};

payjoin-ffi/src/bitcoin_ffi.rs

Lines changed: 0 additions & 55 deletions
This file was deleted.

payjoin-ffi/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![crate_name = "payjoin_ffi"]
22

3-
pub mod bitcoin_ffi;
43
pub mod error;
54
#[cfg(feature = "io")]
65
pub mod io;
@@ -15,7 +14,6 @@ pub mod uri;
1514

1615
pub use payjoin::persist::NoopSessionPersister;
1716

18-
pub use crate::bitcoin_ffi::*;
1917
pub use crate::ohttp::*;
2018
pub use crate::output_substitution::*;
2119
pub use crate::receive::*;

payjoin-ffi/src/receive/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::error::ForeignError;
1616
pub use crate::error::{ImplementationError, SerdeJsonError};
1717
use crate::ohttp::OhttpKeys;
1818
use crate::receive::error::{ReceiverPersistedError, ReceiverReplayError};
19-
use crate::uri::error::PayjoinFeeRateError;
19+
use crate::uri::error::FeeRateError;
2020
use crate::{ClientResponse, OutputSubstitution, Request};
2121

2222
pub mod error;
@@ -366,9 +366,9 @@ impl ReceiverBuilder {
366366
pub fn with_max_fee_rate(
367367
&self,
368368
max_effective_fee_rate_sat_per_vb: u64,
369-
) -> Result<Self, PayjoinFeeRateError> {
369+
) -> Result<Self, FeeRateError> {
370370
let fee_rate = FeeRate::from_sat_per_vb(max_effective_fee_rate_sat_per_vb)
371-
.ok_or_else(|| PayjoinFeeRateError::overflow(max_effective_fee_rate_sat_per_vb))?;
371+
.ok_or_else(|| FeeRateError::overflow(max_effective_fee_rate_sat_per_vb))?;
372372
Ok(Self(self.0.clone().with_max_fee_rate(fee_rate)))
373373
}
374374

payjoin-ffi/src/test_utils.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
use std::io;
22
use std::sync::Arc;
33

4-
use bitcoin_ffi::Psbt;
54
use lazy_static::lazy_static;
65
use payjoin_test_utils::corepc_node::AddressType;
76
use payjoin_test_utils::{
8-
corepc_node, EXAMPLE_URL, INVALID_PSBT, ORIGINAL_PSBT, PARSED_ORIGINAL_PSBT,
9-
PARSED_PAYJOIN_PROPOSAL, PARSED_PAYJOIN_PROPOSAL_WITH_SENDER_INFO, PAYJOIN_PROPOSAL,
7+
corepc_node, EXAMPLE_URL, INVALID_PSBT, ORIGINAL_PSBT, PAYJOIN_PROPOSAL,
108
PAYJOIN_PROPOSAL_WITH_SENDER_INFO, QUERY_PARAMS, RECEIVER_INPUT_CONTRIBUTION,
119
};
1210
use serde_json::Value;
@@ -210,14 +208,3 @@ pub fn payjoin_proposal_with_sender_info() -> String {
210208

211209
#[uniffi::export]
212210
pub fn receiver_input_contribution() -> String { RECEIVER_INPUT_CONTRIBUTION.to_string() }
213-
214-
#[uniffi::export]
215-
pub fn parsed_original_psbt() -> Psbt { PARSED_ORIGINAL_PSBT.clone().into() }
216-
217-
#[uniffi::export]
218-
pub fn parsed_payjoin_proposal() -> Psbt { PARSED_PAYJOIN_PROPOSAL.clone().into() }
219-
220-
#[uniffi::export]
221-
pub fn parsed_payjoin_proposal_with_sender_info() -> Psbt {
222-
PARSED_PAYJOIN_PROPOSAL_WITH_SENDER_INFO.clone().into()
223-
}

payjoin-ffi/src/uri/error.rs

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,13 @@ pub struct UrlParseError(#[from] url::ParseError);
2828
#[error(transparent)]
2929
pub struct IntoUrlError(#[from] payjoin::IntoUrlError);
3030

31-
#[derive(Debug, thiserror::Error, uniffi::Object)]
32-
#[error(transparent)]
33-
pub struct FeeRateError(#[from] bitcoin_ffi::error::FeeRateError);
34-
35-
#[derive(Debug, thiserror::Error, uniffi::Object)]
36-
#[error("{msg}")]
37-
pub struct PayjoinFeeRateError {
38-
msg: String,
39-
}
40-
41-
impl PayjoinFeeRateError {
42-
pub(crate) fn overflow(value_sat_per_vb: u64) -> Self {
43-
Self {
44-
msg: format!(
45-
"Fee rate {value_sat_per_vb} sat/vB exceeds the supported range for this platform"
46-
),
47-
}
48-
}
49-
}
50-
5131
#[derive(Debug, thiserror::Error, uniffi::Object)]
5232
#[error("{msg}")]
53-
pub struct PayjoinFeeRateError {
33+
pub struct FeeRateError {
5434
msg: String,
5535
}
5636

57-
impl PayjoinFeeRateError {
37+
impl FeeRateError {
5838
pub(crate) fn overflow(value_sat_per_vb: u64) -> Self {
5939
Self {
6040
msg: format!(

0 commit comments

Comments
 (0)