@@ -14,6 +14,37 @@ use regex::RegexBuilder;
1414const DERIVE_EQ_HASH : & str = "#[derive(Eq, Hash)]" ;
1515const SERVICES_FOLDER : & str = "./services/hapi/hedera-protobuf-java-api/src/main/proto/services" ;
1616
17+ // Recursively find all .proto files, excluding state/ and auxiliary/ subdirectories
18+ fn find_proto_files ( dir : & Path ) -> anyhow:: Result < Vec < std:: path:: PathBuf > > {
19+ let mut files = Vec :: new ( ) ;
20+ for entry in read_dir ( dir) ? {
21+ let entry = entry?;
22+ let path = entry. path ( ) ;
23+
24+ // Skip state/ directory (internal node state, not for SDK)
25+ // Include auxiliary/tss/ but skip other auxiliary/ subdirectories
26+ if path. is_dir ( ) {
27+ let dir_name = path. file_name ( ) . and_then ( |n| n. to_str ( ) ) . unwrap_or ( "" ) ;
28+
29+ if dir_name == "state" {
30+ continue ; // Skip state directory entirely
31+ } else if dir_name == "auxiliary" {
32+ // Only include auxiliary/tss files
33+ let tss_path = path. join ( "tss" ) ;
34+ if tss_path. is_dir ( ) {
35+ files. extend ( find_proto_files ( & tss_path) ?) ;
36+ }
37+ continue ;
38+ }
39+
40+ files. extend ( find_proto_files ( & path) ?) ;
41+ } else if path. extension ( ) . and_then ( |s| s. to_str ( ) ) == Some ( "proto" ) {
42+ files. push ( path) ;
43+ }
44+ }
45+ Ok ( files)
46+ }
47+
1748fn main ( ) -> anyhow:: Result < ( ) > {
1849 // services is the "base" module for the hedera protobufs
1950 // in the beginning, there was only services and it was named "protos"
@@ -46,14 +77,7 @@ fn main() -> anyhow::Result<()> {
4677 ) ?;
4778 fs:: rename ( out_path. join ( "services" ) , & services_tmp_path) ?;
4879
49- let services: Vec < _ > = read_dir ( & services_tmp_path) ?
50- . chain ( read_dir ( & services_tmp_path. join ( "auxiliary" ) . join ( "tss" ) ) ?)
51- . filter_map ( |entry| {
52- let entry = entry. ok ( ) ?;
53-
54- entry. file_type ( ) . ok ( ) ?. is_file ( ) . then ( || entry. path ( ) )
55- } )
56- . collect ( ) ;
80+ let services = find_proto_files ( & services_tmp_path) ?;
5781
5882 // iterate through each file
5983 let re_package = RegexBuilder :: new ( r"^package (.*);$" ) . multi_line ( true ) . build ( ) ?;
@@ -67,6 +91,7 @@ fn main() -> anyhow::Result<()> {
6791 let contents = contents. replace ( "com.hedera.hapi.services.auxiliary.history." , "" ) ;
6892 let contents = contents. replace ( "com.hedera.hapi.services.auxiliary.tss." , "" ) ;
6993 let contents = contents. replace ( "com.hedera.hapi.platform.event." , "" ) ;
94+ let contents = contents. replace ( "com.hedera.hapi.node.hooks." , "" ) ;
7095
7196 let contents = remove_unused_types ( & contents) ;
7297
@@ -93,7 +118,6 @@ fn main() -> anyhow::Result<()> {
93118 . type_attribute ( "proto.ContractID.contract" , DERIVE_EQ_HASH )
94119 . type_attribute ( "proto.TransactionID" , DERIVE_EQ_HASH )
95120 . type_attribute ( "proto.Timestamp" , DERIVE_EQ_HASH )
96- . type_attribute ( "proto.NftTransfer" , DERIVE_EQ_HASH )
97121 . type_attribute ( "proto.Fraction" , DERIVE_EQ_HASH )
98122 . type_attribute ( "proto.TopicID" , DERIVE_EQ_HASH )
99123 . type_attribute ( "proto.TokenID" , DERIVE_EQ_HASH )
@@ -112,7 +136,14 @@ fn main() -> anyhow::Result<()> {
112136 . type_attribute ( "proto.TokenAllowance" , DERIVE_EQ_HASH )
113137 . type_attribute ( "proto.GrantedCryptoAllowance" , DERIVE_EQ_HASH )
114138 . type_attribute ( "proto.GrantedTokenAllowance" , DERIVE_EQ_HASH )
115- . type_attribute ( "proto.Duration" , DERIVE_EQ_HASH ) ;
139+ . type_attribute ( "proto.Duration" , DERIVE_EQ_HASH )
140+ . type_attribute ( "proto.HookCall" , DERIVE_EQ_HASH )
141+ . type_attribute ( "proto.HookCall.call_spec" , DERIVE_EQ_HASH )
142+ . type_attribute ( "proto.HookCall.id" , DERIVE_EQ_HASH )
143+ . type_attribute ( "proto.HookId" , DERIVE_EQ_HASH )
144+ . type_attribute ( "proto.HookEntityId" , DERIVE_EQ_HASH )
145+ . type_attribute ( "proto.HookEntityId.entity_id" , DERIVE_EQ_HASH )
146+ . type_attribute ( "proto.EvmHookCall" , DERIVE_EQ_HASH ) ;
116147
117148 // the ResponseCodeEnum should be marked as #[non_exhaustive] so
118149 // adding variants does not trigger a breaking change
0 commit comments