Skip to content

Commit

Permalink
Derive Debug Clone on send,receive mod types (#376)
Browse files Browse the repository at this point in the history
These trait implementations make a hygienic Rust API, and some are
needed for downstream bindings (V1Context Clone specifically)
  • Loading branch information
spacebear21 authored Oct 24, 2024
2 parents f70619b + 6ede81e commit 5b0b587
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions payjoin/src/receive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ impl UncheckedProposal {
/// Typestate to validate that the Original PSBT has no receiver-owned inputs.
///
/// Call [`Self::check_inputs_not_owned`] to proceed.
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct MaybeInputsOwned {
psbt: Psbt,
params: Params,
Expand Down Expand Up @@ -212,7 +212,7 @@ impl MaybeInputsOwned {
/// Typestate to validate that the Original PSBT has no inputs that have been seen before.
///
/// Call [`Self::check_no_inputs_seen_before`] to proceed.
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct MaybeInputsSeen {
psbt: Psbt,
params: Params,
Expand Down Expand Up @@ -246,7 +246,7 @@ impl MaybeInputsSeen {
///
/// Only accept PSBTs that send us money.
/// Identify those outputs with [`Self::identify_receiver_outputs`] to proceed.
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct OutputsUnknown {
psbt: Psbt,
params: Params,
Expand Down Expand Up @@ -864,7 +864,7 @@ impl ProvisionalProposal {

/// A finalized payjoin proposal, complete with fees and receiver signatures, that the sender
/// should find acceptable.
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct PayjoinProposal {
payjoin_psbt: Psbt,
params: Params,
Expand Down
6 changes: 3 additions & 3 deletions payjoin/src/receive/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ impl UncheckedProposal {
/// Typestate to validate that the Original PSBT has no receiver-owned inputs.
///
/// Call [`check_no_receiver_owned_inputs()`](struct.UncheckedProposal.html#method.check_no_receiver_owned_inputs) to proceed.
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct MaybeInputsOwned {
inner: super::MaybeInputsOwned,
context: SessionContext,
Expand All @@ -283,7 +283,7 @@ impl MaybeInputsOwned {
/// Typestate to validate that the Original PSBT has no inputs that have been seen before.
///
/// Call [`check_no_inputs_seen`](struct.MaybeInputsSeen.html#method.check_no_inputs_seen_before) to proceed.
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct MaybeInputsSeen {
inner: super::MaybeInputsSeen,
context: SessionContext,
Expand All @@ -306,7 +306,7 @@ impl MaybeInputsSeen {
///
/// Only accept PSBTs that send us money.
/// Identify those outputs with `identify_receiver_outputs()` to proceed
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct OutputsUnknown {
inner: super::OutputsUnknown,
context: SessionContext,
Expand Down
3 changes: 3 additions & 0 deletions payjoin/src/send/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ pub enum Context {
V2(V2PostContext),
}

#[derive(Debug, Clone)]
pub struct V1Context {
psbt_context: PsbtContext,
}
Expand Down Expand Up @@ -418,6 +419,7 @@ impl V2PostContext {
}

#[cfg(feature = "v2")]
#[derive(Debug, Clone)]
pub struct V2GetContext {
endpoint: Url,
psbt_ctx: PsbtContext,
Expand Down Expand Up @@ -491,6 +493,7 @@ pub struct PsbtContext {
}

#[cfg(feature = "v2")]
#[derive(Debug, Clone)]
struct HpkeContext {
receiver: HpkePublicKey,
reply_pair: HpkeKeyPair,
Expand Down

0 comments on commit 5b0b587

Please sign in to comment.