From a4a5438b6d8343e457c8bfca5bd99e746188fd44 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Fri, 10 Jul 2020 11:04:03 -0700 Subject: [PATCH] Add UiTransactionEncoding::Raw --- transaction-status/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/transaction-status/src/lib.rs b/transaction-status/src/lib.rs index 20635d7615..5eb7c3ba3c 100644 --- a/transaction-status/src/lib.rs +++ b/transaction-status/src/lib.rs @@ -173,9 +173,10 @@ pub struct TransactionWithStatusMeta { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] #[serde(rename_all = "camelCase")] pub enum UiTransactionEncoding { - Binary, + Binary, // base58 encoded raw transaction Json, JsonParsed, + Raw, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] @@ -183,6 +184,7 @@ pub enum UiTransactionEncoding { pub enum EncodedTransaction { Binary(String), Json(UiTransaction), + Raw(Transaction), } impl EncodedTransaction { @@ -191,6 +193,7 @@ impl EncodedTransaction { UiTransactionEncoding::Binary => EncodedTransaction::Binary( bs58::encode(bincode::serialize(&transaction).unwrap()).into_string(), ), + UiTransactionEncoding::Raw => EncodedTransaction::Raw(transaction), _ => { let message = if encoding == UiTransactionEncoding::Json { UiMessage::Raw(UiRawMessage { @@ -247,6 +250,7 @@ impl EncodedTransaction { .into_vec() .ok() .and_then(|bytes| bincode::deserialize(&bytes).ok()), + EncodedTransaction::Raw(transaction) => Some(transaction.clone()), } } }