Skip to content

Commit

Permalink
fix: restore with_block to initialize a contract and a reader (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
glihm authored May 16, 2024
1 parent bc708fb commit ec18eea
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions crates/rs/src/expand/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl CairoContract {
Self { address, account, block_id: #snrs_types::BlockId::Tag(#snrs_types::BlockTag::Pending) }
}

pub fn set_contract_address(mut self, address: #snrs_types::FieldElement) {
pub fn set_contract_address(&mut self, address: #snrs_types::FieldElement) {
self.address = address;
}

Expand All @@ -39,6 +39,10 @@ impl CairoContract {
pub fn set_block(&mut self, block_id: #snrs_types::BlockId) {
self.block_id = block_id;
}

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

#[derive(Debug)]
Expand All @@ -56,7 +60,7 @@ impl CairoContract {
Self { address, provider, block_id: #snrs_types::BlockId::Tag(#snrs_types::BlockTag::Pending) }
}

pub fn set_contract_address(mut self, address: #snrs_types::FieldElement) {
pub fn set_contract_address(&mut self, address: #snrs_types::FieldElement) {
self.address = address;
}

Expand All @@ -67,6 +71,10 @@ impl CairoContract {
pub fn set_block(&mut self, block_id: #snrs_types::BlockId) {
self.block_id = block_id;
}

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

Expand Down

0 comments on commit ec18eea

Please sign in to comment.