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;
19
19
use openmina_core:: constants:: constraint_constants;
20
20
use openmina_node_common:: rpc:: RpcSender ;
21
21
use std:: str:: FromStr ;
22
+ use transaction:: GraphQLTransactionStatus ;
22
23
use warp:: { Filter , Rejection , Reply } ;
23
24
24
25
pub mod account;
25
26
pub mod block;
26
27
pub mod constants;
28
+ pub mod transaction;
27
29
pub mod zkapp;
28
30
29
31
#[ derive( Debug , thiserror:: Error ) ]
@@ -236,7 +238,7 @@ impl Query {
236
238
payment : Option < String > ,
237
239
zkapp_transaction : Option < String > ,
238
240
context : & Context ,
239
- ) -> juniper:: FieldResult < String > {
241
+ ) -> juniper:: FieldResult < GraphQLTransactionStatus > {
240
242
if payment. is_some ( ) && zkapp_transaction. is_some ( ) {
241
243
return Err ( Error :: Custom (
242
244
"Cannot provide both payment and zkapp transaction" . to_string ( ) ,
@@ -263,7 +265,8 @@ impl Query {
263
265
. oneshot_request ( RpcRequest :: TransactionStatusGet ( tx) )
264
266
. await
265
267
. ok_or ( Error :: StateMachineEmptyResponse ) ?;
266
- Ok ( res. to_string ( ) )
268
+
269
+ Ok ( GraphQLTransactionStatus :: from ( res) )
267
270
}
268
271
269
272
/// 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