diff --git a/Cargo.lock b/Cargo.lock index 76ff52c..89e1e5d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1102,14 +1102,16 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.40" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" dependencies = [ "android-tzdata", "iana-time-zone", + "js-sys", "num-traits", "serde", + "wasm-bindgen", "windows-link", ] @@ -1606,6 +1608,7 @@ dependencies = [ "base64 0.22.1", "cainome 0.2.3", "cbindgen", + "chrono", "crypto-bigint", "directories", "dojo-types", @@ -6648,8 +6651,8 @@ dependencies = [ [[package]] name = "torii-client" -version = "1.5.0-alpha.1" -source = "git+https://github.com/dojoengine/torii?rev=3ae9b23#3ae9b231b17fd22c211317c242555b31b5322c81" +version = "1.5.4" +source = "git+https://github.com/dojoengine/torii?rev=ae0420b#ae0420b1cbf11748724f96f7e509d17392abe095" dependencies = [ "async-trait", "crypto-bigint", @@ -6674,8 +6677,8 @@ dependencies = [ [[package]] name = "torii-grpc-client" -version = "1.5.0-alpha.1" -source = "git+https://github.com/dojoengine/torii?rev=3ae9b23#3ae9b231b17fd22c211317c242555b31b5322c81" +version = "1.5.4" +source = "git+https://github.com/dojoengine/torii?rev=ae0420b#ae0420b1cbf11748724f96f7e509d17392abe095" dependencies = [ "crypto-bigint", "dojo-types", @@ -6700,8 +6703,8 @@ dependencies = [ [[package]] name = "torii-libp2p-client" -version = "1.5.0-alpha.1" -source = "git+https://github.com/dojoengine/torii?rev=3ae9b23#3ae9b231b17fd22c211317c242555b31b5322c81" +version = "1.5.4" +source = "git+https://github.com/dojoengine/torii?rev=ae0420b#ae0420b1cbf11748724f96f7e509d17392abe095" dependencies = [ "anyhow", "futures", @@ -6723,8 +6726,8 @@ dependencies = [ [[package]] name = "torii-libp2p-types" -version = "1.5.0-alpha.1" -source = "git+https://github.com/dojoengine/torii?rev=3ae9b23#3ae9b231b17fd22c211317c242555b31b5322c81" +version = "1.5.4" +source = "git+https://github.com/dojoengine/torii?rev=ae0420b#ae0420b1cbf11748724f96f7e509d17392abe095" dependencies = [ "serde", "starknet 0.12.0", @@ -6733,9 +6736,10 @@ dependencies = [ [[package]] name = "torii-proto" -version = "1.5.0-alpha.1" -source = "git+https://github.com/dojoengine/torii?rev=3ae9b23#3ae9b231b17fd22c211317c242555b31b5322c81" +version = "1.5.4" +source = "git+https://github.com/dojoengine/torii?rev=ae0420b#ae0420b1cbf11748724f96f7e509d17392abe095" dependencies = [ + "chrono", "crypto-bigint", "dojo-types", "dojo-world", @@ -6755,8 +6759,8 @@ dependencies = [ [[package]] name = "torii-typed-data" -version = "1.5.0-alpha.1" -source = "git+https://github.com/dojoengine/torii?rev=3ae9b23#3ae9b231b17fd22c211317c242555b31b5322c81" +version = "1.5.4" +source = "git+https://github.com/dojoengine/torii?rev=ae0420b#ae0420b1cbf11748724f96f7e509d17392abe095" dependencies = [ "cainome 0.5.1", "crypto-bigint", diff --git a/Cargo.toml b/Cargo.toml index b25b5eb..41d9e55 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,11 +9,11 @@ crate-type = ["cdylib", "rlib", "staticlib"] [dependencies] dojo-world = { git = "https://github.com/dojoengine/dojo", rev = "4145801" } dojo-types = { git = "https://github.com/dojoengine/dojo", rev = "4145801" } -torii-proto = { git = "https://github.com/dojoengine/torii", rev = "3ae9b23" } -torii-client = { git = "https://github.com/dojoengine/torii", rev = "3ae9b23" } -torii-grpc-client = { git = "https://github.com/dojoengine/torii", rev = "3ae9b23" } -torii-typed-data = { git = "https://github.com/dojoengine/torii", rev = "3ae9b23" } -torii-libp2p-types = { git = "https://github.com/dojoengine/torii", rev = "3ae9b23" } +torii-proto = { git = "https://github.com/dojoengine/torii", rev = "ae0420b" } +torii-client = { git = "https://github.com/dojoengine/torii", rev = "ae0420b" } +torii-grpc-client = { git = "https://github.com/dojoengine/torii", rev = "ae0420b" } +torii-typed-data = { git = "https://github.com/dojoengine/torii", rev = "ae0420b" } +torii-libp2p-types = { git = "https://github.com/dojoengine/torii", rev = "ae0420b" } starknet = "0.13.0" starknet-crypto = "0.7.2" @@ -50,6 +50,7 @@ instant = { version = "0.1.13", features = ["wasm-bindgen"] } gloo-timers = { version = "0.3.0", features = ["futures"] } num-bigint = "0.4.6" num-traits = "0.2.19" +chrono = "0.4.41" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] axum = "0.8.1" @@ -71,4 +72,4 @@ base64 = "0.22.1" cbindgen = { git = "https://github.com/masnagam/cbindgen", branch = "fix-issue-43" } [patch.crates-io] -crunchy = { git = "https://github.com/nmathewson/crunchy", branch = "cross-compilation-fix" } \ No newline at end of file +crunchy = { git = "https://github.com/nmathewson/crunchy", branch = "cross-compilation-fix" } diff --git a/dojo.h b/dojo.h index b0d971c..fd0634b 100644 --- a/dojo.h +++ b/dojo.h @@ -696,6 +696,11 @@ typedef struct Controller { typedef struct Entity { struct FieldElement hashed_keys; struct CArrayStruct models; + const char *event_id; + uint64_t executed_at_timestamp; + uint64_t created_at_timestamp; + uint64_t updated_at_timestamp; + bool is_deleted; } Entity; typedef struct OrderBy { diff --git a/dojo.hpp b/dojo.hpp index 4bebd10..c7f501f 100644 --- a/dojo.hpp +++ b/dojo.hpp @@ -129,6 +129,11 @@ struct Struct { struct Entity { FieldElement hashed_keys; CArray models; + const char *event_id; + uint64_t executed_at_timestamp; + uint64_t created_at_timestamp; + uint64_t updated_at_timestamp; + bool is_deleted; }; template diff --git a/dojo.pyx b/dojo.pyx index 22012c4..1a8c3d1 100644 --- a/dojo.pyx +++ b/dojo.pyx @@ -438,6 +438,11 @@ cdef extern from *: cdef struct Entity: FieldElement hashed_keys; CArrayStruct models; + const char *event_id; + uint64_t executed_at_timestamp; + uint64_t created_at_timestamp; + uint64_t updated_at_timestamp; + bool is_deleted; cdef struct OrderBy: const char *model; diff --git a/src/c/types.rs b/src/c/types.rs index 2e397bc..b056b16 100644 --- a/src/c/types.rs +++ b/src/c/types.rs @@ -1,4 +1,4 @@ -use std::ffi::{c_char, CStr, CString}; +use std::ffi::{CStr, CString, c_char}; use crypto_bigint::Encoding; use starknet::core::utils::get_selector_from_name; @@ -678,6 +678,11 @@ pub enum ValueType { pub struct Entity { pub hashed_keys: FieldElement, pub models: CArray, + pub event_id: *const c_char, + pub executed_at_timestamp: u64, + pub created_at_timestamp: u64, + pub updated_at_timestamp: u64, + pub is_deleted: bool, } impl From for torii_proto::schema::Entity { @@ -685,7 +690,15 @@ impl From for torii_proto::schema::Entity { let models: Vec = val.models.into(); let models = models.into_iter().map(|m| m.into()).collect(); - torii_proto::schema::Entity { hashed_keys: val.hashed_keys.into(), models } + torii_proto::schema::Entity { + hashed_keys: val.hashed_keys.into(), + models, + event_id: unsafe { CStr::from_ptr(val.event_id).to_string_lossy().to_string() }, + executed_at: val.executed_at_timestamp, + created_at: val.created_at_timestamp, + updated_at: val.updated_at_timestamp, + is_deleted: val.is_deleted, + } } } @@ -693,7 +706,15 @@ impl From for Entity { fn from(val: torii_proto::schema::Entity) -> Self { let models = val.models.into_iter().map(|m| m.into()).collect::>(); - Entity { hashed_keys: val.hashed_keys.into(), models: models.into() } + Entity { + hashed_keys: val.hashed_keys.into(), + models: models.into(), + event_id: CString::new(val.event_id.clone()).unwrap().into_raw(), + executed_at_timestamp: val.executed_at.timestamp() as u64, + created_at_timestamp: val.created_at.timestamp() as u64, + updated_at_timestamp: val.updated_at.timestamp() as u64, + is_deleted: val.is_deleted, + } } }