Skip to content

Commit

Permalink
chore: move nonce manager struct near the impl block
Browse files Browse the repository at this point in the history
  • Loading branch information
ArniStarkware committed Nov 14, 2024
1 parent 4616027 commit 61ad4b1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/starknet_api/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ pub mod declare;
pub mod deploy_account;
pub mod invoke;

#[derive(Debug, Default)]
pub struct NonceManager {
next_nonce: HashMap<ContractAddress, Felt>,
}

/// Reads from the directory containing the manifest at run time, same as current working directory.
pub fn read_json_file(path_in_resource_dir: &str) -> serde_json::Value {
let path = Path::new(&env::var("CARGO_MANIFEST_DIR").unwrap())
Expand All @@ -26,6 +21,11 @@ pub fn read_json_file(path_in_resource_dir: &str) -> serde_json::Value {
serde_json::from_str(&json_str).unwrap()
}

#[derive(Debug, Default)]
pub struct NonceManager {
next_nonce: HashMap<ContractAddress, Felt>,
}

impl NonceManager {
pub fn next(&mut self, account_address: ContractAddress) -> Nonce {
let next = self.next_nonce.remove(&account_address).unwrap_or_default();
Expand Down

0 comments on commit 61ad4b1

Please sign in to comment.