Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
kariy committed Sep 19, 2023
1 parent 65a6a4c commit 2be9b58
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions crates/torii/client/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@ pub struct Client {
pub(crate) subscription_client_handle: SubscriptionClientHandle,
}

// TODO: able to handle entities that has not been set yet, currently `build` will panic if the
// `entities_to_sync` has never been set (the sql table isnt exist)
pub struct ClientBuilder {
initial_entities_to_sync: Option<Vec<EntityComponent>>,
}

impl ClientBuilder {
pub fn new() -> Self {
Self { initial_entities_to_sync: None }
}

#[must_use]
pub async fn build(self, endpoint: String, world: FieldElement) -> Result<Client, Error> {
let mut grpc_client = torii_grpc::client::WorldClient::new(endpoint, world).await?;
Expand Down Expand Up @@ -111,18 +117,16 @@ impl ClientBuilder {
// async fn main() {
// let world = felt!("0x223b959926c92e10a5de78a76871fa40cefafbdce789137843df7c7b30e3e0");

// let client = super::Client::build(
// "http://localhost:50051".to_string(),
// world,
// vec![EntityComponent {
// let client = super::ClientBuilder::new()
// .set_entities_to_sync(vec![EntityComponent {
// component: "Position".into(),
// keys: vec![felt!(
// "0x517ececd29116499f4a1b64b094da79ba08dfd54a3edaa316134c41f8160973"
// )],
// }],
// )
// .await
// .unwrap();
// }])
// .build("http://localhost:50051".to_string(), world)
// .await
// .unwrap();

// future::pending::<()>().await;
// }
Expand Down

0 comments on commit 2be9b58

Please sign in to comment.