Skip to content

Commit

Permalink
Remove unused serialization attributes from transaction status types (s…
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarry authored Jan 3, 2022
1 parent d6ec103 commit ce6c76e
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions transaction-status/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use {
solana_sdk::{
clock::{Slot, UnixTimestamp},
commitment_config::CommitmentConfig,
deserialize_utils::default_on_eof,
instruction::CompiledInstruction,
message::{Message, MessageHeader},
pubkey::Pubkey,
Expand Down Expand Up @@ -122,7 +121,7 @@ pub struct UiInnerInstructions {
pub instructions: Vec<UiInstruction>,
}

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Debug, PartialEq)]
pub struct TransactionTokenBalance {
pub account_index: u8,
pub mint: String,
Expand Down Expand Up @@ -181,22 +180,16 @@ impl From<InnerInstructions> for UiInnerInstructions {
}
}

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[derive(Clone, Debug, PartialEq)]
pub struct TransactionStatusMeta {
pub status: Result<()>,
pub fee: u64,
pub pre_balances: Vec<u64>,
pub post_balances: Vec<u64>,
#[serde(deserialize_with = "default_on_eof")]
pub inner_instructions: Option<Vec<InnerInstructions>>,
#[serde(deserialize_with = "default_on_eof")]
pub log_messages: Option<Vec<String>>,
#[serde(deserialize_with = "default_on_eof")]
pub pre_token_balances: Option<Vec<TransactionTokenBalance>>,
#[serde(deserialize_with = "default_on_eof")]
pub post_token_balances: Option<Vec<TransactionTokenBalance>>,
#[serde(deserialize_with = "default_on_eof")]
pub rewards: Option<Rewards>,
}

Expand Down Expand Up @@ -333,8 +326,7 @@ impl TransactionStatus {
}
}

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[derive(Clone, Debug, PartialEq)]
pub struct ConfirmedTransactionStatusWithSignature {
pub signature: Signature,
pub slot: Slot,
Expand All @@ -355,8 +347,7 @@ pub struct Reward {

pub type Rewards = Vec<Reward>;

#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ConfirmedBlock {
pub previous_blockhash: String,
pub blockhash: String,
Expand Down Expand Up @@ -499,11 +490,9 @@ impl Default for TransactionDetails {
}
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[derive(Debug, Clone, PartialEq)]
pub struct ConfirmedTransaction {
pub slot: Slot,
#[serde(flatten)]
pub transaction: TransactionWithStatusMeta,
pub block_time: Option<UnixTimestamp>,
}
Expand Down Expand Up @@ -561,8 +550,7 @@ pub struct UiParsedMessage {
pub instructions: Vec<UiInstruction>,
}

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[derive(Clone, Debug, PartialEq)]
pub struct TransactionWithStatusMeta {
pub transaction: Transaction,
pub meta: Option<TransactionStatusMeta>,
Expand Down

0 comments on commit ce6c76e

Please sign in to comment.