File tree Expand file tree Collapse file tree 5 files changed +93
-13
lines changed
Expand file tree Collapse file tree 5 files changed +93
-13
lines changed Original file line number Diff line number Diff line change 2222tsconfig.tsbuildinfo
2323
2424# Types generated for .proto files
25- src /generated /*
25+ src /generated /
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ rust_decimal = "1.36.0"
1818base64 = " 0.22.1"
1919prost = " 0.13.5"
2020prost-types = " 0.13.5"
21+ protobuf = " 3.7.2"
2122
2223[dev-dependencies ]
2324bincode = " 1.3.3"
@@ -29,3 +30,4 @@ alloy-primitives = "0.8.19"
2930
3031[build-dependencies ]
3132prost-build = " 0.13.5"
33+ protobuf-codegen = " 3.7.2"
Original file line number Diff line number Diff line change @@ -5,18 +5,15 @@ use std::io::Result;
55/// Both JS and Rust SDKs read the proto files for generating types.
66fn main ( ) -> Result < ( ) > {
77 // Tell cargo to recompile if any .proto files change
8- println ! ( "cargo:rerun-if-changed=proto/" ) ;
8+ println ! ( "cargo:rerun-if-changed=../../ proto/" ) ;
99
10- // Selects proto files to be read for compiling
11- let proto_files = vec ! [
12- "../../proto/pyth_lazer_transaction.proto" ,
13- "../../proto/publisher_update.proto" ,
14- ] ;
15-
16- // Compiles protos and generates Rust types
17- // Generated types are present in the output folder
18- prost_build:: compile_protos ( & proto_files, & [ "../../proto" ] )
19- . expect ( "Failed to compile protos and generate types" ) ;
10+ protobuf_codegen:: Codegen :: new ( )
11+ . pure ( )
12+ . include ( "../../proto" )
13+ . input ( "../../proto/publisher_update.proto" )
14+ . input ( "../../proto/pyth_lazer_transaction.proto" )
15+ . cargo_out_dir ( "protobuf" )
16+ . run_from_script ( ) ;
2017
2118 Ok ( ( ) )
2219}
Original file line number Diff line number Diff line change @@ -10,8 +10,15 @@ mod serde_price_as_i64;
1010mod serde_str;
1111pub mod subscription;
1212pub mod symbol_state;
13+ //pub mod transaction {
14+ // include!(concat!(env!("OUT_DIR"), "/pyth_lazer_transaction.rs"));
15+ //}
1316pub mod transaction {
14- include ! ( concat!( env!( "OUT_DIR" ) , "/pyth_lazer_transaction.rs" ) ) ;
17+ pub use crate :: protobuf:: pyth_lazer_transaction:: * ;
18+ }
19+
20+ mod protobuf {
21+ include ! ( concat!( env!( "OUT_DIR" ) , "/protobuf/mod.rs" ) ) ;
1522}
1623
1724#[ test]
You can’t perform that action at this time.
0 commit comments