diff --git a/.changelog/unreleased/SDK/4937-borsh-sigdata.md b/.changelog/unreleased/SDK/4937-borsh-sigdata.md new file mode 100644 index 0000000000..cd32d39d6e --- /dev/null +++ b/.changelog/unreleased/SDK/4937-borsh-sigdata.md @@ -0,0 +1,2 @@ +- Enabled borsh serialization for `SigningData`. + ([\#4937](https://github.com/namada-net/namada/pull/4937)) \ No newline at end of file diff --git a/crates/sdk/src/signing.rs b/crates/sdk/src/signing.rs index f8ca8722fb..ed69d29d37 100644 --- a/crates/sdk/src/signing.rs +++ b/crates/sdk/src/signing.rs @@ -5,7 +5,7 @@ use std::collections::BTreeMap; use std::fmt::Display; -use borsh::BorshDeserialize; +use borsh::{BorshDeserialize, BorshSerialize}; use data_encoding::HEXLOWER; use itertools::Itertools; use masp_primitives::asset_type::AssetType; @@ -67,7 +67,15 @@ use crate::wallet::{Wallet, WalletIo}; use crate::{Namada, args, rpc}; /// A structure holding the signing data to craft a transaction -#[derive(Clone, Debug, PartialEq)] +#[derive( + Clone, + Debug, + PartialEq, + Serialize, + Deserialize, + BorshSerialize, + BorshDeserialize, +)] pub struct SigningTxData { /// The address owning the transaction pub owner: Option
, @@ -84,7 +92,9 @@ pub struct SigningTxData { } /// The fee's authorization -#[derive(Clone, Debug)] +#[derive( + Clone, Debug, Serialize, Deserialize, BorshSerialize, BorshDeserialize, +)] pub enum FeeAuthorization { /// A wrapper signer Signer { @@ -98,7 +108,9 @@ pub enum FeeAuthorization { } /// A structure holding the signing data for a wrapper transaction -#[derive(Clone, Debug)] +#[derive( + Clone, Debug, Serialize, Deserialize, BorshSerialize, BorshDeserialize, +)] pub struct SigningWrapperData { /// The signing data for each one of the inner transactions of this batch pub signing_data: Vec, @@ -131,7 +143,9 @@ impl SigningWrapperData { } #[allow(missing_docs)] -#[derive(Clone, Debug)] +#[derive( + Clone, Debug, Serialize, Deserialize, BorshSerialize, BorshDeserialize, +)] pub enum SigningData { Inner(SigningTxData), Wrapper(SigningWrapperData),