File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -19,11 +19,13 @@ use openmina_core::consensus::ConsensusConstants;
1919use openmina_core:: constants:: constraint_constants;
2020use openmina_node_common:: rpc:: RpcSender ;
2121use std:: str:: FromStr ;
22+ use transaction:: GraphQLTransactionStatus ;
2223use warp:: { Filter , Rejection , Reply } ;
2324
2425pub mod account;
2526pub mod block;
2627pub mod constants;
28+ pub mod transaction;
2729pub mod zkapp;
2830
2931#[ derive( Debug , thiserror:: Error ) ]
@@ -236,7 +238,7 @@ impl Query {
236238 payment : Option < String > ,
237239 zkapp_transaction : Option < String > ,
238240 context : & Context ,
239- ) -> juniper:: FieldResult < String > {
241+ ) -> juniper:: FieldResult < GraphQLTransactionStatus > {
240242 if payment. is_some ( ) && zkapp_transaction. is_some ( ) {
241243 return Err ( Error :: Custom (
242244 "Cannot provide both payment and zkapp transaction" . to_string ( ) ,
@@ -263,7 +265,8 @@ impl Query {
263265 . oneshot_request ( RpcRequest :: TransactionStatusGet ( tx) )
264266 . await
265267 . ok_or ( Error :: StateMachineEmptyResponse ) ?;
266- Ok ( res. to_string ( ) )
268+
269+ Ok ( GraphQLTransactionStatus :: from ( res) )
267270 }
268271
269272 /// Retrieve a block with the given state hash or height, if contained in the transition frontier
Original file line number Diff line number Diff line change 1+ use juniper:: GraphQLEnum ;
2+ use node:: rpc:: TransactionStatus ;
3+
4+ #[ derive( Clone , Copy , Debug , GraphQLEnum ) ]
5+ #[ allow( non_camel_case_types) ]
6+ pub enum GraphQLTransactionStatus {
7+ INCLUDED ,
8+ PENDING ,
9+ UNKNOWN ,
10+ }
11+
12+ impl From < TransactionStatus > for GraphQLTransactionStatus {
13+ fn from ( value : TransactionStatus ) -> Self {
14+ match value {
15+ TransactionStatus :: Included => Self :: INCLUDED ,
16+ TransactionStatus :: Pending => Self :: PENDING ,
17+ TransactionStatus :: Unknown => Self :: UNKNOWN ,
18+ }
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments