From 4b65ad980dd116cb0bdf7e5fc343769579f688af Mon Sep 17 00:00:00 2001 From: notV4l Date: Fri, 18 Oct 2024 14:58:33 +0200 Subject: [PATCH 1/4] add on_starknet_event --- README.md | 2 +- dojo.h | 16 +++++++++++++ dojo.hpp | 11 +++++++++ dojo.pyx | 14 +++++++++++ src/c/mod.rs | 61 +++++++++++++++++++++++++++++++++++++++++++++- src/c/types.rs | 40 ++++++++++++++++++++++++++++++- src/wasm/mod.rs | 64 ++++++++++++++++++++++++++++++++++++++++++++++--- 7 files changed, 202 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 156e5cd..b99ca31 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ cargo build --release --target x86_64-unknown-linux-gnu # Building wasm32 binary cargo build --release --target wasm32-unknown-unknown # Building using wasm-pack -bunx wasm-pack build --release +cd pkg && bunx wasm-pack build --release ``` ## Running diff --git a/dojo.h b/dojo.h index ce15c79..63a82cd 100644 --- a/dojo.h +++ b/dojo.h @@ -457,6 +457,17 @@ typedef struct Resultbool { }; } Resultbool; +typedef struct Event { + struct CArrayFieldElement keys; + struct CArrayFieldElement data; + struct FieldElement transaction_hash; +} Event; + +typedef struct CArrayEvent { + struct Event *data; + uintptr_t data_len; +} CArrayEvent; + typedef struct IndexerUpdate { int64_t head; int64_t tps; @@ -652,6 +663,11 @@ struct Resultbool client_update_event_message_subscription(struct ToriiClient *c const struct EntityKeysClause *clauses, uintptr_t clauses_len); +struct ResultSubscription client_on_starknet_event(struct ToriiClient *client, + const struct EntityKeysClause *clauses, + uintptr_t clauses_len, + void (*callback)(struct CArrayEvent)); + struct ResultSubscription on_indexer_update(struct ToriiClient *client, const struct FieldElement *contract_address, void (*callback)(struct IndexerUpdate)); diff --git a/dojo.hpp b/dojo.hpp index 1a404ce..056d10b 100644 --- a/dojo.hpp +++ b/dojo.hpp @@ -787,6 +787,12 @@ struct EntityKeysClause { } }; +struct Event { + CArray keys; + CArray data; + FieldElement transaction_hash; +}; + struct IndexerUpdate { int64_t head; int64_t tps; @@ -908,6 +914,11 @@ Result client_update_event_message_subscription(ToriiClient *client, const EntityKeysClause *clauses, uintptr_t clauses_len); +Result client_on_starknet_event(ToriiClient *client, + const EntityKeysClause *clauses, + uintptr_t clauses_len, + void (*callback)(CArray)); + Result on_indexer_update(ToriiClient *client, const FieldElement *contract_address, void (*callback)(IndexerUpdate)); diff --git a/dojo.pyx b/dojo.pyx index fcc9e13..cf0a415 100644 --- a/dojo.pyx +++ b/dojo.pyx @@ -295,6 +295,15 @@ cdef extern from *: bool ok; Error err; + cdef struct Event: + CArrayFieldElement keys; + CArrayFieldElement data; + FieldElement transaction_hash; + + cdef struct CArrayEvent: + Event *data; + uintptr_t data_len; + cdef struct IndexerUpdate: int64_t head; int64_t tps; @@ -416,6 +425,11 @@ cdef extern from *: const EntityKeysClause *clauses, uintptr_t clauses_len); + ResultSubscription client_on_starknet_event(ToriiClient *client, + const EntityKeysClause *clauses, + uintptr_t clauses_len, + void (*callback)(CArrayEvent)); + ResultSubscription on_indexer_update(ToriiClient *client, const FieldElement *contract_address, void (*callback)(IndexerUpdate)); diff --git a/src/c/mod.rs b/src/c/mod.rs index d5e8154..801a62f 100644 --- a/src/c/mod.rs +++ b/src/c/mod.rs @@ -25,7 +25,7 @@ use tokio_stream::StreamExt; use torii_client::client::Client as TClient; use torii_relay::typed_data::TypedData; use torii_relay::types::Message; -use types::{EntityKeysClause, IndexerUpdate, Struct}; +use types::{EntityKeysClause, Event, IndexerUpdate, Struct}; use self::types::{ BlockId, CArray, Call, Entity, Error, Query, Result, Signature, ToriiClient, Ty, WorldMetadata, @@ -291,6 +291,65 @@ pub unsafe extern "C" fn client_update_event_message_subscription( } } +#[no_mangle] +#[allow(clippy::missing_safety_doc)] +pub unsafe extern "C" fn client_on_starknet_event( + client: *mut ToriiClient, + clauses: *const EntityKeysClause, + clauses_len: usize, + callback: unsafe extern "C" fn(CArray), +) -> Result<*mut Subscription> { + let client = Arc::from_raw(client); + let clauses = unsafe { std::slice::from_raw_parts(clauses, clauses_len) }; + let clauses = clauses.iter().map(|c| c.into()).collect::>(); + + let subscription_id = Arc::new(AtomicU64::new(0)); + let (trigger, tripwire) = Tripwire::new(); + + let subscription = Subscription { id: Arc::clone(&subscription_id), trigger }; + + // Spawn a new thread to handle the stream and reconnections + let client_clone = client.clone(); + client.runtime.spawn(async move { + let mut backoff = Duration::from_secs(1); + let max_backoff = Duration::from_secs(60); + + loop { + let rcv = client_clone.inner.on_starknet_event(clauses.clone()).await; + + match rcv { + Ok(rcv) => { + backoff = Duration::from_secs(1); // Reset backoff on successful connection + + let mut rcv = rcv.take_until_if(tripwire.clone()); + + while let Some(Ok(event)) = rcv.next().await { + let events: Vec = + vec![event].into_iter().map(|e| (&e).into()).collect(); + callback(events.into()); + } + } + Err(_) => { + // Check if the tripwire has been triggered before attempting to reconnect + if tripwire.clone().await { + break; // Exit the loop if the subscription has been cancelled + } + } + } + + // If we've reached this point, the stream has ended (possibly due to disconnection) + // We'll try to reconnect after a delay, unless the tripwire has been triggered + if tripwire.clone().await { + break; // Exit the loop if the subscription has been cancelled + } + sleep(backoff).await; + backoff = std::cmp::min(backoff * 2, max_backoff); + } + }); + + Result::Ok(Box::into_raw(Box::new(subscription))) +} + #[no_mangle] #[allow(clippy::missing_safety_doc)] pub unsafe extern "C" fn on_indexer_update( diff --git a/src/c/types.rs b/src/c/types.rs index 136cd24..bedb4b3 100644 --- a/src/c/types.rs +++ b/src/c/types.rs @@ -1,4 +1,4 @@ -use std::ffi::{CStr, CString, c_char}; +use std::ffi::{c_char, CStr, CString}; use starknet::core::utils::get_selector_from_name; use torii_client::client::Client; @@ -1132,3 +1132,41 @@ impl From<&ModelMetadata> for dojo_types::schema::ModelMetadata { } } } + +#[derive(Debug, Clone)] +#[repr(C)] +pub struct Event { + pub keys: CArray, + pub data: CArray, + pub transaction_hash: FieldElement, +} + +impl From<&Event> for torii_grpc::types::Event { + fn from(val: &Event) -> Self { + let keys: Vec = (&val.keys).into(); + let keys = std::mem::ManuallyDrop::new(keys); + + let data: Vec = (&val.data).into(); + let data = std::mem::ManuallyDrop::new(data); + + torii_grpc::types::Event { + keys: keys.iter().map(Into::into).collect(), + data: data.iter().map(Into::into).collect(), + transaction_hash: (&val.transaction_hash).into(), + } + } +} + +impl From<&torii_grpc::types::Event> for Event { + fn from(val: &torii_grpc::types::Event) -> Self { + let keys = val.keys.iter().map(|k| k.into()).collect::>(); + let data = val.data.iter().map(|k| k.into()).collect::>(); + + Event { + keys: keys.into(), + data: data.into(), + transaction_hash: (&val.transaction_hash).into(), + } + } +} + diff --git a/src/wasm/mod.rs b/src/wasm/mod.rs index 4b5f8f3..406b435 100644 --- a/src/wasm/mod.rs +++ b/src/wasm/mod.rs @@ -2,8 +2,8 @@ mod utils; use std::collections::HashMap; use std::str::FromStr; -use std::sync::Arc; use std::sync::atomic::{AtomicU64, Ordering}; +use std::sync::Arc; use std::time::Duration; use cainome::cairo_serde::{self, ByteArray, CairoSerde}; @@ -35,8 +35,8 @@ use crate::utils::watch_tx; mod types; use types::{ - BlockId, Call, Calls, ClientConfig, Entities, Entity, IndexerUpdate, KeysClauses, Model, Query, - Signature, + BlockId, Call, Calls, ClientConfig, Entities, Entity, IndexerUpdate, KeysClause, KeysClauses, + Model, Query, Signature, }; const JSON_COMPAT_SERIALIZER: serde_wasm_bindgen::Serializer = @@ -597,6 +597,64 @@ impl ToriiClient { .map_err(|err| JsValue::from(format!("failed to update subscription: {err}"))) } + #[wasm_bindgen(js_name = onStarknetEvent)] + pub async fn on_starknet_event( + &self, + clauses: KeysClauses, + callback: js_sys::Function, + ) -> Result { + #[cfg(feature = "console-error-panic")] + console_error_panic_hook::set_once(); + + let clauses: Vec<_> = clauses.iter().map(|c| c.into()).collect(); + let subscription_id = Arc::new(AtomicU64::new(0)); + let (trigger, tripwire) = Tripwire::new(); + + let subscription = Subscription { id: Arc::clone(&subscription_id), trigger }; + + // Spawn a new task to handle the stream and reconnections + let client = self.inner.clone(); + wasm_bindgen_futures::spawn_local(async move { + let mut backoff = 1000; + let max_backoff = 60000; + + loop { + let stream = client.on_starknet_event(clauses.clone()).await; + + match stream { + Ok(stream) => { + backoff = 1000; // Reset backoff on successful connection + + let mut stream = stream.take_until_if(tripwire.clone()); + + while let Some(Ok(event)) = stream.next().await { + let _ = callback.call1( + &JsValue::null(), + &event.serialize(&JSON_COMPAT_SERIALIZER).unwrap(), + ); + } + } + Err(_) => { + // Check if the tripwire has been triggered before attempting to reconnect + if tripwire.clone().await { + break; // Exit the loop if the subscription has been cancelled + } + } + } + + // If we've reached this point, the stream has ended (possibly due to disconnection) + // We'll try to reconnect after a delay, unless the tripwire has been triggered + if tripwire.clone().await { + break; // Exit the loop if the subscription has been cancelled + } + gloo_timers::future::TimeoutFuture::new(backoff).await; + backoff = std::cmp::min(backoff * 2, max_backoff); + } + }); + + Ok(subscription) + } + #[wasm_bindgen(js_name = onIndexerUpdated)] pub async fn on_indexer_updated( &self, From dc2d002bd99e04f7cd680b2ada178c2956aeafd5 Mon Sep 17 00:00:00 2001 From: notV4l Date: Thu, 24 Oct 2024 12:55:50 +0200 Subject: [PATCH 2/4] add Tsify for Event --- src/wasm/types.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/wasm/types.rs b/src/wasm/types.rs index 0c18b81..d5cc16c 100644 --- a/src/wasm/types.rs +++ b/src/wasm/types.rs @@ -513,3 +513,13 @@ impl From<&Primitive> for dojo_types::primitive::Primitive { } } } + + +#[derive(Tsify, Serialize, Deserialize, Debug)] +#[tsify(into_wasm_abi, from_wasm_abi)] +pub struct Event { + pub keys: Vec, + pub data: Vec, + pub transaction_hash: String, +} + From f32d08b18758f677da672aeadec4b90edf3da2da Mon Sep 17 00:00:00 2001 From: notV4l Date: Fri, 25 Oct 2024 16:54:28 +0200 Subject: [PATCH 3/4] rebase --- src/c/mod.rs | 29 ++++++++++------------------- src/c/types.rs | 1 - src/types.rs | 4 ++-- src/wasm/mod.rs | 28 +++++++++------------------- src/wasm/types.rs | 4 +--- src/wasm/utils.rs | 2 +- 6 files changed, 23 insertions(+), 45 deletions(-) diff --git a/src/c/mod.rs b/src/c/mod.rs index 801a62f..ee0b8e1 100644 --- a/src/c/mod.rs +++ b/src/c/mod.rs @@ -1,10 +1,10 @@ mod types; -use std::ffi::{CStr, CString, c_void}; +use std::ffi::{c_void, CStr, CString}; use std::ops::Deref; use std::os::raw::c_char; -use std::sync::Arc; use std::sync::atomic::{AtomicU64, Ordering}; +use std::sync::Arc; use std::time::Duration; use cainome::cairo_serde::{self, ByteArray, CairoSerde}; @@ -18,7 +18,7 @@ use starknet::core::utils::get_contract_address; use starknet::providers::jsonrpc::HttpTransport; use starknet::providers::{JsonRpcClient, Provider as _}; use starknet::signers::{LocalWallet, SigningKey, VerifyingKey}; -use starknet_crypto::{Felt, poseidon_hash_many}; +use starknet_crypto::{poseidon_hash_many, Felt}; use stream_cancel::{StreamExt as _, Tripwire}; use tokio::time::sleep; use tokio_stream::StreamExt; @@ -317,29 +317,20 @@ pub unsafe extern "C" fn client_on_starknet_event( loop { let rcv = client_clone.inner.on_starknet_event(clauses.clone()).await; - match rcv { - Ok(rcv) => { - backoff = Duration::from_secs(1); // Reset backoff on successful connection + if let Ok(rcv) = rcv { + backoff = Duration::from_secs(1); // Reset backoff on successful connection - let mut rcv = rcv.take_until_if(tripwire.clone()); + let mut rcv = rcv.take_until_if(tripwire.clone()); - while let Some(Ok(event)) = rcv.next().await { - let events: Vec = - vec![event].into_iter().map(|e| (&e).into()).collect(); - callback(events.into()); - } - } - Err(_) => { - // Check if the tripwire has been triggered before attempting to reconnect - if tripwire.clone().await { - break; // Exit the loop if the subscription has been cancelled - } + while let Some(Ok(event)) = rcv.next().await { + let events: Vec = vec![event].into_iter().map(|e| (&e).into()).collect(); + callback(events.into()); } } // If we've reached this point, the stream has ended (possibly due to disconnection) // We'll try to reconnect after a delay, unless the tripwire has been triggered - if tripwire.clone().await { + if tripwire.clone().now_or_never().unwrap_or_default() { break; // Exit the loop if the subscription has been cancelled } sleep(backoff).await; diff --git a/src/c/types.rs b/src/c/types.rs index bedb4b3..9e5e0c1 100644 --- a/src/c/types.rs +++ b/src/c/types.rs @@ -1169,4 +1169,3 @@ impl From<&torii_grpc::types::Event> for Event { } } } - diff --git a/src/types.rs b/src/types.rs index 5de54d0..320208f 100644 --- a/src/types.rs +++ b/src/types.rs @@ -1,10 +1,10 @@ use std::ffi::c_char; -use std::sync::Arc; use std::sync::atomic::AtomicU64; +use std::sync::Arc; use starknet::accounts::SingleOwnerAccount; -use starknet::providers::JsonRpcClient; use starknet::providers::jsonrpc::HttpTransport; +use starknet::providers::JsonRpcClient; use starknet::signers::LocalWallet; use stream_cancel::Trigger; use torii_client::client::Client; diff --git a/src/wasm/mod.rs b/src/wasm/mod.rs index 406b435..47abbc5 100644 --- a/src/wasm/mod.rs +++ b/src/wasm/mod.rs @@ -619,32 +619,22 @@ impl ToriiClient { let max_backoff = 60000; loop { - let stream = client.on_starknet_event(clauses.clone()).await; - - match stream { - Ok(stream) => { - backoff = 1000; // Reset backoff on successful connection + if let Ok(stream) = client.on_starknet_event(clauses.clone()).await { + backoff = 1000; // Reset backoff on successful connection - let mut stream = stream.take_until_if(tripwire.clone()); + let mut stream = stream.take_until_if(tripwire.clone()); - while let Some(Ok(event)) = stream.next().await { - let _ = callback.call1( - &JsValue::null(), - &event.serialize(&JSON_COMPAT_SERIALIZER).unwrap(), - ); - } - } - Err(_) => { - // Check if the tripwire has been triggered before attempting to reconnect - if tripwire.clone().await { - break; // Exit the loop if the subscription has been cancelled - } + while let Some(Ok(event)) = stream.next().await { + let _ = callback.call1( + &JsValue::null(), + &event.serialize(&JSON_COMPAT_SERIALIZER).unwrap(), + ); } } // If we've reached this point, the stream has ended (possibly due to disconnection) // We'll try to reconnect after a delay, unless the tripwire has been triggered - if tripwire.clone().await { + if tripwire.clone().now_or_never().unwrap_or_default() { break; // Exit the loop if the subscription has been cancelled } gloo_timers::future::TimeoutFuture::new(backoff).await; diff --git a/src/wasm/types.rs b/src/wasm/types.rs index d5cc16c..3ab6b88 100644 --- a/src/wasm/types.rs +++ b/src/wasm/types.rs @@ -8,7 +8,7 @@ use serde_wasm_bindgen::to_value; use starknet::core::types::FunctionCall; use starknet::core::utils::get_selector_from_name; use starknet_crypto::Felt; -use tsify_next::{Tsify, declare}; +use tsify_next::{declare, Tsify}; use wasm_bindgen::prelude::*; use super::utils::parse_ty_as_json_str; @@ -514,7 +514,6 @@ impl From<&Primitive> for dojo_types::primitive::Primitive { } } - #[derive(Tsify, Serialize, Deserialize, Debug)] #[tsify(into_wasm_abi, from_wasm_abi)] pub struct Event { @@ -522,4 +521,3 @@ pub struct Event { pub data: Vec, pub transaction_hash: String, } - diff --git a/src/wasm/utils.rs b/src/wasm/utils.rs index a056554..7654c40 100644 --- a/src/wasm/utils.rs +++ b/src/wasm/utils.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use dojo_types::primitive::Primitive; -use serde_json::{Value, json}; +use serde_json::{json, Value}; use torii_grpc::types::schema::Entity; use wasm_bindgen::JsValue; From 896c2f592f5a19b3f438156360751baf16c5039c Mon Sep 17 00:00:00 2001 From: notV4l Date: Fri, 25 Oct 2024 17:07:11 +0200 Subject: [PATCH 4/4] alpha.18 --- Cargo.lock | 103 +++++++++++++++++++++++------------------------------ Cargo.toml | 14 ++++---- 2 files changed, 51 insertions(+), 66 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 980faee..61fe19f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -161,9 +161,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.91" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" [[package]] name = "arc-swap" @@ -2258,7 +2258,7 @@ dependencies = [ [[package]] name = "dojo-c" -version = "1.0.0-alpha.17" +version = "1.0.0-alpha.18" dependencies = [ "anyhow", "cainome 0.2.3 (git+https://github.com/cartridge-gg/cainome?tag=v0.3.2)", @@ -2292,8 +2292,8 @@ dependencies = [ [[package]] name = "dojo-types" -version = "1.0.0-alpha.17" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.17#e6bab2d0066c3cf1acfc5ee41a27294b5b23697d" +version = "1.0.0-alpha.18" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.18#615e9fdea899d451ac2ad343a71bcebabb6b6cf6" dependencies = [ "cainome 0.2.3 (git+https://github.com/cartridge-gg/cainome?tag=v0.4.1)", "crypto-bigint", @@ -2310,8 +2310,8 @@ dependencies = [ [[package]] name = "dojo-world" -version = "1.0.0-alpha.17" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.17#e6bab2d0066c3cf1acfc5ee41a27294b5b23697d" +version = "1.0.0-alpha.18" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.18#615e9fdea899d451ac2ad343a71bcebabb6b6cf6" dependencies = [ "anyhow", "async-trait", @@ -3898,15 +3898,6 @@ dependencies = [ "serde", ] -[[package]] -name = "hashlink" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" -dependencies = [ - "hashbrown 0.14.5", -] - [[package]] name = "hashlink" version = "0.9.1" @@ -3930,9 +3921,6 @@ name = "heck" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -dependencies = [ - "unicode-segmentation", -] [[package]] name = "heck" @@ -5344,9 +5332,9 @@ dependencies = [ [[package]] name = "libsqlite3-sys" -version = "0.27.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" dependencies = [ "cc", "pkg-config", @@ -7912,6 +7900,9 @@ name = "smallvec" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +dependencies = [ + "serde", +] [[package]] name = "smol_str" @@ -8022,9 +8013,9 @@ dependencies = [ [[package]] name = "sqlx" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa" +checksum = "93334716a037193fac19df402f8571269c84a00852f6a7066b5d2616dcd64d3e" dependencies = [ "sqlx-core", "sqlx-macros", @@ -8035,11 +8026,10 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6" +checksum = "d4d8060b456358185f7d50c55d9b5066ad956956fddec42ee2e8567134a8936e" dependencies = [ - "ahash", "async-io 1.13.0", "async-std", "atoi", @@ -8049,13 +8039,14 @@ dependencies = [ "crc", "crossbeam-queue", "either", - "event-listener 2.5.3", + "event-listener 5.3.1", "futures-channel", "futures-core", "futures-intrusive", "futures-io", "futures-util", - "hashlink 0.8.4", + "hashbrown 0.14.5", + "hashlink", "hex", "indexmap 2.5.0", "log", @@ -8078,27 +8069,27 @@ dependencies = [ [[package]] name = "sqlx-macros" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127" +checksum = "cac0692bcc9de3b073e8d747391827297e075c7710ff6276d9f7a1f3d58c6657" dependencies = [ "proc-macro2", "quote", "sqlx-core", "sqlx-macros-core", - "syn 1.0.109", + "syn 2.0.77", ] [[package]] name = "sqlx-macros-core" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8" +checksum = "1804e8a7c7865599c9c79be146dc8a9fd8cc86935fa641d3ea58e5f0688abaa5" dependencies = [ "async-std", "dotenvy", "either", - "heck 0.4.1", + "heck 0.5.0", "hex", "once_cell", "proc-macro2", @@ -8110,7 +8101,7 @@ dependencies = [ "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", - "syn 1.0.109", + "syn 2.0.77", "tempfile", "tokio", "url", @@ -8118,12 +8109,12 @@ dependencies = [ [[package]] name = "sqlx-mysql" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" +checksum = "64bb4714269afa44aef2755150a0fc19d756fb580a67db8885608cf02f47d06a" dependencies = [ "atoi", - "base64 0.21.7", + "base64 0.22.1", "bitflags 2.6.0", "byteorder", "bytes", @@ -8162,12 +8153,12 @@ dependencies = [ [[package]] name = "sqlx-postgres" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" +checksum = "6fa91a732d854c5d7726349bb4bb879bb9478993ceb764247660aee25f67c2f8" dependencies = [ "atoi", - "base64 0.21.7", + "base64 0.22.1", "bitflags 2.6.0", "byteorder", "chrono", @@ -8202,9 +8193,9 @@ dependencies = [ [[package]] name = "sqlx-sqlite" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa" +checksum = "d5b2cf34a45953bfd3daaf3db0f7a7878ab9b7a6b91b422d24a7a9e4c857b680" dependencies = [ "atoi", "chrono", @@ -8219,10 +8210,10 @@ dependencies = [ "percent-encoding", "regex", "serde", + "serde_urlencoded", "sqlx-core", "tracing", "url", - "urlencoding", "uuid 1.10.0", ] @@ -9178,8 +9169,8 @@ checksum = "ea68304e134ecd095ac6c3574494fc62b909f416c4fca77e440530221e549d3d" [[package]] name = "torii-client" -version = "1.0.0-alpha.17" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.17#e6bab2d0066c3cf1acfc5ee41a27294b5b23697d" +version = "1.0.0-alpha.18" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.18#615e9fdea899d451ac2ad343a71bcebabb6b6cf6" dependencies = [ "async-trait", "crypto-bigint", @@ -9206,8 +9197,8 @@ dependencies = [ [[package]] name = "torii-core" -version = "1.0.0-alpha.17" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.17#e6bab2d0066c3cf1acfc5ee41a27294b5b23697d" +version = "1.0.0-alpha.18" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.18#615e9fdea899d451ac2ad343a71bcebabb6b6cf6" dependencies = [ "anyhow", "async-trait", @@ -9220,7 +9211,7 @@ dependencies = [ "dojo-world", "futures-channel", "futures-util", - "hashlink 0.9.1", + "hashlink", "num-traits 0.2.19", "once_cell", "reqwest 0.12.7", @@ -9239,8 +9230,8 @@ dependencies = [ [[package]] name = "torii-grpc" -version = "1.0.0-alpha.17" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.17#e6bab2d0066c3cf1acfc5ee41a27294b5b23697d" +version = "1.0.0-alpha.18" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.18#615e9fdea899d451ac2ad343a71bcebabb6b6cf6" dependencies = [ "crypto-bigint", "dojo-types", @@ -9278,8 +9269,8 @@ dependencies = [ [[package]] name = "torii-relay" -version = "1.0.0-alpha.17" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.17#e6bab2d0066c3cf1acfc5ee41a27294b5b23697d" +version = "1.0.0-alpha.18" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.18#615e9fdea899d451ac2ad343a71bcebabb6b6cf6" dependencies = [ "anyhow", "cainome 0.2.3 (git+https://github.com/cartridge-gg/cainome?tag=v0.4.1)", @@ -9670,12 +9661,6 @@ dependencies = [ "serde", ] -[[package]] -name = "urlencoding" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" - [[package]] name = "utf8parse" version = "0.2.2" diff --git a/Cargo.toml b/Cargo.toml index 268ab06..6a1b775 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,23 +1,23 @@ [package] edition = "2021" name = "dojo-c" -version = "1.0.0-alpha.17" +version = "1.0.0-alpha.18" [lib] crate-type = ["cdylib", "rlib", "staticlib"] [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -dojo-world = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.17", features = [ +dojo-world = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.18", features = [ "metadata", ] } [dependencies] -dojo-types = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.17" } -torii-client = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.17" } +dojo-types = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.18" } +torii-client = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.18" } torii-grpc = { git = "https://github.com/dojoengine/dojo", features = [ "client", -], tag = "v1.0.0-alpha.17" } -torii-relay = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.17" } +], tag = "v1.0.0-alpha.18" } +torii-relay = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.18" } starknet = "0.11.0" starknet-crypto = "0.7.2" @@ -37,7 +37,7 @@ cainome = { git = "https://github.com/cartridge-gg/cainome", tag = "v0.3.2" } # WASM [target.'cfg(target_arch = "wasm32")'.dependencies] -dojo-world = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.17", features = [ +dojo-world = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.18", features = [ ] } serde-wasm-bindgen = "0.6.3" wasm-bindgen-futures = "0.4.39"