Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo-minimal.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4778,7 +4778,7 @@ dependencies = [
[[package]]
name = "uniffi-dart"
version = "0.1.0+v0.30.0"
source = "git+https://github.com/Uniffi-Dart/uniffi-dart.git?tag=v0.1.0%2Bv0.30.0#e3ed67f780257a5a7fae23231e13d84f931208e0"
source = "git+https://github.com/Uniffi-Dart/uniffi-dart.git?rev=b0157aa#b0157aad7b65f40eac76f6739113063b31df9d40"
dependencies = [
"anyhow",
"camino",
Expand Down Expand Up @@ -4849,7 +4849,7 @@ dependencies = [
[[package]]
name = "uniffi_dart_macro"
version = "0.1.0+v0.30.0"
source = "git+https://github.com/Uniffi-Dart/uniffi-dart.git?tag=v0.1.0%2Bv0.30.0#e3ed67f780257a5a7fae23231e13d84f931208e0"
source = "git+https://github.com/Uniffi-Dart/uniffi-dart.git?rev=b0157aa#b0157aad7b65f40eac76f6739113063b31df9d40"
dependencies = [
"futures",
"proc-macro2",
Expand Down
4 changes: 2 additions & 2 deletions Cargo-recent.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4697,7 +4697,7 @@ dependencies = [
[[package]]
name = "uniffi-dart"
version = "0.1.0+v0.30.0"
source = "git+https://github.com/Uniffi-Dart/uniffi-dart.git?tag=v0.1.0%2Bv0.30.0#e3ed67f780257a5a7fae23231e13d84f931208e0"
source = "git+https://github.com/Uniffi-Dart/uniffi-dart.git?rev=b0157aa#b0157aad7b65f40eac76f6739113063b31df9d40"
dependencies = [
"anyhow",
"camino",
Expand Down Expand Up @@ -4768,7 +4768,7 @@ dependencies = [
[[package]]
name = "uniffi_dart_macro"
version = "0.1.0+v0.30.0"
source = "git+https://github.com/Uniffi-Dart/uniffi-dart.git?tag=v0.1.0%2Bv0.30.0#e3ed67f780257a5a7fae23231e13d84f931208e0"
source = "git+https://github.com/Uniffi-Dart/uniffi-dart.git?rev=b0157aa#b0157aad7b65f40eac76f6739113063b31df9d40"
dependencies = [
"futures",
"proc-macro2",
Expand Down
2 changes: 1 addition & 1 deletion payjoin-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ thiserror = "2.0.14"
tokio = { version = "1.47.1", features = ["full"], optional = true }
uniffi = { version = "0.30.0", features = ["cli"] }
uniffi-bindgen-cs = { git = "https://github.com/chavic/uniffi-bindgen-cs.git", rev = "878a3d269eacce64beadcd336ade0b7c8da09824", optional = true }
uniffi-dart = { git = "https://github.com/Uniffi-Dart/uniffi-dart.git", tag = "v0.1.0+v0.30.0", optional = true }
uniffi-dart = { git = "https://github.com/Uniffi-Dart/uniffi-dart.git", rev = "b0157aa", optional = true }
url = "2.5.4"

# getrandom is ignored here because it's required by the wasm_js feature
Expand Down
2 changes: 2 additions & 0 deletions payjoin-ffi/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::error;
///
/// e.g. database errors, network failures, wallet errors
#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error(transparent)]
pub struct ImplementationError(#[from] payjoin::ImplementationError);

Expand All @@ -18,6 +19,7 @@ impl From<ImplementationError> for payjoin::ImplementationError {
}

#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error("Error de/serializing JSON object: {0}")]
pub struct SerdeJsonError(#[from] serde_json::Error);

Expand Down
1 change: 1 addition & 0 deletions payjoin-ffi/src/ohttp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ pub use error::OhttpError;

pub mod error {
#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error(transparent)]
pub struct OhttpError(#[from] ohttp::Error);
}
Expand Down
9 changes: 9 additions & 0 deletions payjoin-ffi/src/receive/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ impl From<payjoin::bitcoin::address::ParseError> for ReceiverBuilderError {

/// Error parsing a Bitcoin address.
#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error("Invalid Bitcoin address: {msg}")]
pub struct AddressParseError {
msg: String,
Expand All @@ -136,6 +137,7 @@ impl From<payjoin::bitcoin::address::ParseError> for AddressParseError {
/// 4. Provide errors according to BIP-78 JSON error specifications for return
/// after conversion into [`JsonReply`]
#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error(transparent)]
pub struct ProtocolError(#[from] receive::ProtocolError);

Expand All @@ -149,6 +151,7 @@ pub struct ProtocolError(#[from] receive::ProtocolError);
/// }
/// ```
#[derive(Debug, Clone, PartialEq, Eq, uniffi::Object)]
#[uniffi::export(Debug, Eq)]
pub struct JsonReply(receive::JsonReply);

impl From<JsonReply> for receive::JsonReply {
Expand All @@ -165,11 +168,13 @@ impl From<ProtocolError> for JsonReply {

/// Error that may occur during a v2 session typestate change
#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error(transparent)]
pub struct SessionError(#[from] receive::v2::SessionError);

/// Protocol error raised during output substitution.
#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error(transparent)]
pub struct OutputSubstitutionProtocolError(#[from] receive::OutputSubstitutionError);

Expand All @@ -194,16 +199,19 @@ impl From<FfiValidationError> for OutputSubstitutionError {

/// Error that may occur when coin selection fails.
#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error(transparent)]
pub struct SelectionError(#[from] receive::SelectionError);

/// Error that may occur when input contribution fails.
#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error(transparent)]
pub struct InputContributionError(#[from] receive::InputContributionError);

/// Error validating a PSBT Input
#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error(transparent)]
pub struct PsbtInputError(#[from] receive::PsbtInputError);

Expand Down Expand Up @@ -233,6 +241,7 @@ impl From<FfiValidationError> for InputPairError {

/// Error that may occur when a receiver event log is replayed
#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error(transparent)]
pub struct ReceiverReplayError(
#[from] payjoin::error::ReplayError<receive::v2::ReceiveSession, receive::v2::SessionEvent>,
Expand Down
6 changes: 6 additions & 0 deletions payjoin-ffi/src/send/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::error::{FfiValidationError, ImplementationError};
///
/// This error is unrecoverable.
#[derive(Debug, PartialEq, Eq, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display, Eq)]
#[error("Error initializing the sender: {msg}")]
pub struct BuildSenderError {
msg: String,
Expand Down Expand Up @@ -55,16 +56,19 @@ impl From<FfiValidationError> for SenderInputError {
/// `unwrap()`ing it is thus considered OK in Rust but you may achieve nicer message by displaying
/// it.
#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error(transparent)]
pub struct CreateRequestError(#[from] send::v2::CreateRequestError);

/// Error returned for v2-specific payload encapsulation errors.
#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error(transparent)]
pub struct EncapsulationError(#[from] send::v2::EncapsulationError);

/// Error that may occur when the response from receiver is malformed.
#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error(transparent)]
pub struct ValidationError(#[from] send::ValidationError);

Expand Down Expand Up @@ -106,11 +110,13 @@ impl From<send::ResponseError> for ResponseError {

/// A well-known error that can be safely displayed to end users.
#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error(transparent)]
pub struct WellKnownError(#[from] send::WellKnownError);

/// Error that may occur when the sender session event log is replayed
#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error(transparent)]
pub struct SenderReplayError(
#[from] payjoin::error::ReplayError<send::v2::SendSession, send::v2::SessionEvent>,
Expand Down
1 change: 1 addition & 0 deletions payjoin-ffi/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ impl FfiError {
}

#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error(transparent)]
pub struct BoxSendSyncError(#[from] payjoin_test_utils::BoxSendSyncError);

Expand Down
5 changes: 5 additions & 0 deletions payjoin-ffi/src/uri/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#[derive(Debug, PartialEq, Eq, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display, Eq)]
#[error("Error parsing the payjoin URI: {msg}")]
pub struct PjParseError {
msg: String,
Expand All @@ -9,6 +10,7 @@ impl PjParseError {
}

#[derive(Debug, PartialEq, Eq, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display, Eq)]
#[error("URI doesn't support payjoin: {msg}")]
pub struct PjNotSupported {
msg: String,
Expand All @@ -21,14 +23,17 @@ impl PjNotSupported {
}

#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error(transparent)]
pub struct UrlParseError(#[from] url::ParseError);

#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error(transparent)]
pub struct IntoUrlError(#[from] payjoin::IntoUrlError);

#[derive(Debug, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display)]
#[error("{msg}")]
pub struct FeeRateError {
msg: String,
Expand Down
Loading