Skip to content

Commit

Permalink
feat: add block_id field inside the ContractReader
Browse files Browse the repository at this point in the history
  • Loading branch information
glihm committed Dec 15, 2023
1 parent 028fc11 commit 8bba7d3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/rs/src/expand/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ impl CairoContract {
pub struct #reader<P: #snrs_providers::Provider + Sync> {
pub address: #snrs_types::FieldElement,
pub provider: P,
pub block_id: Option<#snrs_types::BlockId>,
}

impl<P: #snrs_providers::Provider + Sync> #reader<P> {
pub fn new(
address: #snrs_types::FieldElement,
provider: P,
) -> Self {
Self { address, provider }
Self { address, provider, block_id: None }
}

pub fn set_contract_address(mut self, address: #snrs_types::FieldElement) {
Expand All @@ -57,6 +58,10 @@ impl CairoContract {
pub fn provider(&self) -> &P {
&self.provider
}

pub fn with_block(self, block_id: #snrs_types::BlockId) -> Self {
Self { block_id: Some(block_id), ..self }
}
}
};

Expand Down

0 comments on commit 8bba7d3

Please sign in to comment.