From ed18ad5632ecf707ffd84f32a91aa766c2a73932 Mon Sep 17 00:00:00 2001 From: Ryan Tan Date: Thu, 14 Nov 2024 21:36:12 +0000 Subject: [PATCH] fix(crypto): expose operation hash as blake2b schema --- crates/jstz_crypto/src/hash.rs | 2 ++ crates/jstz_node/openapi.json | 10 +++++++++- crates/jstz_proto/src/receipt.rs | 1 - 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/jstz_crypto/src/hash.rs b/crates/jstz_crypto/src/hash.rs index 92e8fa707..5c48952ba 100644 --- a/crates/jstz_crypto/src/hash.rs +++ b/crates/jstz_crypto/src/hash.rs @@ -7,6 +7,7 @@ use boa_gc::{empty_trace, Finalize, Trace}; use derive_more::{Display, Error}; use hex::FromHexError; use serde::{Deserialize, Serialize}; +use utoipa::ToSchema; #[derive( Debug, @@ -20,6 +21,7 @@ use serde::{Deserialize, Serialize}; Deserialize, Default, Finalize, + ToSchema, )] pub struct Blake2b([u8; 32]); diff --git a/crates/jstz_node/openapi.json b/crates/jstz_node/openapi.json index 3d053e65c..02d381f6e 100644 --- a/crates/jstz_node/openapi.json +++ b/crates/jstz_node/openapi.json @@ -419,6 +419,14 @@ }, "components": { "schemas": { + "Blake2b": { + "type": "array", + "items": { + "type": "integer", + "format": "int32", + "minimum": 0 + } + }, "Content": { "oneOf": [ { @@ -669,7 +677,7 @@ ], "properties": { "hash": { - "type": "string" + "$ref": "#/components/schemas/Blake2b" }, "result": { "$ref": "#/components/schemas/ReceiptResult" diff --git a/crates/jstz_proto/src/receipt.rs b/crates/jstz_proto/src/receipt.rs index 67cecec6b..c810c1113 100644 --- a/crates/jstz_proto/src/receipt.rs +++ b/crates/jstz_proto/src/receipt.rs @@ -30,7 +30,6 @@ impl From> for ReceiptResult { #[derive(Debug, Clone, Serialize, Deserialize, ToSchema)] pub struct Receipt { - #[schema(value_type = String)] hash: OperationHash, pub result: ReceiptResult, }