@@ -1123,6 +1123,19 @@ impl EventRequest {
1123
1123
}
1124
1124
}
1125
1125
}
1126
+ #[ derive( Debug , Clone , Deserialize , Serialize ) ]
1127
+ pub struct IdRegistryEventByAddressRequest {
1128
+ #[ serde( with = "serdehex" ) ]
1129
+ pub address : Vec < u8 > ,
1130
+ }
1131
+
1132
+ impl IdRegistryEventByAddressRequest {
1133
+ pub fn to_proto ( self ) -> proto:: IdRegistryEventByAddressRequest {
1134
+ proto:: IdRegistryEventByAddressRequest {
1135
+ address : self . address ,
1136
+ }
1137
+ }
1138
+ }
1126
1139
1127
1140
#[ derive( Debug , Clone , Deserialize , Serialize ) ]
1128
1141
pub struct ValidationResult {
@@ -1994,6 +2007,10 @@ pub trait HubHttpService {
1994
2007
) -> Result < OnChainEventResponse , ErrorResponse > ;
1995
2008
async fn get_events ( & self , req : EventsRequest ) -> Result < EventsResponse , ErrorResponse > ;
1996
2009
async fn get_event_by_id ( & self , req : EventRequest ) -> Result < HubEvent , ErrorResponse > ;
2010
+ async fn get_id_registry_on_chain_event_by_address (
2011
+ & self ,
2012
+ req : IdRegistryEventByAddressRequest ,
2013
+ ) -> Result < OnChainEvent , ErrorResponse > ;
1997
2014
}
1998
2015
1999
2016
#[ async_trait]
@@ -2633,6 +2650,22 @@ impl HubHttpService for HubHttpServiceImpl {
2633
2650
response. into_inner ( ) ,
2634
2651
) ?)
2635
2652
}
2653
+ async fn get_id_registry_on_chain_event_by_address (
2654
+ & self ,
2655
+ req : IdRegistryEventByAddressRequest ,
2656
+ ) -> Result < OnChainEvent , ErrorResponse > {
2657
+ let grpc_req = tonic:: Request :: new ( req. to_proto ( ) ) ;
2658
+ let response = self
2659
+ . service
2660
+ . get_id_registry_on_chain_event_by_address ( grpc_req)
2661
+ . await
2662
+ . map_err ( |e| ErrorResponse {
2663
+ error : "Failed to get id registry event" . to_string ( ) ,
2664
+ error_detail : Some ( e. to_string ( ) ) ,
2665
+ } ) ?;
2666
+ let onchain = response. into_inner ( ) ;
2667
+ map_proto_on_chain_event_to_json_on_chain_event ( onchain)
2668
+ }
2636
2669
}
2637
2670
2638
2671
// Router implementation
@@ -2813,6 +2846,17 @@ impl Router {
2813
2846
)
2814
2847
. await
2815
2848
}
2849
+ ( & Method :: GET , "/v1/onChainIdRegistryEventByAddress" ) => {
2850
+ self . handle_request :: < IdRegistryEventByAddressRequest , OnChainEvent , _ > (
2851
+ req,
2852
+ |service, req| {
2853
+ Box :: pin ( async move {
2854
+ service. get_id_registry_on_chain_event_by_address ( req) . await
2855
+ } )
2856
+ } ,
2857
+ )
2858
+ . await
2859
+ }
2816
2860
( & Method :: GET , "/v1/events" ) => {
2817
2861
self . handle_request :: < EventsRequest , EventsResponse , _ > ( req, |service, req| {
2818
2862
Box :: pin ( async move { service. get_events ( req) . await } )
0 commit comments