Skip to content
Open
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
2 changes: 2 additions & 0 deletions .changelog/unreleased/SDK/4937-borsh-sigdata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Enabled borsh serialization for `SigningData`.
([\#4937](https://github.com/namada-net/namada/pull/4937))
24 changes: 19 additions & 5 deletions crates/sdk/src/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Address>,
Expand All @@ -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 {
Expand All @@ -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<SigningTxData>,
Expand Down Expand Up @@ -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),
Expand Down
Loading