Skip to content

Commit

Permalink
chore: make mods singular (#687)
Browse files Browse the repository at this point in the history
* chore: renamed mods to singular form
  • Loading branch information
SantiagoPittella authored Jan 23, 2025
1 parent 4383beb commit ac52aaa
Show file tree
Hide file tree
Showing 78 changed files with 114 additions and 117 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* Added per transaction prover support to the web client (#674).
* [BREAKING] Added `BlockNumber` structure (#677).
* Created functions for creating standard notes and note scripts easily on the web client (#686).
* [BREAKING] Renamed plural modules to singular (#687).

### Fixes

Expand Down
2 changes: 1 addition & 1 deletion bin/miden-cli/src/commands/account.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use clap::Parser;
use miden_client::{
accounts::{Account, AccountId, AccountType, StorageSlot},
account::{Account, AccountId, AccountType, StorageSlot},
assets::Asset,
crypto::FeltRng,
Client, ZERO,
Expand Down
2 changes: 1 addition & 1 deletion bin/miden-cli/src/commands/export.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{fs::File, io::Write, path::PathBuf};

use miden_client::{
accounts::AccountData, crypto::FeltRng, store::NoteExportType, utils::Serializable, Client,
account::AccountData, crypto::FeltRng, store::NoteExportType, utils::Serializable, Client,
};
use tracing::info;

Expand Down
4 changes: 2 additions & 2 deletions bin/miden-cli/src/commands/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use std::{
};

use miden_client::{
accounts::{AccountData, AccountId},
account::{AccountData, AccountId},
crypto::FeltRng,
notes::NoteFile,
note::NoteFile,
utils::Deserializable,
Client, ClientError,
};
Expand Down
2 changes: 1 addition & 1 deletion bin/miden-cli/src/commands/new_account.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use clap::{Parser, ValueEnum};
use miden_client::{
accounts::{
account::{
AccountBuilder, AccountStorageMode, AccountType, BasicFungibleFaucetComponent,
BasicWalletComponent, RpoFalcon512Component,
},
Expand Down
8 changes: 3 additions & 5 deletions bin/miden-cli/src/commands/new_transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ use std::{io, sync::Arc};

use clap::{Parser, ValueEnum};
use miden_client::{
accounts::AccountId,
account::AccountId,
assets::{FungibleAsset, NonFungibleDeltaAction},
crypto::{Digest, FeltRng},
notes::{
build_swap_tag, get_input_note_with_id_prefix, BlockNumber, NoteType as MidenNoteType,
},
transactions::{
note::{build_swap_tag, get_input_note_with_id_prefix, BlockNumber, NoteType as MidenNoteType},
transaction::{
PaymentTransactionData, SwapTransactionData, TransactionRequest, TransactionRequestBuilder,
TransactionResult,
},
Expand Down
10 changes: 5 additions & 5 deletions bin/miden-cli/src/commands/notes.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use clap::ValueEnum;
use comfy_table::{presets, Attribute, Cell, ContentArrangement, Table};
use miden_client::{
accounts::AccountId,
account::AccountId,
assets::Asset,
crypto::{Digest, FeltRng},
notes::{
note::{
get_input_note_with_id_prefix,
script_roots::{P2ID, P2IDR, SWAP},
NoteConsumability, NoteInputs, NoteMetadata,
Expand Down Expand Up @@ -312,9 +312,9 @@ where
fn note_record_type(note_record_metadata: Option<&NoteMetadata>) -> String {
match note_record_metadata {
Some(metadata) => match metadata.note_type() {
miden_client::notes::NoteType::Private => "Private",
miden_client::notes::NoteType::Encrypted => "Encrypted",
miden_client::notes::NoteType::Public => "Public",
miden_client::note::NoteType::Private => "Private",
miden_client::note::NoteType::Encrypted => "Encrypted",
miden_client::note::NoteType::Public => "Public",
},
None => "-",
}
Expand Down
2 changes: 1 addition & 1 deletion bin/miden-cli/src/commands/tags.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use miden_client::{
crypto::FeltRng,
notes::{NoteExecutionMode, NoteTag},
note::{NoteExecutionMode, NoteTag},
Client,
};
use tracing::info;
Expand Down
2 changes: 1 addition & 1 deletion bin/miden-cli/src/commands/transactions.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use miden_client::{
crypto::FeltRng, store::TransactionFilter, transactions::TransactionRecord, Client,
crypto::FeltRng, store::TransactionFilter, transaction::TransactionRecord, Client,
};

use crate::{create_dynamic_table, Parser};
Expand Down
2 changes: 1 addition & 1 deletion bin/miden-cli/src/faucet_details_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
path::PathBuf,
};

use miden_client::{accounts::AccountId, assets::FungibleAsset};
use miden_client::{account::AccountId, assets::FungibleAsset};
use miden_lib::account::faucets::BasicFungibleFaucet;
use serde::{Deserialize, Serialize};

Expand Down
2 changes: 1 addition & 1 deletion bin/miden-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{env, sync::Arc};
use clap::Parser;
use comfy_table::{presets, Attribute, Cell, ContentArrangement, Table};
use miden_client::{
accounts::AccountHeader,
account::AccountHeader,
crypto::{FeltRng, RpoRandomCoin},
rpc::TonicRpcClient,
store::{
Expand Down
6 changes: 3 additions & 3 deletions bin/miden-cli/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ use assert_cmd::Command;
use config::RpcConfig;
use miden_client::{
self,
accounts::{
account::{
AccountBuilder, AccountId, AccountStorageMode, AccountType, BasicWalletComponent,
RpoFalcon512Component,
},
auth::AuthSecretKey,
crypto::{FeltRng, RpoRandomCoin, SecretKey},
notes::{
note::{
Note, NoteAssets, NoteExecutionHint, NoteExecutionMode, NoteFile, NoteInputs, NoteMetadata,
NoteRecipient, NoteTag, NoteType,
},
rpc::TonicRpcClient,
store::{sqlite_store::SqliteStore, NoteFilter, StoreAuthenticator},
testing::account_id::ACCOUNT_ID_OFF_CHAIN_SENDER,
transactions::{OutputNote, TransactionRequestBuilder},
transaction::{OutputNote, TransactionRequestBuilder},
utils::Serializable,
Client, Felt,
};
Expand Down
2 changes: 1 addition & 1 deletion bin/miden-cli/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use figment::{
providers::{Format, Toml},
Figment,
};
use miden_client::{accounts::AccountId, crypto::FeltRng, Client};
use miden_client::{account::AccountId, crypto::FeltRng, Client};
use tracing::info;

use super::{config::CliConfig, get_account_with_id_prefix, CLIENT_CONFIG_FILE_NAME};
Expand Down
2 changes: 1 addition & 1 deletion crates/rust-client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fn replace_no_std_types() {
fn generate_known_script_roots() -> std::io::Result<()> {
// Get the output directory from the environment variables
let out_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("src/notes/script_roots.rs");
let dest_path = Path::new(&out_dir).join("src/note/script_roots.rs");
let mut f = File::create(&dest_path)?;
// Write the top-level doc comment
writeln!(f, "//! Well-known note script roots.")?;
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions crates/rust-client/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ use miden_tx::{
use thiserror::Error;

use crate::{
notes::NoteScreenerError,
note::NoteScreenerError,
rpc::RpcError,
store::{NoteRecordError, StoreError},
transactions::{TransactionRequestError, TransactionScriptBuilderError},
transaction::{TransactionRequestError, TransactionScriptBuilderError},
};

// CLIENT ERROR
Expand Down
6 changes: 3 additions & 3 deletions crates/rust-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ pub use alloc::boxed::Box;
#[cfg(feature = "std")]
extern crate std;

pub mod accounts;
pub mod notes;
pub mod account;
pub mod note;
pub mod rpc;
pub mod store;
pub mod sync;
pub mod transactions;
pub mod transaction;

#[cfg(test)]
pub mod mock;
Expand Down
6 changes: 3 additions & 3 deletions crates/rust-client/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ use uuid::Uuid;
use crate::{
rpc::{
domain::{
accounts::{AccountDetails, AccountProofs},
notes::{NetworkNote, NoteSyncInfo},
account::{AccountDetails, AccountProofs},
note::{NetworkNote, NoteSyncInfo},
sync::StateSyncInfo,
},
generated::{
Expand All @@ -42,7 +42,7 @@ use crate::{
NodeRpcClient, RpcError,
},
store::{sqlite_store::SqliteStore, StoreAuthenticator},
transactions::ForeignAccount,
transaction::ForeignAccount,
Client,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use miden_objects::{
};

use crate::{
rpc::{domain::notes::NetworkNote, RpcError},
rpc::{domain::note::NetworkNote, RpcError},
store::{input_note_states::ExpectedNoteState, InputNoteRecord, InputNoteState},
sync::NoteTagRecord,
Client, ClientError,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions crates/rust-client/src/rpc/domain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ use core::any::type_name;

use super::errors::RpcConversionError;

pub mod accounts;
pub mod blocks;
pub mod account;
pub mod block;
pub mod digest;
pub mod merkle;
pub mod notes;
pub mod nullifiers;
pub mod note;
pub mod nullifier;
pub mod sync;
pub mod transactions;
pub mod transaction;

// UTILITIES
// ================================================================================================
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions crates/rust-client/src/rpc/domain/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use miden_objects::{
Digest,
};

use super::{notes::CommittedNote, nullifiers::NullifierUpdate, transactions::TransactionUpdate};
use super::{note::CommittedNote, nullifier::NullifierUpdate, transaction::TransactionUpdate};
use crate::rpc::{generated::responses::SyncStateResponse, RpcError};

// STATE SYNC INFO
Expand Down Expand Up @@ -91,7 +91,7 @@ impl TryFrom<SyncStateResponse> for StateSyncInfo {
.ok_or(RpcError::ExpectedDataMissing("Metadata".into()))?
.try_into()?;

let committed_note = super::notes::CommittedNote::new(
let committed_note = super::note::CommittedNote::new(
note_id,
note.note_index as u16,
merkle_path,
Expand Down
6 changes: 3 additions & 3 deletions crates/rust-client/src/rpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use core::fmt;

use async_trait::async_trait;
use domain::{
accounts::{AccountDetails, AccountProofs},
notes::{NetworkNote, NoteSyncInfo},
account::{AccountDetails, AccountProofs},
note::{NetworkNote, NoteSyncInfo},
sync::StateSyncInfo,
};
use miden_objects::{
Expand Down Expand Up @@ -45,7 +45,7 @@ pub use web_tonic_client::WebTonicRpcClient;
use crate::{
store::{input_note_states::UnverifiedNoteState, InputNoteRecord},
sync::get_nullifier_prefix,
transactions::ForeignAccount,
transaction::ForeignAccount,
};

// NODE RPC CLIENT TRAIT
Expand Down
8 changes: 3 additions & 5 deletions crates/rust-client/src/rpc/tonic_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ use tracing::info;

use super::{
domain::{
accounts::{AccountProof, AccountProofs, AccountUpdateSummary},
notes::NetworkNote,
account::{AccountProof, AccountProofs, AccountUpdateSummary},
note::NetworkNote,
},
generated::{
requests::{
Expand All @@ -36,9 +36,7 @@ use super::{
AccountDetails, Endpoint, NodeRpcClient, NodeRpcClientEndpoint, NoteSyncInfo, RpcError,
StateSyncInfo,
};
use crate::{
rpc::generated::requests::GetBlockHeaderByNumberRequest, transactions::ForeignAccount,
};
use crate::{rpc::generated::requests::GetBlockHeaderByNumberRequest, transaction::ForeignAccount};

// TONIC RPC CLIENT
// ================================================================================================
Expand Down
6 changes: 3 additions & 3 deletions crates/rust-client/src/rpc/web_tonic_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use tonic_web_wasm_client::Client;

use super::{
domain::{
accounts::{AccountDetails, AccountProof, AccountProofs, AccountUpdateSummary},
notes::{NetworkNote, NoteSyncInfo},
account::{AccountDetails, AccountProof, AccountProofs, AccountUpdateSummary},
note::{NetworkNote, NoteSyncInfo},
sync::StateSyncInfo,
},
generated::{
Expand All @@ -34,7 +34,7 @@ use super::{
},
NodeRpcClient, NodeRpcClientEndpoint, RpcError,
};
use crate::transactions::ForeignAccount;
use crate::transaction::ForeignAccount;

pub struct WebTonicRpcClient {
endpoint: String,
Expand Down
2 changes: 1 addition & 1 deletion crates/rust-client/src/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use miden_objects::{

use crate::{
sync::{NoteTagRecord, StateSyncUpdate},
transactions::{TransactionRecord, TransactionStoreUpdate},
transaction::{TransactionRecord, TransactionStoreUpdate},
};

/// Contains [ClientDataStore] to automatically implement [DataStore] for anything that implements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ mod tests {

use super::{insert_account_auth, AuthSecretKey};
use crate::store::{
sqlite_store::{accounts::insert_account_code, tests::create_test_store},
sqlite_store::{account::insert_account_code, tests::create_test_store},
Store,
};

Expand Down
8 changes: 4 additions & 4 deletions crates/rust-client/src/store/sqlite_store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ use super::{
use crate::{
store::StoreError,
sync::{NoteTagRecord, StateSyncUpdate},
transactions::{TransactionRecord, TransactionStoreUpdate},
transaction::{TransactionRecord, TransactionStoreUpdate},
};

mod accounts;
mod account;
mod chain_data;
mod errors;
mod notes;
mod note;
mod sync;
mod transactions;
mod transaction;

// SQLITE STORE
// ================================================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use rusqlite::{named_params, params, params_from_iter, types::Value, Connection,

use super::SqliteStore;
use crate::{
notes::NoteUpdates,
note::NoteUpdates,
store::{
note_record::OutputNoteState, InputNoteRecord, InputNoteState, NoteFilter,
OutputNoteRecord, StoreError,
Expand Down
4 changes: 2 additions & 2 deletions crates/rust-client/src/store/sqlite_store/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use super::SqliteStore;
use crate::{
store::{
sqlite_store::{
accounts::{lock_account, update_account},
notes::apply_note_updates_tx,
account::{lock_account, update_account},
note::apply_note_updates_tx,
},
StoreError,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ use rusqlite::{params, Connection, Transaction};
use tracing::info;

use super::{
accounts::update_account, notes::apply_note_updates_tx, sync::add_note_tag_tx, SqliteStore,
account::update_account, note::apply_note_updates_tx, sync::add_note_tag_tx, SqliteStore,
};
use crate::{
rpc::domain::transactions::TransactionUpdate,
rpc::domain::transaction::TransactionUpdate,
store::{StoreError, TransactionFilter},
transactions::{TransactionRecord, TransactionStatus, TransactionStoreUpdate},
transaction::{TransactionRecord, TransactionStatus, TransactionStoreUpdate},
};

pub(crate) const INSERT_TRANSACTION_QUERY: &str =
Expand Down
Loading

0 comments on commit ac52aaa

Please sign in to comment.