diff --git a/zcash_client_backend/Cargo.toml b/zcash_client_backend/Cargo.toml index c499cee436..905f528cdb 100644 --- a/zcash_client_backend/Cargo.toml +++ b/zcash_client_backend/Cargo.toml @@ -47,6 +47,7 @@ rand_core.workspace = true base64.workspace = true bech32.workspace = true bs58.workspace = true +serde.workspace = true # - Errors bip32 = { workspace = true, optional = true } @@ -123,7 +124,6 @@ tower = { workspace = true, optional = true } http-body-util = { workspace = true, optional = true } hyper-util = { workspace = true, optional = true } rand = { workspace = true, optional = true } -serde = { workspace = true, optional = true } tokio-rustls = { workspace = true, optional = true } webpki-roots = { workspace = true, optional = true } @@ -186,7 +186,6 @@ tor = [ "dep:hyper-util", "dep:rand", "dep:rust_decimal", - "dep:serde", "dep:serde_json", "dep:tokio", "dep:tokio-rustls", diff --git a/zcash_client_backend/src/fees.rs b/zcash_client_backend/src/fees.rs index fea9424243..e9e2f7fbe6 100644 --- a/zcash_client_backend/src/fees.rs +++ b/zcash_client_backend/src/fees.rs @@ -1,5 +1,6 @@ use std::fmt; +use serde::{Deserialize, Serialize}; use zcash_primitives::{ consensus::{self, BlockHeight}, memo::MemoBytes, @@ -24,10 +25,10 @@ pub mod zip317; /// `ChangeValue` represents either a proposed change output to a shielded pool /// (with an optional change memo), or if the "transparent-inputs" feature is /// enabled, an ephemeral output to the transparent pool. -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct ChangeValue(ChangeValueInner); -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] enum ChangeValueInner { Shielded { protocol: ShieldedProtocol, @@ -114,7 +115,7 @@ impl ChangeValue { /// The amount of change and fees required to make a transaction's inputs and /// outputs balance under a specific fee rule, as computed by a particular /// [`ChangeStrategy`] that is aware of that rule. -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct TransactionBalance { proposed_change: Vec, fee_required: NonNegativeAmount, diff --git a/zcash_client_backend/src/proposal.rs b/zcash_client_backend/src/proposal.rs index 3c06be6c45..45899a7fd8 100644 --- a/zcash_client_backend/src/proposal.rs +++ b/zcash_client_backend/src/proposal.rs @@ -6,6 +6,7 @@ use std::{ }; use nonempty::NonEmpty; +use serde::{Deserialize, Serialize}; use zcash_primitives::{ consensus::BlockHeight, transaction::{components::amount::NonNegativeAmount, TxId}, @@ -330,14 +331,14 @@ impl Debug for Proposal { } /// A reference to either a payment or change output within a step. -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] pub enum StepOutputIndex { Payment(usize), Change(usize), } /// A reference to the output of a step in a proposal. -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] pub struct StepOutput { step_index: usize, output_index: StepOutputIndex, diff --git a/zcash_client_backend/src/wallet.rs b/zcash_client_backend/src/wallet.rs index f3bca04baa..3a04aa200c 100644 --- a/zcash_client_backend/src/wallet.rs +++ b/zcash_client_backend/src/wallet.rs @@ -2,6 +2,7 @@ //! light client. use incrementalmerkletree::Position; +use serde::{Deserialize, Serialize}; use zcash_address::ZcashAddress; use zcash_note_encryption::EphemeralKeyBytes; use zcash_primitives::{ @@ -28,7 +29,7 @@ use crate::fees::orchard as orchard_fees; use zcash_primitives::legacy::keys::{NonHardenedChildIndex, TransparentKeyScope}; /// A unique identifier for a shielded transaction output -#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)] pub struct NoteId { txid: TxId, protocol: ShieldedProtocol,