Skip to content

Commit

Permalink
refactotr: dont use modelr eader block
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkooo committed Nov 14, 2024
1 parent cea8102 commit 155033d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions crates/torii/core/src/processors/register_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use async_trait::async_trait;
use dojo_world::contracts::abigen::world::Event as WorldEvent;
use dojo_world::contracts::model::ModelReader;
use dojo_world::contracts::world::WorldContractReader;
use starknet::core::types::{BlockId, Event};
use starknet::core::types::Event;
use starknet::providers::Provider;
use tracing::{debug, info};

Expand Down Expand Up @@ -34,7 +34,7 @@ where
&self,
world: &WorldContractReader<P>,
db: &mut Sql,
block_number: u64,
_block_number: u64,
block_timestamp: u64,
_event_id: &str,
event: &Event,
Expand All @@ -60,8 +60,7 @@ where

// Called model here by language, but it's an event. Torii rework will make clear
// distinction.
let model =
world.model_reader_with_block(&namespace, &name, BlockId::Number(block_number)).await?;
let model = world.model_reader(&namespace, &name).await?;
let schema = model.schema().await?;
let layout = model.layout().await?;

Expand Down
7 changes: 3 additions & 4 deletions crates/torii/core/src/processors/register_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use async_trait::async_trait;
use dojo_world::contracts::abigen::world::Event as WorldEvent;
use dojo_world::contracts::model::ModelReader;
use dojo_world::contracts::world::WorldContractReader;
use starknet::core::types::{BlockId, Event};
use starknet::core::types::Event;
use starknet::providers::Provider;
use tracing::{debug, info};

Expand Down Expand Up @@ -34,7 +34,7 @@ where
&self,
world: &WorldContractReader<P>,
db: &mut Sql,
block_number: u64,
_block_number: u64,
block_timestamp: u64,
_event_id: &str,
event: &Event,
Expand All @@ -58,8 +58,7 @@ where
let namespace = event.namespace.to_string().unwrap();
let name = event.name.to_string().unwrap();

let model =
world.model_reader_with_block(&namespace, &name, BlockId::Number(block_number)).await?;
let model = world.model_reader(&namespace, &name).await?;
let schema = model.schema().await?;
let layout = model.layout().await?;

Expand Down

0 comments on commit 155033d

Please sign in to comment.