From 5670b34851dbad4a4af7d6948517d83778ec666d Mon Sep 17 00:00:00 2001 From: Herr Seppia Date: Thu, 12 Sep 2024 09:14:29 +0200 Subject: [PATCH 1/4] node-data: add `is_deploy` and `memo` to transaction serialization --- node-data/src/events/transactions.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/node-data/src/events/transactions.rs b/node-data/src/events/transactions.rs index 1577352341..bf9aac4096 100644 --- a/node-data/src/events/transactions.rs +++ b/node-data/src/events/transactions.rs @@ -134,6 +134,9 @@ impl Serialize for Transaction { call }); state.serialize_field("call", &call)?; + + state.serialize_field("is_deploy", &tx.deploy().is_some())?; + state.serialize_field("memo", &tx.memo().map(hex::encode))?; state.end() } } From 4ccb643b08691b88ddb3c5a9c4e0fd671536df91 Mon Sep 17 00:00:00 2001 From: Herr Seppia Date: Thu, 12 Sep 2024 09:16:46 +0200 Subject: [PATCH 2/4] rusk: GQL - add `is_deploy` and `memo` to transaction --- rusk/src/lib/http/chain/graphql/data.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rusk/src/lib/http/chain/graphql/data.rs b/rusk/src/lib/http/chain/graphql/data.rs index 8c6cbe63f2..fc625bf244 100644 --- a/rusk/src/lib/http/chain/graphql/data.rs +++ b/rusk/src/lib/http/chain/graphql/data.rs @@ -265,6 +265,14 @@ impl Transaction<'_> { data: hex::encode(&call.fn_args), }) } + + pub async fn is_deploy(&self) -> bool { + self.0.inner.deploy().is_some() + } + + pub async fn memo(&self) -> Option { + self.0.inner.memo().map(hex::encode) + } } #[derive(SimpleObject)] From 86e73fdd7c6c6e1e48ec353dc1c0f2549beff754 Mon Sep 17 00:00:00 2001 From: Herr Seppia Date: Thu, 12 Sep 2024 09:17:35 +0200 Subject: [PATCH 3/4] rusk: GQL - add `json` to block header --- rusk/src/lib/http/chain/graphql/data.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rusk/src/lib/http/chain/graphql/data.rs b/rusk/src/lib/http/chain/graphql/data.rs index fc625bf244..ec72da56dd 100644 --- a/rusk/src/lib/http/chain/graphql/data.rs +++ b/rusk/src/lib/http/chain/graphql/data.rs @@ -164,6 +164,10 @@ impl Header<'_> { pub async fn iteration(&self) -> u8 { self.0.iteration } + + pub async fn json(&self) -> String { + serde_json::to_string(self.0).unwrap_or_default() + } } #[Object] From c62a587ff048b8a15ebe3c00cf03869e596eb2fd Mon Sep 17 00:00:00 2001 From: Herr Seppia Date: Thu, 12 Sep 2024 11:21:47 +0200 Subject: [PATCH 4/4] rusk: GQL - add `tx_type` to Transaction --- rusk/src/lib/http/chain/graphql/data.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rusk/src/lib/http/chain/graphql/data.rs b/rusk/src/lib/http/chain/graphql/data.rs index ec72da56dd..9c10ad0391 100644 --- a/rusk/src/lib/http/chain/graphql/data.rs +++ b/rusk/src/lib/http/chain/graphql/data.rs @@ -262,6 +262,14 @@ impl Transaction<'_> { self.0.inner.gas_price() } + pub async fn tx_type(&self) -> String { + match self.0.inner { + execution_core::transfer::Transaction::Phoenix(_) => "Phoenix", + execution_core::transfer::Transaction::Moonlight(_) => "Moonlight", + } + .into() + } + pub async fn call_data(&self) -> Option { self.0.inner.call().map(|call| CallData { contract_id: hex::encode(call.contract),