diff --git a/.gitignore b/.gitignore index 1ceaa08c6..2db71532f 100644 --- a/.gitignore +++ b/.gitignore @@ -39,7 +39,7 @@ node_modules/ # Ignore files that spawn using `miden-client init` miden-client.toml **/packages/** -keystore/ +/keystore/ # Ignore files that spawn using `cargo run` miden-node.pid diff --git a/Cargo.lock b/Cargo.lock index f53240e53..23754e073 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2487,34 +2487,11 @@ version = "0.13.0" dependencies = [ "anyhow", "async-trait", - "chrono", "futures", - "getrandom 0.3.4", - "hex", - "miden-client", - "miden-client-sqlite-store", - "miden-mast-package", - "miden-node-proto-build", - "miden-note-transport-proto-build", - "miden-protocol", - "miden-remote-prover-client", - "miden-standards", - "miden-testing", - "miden-tx", - "miette", - "prost", - "prost-types", - "rand 0.9.2", + "miden-client-core", "thiserror 2.0.17", "tokio", - "tonic", - "tonic-health", - "tonic-prost", - "tonic-prost-build", - "tonic-web-wasm-client", "tracing", - "uuid", - "web-sys", ] [[package]] @@ -2543,6 +2520,42 @@ dependencies = [ "uuid", ] +[[package]] +name = "miden-client-core" +version = "0.13.0" +dependencies = [ + "anyhow", + "async-trait", + "chrono", + "futures", + "getrandom 0.3.4", + "hex", + "miden-client-core", + "miden-client-sqlite-store", + "miden-mast-package", + "miden-node-proto-build", + "miden-note-transport-proto-build", + "miden-protocol", + "miden-remote-prover-client", + "miden-standards", + "miden-testing", + "miden-tx", + "miette", + "prost", + "prost-types", + "rand 0.9.2", + "thiserror 2.0.17", + "tokio", + "tonic", + "tonic-health", + "tonic-prost", + "tonic-prost-build", + "tonic-web-wasm-client", + "tracing", + "uuid", + "web-sys", +] + [[package]] name = "miden-client-integration-tests" version = "0.13.0" @@ -2572,7 +2585,6 @@ dependencies = [ "deadpool-sync", "miden-client", "miden-protocol", - "miden-standards", "rusqlite", "rusqlite_migration", "thiserror 2.0.17", @@ -2599,7 +2611,7 @@ dependencies = [ "console_error_panic_hook", "hex", "js-sys", - "miden-client", + "miden-client-core", "miden-idxdb-store", "miden-protocol", "rand 0.9.2", @@ -2727,7 +2739,7 @@ dependencies = [ "async-trait", "base64", "chrono", - "miden-client", + "miden-client-core", "miette", "serde", "serde-wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index 5632e05fc..ed5cd494e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,8 @@ members = [ "bin/integration-tests", "bin/miden-cli", "crates/idxdb-store", - "crates/rust-client", + "crates/miden-client", + "crates/miden-client-core", "crates/sqlite-store", "crates/testing/miden-client-tests", "crates/testing/node-builder", @@ -13,7 +14,7 @@ members = [ "crates/web-client", ] -default-members = ["bin/miden-cli", "crates/rust-client"] +default-members = ["bin/miden-cli", "crates/miden-client"] [workspace.package] authors = ["miden contributors"] @@ -58,7 +59,7 @@ miette = { features = ["fancy"], version = "7.6" } rand = { version = "0.9" } serde = { features = ["derive"], version = "1.0" } thiserror = { default-features = false, version = "2.0" } -tokio = { features = ["macros", "rt-multi-thread"], version = "1.48" } +tokio = { features = ["macros", "net", "rt-multi-thread", "sync", "time"], version = "1.48" } tracing = { version = "0.1" } # Lints are set to warn for development, which are promoted to errors in CI. diff --git a/Makefile b/Makefile index 0165f510d..cc04ccdb6 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ WARNINGS=RUSTDOCFLAGS="-D warnings" PROVER_DIR="crates/testing/prover" WEB_CLIENT_DIR=crates/web-client -RUST_CLIENT_DIR=crates/rust-client +RUST_CLIENT_DIR=crates/miden-client-core EXCLUDE_WASM_PACKAGES=--exclude miden-client-web --exclude miden-idxdb-store @@ -33,14 +33,16 @@ clippy-wasm: rust-client-ts-build ## Run Clippy for the wasm packages (web clien cargo clippy --package miden-idxdb-store --target wasm32-unknown-unknown --all-targets -- -D warnings .PHONY: fix -fix: ## Run Fix with configs, building tests with proper features to avoid type split. - cargo +nightly fix --workspace $(EXCLUDE_WASM_PACKAGES) --exclude testing-remote-prover --features "testing std" --all-targets --allow-staged --allow-dirty - cargo +nightly fix --package testing-remote-prover --all-targets --allow-staged --allow-dirty +fix: ## Run format and clippy across the workspace using the nightly toolchain. + cargo +nightly fmt --all + cargo +nightly clippy --workspace $(EXCLUDE_WASM_PACKAGES) --exclude testing-remote-prover --all-targets -- -A clippy::duplicated_attributes -A clippy::implicit_clone -D warnings + cargo +nightly clippy --package testing-remote-prover --all-targets -- -D warnings .PHONY: fix-wasm -fix-wasm: ## Run Fix for the wasm packages (web client and idxdb store) - cargo +nightly fix --package miden-client-web --target wasm32-unknown-unknown --allow-staged --allow-dirty --all-targets - cargo +nightly fix --package miden-idxdb-store --target wasm32-unknown-unknown --allow-staged --allow-dirty --all-targets +fix-wasm: ## Run formatting and clippy for the wasm packages (web client and idxdb store) + cargo +nightly fmt --package miden-client-web --package miden-idxdb-store + cargo +nightly clippy --package miden-client-web --target wasm32-unknown-unknown --all-targets -- -A clippy::duplicated_attributes -A clippy::implicit_clone -D warnings + cargo +nightly clippy --package miden-idxdb-store --target wasm32-unknown-unknown --all-targets -- -A clippy::duplicated_attributes -A clippy::implicit_clone -D warnings .PHONY: format format: ## Run format using nightly toolchain @@ -72,13 +74,10 @@ rust-client-ts-lint: # --- Documentation ------------------------------------------------------------------------------- .PHONY: doc -doc: ## Generate & check rust documentation. Ensure you have the nightly toolchain installed. - @cd crates/rust-client && \ - RUSTDOCFLAGS="-D warnings --cfg docsrs" cargo +nightly doc --lib --no-deps --all-features --keep-going --release - -doc-open: ## Generate & open rust documentation in browser. Ensure you have the nightly toolchain installed. - @cd crates/rust-client && \ - RUSTDOCFLAGS="-D warnings --cfg docsrs" cargo +nightly doc --lib --no-deps --all-features --keep-going --release --open +doc: ## Generate & check rust documentation. You'll need `jq` in order for this to run. + @cd $(RUST_CLIENT_DIR) && \ + FEATURES=$$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "miden-client") | .features | keys[] | select(. != "web-tonic" and . != "idxdb")' | tr '\n' ',') && \ + RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --features "$$FEATURES" --keep-going --release .PHONY: serve-docs serve-docs: ## Serves the docs diff --git a/README.md b/README.md index b9f8a1d8a..f09bf0e1b 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ The Miden client is still under heavy development and the project can be conside The Miden client currently consists of two components: -- `miden-client` library, which can be used by other project to programmatically interact with the Miden rollup. You can find more information about the library in the [Rust client Library](./crates/rust-client/README.md) section. +- `miden-client` library, which can be used by other project to programmatically interact with the Miden rollup. You can find more information about the library in the [Rust client Library](./crates/miden-client-core/README.md) section. - `miden-client-cli`, which is a wrapper around the library exposing its functionality via a simple command-line interface (CLI). You can find more information about the CLI in the [Miden client CLI](./bin/miden-cli/README.md) section. The client's main responsibility is to maintain a partial view of the blockchain which allows for locally executing and proving transactions. It keeps a local store of various entities that periodically get updated by syncing with the node. diff --git a/bin/integration-tests/Cargo.toml b/bin/integration-tests/Cargo.toml index 7e5ee9de2..7789ea5ca 100644 --- a/bin/integration-tests/Cargo.toml +++ b/bin/integration-tests/Cargo.toml @@ -19,7 +19,7 @@ path = "tests/integration.rs" [dependencies] # Workspace dependencies -miden-client = { features = ["std", "testing", "tonic"], path = "../../crates/rust-client" } +miden-client = { features = ["std", "testing", "tonic"], path = "../../crates/miden-client" } miden-client-sqlite-store = { package = "miden-client-sqlite-store", path = "../../crates/sqlite-store" } # External dependencies diff --git a/bin/integration-tests/src/tests/client.rs b/bin/integration-tests/src/tests/client.rs index f8f4423b8..41d9f33a5 100644 --- a/bin/integration-tests/src/tests/client.rs +++ b/bin/integration-tests/src/tests/client.rs @@ -770,9 +770,11 @@ pub async fn test_consume_multiple_expected_notes(client_config: ClientConfig) - ); // Validate the final asset amounts in each account - for (client, account_id) in [(client, to_account_ids[0]), (unauth_client, to_account_ids[1])] { + for (loop_client, account_id) in + [(client, to_account_ids[0]), (unauth_client, to_account_ids[1])] + { assert_account_has_single_asset( - &client, + &loop_client, account_id, faucet_account_id, TRANSFER_AMOUNT * 2, diff --git a/bin/integration-tests/src/tests/pass_through.rs b/bin/integration-tests/src/tests/pass_through.rs index d811c31d3..26bfe7c25 100644 --- a/bin/integration-tests/src/tests/pass_through.rs +++ b/bin/integration-tests/src/tests/pass_through.rs @@ -191,7 +191,7 @@ pub async fn test_pass_through(client_config: ClientConfig) -> Result<()> { // HELPERS // ================================================================================================ -async fn create_pass_through_account( +async fn create_pass_through_account( client: &mut Client, ) -> Result { let mut init_seed = [0u8; 32]; diff --git a/bin/miden-cli/Cargo.toml b/bin/miden-cli/Cargo.toml index f94d57b61..b1ee532ee 100644 --- a/bin/miden-cli/Cargo.toml +++ b/bin/miden-cli/Cargo.toml @@ -18,7 +18,7 @@ path = "src/main.rs" [dependencies] # Workspace dependencies -miden-client = { features = ["tonic"], path = "../../crates/rust-client" } +miden-client = { features = ["tonic"], path = "../../crates/miden-client" } miden-client-sqlite-store = { package = "miden-client-sqlite-store", path = "../../crates/sqlite-store" } # External dependencies @@ -36,12 +36,12 @@ tracing = { workspace = true } tracing-subscriber = { version = "0.3" } [build-dependencies] -miden-client = { path = "../../crates/rust-client" } +miden-client = { path = "../../crates/miden-client" } [dev-dependencies] anyhow = { workspace = true } assert_cmd = { version = "2.0" } -miden-client = { features = ["testing"], path = "../../crates/rust-client" } +miden-client = { features = ["testing"], path = "../../crates/miden-client" } predicates = { version = "3.0" } regex = { version = "1.0" } serial_test = { version = "3.0" } diff --git a/bin/miden-cli/src/commands/account.rs b/bin/miden-cli/src/commands/account.rs index b20ce0022..160348490 100644 --- a/bin/miden-cli/src/commands/account.rs +++ b/bin/miden-cli/src/commands/account.rs @@ -16,7 +16,7 @@ use miden_client::{Client, PrettyPrint, ZERO}; use crate::config::CliConfig; use crate::errors::CliError; use crate::utils::{load_config_file, load_faucet_details_map, parse_account_id}; -use crate::{client_binary_name, create_dynamic_table}; +use crate::{CliAuthenticator, client_binary_name, create_dynamic_table}; pub const DEFAULT_ACCOUNT_ID_KEY: &str = "default_account_id"; @@ -46,7 +46,10 @@ pub struct AccountCmd { } impl AccountCmd { - pub async fn execute(&self, mut client: Client) -> Result<(), CliError> { + pub async fn execute(&self, mut client: Client) -> Result<(), CliError> + where + AUTH: CliAuthenticator, + { let (cli_config, _) = load_config_file()?; match self { AccountCmd { @@ -103,7 +106,10 @@ impl AccountCmd { // LIST ACCOUNTS // ================================================================================================ -async fn list_accounts(client: Client) -> Result<(), CliError> { +async fn list_accounts(client: Client) -> Result<(), CliError> +where + AUTH: CliAuthenticator, +{ let accounts = client.get_account_headers().await?; let mut table = @@ -137,7 +143,10 @@ pub async fn show_account( account_id: AccountId, cli_config: &CliConfig, with_code: bool, -) -> Result<(), CliError> { +) -> Result<(), CliError> +where + AUTH: CliAuthenticator, +{ let account = if let Some(account) = client.get_account(account_id).await? { // TODO: Show partial accounts through CLI account.try_into().map_err(|_| CliError::InvalidAccount(account_id))? @@ -240,7 +249,10 @@ async fn print_summary_table( account: &Account, client: &Client, cli_config: &CliConfig, -) -> Result<(), CliError> { +) -> Result<(), CliError> +where + AUTH: CliAuthenticator, +{ let mut table = create_dynamic_table(&["Account Information"]); table .load_preset(presets::UTF8_HORIZONTAL_ONLY) @@ -294,7 +306,10 @@ fn account_type_display_name(account_id: &AccountId) -> Result pub(crate) async fn set_default_account_if_unset( client: &mut Client, account_id: AccountId, -) -> Result<(), CliError> { +) -> Result<(), CliError> +where + AUTH: CliAuthenticator, +{ if client .get_setting::(DEFAULT_ACCOUNT_ID_KEY.to_string()) .await? @@ -318,7 +333,10 @@ async fn account_bech_32( account_id: AccountId, client: &Client, cli_config: &CliConfig, -) -> Result { +) -> Result +where + AUTH: CliAuthenticator, +{ let account_record = client.try_get_account(account_id).await?; let account: Account = account_record.try_into().map_err(|_| CliError::InvalidAccount(account_id))?; diff --git a/bin/miden-cli/src/commands/address.rs b/bin/miden-cli/src/commands/address.rs index 87d55c446..b2ee750ce 100644 --- a/bin/miden-cli/src/commands/address.rs +++ b/bin/miden-cli/src/commands/address.rs @@ -6,7 +6,7 @@ use miden_client::note::{NoteExecutionMode, NoteTag}; use crate::errors::CliError; use crate::utils::parse_account_id; -use crate::{Parser, Subcommand, create_dynamic_table, load_config_file}; +use crate::{CliAuthenticator, Parser, Subcommand, create_dynamic_table, load_config_file}; #[derive(Debug, Clone)] pub enum CliAddressInterface { @@ -64,7 +64,10 @@ pub struct AddressCmd { } impl AddressCmd { - pub async fn execute(&self, client: Client) -> Result<(), CliError> { + pub async fn execute(&self, client: Client) -> Result<(), CliError> + where + AUTH: CliAuthenticator, + { match &self.command { Some(AddressSubCommand::List { account_id: Some(account_id) }) => { let (cli_config, _) = load_config_file()?; @@ -109,7 +112,10 @@ fn print_account_addresses(account_id: &String, addresses: &Vec
, networ async fn list_all_addresses( client: Client, network_id: NetworkId, -) -> Result<(), CliError> { +) -> Result<(), CliError> +where + AUTH: CliAuthenticator, +{ println!("Listing addresses for all accounts:\n"); let accounts = client.get_account_headers().await?; for (acc_header, _) in accounts { @@ -128,7 +134,10 @@ async fn list_account_addresses( client: Client, account_id: &String, network_id: NetworkId, -) -> Result<(), CliError> { +) -> Result<(), CliError> +where + AUTH: CliAuthenticator, +{ let id = parse_account_id(&client, account_id).await?; let addresses = match client.get_account(id).await? { Some(account) => account.addresses().clone(), @@ -148,7 +157,10 @@ async fn add_address( account_id: String, interface: CliAddressInterface, tag_len: Option, -) -> Result<(), CliError> { +) -> Result<(), CliError> +where + AUTH: CliAuthenticator, +{ let account_id = parse_account_id(&client, &account_id).await?; let interface = interface.into(); let routing_params = match tag_len { @@ -176,7 +188,10 @@ async fn remove_address( mut client: Client, account_id: String, address: String, -) -> Result<(), CliError> { +) -> Result<(), CliError> +where + AUTH: CliAuthenticator, +{ let account_id = parse_account_id(&client, &account_id).await?; let (_, address) = Address::decode(&address).map_err(|e| CliError::Address(e, address))?; let execution_mode = match address.to_note_tag().execution_mode() { diff --git a/bin/miden-cli/src/commands/exec.rs b/bin/miden-cli/src/commands/exec.rs index d5a7d13ea..64f307301 100644 --- a/bin/miden-cli/src/commands/exec.rs +++ b/bin/miden-cli/src/commands/exec.rs @@ -2,11 +2,11 @@ use std::collections::BTreeSet; use std::path::PathBuf; use clap::Parser; -use miden_client::auth::TransactionAuthenticator; use miden_client::vm::AdviceInputs; use miden_client::{Client, Felt, Word}; use serde::{Deserialize, Deserializer, Serialize, de}; +use crate::CliAuthenticator; use crate::errors::CliError; use crate::utils::get_input_acc_id_by_prefix_or_default; @@ -50,7 +50,7 @@ pub struct ExecCmd { } impl ExecCmd { - pub async fn execute( + pub async fn execute( &self, mut client: Client, ) -> Result<(), CliError> { diff --git a/bin/miden-cli/src/commands/export.rs b/bin/miden-cli/src/commands/export.rs index 58d5fb89e..f2f7b8802 100644 --- a/bin/miden-cli/src/commands/export.rs +++ b/bin/miden-cli/src/commands/export.rs @@ -4,14 +4,13 @@ use std::path::PathBuf; use miden_client::Client; use miden_client::account::{Account, AccountFile}; -use miden_client::auth::TransactionAuthenticator; use miden_client::store::NoteExportType; use miden_client::utils::{Serializable, get_public_keys_from_account}; use tracing::info; use crate::errors::CliError; use crate::utils::parse_account_id; -use crate::{FilesystemKeyStore, Parser, get_output_note_with_id_prefix}; +use crate::{CliAuthenticator, CliKeyStore, Parser, get_output_note_with_id_prefix}; #[derive(Debug, Parser, Clone)] #[command(about = "Export client output notes, or account data")] @@ -55,10 +54,10 @@ impl From<&ExportType> for NoteExportType { } impl ExportCmd { - pub async fn execute( + pub async fn execute( &self, mut client: Client, - keystore: FilesystemKeyStore, + keystore: CliKeyStore, ) -> Result<(), CliError> { if self.account { export_account(&client, &keystore, self.id.as_str(), self.filename.clone()).await?; @@ -78,10 +77,13 @@ impl ExportCmd { async fn export_account( client: &Client, - keystore: &FilesystemKeyStore, + keystore: &CliKeyStore, account_id: &str, filename: Option, -) -> Result { +) -> Result +where + AUTH: CliAuthenticator, +{ let account_id = parse_account_id(client, account_id).await?; let account = client @@ -122,7 +124,7 @@ async fn export_account( // EXPORT NOTE // ================================================================================================ -async fn export_note( +async fn export_note( client: &mut Client, note_id: &str, filename: Option, diff --git a/bin/miden-cli/src/commands/import.rs b/bin/miden-cli/src/commands/import.rs index 6048ab58a..13fa04478 100644 --- a/bin/miden-cli/src/commands/import.rs +++ b/bin/miden-cli/src/commands/import.rs @@ -3,7 +3,6 @@ use std::io::Read; use std::path::PathBuf; use miden_client::account::{AccountFile, AccountId}; -use miden_client::auth::TransactionAuthenticator; use miden_client::note::NoteFile; use miden_client::utils::Deserializable; use miden_client::{Client, ClientError}; @@ -11,7 +10,7 @@ use tracing::info; use crate::commands::account::set_default_account_if_unset; use crate::errors::CliError; -use crate::{FilesystemKeyStore, Parser}; +use crate::{CliAuthenticator, CliKeyStore, Parser}; #[derive(Debug, Parser, Clone)] #[command(about = "Import notes or accounts")] @@ -25,10 +24,10 @@ pub struct ImportCmd { } impl ImportCmd { - pub async fn execute( + pub async fn execute( &self, mut client: Client, - keystore: FilesystemKeyStore, + keystore: CliKeyStore, ) -> Result<(), CliError> { validate_paths(&self.filenames)?; for filename in &self.filenames { @@ -68,10 +67,13 @@ impl ImportCmd { async fn import_account( client: &mut Client, - keystore: &FilesystemKeyStore, + keystore: &CliKeyStore, account_data_file_contents: &[u8], overwrite: bool, -) -> Result { +) -> Result +where + AUTH: CliAuthenticator, +{ let account_data = AccountFile::read_from_bytes(account_data_file_contents) .map_err(ClientError::DataDeserializationError)?; let account_id = account_data.account.id(); diff --git a/bin/miden-cli/src/commands/new_account.rs b/bin/miden-cli/src/commands/new_account.rs index 63685492c..11a719cb0 100644 --- a/bin/miden-cli/src/commands/new_account.rs +++ b/bin/miden-cli/src/commands/new_account.rs @@ -15,8 +15,7 @@ use miden_client::account::component::{ StorageValueName, }; use miden_client::account::{Account, AccountBuilder, AccountStorageMode, AccountType}; -use miden_client::auth::{AuthRpoFalcon512, AuthSecretKey, TransactionAuthenticator}; -use miden_client::keystore::FilesystemKeyStore; +use miden_client::auth::{AuthRpoFalcon512, AuthSecretKey}; use miden_client::transaction::TransactionRequestBuilder; use miden_client::utils::Deserializable; use miden_client::vm::{Package, SectionId}; @@ -26,7 +25,7 @@ use tracing::debug; use crate::commands::account::set_default_account_if_unset; use crate::config::CliConfig; use crate::errors::CliError; -use crate::{client_binary_name, load_config_file}; +use crate::{CliAuthenticator, CliKeyStore, client_binary_name, load_config_file}; // CLI TYPES // ================================================================================================ @@ -100,10 +99,10 @@ pub struct NewWalletCmd { } impl NewWalletCmd { - pub async fn execute( + pub async fn execute( &self, mut client: Client, - keystore: FilesystemKeyStore, + keystore: CliKeyStore, ) -> Result<(), CliError> { let package_paths: Vec = [PathBuf::from("basic-wallet")] .into_iter() @@ -195,10 +194,10 @@ pub struct NewAccountCmd { } impl NewAccountCmd { - pub async fn execute( + pub async fn execute( &self, mut client: Client, - keystore: FilesystemKeyStore, + keystore: CliKeyStore, ) -> Result<(), CliError> { let new_account = create_client_account( &mut client, @@ -347,9 +346,9 @@ fn separate_auth_components( /// and build the account. /// /// If no auth component is detected in the packages, a Falcon-based auth component will be added. -async fn create_client_account( +async fn create_client_account( client: &mut Client, - keystore: &FilesystemKeyStore, + keystore: &CliKeyStore, account_type: AccountType, storage_mode: AccountStorageMode, package_paths: &[PathBuf], @@ -424,7 +423,7 @@ async fn create_client_account( } /// Submits a deploy transaction to the node for the specified account. -async fn deploy_account( +async fn deploy_account( client: &mut Client, account: &Account, ) -> Result<(), CliError> { diff --git a/bin/miden-cli/src/commands/new_transactions.rs b/bin/miden-cli/src/commands/new_transactions.rs index b886cd1db..502146624 100644 --- a/bin/miden-cli/src/commands/new_transactions.rs +++ b/bin/miden-cli/src/commands/new_transactions.rs @@ -4,7 +4,6 @@ use std::sync::Arc; use clap::{Parser, ValueEnum}; use miden_client::account::AccountId; use miden_client::asset::{FungibleAsset, NonFungibleDeltaAction}; -use miden_client::auth::TransactionAuthenticator; use miden_client::note::{ BlockNumber, NoteType as MidenNoteType, @@ -24,7 +23,6 @@ use miden_client::transaction::{ use miden_client::{Client, RemoteTransactionProver}; use tracing::info; -use crate::create_dynamic_table; use crate::errors::CliError; use crate::utils::{ SHARED_TOKEN_DOCUMENTATION, @@ -33,6 +31,7 @@ use crate::utils::{ load_faucet_details_map, parse_account_id, }; +use crate::{CliAuthenticator, create_dynamic_table}; #[derive(Debug, Clone, Copy, ValueEnum)] pub enum NoteType { @@ -72,7 +71,7 @@ pub struct MintCmd { } impl MintCmd { - pub async fn execute( + pub async fn execute( &self, mut client: Client, ) -> Result<(), CliError> { @@ -143,7 +142,7 @@ pub struct SendCmd { } impl SendCmd { - pub async fn execute( + pub async fn execute( &self, mut client: Client, ) -> Result<(), CliError> { @@ -225,7 +224,7 @@ pub struct SwapCmd { } impl SwapCmd { - pub async fn execute( + pub async fn execute( &self, mut client: Client, ) -> Result<(), CliError> { @@ -304,7 +303,7 @@ pub struct ConsumeNotesCmd { } impl ConsumeNotesCmd { - pub async fn execute( + pub async fn execute( &self, mut client: Client, ) -> Result<(), CliError> { @@ -375,7 +374,7 @@ impl ConsumeNotesCmd { // EXECUTE TRANSACTION // ================================================================================================ -async fn execute_transaction( +async fn execute_transaction( client: &mut Client, account_id: AccountId, transaction_request: TransactionRequest, diff --git a/bin/miden-cli/src/commands/notes.rs b/bin/miden-cli/src/commands/notes.rs index a62cb712e..5066b5330 100644 --- a/bin/miden-cli/src/commands/notes.rs +++ b/bin/miden-cli/src/commands/notes.rs @@ -2,7 +2,6 @@ use clap::ValueEnum; use comfy_table::{Attribute, Cell, ContentArrangement, Table, presets}; use miden_client::address::Address; use miden_client::asset::Asset; -use miden_client::auth::TransactionAuthenticator; use miden_client::note::{ Note, NoteConsumability, @@ -17,7 +16,7 @@ use miden_client::{Client, ClientError, IdPrefixFetchError, PrettyPrint}; use crate::errors::CliError; use crate::utils::{load_faucet_details_map, parse_account_id}; -use crate::{Parser, create_dynamic_table, get_output_note_with_id_prefix}; +use crate::{CliAuthenticator, Parser, create_dynamic_table, get_output_note_with_id_prefix}; #[derive(Clone, Debug, ValueEnum)] pub enum NoteFilter { @@ -72,7 +71,7 @@ pub struct NotesCmd { } impl NotesCmd { - pub async fn execute( + pub async fn execute( &self, mut client: Client, ) -> Result<(), CliError> { @@ -121,7 +120,7 @@ struct CliNoteSummary { // LIST NOTES // ================================================================================================ -async fn list_notes( +async fn list_notes( client: Client, filter: ClientNoteFilter, ) -> Result<(), CliError> { @@ -147,7 +146,7 @@ async fn list_notes( // SHOW NOTE // ================================================================================================ #[allow(clippy::too_many_lines)] -async fn show_note( +async fn show_note( client: Client, note_id: String, with_code: bool, @@ -318,7 +317,7 @@ async fn show_note( // LIST CONSUMABLE INPUT NOTES // ================================================================================================ -async fn list_consumable_notes( +async fn list_consumable_notes( client: Client, account_id: Option<&String>, ) -> Result<(), CliError> { @@ -335,7 +334,7 @@ async fn list_consumable_notes( // ================================================================================================ /// Send a (stored) note -async fn send( +async fn send( client: &mut Client, note_id: &str, address: &str, @@ -361,7 +360,7 @@ async fn send( /// Fetched notes are stored in the store. async fn fetch(client: &mut Client) -> Result<(), CliError> where - AUTH: TransactionAuthenticator + Sync + 'static, + AUTH: CliAuthenticator, { client.fetch_private_notes().await?; diff --git a/bin/miden-cli/src/commands/sync.rs b/bin/miden-cli/src/commands/sync.rs index 01d9f08b3..350a869a0 100644 --- a/bin/miden-cli/src/commands/sync.rs +++ b/bin/miden-cli/src/commands/sync.rs @@ -1,7 +1,7 @@ use clap::Parser; use miden_client::Client; -use miden_client::auth::TransactionAuthenticator; +use crate::CliAuthenticator; use crate::errors::CliError; #[derive(Debug, Parser, Clone)] @@ -9,7 +9,7 @@ use crate::errors::CliError; pub struct SyncCmd {} impl SyncCmd { - pub async fn execute( + pub async fn execute( &self, mut client: Client, ) -> Result<(), CliError> { diff --git a/bin/miden-cli/src/commands/tags.rs b/bin/miden-cli/src/commands/tags.rs index 854041ab3..c78d0d40f 100644 --- a/bin/miden-cli/src/commands/tags.rs +++ b/bin/miden-cli/src/commands/tags.rs @@ -3,7 +3,7 @@ use miden_client::note::{NoteExecutionMode, NoteTag}; use tracing::info; use crate::errors::CliError; -use crate::{Parser, create_dynamic_table}; +use crate::{CliAuthenticator, Parser, create_dynamic_table}; #[derive(Default, Debug, Parser, Clone)] #[command(about = "View and manage tags. Defaults to `list` command")] @@ -22,7 +22,10 @@ pub struct TagsCmd { } impl TagsCmd { - pub async fn execute(&self, client: Client) -> Result<(), CliError> { + pub async fn execute(&self, client: Client) -> Result<(), CliError> + where + AUTH: CliAuthenticator, + { match self { TagsCmd { add: Some(tag), .. } => { add_tag(client, *tag).await?; @@ -40,7 +43,10 @@ impl TagsCmd { // HELPERS // ================================================================================================ -async fn list_tags(client: Client) -> Result<(), CliError> { +async fn list_tags(client: Client) -> Result<(), CliError> +where + AUTH: CliAuthenticator, +{ let mut table = create_dynamic_table(&["Tag", "Source"]); let tags = client.get_note_tags().await?; @@ -62,7 +68,10 @@ async fn list_tags(client: Client) -> Result<(), CliError> { Ok(()) } -async fn add_tag(mut client: Client, tag: u32) -> Result<(), CliError> { +async fn add_tag(mut client: Client, tag: u32) -> Result<(), CliError> +where + AUTH: CliAuthenticator, +{ let tag: NoteTag = tag.into(); let execution_mode = match tag.execution_mode() { NoteExecutionMode::Local => "Local", @@ -78,7 +87,10 @@ async fn add_tag(mut client: Client, tag: u32) -> Result<(), CliErro Ok(()) } -async fn remove_tag(mut client: Client, tag: u32) -> Result<(), CliError> { +async fn remove_tag(mut client: Client, tag: u32) -> Result<(), CliError> +where + AUTH: CliAuthenticator, +{ client.remove_note_tag(tag.into()).await?; println!("Tag {tag} removed"); Ok(()) diff --git a/bin/miden-cli/src/commands/transactions.rs b/bin/miden-cli/src/commands/transactions.rs index 70fd3fe39..6cb30fdfa 100644 --- a/bin/miden-cli/src/commands/transactions.rs +++ b/bin/miden-cli/src/commands/transactions.rs @@ -1,10 +1,9 @@ use miden_client::Client; -use miden_client::auth::TransactionAuthenticator; use miden_client::store::TransactionFilter; use miden_client::transaction::TransactionRecord; use crate::errors::CliError; -use crate::{Parser, create_dynamic_table}; +use crate::{CliAuthenticator, Parser, create_dynamic_table}; #[derive(Default, Debug, Parser, Clone)] #[command(about = "Manage and view transactions. Defaults to `list` command")] @@ -15,7 +14,7 @@ pub struct TransactionCmd { } impl TransactionCmd { - pub async fn execute( + pub async fn execute( &self, client: Client, ) -> Result<(), CliError> { @@ -26,9 +25,7 @@ impl TransactionCmd { // LIST TRANSACTIONS // ================================================================================================ -async fn list_transactions( - client: Client, -) -> Result<(), CliError> { +async fn list_transactions(client: Client) -> Result<(), CliError> { let transactions = client.get_transactions(TransactionFilter::All).await?; print_transactions_summary(&transactions); Ok(()) diff --git a/bin/miden-cli/src/errors.rs b/bin/miden-cli/src/errors.rs index c74d9bf47..815670f22 100644 --- a/bin/miden-cli/src/errors.rs +++ b/bin/miden-cli/src/errors.rs @@ -34,14 +34,9 @@ pub enum CliError { #[error("asset error")] #[diagnostic(code(cli::asset_error))] Asset(#[source] AssetError), - #[error("client error: {error}")] + #[error("client error: {0}")] #[diagnostic(code(cli::client_error))] - Client { - #[source] - error: ClientError, - #[help] - help: Option, - }, + Client(#[source] ClientError, #[help] Option), #[error("config error: {1}")] #[diagnostic( code(cli::config_error), @@ -101,6 +96,6 @@ pub enum CliError { impl From for CliError { fn from(error: ClientError) -> Self { let help = Option::::from(&error).map(ErrorHint::into_help_message); - CliError::Client { error, help } + CliError::Client(error, help) } } diff --git a/bin/miden-cli/src/faucet_details_map.rs b/bin/miden-cli/src/faucet_details_map.rs index ba0514123..00964d69d 100644 --- a/bin/miden-cli/src/faucet_details_map.rs +++ b/bin/miden-cli/src/faucet_details_map.rs @@ -7,6 +7,7 @@ use miden_client::asset::FungibleAsset; use miden_client::utils::{base_units_to_tokens, tokens_to_base_units}; use serde::{Deserialize, Serialize}; +use crate::CliAuthenticator; use crate::errors::CliError; use crate::utils::parse_account_id; @@ -97,7 +98,10 @@ impl FaucetDetailsMap { &self, client: &Client, arg: &str, - ) -> Result { + ) -> Result + where + AUTH: CliAuthenticator, + { let (amount, asset) = arg.split_once("::").ok_or(CliError::Parse( "separator `::` not found".into(), "Failed to parse amount and asset".to_string(), diff --git a/bin/miden-cli/src/info.rs b/bin/miden-cli/src/info.rs index 916f50bc8..66a4737e1 100644 --- a/bin/miden-cli/src/info.rs +++ b/bin/miden-cli/src/info.rs @@ -2,15 +2,14 @@ use std::fs; use miden_client::Client; use miden_client::account::AccountId; -use miden_client::auth::TransactionAuthenticator; use miden_client::store::NoteFilter; use super::config::CliConfig; use crate::commands::account::DEFAULT_ACCOUNT_ID_KEY; use crate::errors::CliError; -use crate::load_config_file; +use crate::{CliAuthenticator, load_config_file}; -pub async fn print_client_info( +pub async fn print_client_info( client: &Client, ) -> Result<(), CliError> { let (config, _) = load_config_file()?; @@ -22,9 +21,7 @@ pub async fn print_client_info( // HELPERS // ================================================================================================ -async fn print_client_stats( - client: &Client, -) -> Result<(), CliError> { +async fn print_client_stats(client: &Client) -> Result<(), CliError> { println!("Block number: {}", client.get_sync_height().await?); println!("Tracked accounts: {}", client.get_account_headers().await?.len()); println!("Expected notes: {}", client.get_input_notes(NoteFilter::Expected).await?.len()); diff --git a/bin/miden-cli/src/lib.rs b/bin/miden-cli/src/lib.rs index edeac016c..304147d35 100644 --- a/bin/miden-cli/src/lib.rs +++ b/bin/miden-cli/src/lib.rs @@ -30,6 +30,10 @@ use commands::transactions::TransactionCmd; use self::utils::{config_file_exists, load_config_file}; use crate::commands::address::AddressCmd; +pub type CliKeyStore = FilesystemKeyStore; + +pub trait CliAuthenticator: TransactionAuthenticator + Send + Sync + 'static {} +impl CliAuthenticator for T where T: TransactionAuthenticator + Send + Sync + 'static {} mod config; mod errors; mod faucet_details_map; @@ -260,7 +264,7 @@ pub fn create_dynamic_table(headers: &[&str]) -> Table { /// `note_id_prefix` is a prefix of its ID. /// - Returns [`IdPrefixFetchError::MultipleMatches`] if there were more than one note found where /// `note_id_prefix` is a prefix of its ID. -pub(crate) async fn get_output_note_with_id_prefix( +pub(crate) async fn get_output_note_with_id_prefix( client: &Client, note_id_prefix: &str, ) -> Result { @@ -309,7 +313,10 @@ pub(crate) async fn get_output_note_with_id_prefix( client: &Client, account_id_prefix: &str, -) -> Result { +) -> Result +where + AUTH: CliAuthenticator, +{ let mut accounts = client .get_account_headers() .await diff --git a/bin/miden-cli/src/utils.rs b/bin/miden-cli/src/utils.rs index 94ea3cab4..5a795158a 100644 --- a/bin/miden-cli/src/utils.rs +++ b/bin/miden-cli/src/utils.rs @@ -7,6 +7,7 @@ use miden_client::account::AccountId; use miden_client::address::{Address, AddressId}; use super::{CLIENT_CONFIG_FILE_NAME, get_account_with_id_prefix}; +use crate::CliAuthenticator; use crate::commands::account::DEFAULT_ACCOUNT_ID_KEY; use crate::config::{CliConfig, get_global_miden_dir, get_local_miden_dir}; use crate::errors::CliError; @@ -25,7 +26,10 @@ For example, `100::0xabcdef0123456789` or `1.23::TST`"; pub(crate) async fn get_input_acc_id_by_prefix_or_default( client: &Client, account_id: Option, -) -> Result { +) -> Result +where + AUTH: CliAuthenticator, +{ let account_id_str = if let Some(account_id_prefix) = account_id { account_id_prefix } else { @@ -54,7 +58,10 @@ pub(crate) async fn get_input_acc_id_by_prefix_or_default( pub(crate) async fn parse_account_id( client: &Client, account_id: &str, -) -> Result { +) -> Result +where + AUTH: CliAuthenticator, +{ if account_id.starts_with("0x") { if let Ok(account_id) = AccountId::from_hex(account_id) { return Ok(account_id); diff --git a/crates/idxdb-store/Cargo.toml b/crates/idxdb-store/Cargo.toml index 4086268e4..bef6ceeef 100644 --- a/crates/idxdb-store/Cargo.toml +++ b/crates/idxdb-store/Cargo.toml @@ -13,7 +13,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] # Miden dependencies -miden-client = { default-features = false, path = "../rust-client" } +miden-client-core = { default-features = false, path = "../miden-client-core" } # Workspace dependencies async-trait = { workspace = true } diff --git a/crates/idxdb-store/src/README.md b/crates/idxdb-store/src/README.md index 07731e837..8a654ca37 100644 --- a/crates/idxdb-store/src/README.md +++ b/crates/idxdb-store/src/README.md @@ -13,4 +13,5 @@ files under `src/js`. This is because to use extern functions, we still need to To unify and make this setup straightforward, the top-most makefile from this project has a useful target: `make rust-client-ts-build`, which takes the .ts files and compiles them down to .js files. - +The target name is kept for backwards compatibility, but it now invokes the tooling that lives +under the `miden-client-core` crate. diff --git a/crates/idxdb-store/src/account/js_bindings.rs b/crates/idxdb-store/src/account/js_bindings.rs index 9c80b54e8..6c813f4d4 100644 --- a/crates/idxdb-store/src/account/js_bindings.rs +++ b/crates/idxdb-store/src/account/js_bindings.rs @@ -1,10 +1,10 @@ use alloc::string::String; use alloc::vec::Vec; -use miden_client::Word; -use miden_client::account::{StorageMap, StorageSlot}; -use miden_client::asset::Asset; -use miden_client::utils::Serializable; +use miden_client_core::Word; +use miden_client_core::account::{StorageMap, StorageSlot}; +use miden_client_core::asset::Asset; +use miden_client_core::utils::Serializable; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys; diff --git a/crates/idxdb-store/src/account/mod.rs b/crates/idxdb-store/src/account/mod.rs index 1e2d810cc..018432bea 100644 --- a/crates/idxdb-store/src/account/mod.rs +++ b/crates/idxdb-store/src/account/mod.rs @@ -2,7 +2,7 @@ use alloc::collections::BTreeMap; use alloc::string::{String, ToString}; use alloc::vec::Vec; -use miden_client::account::{ +use miden_client_core::account::{ Account, AccountCode, AccountHeader, @@ -15,16 +15,16 @@ use miden_client::account::{ StorageSlotName, StorageSlotType, }; -use miden_client::asset::{Asset, AssetVault}; -use miden_client::store::{ +use miden_client_core::asset::{Asset, AssetVault}; +use miden_client_core::store::{ AccountRecord, AccountRecordData, AccountStatus, AccountStorageFilter, StoreError, }; -use miden_client::utils::Serializable; -use miden_client::{AccountError, Word}; +use miden_client_core::utils::Serializable; +use miden_client_core::{AccountError, Word}; use super::WebStore; use crate::account::js_bindings::idxdb_get_account_addresses; diff --git a/crates/idxdb-store/src/account/utils.rs b/crates/idxdb-store/src/account/utils.rs index c97c487cf..332a0e08f 100644 --- a/crates/idxdb-store/src/account/utils.rs +++ b/crates/idxdb-store/src/account/utils.rs @@ -1,7 +1,7 @@ use alloc::string::ToString; use alloc::vec::Vec; -use miden_client::account::{ +use miden_client_core::account::{ Account, AccountCode, AccountHeader, @@ -10,10 +10,10 @@ use miden_client::account::{ Address, StorageSlotContent, }; -use miden_client::asset::AssetVault; -use miden_client::store::{AccountStatus, StoreError}; -use miden_client::utils::{Deserializable, Serializable}; -use miden_client::{Felt, Word}; +use miden_client_core::asset::AssetVault; +use miden_client_core::store::{AccountStatus, StoreError}; +use miden_client_core::utils::{Deserializable, Serializable}; +use miden_client_core::{Felt, Word}; use wasm_bindgen::JsValue; use wasm_bindgen_futures::JsFuture; diff --git a/crates/idxdb-store/src/chain_data/mod.rs b/crates/idxdb-store/src/chain_data/mod.rs index c4add1dfa..5f20b2a0e 100644 --- a/crates/idxdb-store/src/chain_data/mod.rs +++ b/crates/idxdb-store/src/chain_data/mod.rs @@ -2,12 +2,12 @@ use alloc::collections::{BTreeMap, BTreeSet}; use alloc::string::{String, ToString}; use alloc::vec::Vec; -use miden_client::Word; -use miden_client::block::BlockHeader; -use miden_client::crypto::{Forest, InOrderIndex, MmrPeaks}; -use miden_client::note::BlockNumber; -use miden_client::store::{BlockRelevance, PartialBlockchainFilter, StoreError}; -use miden_client::utils::Deserializable; +use miden_client_core::Word; +use miden_client_core::block::BlockHeader; +use miden_client_core::crypto::{Forest, InOrderIndex, MmrPeaks}; +use miden_client_core::note::BlockNumber; +use miden_client_core::store::{BlockRelevance, PartialBlockchainFilter, StoreError}; +use miden_client_core::utils::Deserializable; use super::WebStore; use crate::promise::{await_js, await_js_value, await_ok}; diff --git a/crates/idxdb-store/src/chain_data/utils.rs b/crates/idxdb-store/src/chain_data/utils.rs index 0f1393abc..f78c12f8f 100644 --- a/crates/idxdb-store/src/chain_data/utils.rs +++ b/crates/idxdb-store/src/chain_data/utils.rs @@ -3,11 +3,11 @@ use alloc::string::{String, ToString}; use alloc::vec::Vec; use core::num::NonZeroUsize; -use miden_client::Word; -use miden_client::block::BlockHeader; -use miden_client::crypto::InOrderIndex; -use miden_client::store::StoreError; -use miden_client::utils::Serializable; +use miden_client_core::Word; +use miden_client_core::block::BlockHeader; +use miden_client_core::crypto::InOrderIndex; +use miden_client_core::store::StoreError; +use miden_client_core::utils::Serializable; use serde_wasm_bindgen::from_value; use wasm_bindgen::JsValue; diff --git a/crates/idxdb-store/src/export/mod.rs b/crates/idxdb-store/src/export/mod.rs index f7d8998ef..523a6e6bd 100644 --- a/crates/idxdb-store/src/export/mod.rs +++ b/crates/idxdb-store/src/export/mod.rs @@ -1,4 +1,4 @@ -use miden_client::store::StoreError; +use miden_client_core::store::StoreError; use super::WebStore; diff --git a/crates/idxdb-store/src/import/mod.rs b/crates/idxdb-store/src/import/mod.rs index 654436b68..774680d53 100644 --- a/crates/idxdb-store/src/import/mod.rs +++ b/crates/idxdb-store/src/import/mod.rs @@ -1,4 +1,4 @@ -use miden_client::store::StoreError; +use miden_client_core::store::StoreError; use super::WebStore; diff --git a/crates/idxdb-store/src/lib.rs b/crates/idxdb-store/src/lib.rs index 75fa6c08a..21752156e 100644 --- a/crates/idxdb-store/src/lib.rs +++ b/crates/idxdb-store/src/lib.rs @@ -14,8 +14,8 @@ use alloc::vec::Vec; use base64::Engine; use base64::engine::general_purpose; -use miden_client::Word; -use miden_client::account::{ +use miden_client_core::Word; +use miden_client_core::account::{ Account, AccountCode, AccountHeader, @@ -23,11 +23,11 @@ use miden_client::account::{ AccountStorage, Address, }; -use miden_client::asset::AssetVault; -use miden_client::block::BlockHeader; -use miden_client::crypto::{InOrderIndex, MmrPeaks}; -use miden_client::note::{BlockNumber, NoteScript, Nullifier}; -use miden_client::store::{ +use miden_client_core::asset::AssetVault; +use miden_client_core::block::BlockHeader; +use miden_client_core::crypto::{InOrderIndex, MmrPeaks}; +use miden_client_core::note::{BlockNumber, NoteScript, Nullifier}; +use miden_client_core::store::{ AccountRecord, AccountStatus, AccountStorageFilter, @@ -40,8 +40,8 @@ use miden_client::store::{ StoreError, TransactionFilter, }; -use miden_client::sync::{NoteTagRecord, StateSyncUpdate}; -use miden_client::transaction::{TransactionRecord, TransactionStoreUpdate}; +use miden_client_core::sync::{NoteTagRecord, StateSyncUpdate}; +use miden_client_core::transaction::{TransactionRecord, TransactionStoreUpdate}; use serde::de::Error; use serde::{Deserialize, Deserializer}; use wasm_bindgen::prelude::*; diff --git a/crates/idxdb-store/src/note/mod.rs b/crates/idxdb-store/src/note/mod.rs index 2a003dd8e..9e39f451a 100644 --- a/crates/idxdb-store/src/note/mod.rs +++ b/crates/idxdb-store/src/note/mod.rs @@ -1,9 +1,9 @@ use alloc::string::{String, ToString}; use alloc::vec::Vec; -use miden_client::Word; -use miden_client::note::{NoteScript, Nullifier}; -use miden_client::store::{ +use miden_client_core::Word; +use miden_client_core::note::{NoteScript, Nullifier}; +use miden_client_core::store::{ InputNoteRecord, InputNoteState, NoteFilter, diff --git a/crates/idxdb-store/src/note/utils.rs b/crates/idxdb-store/src/note/utils.rs index 794600b04..aead54438 100644 --- a/crates/idxdb-store/src/note/utils.rs +++ b/crates/idxdb-store/src/note/utils.rs @@ -2,8 +2,8 @@ use alloc::string::{String, ToString}; use alloc::vec::Vec; use chrono::Utc; -use miden_client::Word; -use miden_client::note::{ +use miden_client_core::Word; +use miden_client_core::note::{ NoteAssets, NoteDetails, NoteInputs, @@ -12,14 +12,14 @@ use miden_client::note::{ NoteScript, NoteUpdateTracker, }; -use miden_client::store::{ +use miden_client_core::store::{ InputNoteRecord, InputNoteState, OutputNoteRecord, OutputNoteState, StoreError, }; -use miden_client::utils::{Deserializable, Serializable}; +use miden_client_core::utils::{Deserializable, Serializable}; use wasm_bindgen::prelude::wasm_bindgen; use super::js_bindings::{ diff --git a/crates/idxdb-store/src/settings/mod.rs b/crates/idxdb-store/src/settings/mod.rs index 777597f8e..9d35475af 100644 --- a/crates/idxdb-store/src/settings/mod.rs +++ b/crates/idxdb-store/src/settings/mod.rs @@ -1,7 +1,7 @@ use alloc::string::String; use alloc::vec::Vec; -use miden_client::store::StoreError; +use miden_client_core::store::StoreError; mod js_bindings; mod models; diff --git a/crates/idxdb-store/src/sync/js_bindings.rs b/crates/idxdb-store/src/sync/js_bindings.rs index 03b9dee2c..157146aff 100644 --- a/crates/idxdb-store/src/sync/js_bindings.rs +++ b/crates/idxdb-store/src/sync/js_bindings.rs @@ -1,9 +1,9 @@ use alloc::string::{String, ToString}; use alloc::vec::Vec; -use miden_client::Word; -use miden_client::account::{Account, StorageSlotContent}; -use miden_client::utils::Serializable; +use miden_client_core::Word; +use miden_client_core::account::{Account, StorageSlotContent}; +use miden_client_core::utils::Serializable; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys; diff --git a/crates/idxdb-store/src/sync/mod.rs b/crates/idxdb-store/src/sync/mod.rs index 56c443872..cca196e5d 100644 --- a/crates/idxdb-store/src/sync/mod.rs +++ b/crates/idxdb-store/src/sync/mod.rs @@ -1,11 +1,11 @@ use alloc::string::{String, ToString}; use alloc::vec::Vec; -use miden_client::account::AccountId; -use miden_client::note::{BlockNumber, NoteId, NoteTag}; -use miden_client::store::StoreError; -use miden_client::sync::{NoteTagRecord, NoteTagSource, StateSyncUpdate}; -use miden_client::utils::{Deserializable, Serializable}; +use miden_client_core::account::AccountId; +use miden_client_core::note::{BlockNumber, NoteId, NoteTag}; +use miden_client_core::store::StoreError; +use miden_client_core::sync::{NoteTagRecord, NoteTagSource, StateSyncUpdate}; +use miden_client_core::utils::{Deserializable, Serializable}; use super::WebStore; use super::chain_data::utils::{ diff --git a/crates/idxdb-store/src/transaction/mod.rs b/crates/idxdb-store/src/transaction/mod.rs index 525de92cb..28d04ee03 100644 --- a/crates/idxdb-store/src/transaction/mod.rs +++ b/crates/idxdb-store/src/transaction/mod.rs @@ -1,10 +1,10 @@ use alloc::string::{String, ToString}; use alloc::vec::Vec; -use miden_client::Word; -use miden_client::account::Account; -use miden_client::store::{StoreError, TransactionFilter}; -use miden_client::transaction::{ +use miden_client_core::Word; +use miden_client_core::account::Account; +use miden_client_core::store::{StoreError, TransactionFilter}; +use miden_client_core::transaction::{ TransactionDetails, TransactionId, TransactionRecord, @@ -12,7 +12,7 @@ use miden_client::transaction::{ TransactionStatus, TransactionStoreUpdate, }; -use miden_client::utils::Deserializable; +use miden_client_core::utils::Deserializable; use super::WebStore; use super::account::utils::update_account; diff --git a/crates/idxdb-store/src/transaction/utils.rs b/crates/idxdb-store/src/transaction/utils.rs index 079aa2bd0..760aa3da4 100644 --- a/crates/idxdb-store/src/transaction/utils.rs +++ b/crates/idxdb-store/src/transaction/utils.rs @@ -1,17 +1,17 @@ use alloc::string::String; use alloc::vec::Vec; -use miden_client::Word; -use miden_client::note::{BlockNumber, ToInputNoteCommitments}; -use miden_client::store::StoreError; -use miden_client::transaction::{ +use miden_client_core::Word; +use miden_client_core::note::{BlockNumber, ToInputNoteCommitments}; +use miden_client_core::store::StoreError; +use miden_client_core::transaction::{ ExecutedTransaction, TransactionDetails, TransactionRecord, TransactionScript, TransactionStatus, }; -use miden_client::utils::Serializable; +use miden_client_core::utils::Serializable; use wasm_bindgen::prelude::wasm_bindgen; use super::js_bindings::{idxdb_insert_transaction_script, idxdb_upsert_transaction_record}; diff --git a/crates/rust-client/Cargo.toml b/crates/miden-client-core/Cargo.toml similarity index 91% rename from crates/rust-client/Cargo.toml rename to crates/miden-client-core/Cargo.toml index 80210e5e0..0a178400d 100644 --- a/crates/rust-client/Cargo.toml +++ b/crates/miden-client-core/Cargo.toml @@ -1,12 +1,12 @@ [package] authors.workspace = true categories = ["no-std"] -description = "Client library that facilitates interaction with the Miden network" -documentation = "https://docs.rs/miden-client" +description = "Core client library that facilitates interaction with the Miden network" +documentation = "https://docs.rs/miden-client-core/0.13.0" edition.workspace = true keywords = ["client", "miden"] license.workspace = true -name = "miden-client" +name = "miden-client-core" readme = "README.md" repository.workspace = true rust-version.workspace = true @@ -75,7 +75,7 @@ prost = { default-features = false, features = ["deri tonic-prost-build = { version = "0.14" } [dev-dependencies] -miden-client = { features = ["std", "testing"], path = "." } +miden-client-core = { features = ["std", "testing"], path = "." } miden-client-sqlite-store = { package = "miden-client-sqlite-store", path = "../sqlite-store" } miden-protocol = { default-features = false, features = ["testing"], workspace = true } miden-standards = { features = ["testing"], workspace = true } diff --git a/crates/rust-client/README.md b/crates/miden-client-core/README.md similarity index 77% rename from crates/rust-client/README.md rename to crates/miden-client-core/README.md index 47f1fb5fa..9094be401 100644 --- a/crates/rust-client/README.md +++ b/crates/miden-client-core/README.md @@ -1,13 +1,13 @@ -# Rust Client Library +# Miden Client Core -Rust library, which can be used by other project to programmatically interact with the Miden rollup. +Rust library, which can be used by other project to programmatically interact with the Miden rollup. This crate is no_std-compatible and is re-exported by the std-only `miden-client` facade. -## Adding miden-client as a dependency +## Adding miden-client-core as a dependency -In order to utilize the `miden-client` library, you can add the dependency to your project's `Cargo.toml` file: +In order to utilize the `miden-client-core` library, you can add the dependency to your project's `Cargo.toml` file: ````toml -miden-client = { version = "0.13" } +miden-client-core = { version = "0.13" } ```` ## Crate Features diff --git a/crates/rust-client/build.rs b/crates/miden-client-core/build.rs similarity index 100% rename from crates/rust-client/build.rs rename to crates/miden-client-core/build.rs diff --git a/crates/rust-client/src/account/mod.rs b/crates/miden-client-core/src/account/mod.rs similarity index 99% rename from crates/rust-client/src/account/mod.rs rename to crates/miden-client-core/src/account/mod.rs index c2f02c033..253d1bd34 100644 --- a/crates/rust-client/src/account/mod.rs +++ b/crates/miden-client-core/src/account/mod.rs @@ -69,6 +69,7 @@ use miden_standards::account::auth::{AuthEcdsaK256Keccak, AuthRpoFalcon512}; // ================================================================================================ pub use miden_standards::account::interface::AccountInterfaceExt; use miden_standards::account::wallets::BasicWallet; +use miden_tx::auth::TransactionAuthenticator; use super::Client; use crate::auth::AuthSchemeId; @@ -120,7 +121,10 @@ pub mod component { /// with the network. /// /// - **Data retrieval:** The module also provides methods to fetch account-related data. -impl Client { +impl Client +where + AUTH: TransactionAuthenticator + Sync, +{ // ACCOUNT CREATION // -------------------------------------------------------------------------------------------- diff --git a/crates/rust-client/src/builder.rs b/crates/miden-client-core/src/builder.rs similarity index 98% rename from crates/rust-client/src/builder.rs rename to crates/miden-client-core/src/builder.rs index a0b09c28d..0ea0d48ab 100644 --- a/crates/rust-client/src/builder.rs +++ b/crates/miden-client-core/src/builder.rs @@ -67,7 +67,7 @@ pub struct ClientBuilder { /// An optional store provided by the user. pub store: Option, /// An optional RNG provided by the user. - rng: Option>, + rng: Option>, /// The keystore configuration provided by the user. keystore: Option>, /// A flag to enable debug mode. @@ -142,7 +142,7 @@ where /// Optionally provide a custom RNG. #[must_use] - pub fn rng(mut self, rng: Box) -> Self { + pub fn rng(mut self, rng: Box) -> Self { self.rng = Some(rng); self } diff --git a/crates/rust-client/src/errors.rs b/crates/miden-client-core/src/errors.rs similarity index 100% rename from crates/rust-client/src/errors.rs rename to crates/miden-client-core/src/errors.rs diff --git a/crates/rust-client/src/keystore/fs_keystore.rs b/crates/miden-client-core/src/keystore/fs_keystore.rs similarity index 98% rename from crates/rust-client/src/keystore/fs_keystore.rs rename to crates/miden-client-core/src/keystore/fs_keystore.rs index cabdcaf6d..43892f95a 100644 --- a/crates/rust-client/src/keystore/fs_keystore.rs +++ b/crates/miden-client-core/src/keystore/fs_keystore.rs @@ -1,9 +1,8 @@ -use alloc::string::String; +use alloc::string::{String, ToString}; use std::fs::OpenOptions; use std::hash::{DefaultHasher, Hash, Hasher}; use std::io::{BufRead, BufReader, BufWriter, Write}; use std::path::PathBuf; -use std::string::ToString; use miden_protocol::Word; use miden_protocol::account::auth::{AuthSecretKey, PublicKey, PublicKeyCommitment, Signature}; diff --git a/crates/rust-client/src/keystore/mod.rs b/crates/miden-client-core/src/keystore/mod.rs similarity index 74% rename from crates/rust-client/src/keystore/mod.rs rename to crates/miden-client-core/src/keystore/mod.rs index 5404d08f1..d03cf89b2 100644 --- a/crates/rust-client/src/keystore/mod.rs +++ b/crates/miden-client-core/src/keystore/mod.rs @@ -4,13 +4,14 @@ use thiserror::Error; #[derive(Debug, Error)] pub enum KeyStoreError { - #[error("storage error: {0}")] + #[error("keystore storage error: {0}")] StorageError(String), - #[error("decoding error: {0}")] + #[error("keystore decoding error: {0}")] DecodingError(String), } #[cfg(feature = "std")] mod fs_keystore; + #[cfg(feature = "std")] pub use fs_keystore::FilesystemKeyStore; diff --git a/crates/rust-client/src/lib.rs b/crates/miden-client-core/src/lib.rs similarity index 91% rename from crates/rust-client/src/lib.rs rename to crates/miden-client-core/src/lib.rs index 0d80b9e6e..dea2b0089 100644 --- a/crates/rust-client/src/lib.rs +++ b/crates/miden-client-core/src/lib.rs @@ -46,7 +46,7 @@ //! //! ```toml //! [dependencies] -//! miden-client = "0.10" +//! miden-client-core = "0.13" //! ``` //! //! ## Example @@ -56,13 +56,13 @@ //! ```rust //! use std::sync::Arc; //! -//! use miden_client::crypto::RpoRandomCoin; -//! use miden_client::keystore::FilesystemKeyStore; -//! use miden_client::note_transport::NOTE_TRANSPORT_DEFAULT_ENDPOINT; -//! use miden_client::note_transport::grpc::GrpcNoteTransportClient; -//! use miden_client::rpc::{Endpoint, GrpcClient}; -//! use miden_client::store::Store; -//! use miden_client::{Client, ExecutionOptions, Felt}; +//! use miden_client_core::crypto::RpoRandomCoin; +//! use miden_client_core::keystore::FilesystemKeyStore; +//! use miden_client_core::note_transport::NOTE_TRANSPORT_DEFAULT_ENDPOINT; +//! use miden_client_core::note_transport::grpc::GrpcNoteTransportClient; +//! use miden_client_core::rpc::{Endpoint, GrpcClient}; +//! use miden_client_core::store::Store; +//! use miden_client_core::{Client, ExecutionOptions, Felt}; //! use miden_client_sqlite_store::SqliteStore; //! use miden_protocol::crypto::rand::FeltRng; //! use miden_protocol::{MAX_TX_EXECUTION_CYCLES, MIN_TX_EXECUTION_CYCLES}; @@ -394,7 +394,7 @@ where #[allow(clippy::too_many_arguments)] pub async fn new( rpc_api: Arc, - rng: Box, + rng: Box, store: Arc, authenticator: Option>, exec_options: ExecutionOptions, @@ -437,6 +437,36 @@ where self.exec_options.enable_debugging() } + /// Returns a clone of the client's store handle. + pub fn store(&self) -> Arc { + self.store.clone() + } + + /// Returns a clone of the client's RPC client handle. + pub fn rpc_client(&self) -> Arc { + self.rpc_api.clone() + } + + /// Returns the default transaction prover used by the client. + pub fn transaction_prover(&self) -> Arc { + self.tx_prover.clone() + } + + /// Returns the transaction authenticator associated with the client, if any. + pub fn authenticator(&self) -> Option> { + self.authenticator.clone() + } + + /// Returns the MASM source manager used by the client. + pub fn source_manager(&self) -> Arc { + self.source_manager.clone() + } + + /// Returns the note transport client if present. + pub fn note_transport_client(&self) -> Option> { + self.note_transport_api.clone() + } + /// Returns an instance of the `CodeBuilder` pub fn code_builder(&self) -> assembly::CodeBuilder { assembly::CodeBuilder::with_source_manager(self.source_manager.clone()) @@ -492,14 +522,14 @@ impl Client { /// A wrapper around a [`FeltRng`] that implements the [`RngCore`] trait. /// This allows the user to pass their own generic RNG so that it's used by the client. -pub struct ClientRng(Box); +pub struct ClientRng(Box); impl ClientRng { - pub fn new(rng: Box) -> Self { + pub fn new(rng: Box) -> Self { Self(rng) } - pub fn inner_mut(&mut self) -> &mut Box { + pub fn inner_mut(&mut self) -> &mut Box { &mut self.0 } } diff --git a/crates/rust-client/src/note/import.rs b/crates/miden-client-core/src/note/import.rs similarity index 99% rename from crates/rust-client/src/note/import.rs rename to crates/miden-client-core/src/note/import.rs index 16d6bf5ab..56ea3e4ae 100644 --- a/crates/rust-client/src/note/import.rs +++ b/crates/miden-client-core/src/note/import.rs @@ -22,8 +22,8 @@ use miden_protocol::note::{ NoteMetadata, NoteTag, }; -use miden_tx::auth::TransactionAuthenticator; +use crate::note::NoteScreenerAuth; use crate::rpc::RpcError; use crate::rpc::domain::note::FetchedNote; use crate::store::input_note_states::ExpectedNoteState; @@ -34,7 +34,7 @@ use crate::{Client, ClientError}; /// Note importing methods. impl Client where - AUTH: TransactionAuthenticator + Sync + 'static, + AUTH: NoteScreenerAuth + 'static, { // INPUT NOTE CREATION // -------------------------------------------------------------------------------------------- diff --git a/crates/rust-client/src/note/mod.rs b/crates/miden-client-core/src/note/mod.rs similarity index 97% rename from crates/rust-client/src/note/mod.rs rename to crates/miden-client-core/src/note/mod.rs index 09713feef..d36ac340e 100644 --- a/crates/rust-client/src/note/mod.rs +++ b/crates/miden-client-core/src/note/mod.rs @@ -104,7 +104,7 @@ pub use miden_standards::note::{ create_p2ide_note, create_swap_note, }; -pub use note_screener::{NoteConsumability, NoteScreener, NoteScreenerError}; +pub use note_screener::{NoteConsumability, NoteScreener, NoteScreenerAuth, NoteScreenerError}; pub use note_update_tracker::{ InputNoteUpdate, NoteUpdateTracker, @@ -114,7 +114,7 @@ pub use note_update_tracker::{ /// Note retrieval methods. impl Client where - AUTH: TransactionAuthenticator + Sync, + AUTH: NoteScreenerAuth, { // INPUT NOTE DATA RETRIEVAL // -------------------------------------------------------------------------------------------- @@ -142,7 +142,10 @@ where pub async fn get_consumable_notes( &self, account_id: Option, - ) -> Result)>, ClientError> { + ) -> Result)>, ClientError> + where + AUTH: NoteScreenerAuth, + { let committed_notes = self.store.get_input_notes(NoteFilter::Committed).await?; let note_screener = NoteScreener::new(self.store.clone(), self.authenticator.clone()); @@ -174,7 +177,10 @@ where pub async fn get_note_consumability( &self, note: InputNoteRecord, - ) -> Result, ClientError> { + ) -> Result, ClientError> + where + AUTH: NoteScreenerAuth, + { let note_screener = NoteScreener::new(self.store.clone(), self.authenticator.clone()); note_screener .check_relevance(¬e.clone().try_into()?) @@ -223,7 +229,7 @@ pub async fn get_input_note_with_id_prefix( note_id_prefix: &str, ) -> Result where - AUTH: TransactionAuthenticator + Sync, + AUTH: TransactionAuthenticator + Send + Sync, { let mut input_note_records = client .get_input_notes(NoteFilter::All) diff --git a/crates/rust-client/src/note/note_screener.rs b/crates/miden-client-core/src/note/note_screener.rs similarity index 93% rename from crates/rust-client/src/note/note_screener.rs rename to crates/miden-client-core/src/note/note_screener.rs index 99723d69e..5e99595e7 100644 --- a/crates/rust-client/src/note/note_screener.rs +++ b/crates/miden-client-core/src/note/note_screener.rs @@ -2,7 +2,6 @@ use alloc::boxed::Box; use alloc::sync::Arc; use alloc::vec::Vec; -use async_trait::async_trait; use miden_protocol::account::{Account, AccountId}; use miden_protocol::note::{Note, NoteId}; use miden_protocol::{AccountError, AssetError}; @@ -19,6 +18,15 @@ use crate::store::{InputNoteRecord, NoteFilter, Store, StoreError}; use crate::sync::{NoteUpdateAction, OnNoteReceived}; use crate::transaction::{InputNote, TransactionRequestBuilder, TransactionRequestError}; +#[cfg(feature = "std")] +pub trait NoteScreenerAuth: TransactionAuthenticator + Send + Sync {} +#[cfg(feature = "std")] +impl NoteScreenerAuth for T where T: TransactionAuthenticator + Send + Sync {} + +#[cfg(not(feature = "std"))] +pub trait NoteScreenerAuth: TransactionAuthenticator + Sync {} +#[cfg(not(feature = "std"))] +impl NoteScreenerAuth for T where T: TransactionAuthenticator + Sync {} /// Represents the consumability of a note by a specific account. /// /// The tuple contains the account ID that may consume the note and the moment it will become @@ -41,7 +49,7 @@ pub struct NoteScreener { impl NoteScreener where - AUTH: TransactionAuthenticator + Sync, + AUTH: NoteScreenerAuth, { pub fn new(store: Arc, authenticator: Option>) -> Self { Self { store, authenticator } @@ -119,10 +127,11 @@ where // DEFAULT CALLBACK IMPLEMENTATIONS // ================================================================================================ -#[async_trait(?Send)] +#[cfg_attr(feature = "std", async_trait::async_trait)] +#[cfg_attr(not(feature = "std"), async_trait::async_trait(?Send))] impl OnNoteReceived for NoteScreener where - AUTH: TransactionAuthenticator + Sync, + AUTH: NoteScreenerAuth, { /// Default implementation of the [`OnNoteReceived`] callback. It queries the store for the /// committed note to check if it's relevant. If the note wasn't being tracked but it came in diff --git a/crates/rust-client/src/note/note_update_tracker.rs b/crates/miden-client-core/src/note/note_update_tracker.rs similarity index 100% rename from crates/rust-client/src/note/note_update_tracker.rs rename to crates/miden-client-core/src/note/note_update_tracker.rs diff --git a/crates/rust-client/src/note_transport/errors.rs b/crates/miden-client-core/src/note_transport/errors.rs similarity index 100% rename from crates/rust-client/src/note_transport/errors.rs rename to crates/miden-client-core/src/note_transport/errors.rs diff --git a/crates/rust-client/src/note_transport/generated/mod.rs b/crates/miden-client-core/src/note_transport/generated/mod.rs similarity index 100% rename from crates/rust-client/src/note_transport/generated/mod.rs rename to crates/miden-client-core/src/note_transport/generated/mod.rs diff --git a/crates/rust-client/src/note_transport/generated/nostd/miden_note_transport.rs b/crates/miden-client-core/src/note_transport/generated/nostd/miden_note_transport.rs similarity index 100% rename from crates/rust-client/src/note_transport/generated/nostd/miden_note_transport.rs rename to crates/miden-client-core/src/note_transport/generated/nostd/miden_note_transport.rs diff --git a/crates/rust-client/src/note_transport/generated/nostd/miden_private_transport.rs b/crates/miden-client-core/src/note_transport/generated/nostd/miden_private_transport.rs similarity index 100% rename from crates/rust-client/src/note_transport/generated/nostd/miden_private_transport.rs rename to crates/miden-client-core/src/note_transport/generated/nostd/miden_private_transport.rs diff --git a/crates/rust-client/src/note_transport/generated/nostd/mod.rs b/crates/miden-client-core/src/note_transport/generated/nostd/mod.rs similarity index 100% rename from crates/rust-client/src/note_transport/generated/nostd/mod.rs rename to crates/miden-client-core/src/note_transport/generated/nostd/mod.rs diff --git a/crates/rust-client/src/note_transport/generated/std/miden_note_transport.rs b/crates/miden-client-core/src/note_transport/generated/std/miden_note_transport.rs similarity index 100% rename from crates/rust-client/src/note_transport/generated/std/miden_note_transport.rs rename to crates/miden-client-core/src/note_transport/generated/std/miden_note_transport.rs diff --git a/crates/rust-client/src/note_transport/generated/std/mod.rs b/crates/miden-client-core/src/note_transport/generated/std/mod.rs similarity index 100% rename from crates/rust-client/src/note_transport/generated/std/mod.rs rename to crates/miden-client-core/src/note_transport/generated/std/mod.rs diff --git a/crates/rust-client/src/note_transport/grpc.rs b/crates/miden-client-core/src/note_transport/grpc.rs similarity index 100% rename from crates/rust-client/src/note_transport/grpc.rs rename to crates/miden-client-core/src/note_transport/grpc.rs diff --git a/crates/rust-client/src/note_transport/mod.rs b/crates/miden-client-core/src/note_transport/mod.rs similarity index 98% rename from crates/rust-client/src/note_transport/mod.rs rename to crates/miden-client-core/src/note_transport/mod.rs index 6fd8f066e..6665bfd0b 100644 --- a/crates/rust-client/src/note_transport/mod.rs +++ b/crates/miden-client-core/src/note_transport/mod.rs @@ -15,6 +15,7 @@ use miden_tx::auth::TransactionAuthenticator; use miden_tx::utils::{ByteReader, ByteWriter, Deserializable, DeserializationError, SliceReader}; pub use self::errors::NoteTransportError; +use crate::note::NoteScreenerAuth; use crate::store::Store; use crate::{Client, ClientError}; @@ -22,7 +23,10 @@ pub const NOTE_TRANSPORT_DEFAULT_ENDPOINT: &str = "https://transport.miden.io"; pub const NOTE_TRANSPORT_CURSOR_STORE_SETTING: &str = "note_transport_cursor"; /// Client note transport methods. -impl Client { +impl Client +where + AUTH: TransactionAuthenticator + Sync, +{ /// Check if note transport connection is configured pub fn is_note_transport_enabled(&self) -> bool { self.note_transport_api.is_some() @@ -62,7 +66,7 @@ impl Client { impl Client where - AUTH: TransactionAuthenticator + Sync + 'static, + AUTH: NoteScreenerAuth + 'static, { /// Fetch notes for tracked note tags. /// diff --git a/crates/rust-client/src/rpc/domain/account.rs b/crates/miden-client-core/src/rpc/domain/account.rs similarity index 100% rename from crates/rust-client/src/rpc/domain/account.rs rename to crates/miden-client-core/src/rpc/domain/account.rs diff --git a/crates/rust-client/src/rpc/domain/account_vault.rs b/crates/miden-client-core/src/rpc/domain/account_vault.rs similarity index 100% rename from crates/rust-client/src/rpc/domain/account_vault.rs rename to crates/miden-client-core/src/rpc/domain/account_vault.rs diff --git a/crates/rust-client/src/rpc/domain/block.rs b/crates/miden-client-core/src/rpc/domain/block.rs similarity index 100% rename from crates/rust-client/src/rpc/domain/block.rs rename to crates/miden-client-core/src/rpc/domain/block.rs diff --git a/crates/rust-client/src/rpc/domain/digest.rs b/crates/miden-client-core/src/rpc/domain/digest.rs similarity index 100% rename from crates/rust-client/src/rpc/domain/digest.rs rename to crates/miden-client-core/src/rpc/domain/digest.rs diff --git a/crates/rust-client/src/rpc/domain/merkle.rs b/crates/miden-client-core/src/rpc/domain/merkle.rs similarity index 100% rename from crates/rust-client/src/rpc/domain/merkle.rs rename to crates/miden-client-core/src/rpc/domain/merkle.rs diff --git a/crates/rust-client/src/rpc/domain/mod.rs b/crates/miden-client-core/src/rpc/domain/mod.rs similarity index 100% rename from crates/rust-client/src/rpc/domain/mod.rs rename to crates/miden-client-core/src/rpc/domain/mod.rs diff --git a/crates/rust-client/src/rpc/domain/note.rs b/crates/miden-client-core/src/rpc/domain/note.rs similarity index 100% rename from crates/rust-client/src/rpc/domain/note.rs rename to crates/miden-client-core/src/rpc/domain/note.rs diff --git a/crates/rust-client/src/rpc/domain/nullifier.rs b/crates/miden-client-core/src/rpc/domain/nullifier.rs similarity index 100% rename from crates/rust-client/src/rpc/domain/nullifier.rs rename to crates/miden-client-core/src/rpc/domain/nullifier.rs diff --git a/crates/rust-client/src/rpc/domain/smt.rs b/crates/miden-client-core/src/rpc/domain/smt.rs similarity index 100% rename from crates/rust-client/src/rpc/domain/smt.rs rename to crates/miden-client-core/src/rpc/domain/smt.rs diff --git a/crates/rust-client/src/rpc/domain/storage_map.rs b/crates/miden-client-core/src/rpc/domain/storage_map.rs similarity index 100% rename from crates/rust-client/src/rpc/domain/storage_map.rs rename to crates/miden-client-core/src/rpc/domain/storage_map.rs diff --git a/crates/rust-client/src/rpc/domain/sync.rs b/crates/miden-client-core/src/rpc/domain/sync.rs similarity index 100% rename from crates/rust-client/src/rpc/domain/sync.rs rename to crates/miden-client-core/src/rpc/domain/sync.rs diff --git a/crates/rust-client/src/rpc/domain/transaction.rs b/crates/miden-client-core/src/rpc/domain/transaction.rs similarity index 100% rename from crates/rust-client/src/rpc/domain/transaction.rs rename to crates/miden-client-core/src/rpc/domain/transaction.rs diff --git a/crates/rust-client/src/rpc/domain/word.rs b/crates/miden-client-core/src/rpc/domain/word.rs similarity index 100% rename from crates/rust-client/src/rpc/domain/word.rs rename to crates/miden-client-core/src/rpc/domain/word.rs diff --git a/crates/rust-client/src/rpc/endpoint.rs b/crates/miden-client-core/src/rpc/endpoint.rs similarity index 100% rename from crates/rust-client/src/rpc/endpoint.rs rename to crates/miden-client-core/src/rpc/endpoint.rs diff --git a/crates/rust-client/src/rpc/errors.rs b/crates/miden-client-core/src/rpc/errors.rs similarity index 100% rename from crates/rust-client/src/rpc/errors.rs rename to crates/miden-client-core/src/rpc/errors.rs diff --git a/crates/rust-client/src/rpc/generated/mod.rs b/crates/miden-client-core/src/rpc/generated/mod.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/mod.rs rename to crates/miden-client-core/src/rpc/generated/mod.rs diff --git a/crates/rust-client/src/rpc/generated/nostd/account.rs b/crates/miden-client-core/src/rpc/generated/nostd/account.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/nostd/account.rs rename to crates/miden-client-core/src/rpc/generated/nostd/account.rs diff --git a/crates/rust-client/src/rpc/generated/nostd/block_producer.rs b/crates/miden-client-core/src/rpc/generated/nostd/block_producer.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/nostd/block_producer.rs rename to crates/miden-client-core/src/rpc/generated/nostd/block_producer.rs diff --git a/crates/rust-client/src/rpc/generated/nostd/blockchain.rs b/crates/miden-client-core/src/rpc/generated/nostd/blockchain.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/nostd/blockchain.rs rename to crates/miden-client-core/src/rpc/generated/nostd/blockchain.rs diff --git a/crates/rust-client/src/rpc/generated/nostd/mod.rs b/crates/miden-client-core/src/rpc/generated/nostd/mod.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/nostd/mod.rs rename to crates/miden-client-core/src/rpc/generated/nostd/mod.rs diff --git a/crates/rust-client/src/rpc/generated/nostd/note.rs b/crates/miden-client-core/src/rpc/generated/nostd/note.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/nostd/note.rs rename to crates/miden-client-core/src/rpc/generated/nostd/note.rs diff --git a/crates/rust-client/src/rpc/generated/nostd/primitives.rs b/crates/miden-client-core/src/rpc/generated/nostd/primitives.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/nostd/primitives.rs rename to crates/miden-client-core/src/rpc/generated/nostd/primitives.rs diff --git a/crates/rust-client/src/rpc/generated/nostd/rpc.rs b/crates/miden-client-core/src/rpc/generated/nostd/rpc.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/nostd/rpc.rs rename to crates/miden-client-core/src/rpc/generated/nostd/rpc.rs diff --git a/crates/rust-client/src/rpc/generated/nostd/rpc_store.rs b/crates/miden-client-core/src/rpc/generated/nostd/rpc_store.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/nostd/rpc_store.rs rename to crates/miden-client-core/src/rpc/generated/nostd/rpc_store.rs diff --git a/crates/rust-client/src/rpc/generated/nostd/shared.rs b/crates/miden-client-core/src/rpc/generated/nostd/shared.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/nostd/shared.rs rename to crates/miden-client-core/src/rpc/generated/nostd/shared.rs diff --git a/crates/rust-client/src/rpc/generated/nostd/transaction.rs b/crates/miden-client-core/src/rpc/generated/nostd/transaction.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/nostd/transaction.rs rename to crates/miden-client-core/src/rpc/generated/nostd/transaction.rs diff --git a/crates/rust-client/src/rpc/generated/std/account.rs b/crates/miden-client-core/src/rpc/generated/std/account.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/std/account.rs rename to crates/miden-client-core/src/rpc/generated/std/account.rs diff --git a/crates/rust-client/src/rpc/generated/std/block_producer.rs b/crates/miden-client-core/src/rpc/generated/std/block_producer.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/std/block_producer.rs rename to crates/miden-client-core/src/rpc/generated/std/block_producer.rs diff --git a/crates/rust-client/src/rpc/generated/std/blockchain.rs b/crates/miden-client-core/src/rpc/generated/std/blockchain.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/std/blockchain.rs rename to crates/miden-client-core/src/rpc/generated/std/blockchain.rs diff --git a/crates/rust-client/src/rpc/generated/std/mod.rs b/crates/miden-client-core/src/rpc/generated/std/mod.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/std/mod.rs rename to crates/miden-client-core/src/rpc/generated/std/mod.rs diff --git a/crates/rust-client/src/rpc/generated/std/note.rs b/crates/miden-client-core/src/rpc/generated/std/note.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/std/note.rs rename to crates/miden-client-core/src/rpc/generated/std/note.rs diff --git a/crates/rust-client/src/rpc/generated/std/primitives.rs b/crates/miden-client-core/src/rpc/generated/std/primitives.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/std/primitives.rs rename to crates/miden-client-core/src/rpc/generated/std/primitives.rs diff --git a/crates/rust-client/src/rpc/generated/std/rpc.rs b/crates/miden-client-core/src/rpc/generated/std/rpc.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/std/rpc.rs rename to crates/miden-client-core/src/rpc/generated/std/rpc.rs diff --git a/crates/rust-client/src/rpc/generated/std/rpc_store.rs b/crates/miden-client-core/src/rpc/generated/std/rpc_store.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/std/rpc_store.rs rename to crates/miden-client-core/src/rpc/generated/std/rpc_store.rs diff --git a/crates/rust-client/src/rpc/generated/std/shared.rs b/crates/miden-client-core/src/rpc/generated/std/shared.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/std/shared.rs rename to crates/miden-client-core/src/rpc/generated/std/shared.rs diff --git a/crates/rust-client/src/rpc/generated/std/transaction.rs b/crates/miden-client-core/src/rpc/generated/std/transaction.rs similarity index 100% rename from crates/rust-client/src/rpc/generated/std/transaction.rs rename to crates/miden-client-core/src/rpc/generated/std/transaction.rs diff --git a/crates/rust-client/src/rpc/mod.rs b/crates/miden-client-core/src/rpc/mod.rs similarity index 100% rename from crates/rust-client/src/rpc/mod.rs rename to crates/miden-client-core/src/rpc/mod.rs diff --git a/crates/rust-client/src/rpc/tonic_client/api_client.rs b/crates/miden-client-core/src/rpc/tonic_client/api_client.rs similarity index 100% rename from crates/rust-client/src/rpc/tonic_client/api_client.rs rename to crates/miden-client-core/src/rpc/tonic_client/api_client.rs diff --git a/crates/rust-client/src/rpc/tonic_client/mod.rs b/crates/miden-client-core/src/rpc/tonic_client/mod.rs similarity index 100% rename from crates/rust-client/src/rpc/tonic_client/mod.rs rename to crates/miden-client-core/src/rpc/tonic_client/mod.rs diff --git a/crates/rust-client/src/settings/mod.rs b/crates/miden-client-core/src/settings/mod.rs similarity index 94% rename from crates/rust-client/src/settings/mod.rs rename to crates/miden-client-core/src/settings/mod.rs index e75fd3c91..e49e6f644 100644 --- a/crates/rust-client/src/settings/mod.rs +++ b/crates/miden-client-core/src/settings/mod.rs @@ -4,6 +4,7 @@ use alloc::string::String; use alloc::vec::Vec; +use miden_tx::auth::TransactionAuthenticator; use miden_tx::utils::{Deserializable, Serializable}; use super::Client; @@ -17,7 +18,10 @@ use crate::errors::ClientError; /// - **Settings accessors:** Methods to get, set, and delete setting values from the store. /// - **Default account ID:** Methods to get, set, and delete the default account ID. This is a /// wrapper around a specific setting value. -impl Client { +impl Client +where + AUTH: TransactionAuthenticator + Sync, +{ // SETTINGS ACCESSORS // -------------------------------------------------------------------------------------------- diff --git a/crates/rust-client/src/store/account.rs b/crates/miden-client-core/src/store/account.rs similarity index 100% rename from crates/rust-client/src/store/account.rs rename to crates/miden-client-core/src/store/account.rs diff --git a/crates/rust-client/src/store/data_store.rs b/crates/miden-client-core/src/store/data_store.rs similarity index 100% rename from crates/rust-client/src/store/data_store.rs rename to crates/miden-client-core/src/store/data_store.rs diff --git a/crates/rust-client/src/store/errors.rs b/crates/miden-client-core/src/store/errors.rs similarity index 100% rename from crates/rust-client/src/store/errors.rs rename to crates/miden-client-core/src/store/errors.rs diff --git a/crates/rust-client/src/store/mod.rs b/crates/miden-client-core/src/store/mod.rs similarity index 100% rename from crates/rust-client/src/store/mod.rs rename to crates/miden-client-core/src/store/mod.rs diff --git a/crates/rust-client/src/store/note_record/input_note_record/mod.rs b/crates/miden-client-core/src/store/note_record/input_note_record/mod.rs similarity index 100% rename from crates/rust-client/src/store/note_record/input_note_record/mod.rs rename to crates/miden-client-core/src/store/note_record/input_note_record/mod.rs diff --git a/crates/rust-client/src/store/note_record/input_note_record/states/committed.rs b/crates/miden-client-core/src/store/note_record/input_note_record/states/committed.rs similarity index 100% rename from crates/rust-client/src/store/note_record/input_note_record/states/committed.rs rename to crates/miden-client-core/src/store/note_record/input_note_record/states/committed.rs diff --git a/crates/rust-client/src/store/note_record/input_note_record/states/consumed_authenticated_local.rs b/crates/miden-client-core/src/store/note_record/input_note_record/states/consumed_authenticated_local.rs similarity index 100% rename from crates/rust-client/src/store/note_record/input_note_record/states/consumed_authenticated_local.rs rename to crates/miden-client-core/src/store/note_record/input_note_record/states/consumed_authenticated_local.rs diff --git a/crates/rust-client/src/store/note_record/input_note_record/states/consumed_external.rs b/crates/miden-client-core/src/store/note_record/input_note_record/states/consumed_external.rs similarity index 100% rename from crates/rust-client/src/store/note_record/input_note_record/states/consumed_external.rs rename to crates/miden-client-core/src/store/note_record/input_note_record/states/consumed_external.rs diff --git a/crates/rust-client/src/store/note_record/input_note_record/states/consumed_unauthenticated_local.rs b/crates/miden-client-core/src/store/note_record/input_note_record/states/consumed_unauthenticated_local.rs similarity index 100% rename from crates/rust-client/src/store/note_record/input_note_record/states/consumed_unauthenticated_local.rs rename to crates/miden-client-core/src/store/note_record/input_note_record/states/consumed_unauthenticated_local.rs diff --git a/crates/rust-client/src/store/note_record/input_note_record/states/expected.rs b/crates/miden-client-core/src/store/note_record/input_note_record/states/expected.rs similarity index 100% rename from crates/rust-client/src/store/note_record/input_note_record/states/expected.rs rename to crates/miden-client-core/src/store/note_record/input_note_record/states/expected.rs diff --git a/crates/rust-client/src/store/note_record/input_note_record/states/invalid.rs b/crates/miden-client-core/src/store/note_record/input_note_record/states/invalid.rs similarity index 100% rename from crates/rust-client/src/store/note_record/input_note_record/states/invalid.rs rename to crates/miden-client-core/src/store/note_record/input_note_record/states/invalid.rs diff --git a/crates/rust-client/src/store/note_record/input_note_record/states/mod.rs b/crates/miden-client-core/src/store/note_record/input_note_record/states/mod.rs similarity index 100% rename from crates/rust-client/src/store/note_record/input_note_record/states/mod.rs rename to crates/miden-client-core/src/store/note_record/input_note_record/states/mod.rs diff --git a/crates/rust-client/src/store/note_record/input_note_record/states/processing_authenticated.rs b/crates/miden-client-core/src/store/note_record/input_note_record/states/processing_authenticated.rs similarity index 100% rename from crates/rust-client/src/store/note_record/input_note_record/states/processing_authenticated.rs rename to crates/miden-client-core/src/store/note_record/input_note_record/states/processing_authenticated.rs diff --git a/crates/rust-client/src/store/note_record/input_note_record/states/processing_unauthenticated.rs b/crates/miden-client-core/src/store/note_record/input_note_record/states/processing_unauthenticated.rs similarity index 100% rename from crates/rust-client/src/store/note_record/input_note_record/states/processing_unauthenticated.rs rename to crates/miden-client-core/src/store/note_record/input_note_record/states/processing_unauthenticated.rs diff --git a/crates/rust-client/src/store/note_record/input_note_record/states/unverified.rs b/crates/miden-client-core/src/store/note_record/input_note_record/states/unverified.rs similarity index 100% rename from crates/rust-client/src/store/note_record/input_note_record/states/unverified.rs rename to crates/miden-client-core/src/store/note_record/input_note_record/states/unverified.rs diff --git a/crates/rust-client/src/store/note_record/mod.rs b/crates/miden-client-core/src/store/note_record/mod.rs similarity index 100% rename from crates/rust-client/src/store/note_record/mod.rs rename to crates/miden-client-core/src/store/note_record/mod.rs diff --git a/crates/rust-client/src/store/note_record/output_note_record/mod.rs b/crates/miden-client-core/src/store/note_record/output_note_record/mod.rs similarity index 100% rename from crates/rust-client/src/store/note_record/output_note_record/mod.rs rename to crates/miden-client-core/src/store/note_record/output_note_record/mod.rs diff --git a/crates/rust-client/src/store/web_store/js/transactions.js.map b/crates/miden-client-core/src/store/web_store/js/transactions.js.map similarity index 100% rename from crates/rust-client/src/store/web_store/js/transactions.js.map rename to crates/miden-client-core/src/store/web_store/js/transactions.js.map diff --git a/crates/rust-client/src/sync/block_header.rs b/crates/miden-client-core/src/sync/block_header.rs similarity index 100% rename from crates/rust-client/src/sync/block_header.rs rename to crates/miden-client-core/src/sync/block_header.rs diff --git a/crates/rust-client/src/sync/mod.rs b/crates/miden-client-core/src/sync/mod.rs similarity index 98% rename from crates/rust-client/src/sync/mod.rs rename to crates/miden-client-core/src/sync/mod.rs index 737a8f44e..c8072f13f 100644 --- a/crates/rust-client/src/sync/mod.rs +++ b/crates/miden-client-core/src/sync/mod.rs @@ -64,11 +64,10 @@ use miden_protocol::account::AccountId; use miden_protocol::block::BlockNumber; use miden_protocol::note::{NoteId, NoteTag}; use miden_protocol::transaction::TransactionId; -use miden_tx::auth::TransactionAuthenticator; use miden_tx::utils::{Deserializable, DeserializationError, Serializable}; use tracing::{debug, info}; -use crate::note::NoteScreener; +use crate::note::{NoteScreener, NoteScreenerAuth}; use crate::store::{NoteFilter, TransactionFilter}; use crate::{Client, ClientError}; mod block_header; @@ -90,7 +89,7 @@ pub use state_sync_update::{ /// Client synchronization methods. impl Client where - AUTH: TransactionAuthenticator + Sync + 'static, + AUTH: NoteScreenerAuth + 'static, { // SYNC STATE // -------------------------------------------------------------------------------------------- @@ -119,7 +118,10 @@ where /// state. /// 7. The MMR is updated with the new peaks and authentication nodes. /// 8. All updates are applied to the store to be persisted. - pub async fn sync_state(&mut self) -> Result { + pub async fn sync_state(&mut self) -> Result + where + AUTH: NoteScreenerAuth, + { _ = self.ensure_genesis_in_place().await?; let note_screener = NoteScreener::new(self.store.clone(), self.authenticator.clone()); @@ -196,7 +198,7 @@ where // ================================================================================================ /// Contains stats about the sync operation. -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Clone)] pub struct SyncSummary { /// Block number up to which the client has been synced. pub block_num: BlockNumber, diff --git a/crates/rust-client/src/sync/state_sync.rs b/crates/miden-client-core/src/sync/state_sync.rs similarity index 98% rename from crates/rust-client/src/sync/state_sync.rs rename to crates/miden-client-core/src/sync/state_sync.rs index adf7cc73c..7bac5cbf8 100644 --- a/crates/rust-client/src/sync/state_sync.rs +++ b/crates/miden-client-core/src/sync/state_sync.rs @@ -3,7 +3,6 @@ use alloc::collections::{BTreeMap, BTreeSet}; use alloc::sync::Arc; use alloc::vec::Vec; -use async_trait::async_trait; use miden_protocol::Word; use miden_protocol::account::{Account, AccountHeader, AccountId}; use miden_protocol::block::{BlockHeader, BlockNumber}; @@ -37,7 +36,8 @@ pub enum NoteUpdateAction { Discard, } -#[async_trait(?Send)] +#[cfg_attr(feature = "std", async_trait::async_trait)] +#[cfg_attr(not(feature = "std"), async_trait::async_trait(?Send))] pub trait OnNoteReceived { /// Callback that gets executed when a new note is received as part of the sync response. /// @@ -65,13 +65,19 @@ pub trait OnNoteReceived { /// /// When created it receives a callback that will be executed when a new note inclusion is received /// in the sync response. +#[cfg(feature = "std")] +type NoteScreenerHandle = Arc; + +#[cfg(not(feature = "std"))] +type NoteScreenerHandle = Arc; + #[derive(Clone)] pub struct StateSync { /// The RPC client used to communicate with the node. rpc_api: Arc, /// Responsible for checking the relevance of notes and executing the /// [`OnNoteReceived`] callback when a new note inclusion is received. - note_screener: Arc, + note_screener: NoteScreenerHandle, /// The number of blocks that are considered old enough to discard pending transactions. If /// `None`, there is no limit and transactions will be kept indefinitely. tx_graceful_blocks: Option, @@ -88,7 +94,7 @@ impl StateSync { /// * `note_screener` - The note screener used to check the relevance of notes. pub fn new( rpc_api: Arc, - note_screener: Arc, + note_screener: NoteScreenerHandle, tx_graceful_blocks: Option, ) -> Self { Self { diff --git a/crates/rust-client/src/sync/state_sync_update.rs b/crates/miden-client-core/src/sync/state_sync_update.rs similarity index 100% rename from crates/rust-client/src/sync/state_sync_update.rs rename to crates/miden-client-core/src/sync/state_sync_update.rs diff --git a/crates/rust-client/src/sync/tag.rs b/crates/miden-client-core/src/sync/tag.rs similarity index 100% rename from crates/rust-client/src/sync/tag.rs rename to crates/miden-client-core/src/sync/tag.rs diff --git a/crates/rust-client/src/test_utils/common.rs b/crates/miden-client-core/src/test_utils/common.rs similarity index 100% rename from crates/rust-client/src/test_utils/common.rs rename to crates/miden-client-core/src/test_utils/common.rs diff --git a/crates/rust-client/src/test_utils/mock.rs b/crates/miden-client-core/src/test_utils/mock.rs similarity index 100% rename from crates/rust-client/src/test_utils/mock.rs rename to crates/miden-client-core/src/test_utils/mock.rs diff --git a/crates/rust-client/src/test_utils/mod.rs b/crates/miden-client-core/src/test_utils/mod.rs similarity index 100% rename from crates/rust-client/src/test_utils/mod.rs rename to crates/miden-client-core/src/test_utils/mod.rs diff --git a/crates/rust-client/src/test_utils/note_transport.rs b/crates/miden-client-core/src/test_utils/note_transport.rs similarity index 100% rename from crates/rust-client/src/test_utils/note_transport.rs rename to crates/miden-client-core/src/test_utils/note_transport.rs diff --git a/crates/rust-client/src/transaction/mod.rs b/crates/miden-client-core/src/transaction/mod.rs similarity index 99% rename from crates/rust-client/src/transaction/mod.rs rename to crates/miden-client-core/src/transaction/mod.rs index 3dc479ba0..8cb8b8ec7 100644 --- a/crates/rust-client/src/transaction/mod.rs +++ b/crates/miden-client-core/src/transaction/mod.rs @@ -78,7 +78,7 @@ use tracing::info; use super::Client; use crate::ClientError; -use crate::note::{NoteScreener, NoteUpdateTracker}; +use crate::note::{NoteScreener, NoteScreenerAuth, NoteUpdateTracker}; use crate::rpc::AccountStateAt; use crate::store::data_store::ClientDataStore; use crate::store::input_note_states::ExpectedNoteState; @@ -150,7 +150,7 @@ pub use result::TransactionResult; /// Transaction management methods impl Client where - AUTH: TransactionAuthenticator + Sync + 'static, + AUTH: NoteScreenerAuth + 'static, { // TRANSACTION DATA RETRIEVAL // -------------------------------------------------------------------------------------------- @@ -503,7 +503,10 @@ where &self, submission_height: BlockNumber, tx_result: &TransactionResult, - ) -> Result { + ) -> Result + where + AUTH: NoteScreenerAuth, + { let executed_tx = tx_result.executed_transaction(); let current_timestamp = self.store.get_current_timestamp(); let current_block_num = self.store.get_sync_height().await?; diff --git a/crates/rust-client/src/transaction/prover.rs b/crates/miden-client-core/src/transaction/prover.rs similarity index 100% rename from crates/rust-client/src/transaction/prover.rs rename to crates/miden-client-core/src/transaction/prover.rs diff --git a/crates/rust-client/src/transaction/record.rs b/crates/miden-client-core/src/transaction/record.rs similarity index 100% rename from crates/rust-client/src/transaction/record.rs rename to crates/miden-client-core/src/transaction/record.rs diff --git a/crates/rust-client/src/transaction/request/builder.rs b/crates/miden-client-core/src/transaction/request/builder.rs similarity index 100% rename from crates/rust-client/src/transaction/request/builder.rs rename to crates/miden-client-core/src/transaction/request/builder.rs diff --git a/crates/rust-client/src/transaction/request/foreign.rs b/crates/miden-client-core/src/transaction/request/foreign.rs similarity index 100% rename from crates/rust-client/src/transaction/request/foreign.rs rename to crates/miden-client-core/src/transaction/request/foreign.rs diff --git a/crates/rust-client/src/transaction/request/mod.rs b/crates/miden-client-core/src/transaction/request/mod.rs similarity index 99% rename from crates/rust-client/src/transaction/request/mod.rs rename to crates/miden-client-core/src/transaction/request/mod.rs index 08c48f613..132ae0dd8 100644 --- a/crates/rust-client/src/transaction/request/mod.rs +++ b/crates/miden-client-core/src/transaction/request/mod.rs @@ -104,6 +104,10 @@ pub struct TransactionRequest { } impl TransactionRequest { + pub fn builder() -> TransactionRequestBuilder { + TransactionRequestBuilder::new() + } + // PUBLIC ACCESSORS // -------------------------------------------------------------------------------------------- diff --git a/crates/rust-client/src/transaction/result.rs b/crates/miden-client-core/src/transaction/result.rs similarity index 100% rename from crates/rust-client/src/transaction/result.rs rename to crates/miden-client-core/src/transaction/result.rs diff --git a/crates/rust-client/src/transaction/store_update.rs b/crates/miden-client-core/src/transaction/store_update.rs similarity index 100% rename from crates/rust-client/src/transaction/store_update.rs rename to crates/miden-client-core/src/transaction/store_update.rs diff --git a/crates/rust-client/src/utils.rs b/crates/miden-client-core/src/utils.rs similarity index 100% rename from crates/rust-client/src/utils.rs rename to crates/miden-client-core/src/utils.rs diff --git a/crates/miden-client/Cargo.toml b/crates/miden-client/Cargo.toml new file mode 100644 index 000000000..c69ddad83 --- /dev/null +++ b/crates/miden-client/Cargo.toml @@ -0,0 +1,31 @@ +[package] +authors.workspace = true +categories = ["asynchronous"] +description = "Std-enabled orchestration layer for interacting with the Miden network" +documentation = "https://docs.rs/miden-client/0.13.0" +edition.workspace = true +keywords = ["client", "miden", "service"] +license.workspace = true +name = "miden-client" +readme = "README.md" +repository.workspace = true +rust-version.workspace = true +version.workspace = true + +[features] +default = ["std"] +std = ["miden-client-core/std"] +testing = ["miden-client-core/testing", "std"] +tonic = ["miden-client-core/tonic", "std"] + +[dependencies] +anyhow = { workspace = true } +async-trait = { workspace = true } +futures = { version = "0.3" } +miden-client-core = { default-features = false, path = "../miden-client-core" } +thiserror = { workspace = true } +tokio = { workspace = true } +tracing = { workspace = true } + +[lints] +workspace = true diff --git a/crates/miden-client/README.md b/crates/miden-client/README.md new file mode 100644 index 000000000..2eff3689e --- /dev/null +++ b/crates/miden-client/README.md @@ -0,0 +1,64 @@ +# miden-client + +`miden-client` provides a std-enabled orchestration layer around the `miden-client-core` +functionality. It exposes the background service, handler registration, and other utilities for +running the client in long-lived server applications. + +The crate re-exports everything from `miden-client-core`, so existing consumers can migrate +incrementally while gaining access to the new service abstractions. + +## Quick start + +```rust +use std::sync::Arc; +use std::time::Duration; + +use miden_client::builder::ClientBuilder; +use miden_client::service::{ClientRuntime, ClientServiceConfig, ClientServiceError, SyncEvent}; +use miden_client::keystore::FilesystemKeyStore; +use miden_client::note::NoteTag; +use miden_client_sqlite_store::ClientBuilderSqliteExt; + +# #[tokio::main] +async fn main() -> Result<(), ClientServiceError> { + // Build the core client as usual. + let client = ClientBuilder::>::new() + .sqlite_store("./client.sqlite3") + .filesystem_keystore("./keys") + .build() + .await?; + + // Start the background runtime with a 5 second polling interval. + let runtime = ClientRuntime::start(client, ClientServiceConfig::default()).await?; + let handle = runtime.handle(); + + // Register a blocking handler that logs new notes. + handle + .register_blocking_handler(|_handle, event: SyncEvent| async move { + if !event.summary.received_notes.is_empty() { + tracing::info!(?event.summary.received_notes, "new notes received"); + } + Ok(()) + }) + .await; + + // Trigger an immediate sync in addition to the background interval. + handle.trigger_sync(); + + // Update tracked note tags without blocking reads from other tasks. + handle + .add_note_tag(NoteTag::from_word(miden_client::Word::default())) + .await?; + + // Application code can now execute transactions while the background service keeps the + // client in sync. + + // When shutting down, drop the runtime or call `runtime.shutdown().await` explicitly. + runtime.shutdown().await; + + Ok(()) +} +``` + +See the [`service` module documentation](https://docs.rs/miden-client) for more details on the +available APIs, including transaction queues, handler management, and manual sync controls. diff --git a/crates/miden-client/src/lib.rs b/crates/miden-client/src/lib.rs new file mode 100644 index 000000000..237f7c4f1 --- /dev/null +++ b/crates/miden-client/src/lib.rs @@ -0,0 +1,17 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +pub use miden_client_core::*; + +#[cfg(feature = "std")] +pub mod service; + +#[cfg(feature = "std")] +pub use service::{ + ClientHandle, + ClientRuntime, + ClientServiceConfig, + ClientServiceError, + HandlerError, + HandlerId, + SyncEvent, +}; diff --git a/crates/miden-client/src/service/config.rs b/crates/miden-client/src/service/config.rs new file mode 100644 index 000000000..e404860a6 --- /dev/null +++ b/crates/miden-client/src/service/config.rs @@ -0,0 +1,20 @@ +use std::time::Duration; + +/// Configuration options for the [`ClientRuntime`](crate::service::ClientRuntime). +#[derive(Debug, Clone)] +pub struct ClientServiceConfig { + /// Interval at which the background sync loop will poll the chain. + /// If `None`, the service will only sync when explicitly triggered. + pub sync_interval: Option, + /// Whether an initial sync should be performed before the background task starts looping. + pub initial_sync: bool, +} + +impl Default for ClientServiceConfig { + fn default() -> Self { + Self { + sync_interval: Some(Duration::from_secs(5)), + initial_sync: true, + } + } +} diff --git a/crates/miden-client/src/service/error.rs b/crates/miden-client/src/service/error.rs new file mode 100644 index 000000000..99041ec70 --- /dev/null +++ b/crates/miden-client/src/service/error.rs @@ -0,0 +1,28 @@ +use anyhow::Error as AnyhowError; +use miden_client_core::ClientError; +use thiserror::Error; + +/// Error type produced by service operations. +#[derive(Debug, Error)] +pub enum ClientServiceError { + #[error(transparent)] + Client(#[from] ClientError), + #[error(transparent)] + Handler(#[from] HandlerError), + #[error("service is shutting down")] + ShuttingDown, +} + +/// Error returned by sync handlers. +#[derive(Debug, Error)] +pub enum HandlerError { + #[error(transparent)] + Other(#[from] AnyhowError), +} + +impl HandlerError { + #[must_use] + pub fn new(err: impl Into) -> Self { + Self::Other(err.into()) + } +} diff --git a/crates/miden-client/src/service/event.rs b/crates/miden-client/src/service/event.rs new file mode 100644 index 000000000..ad15831ca --- /dev/null +++ b/crates/miden-client/src/service/event.rs @@ -0,0 +1,25 @@ +use std::sync::atomic::{AtomicU64, Ordering}; +use std::time::Instant; + +use miden_client_core::sync::SyncSummary; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub struct HandlerId(u64); + +impl HandlerId { + pub fn next(counter: &AtomicU64) -> Self { + Self(counter.fetch_add(1, Ordering::Relaxed)) + } +} + +#[derive(Debug, Clone)] +pub struct SyncEvent { + pub summary: SyncSummary, + pub timestamp: Instant, +} + +impl SyncEvent { + pub fn new(summary: SyncSummary) -> Self { + Self { summary, timestamp: Instant::now() } + } +} diff --git a/crates/miden-client/src/service/handle.rs b/crates/miden-client/src/service/handle.rs new file mode 100644 index 000000000..338b0afcc --- /dev/null +++ b/crates/miden-client/src/service/handle.rs @@ -0,0 +1,205 @@ +use std::future::Future; +use std::pin::Pin; +use std::sync::Arc; + +use miden_client_core::account::AccountId; +use miden_client_core::block::BlockNumber; +use miden_client_core::note::NoteTag; +use miden_client_core::store::Store; +use miden_client_core::transaction::{ + ProvenTransaction, + TransactionAuthenticator, + TransactionInputs, + TransactionProver, + TransactionRequest, + TransactionResult, +}; +use miden_client_core::{Client, ClientError}; + +use super::config::ClientServiceConfig; +use super::error::{ClientServiceError, HandlerError}; +use super::event::{HandlerId, SyncEvent}; +use super::inner::{BlockingHandlerFuture, NonBlockingHandlerFuture, ServiceInner}; + +pub(super) type ClientFuture<'a, T> = Pin> + 'a>>; + +pub struct ClientHandle +where + AUTH: TransactionAuthenticator + Send + Sync + 'static, +{ + pub(super) inner: Arc>, +} + +impl Clone for ClientHandle +where + AUTH: TransactionAuthenticator + Send + Sync + 'static, +{ + fn clone(&self) -> Self { + Self { inner: Arc::clone(&self.inner) } + } +} + +impl ClientHandle +where + AUTH: TransactionAuthenticator + Send + Sync + 'static, +{ + pub(super) fn new(inner: Arc>) -> Self { + Self { inner } + } + + pub fn config(&self) -> ClientServiceConfig { + self.inner.config.clone() + } + + pub fn store(&self) -> Arc { + self.inner.store() + } + + pub async fn with_client(&self, f: F) -> Result + where + F: for<'a> FnOnce(&'a mut Client) -> ClientFuture<'a, T>, + { + if self.inner.is_shutdown() { + return Err(ClientServiceError::ShuttingDown); + } + + let mut guard = self.inner.client.lock().await; + let result = f(&mut *guard).await?; + Ok(result) + } + + pub async fn sync_now(&self) -> Result { + if self.inner.is_shutdown() { + return Err(ClientServiceError::ShuttingDown); + } + + let summary = ServiceInner::sync_once(&self.inner).await?; + let event = SyncEvent::new(summary.clone()); + ServiceInner::dispatch_handlers(&self.inner, self.clone(), event.clone()).await?; + Ok(event) + } + + pub fn trigger_sync(&self) { + self.inner.sync_trigger.notify_one(); + } + + pub async fn register_blocking_handler(&self, handler: F) -> HandlerId + where + F: Fn(ClientHandle, SyncEvent) -> Fut + Send + Sync + 'static, + Fut: Future> + Send + 'static, + { + let id = self.inner.generate_handler_id(); + let handler = Arc::new(move |handle: ClientHandle, event: SyncEvent| { + Box::pin(handler(handle, event)) as BlockingHandlerFuture + }); + + self.inner.blocking_handlers.write().await.insert(id, handler); + id + } + + pub async fn register_non_blocking_handler(&self, handler: F) -> HandlerId + where + F: Fn(ClientHandle, SyncEvent) -> Fut + Send + Sync + 'static, + Fut: Future> + Send + 'static, + { + let id = self.inner.generate_handler_id(); + let handler = Arc::new(move |handle: ClientHandle, event: SyncEvent| { + Box::pin(handler(handle, event)) as NonBlockingHandlerFuture + }); + + self.inner.non_blocking_handlers.write().await.insert(id, handler); + id + } + + pub async fn unregister_blocking_handler(&self, id: HandlerId) { + self.inner.blocking_handlers.write().await.remove(&id); + } + + pub async fn unregister_non_blocking_handler(&self, id: HandlerId) { + self.inner.non_blocking_handlers.write().await.remove(&id); + } + + pub async fn execute_transaction( + &self, + account_id: AccountId, + request: TransactionRequest, + ) -> Result { + self.with_client(move |client| { + Box::pin(async move { client.execute_transaction(account_id, request).await }) + }) + .await + } + + pub async fn prove_transaction( + &self, + tx_result: &TransactionResult, + prover: Option>, + ) -> Result { + let prover = if let Some(prover) = prover { + prover + } else { + let client = self.inner.client.lock().await; + client.transaction_prover() + }; + + let executed = tx_result.executed_transaction().clone().into(); + let proven_tx = prover.prove(executed).await.map_err(ClientError::from)?; + + Ok(proven_tx) + } + + pub async fn submit_proven_transaction( + &self, + proven_transaction: ProvenTransaction, + tx_inputs: TransactionInputs, + ) -> Result { + self.with_client(move |client| { + Box::pin(async move { + client.submit_proven_transaction(proven_transaction, tx_inputs).await + }) + }) + .await + } + + pub async fn apply_transaction( + &self, + submission_height: BlockNumber, + tx_result: TransactionResult, + ) -> Result<(), ClientServiceError> { + self.with_client(move |client| { + Box::pin(async move { client.apply_transaction(&tx_result, submission_height).await }) + }) + .await + } + + pub async fn prove_submit_and_apply( + &self, + tx_result: TransactionResult, + prover: Option>, + ) -> Result<(), ClientServiceError> { + let tx_inputs = tx_result.executed_transaction().tx_inputs().clone(); + let proven_tx = self.prove_transaction(&tx_result, prover).await?; + let block_num = self.submit_proven_transaction(proven_tx, tx_inputs).await?; + self.apply_transaction(block_num, tx_result).await + } + + pub async fn execute_full_transaction( + &self, + account_id: AccountId, + request: TransactionRequest, + prover: Option>, + ) -> Result<(), ClientServiceError> { + let tx_result = self.execute_transaction(account_id, request).await?; + self.prove_submit_and_apply(tx_result, prover).await + } + + pub async fn add_note_tag(&self, tag: NoteTag) -> Result<(), ClientServiceError> { + self.with_client(move |client| Box::pin(async move { client.add_note_tag(tag).await })) + .await + } + + pub async fn remove_note_tag(&self, tag: NoteTag) -> Result<(), ClientServiceError> { + self.with_client(move |client| Box::pin(async move { client.remove_note_tag(tag).await })) + .await + } +} diff --git a/crates/miden-client/src/service/inner.rs b/crates/miden-client/src/service/inner.rs new file mode 100644 index 000000000..086305cf4 --- /dev/null +++ b/crates/miden-client/src/service/inner.rs @@ -0,0 +1,123 @@ +use std::collections::HashMap; +use std::future::Future; +use std::pin::Pin; +use std::sync::Arc; +use std::sync::atomic::{AtomicBool, AtomicU64, Ordering}; + +use miden_client_core::Client; +use miden_client_core::store::Store; +use miden_client_core::sync::SyncSummary; +use miden_client_core::transaction::TransactionAuthenticator; +use tokio::sync::{Mutex, Notify, RwLock}; +use tracing::{error, trace}; + +use super::config::ClientServiceConfig; +use super::error::{ClientServiceError, HandlerError}; +use super::event::{HandlerId, SyncEvent}; +use super::handle::ClientHandle; + +pub(super) type BlockingHandlerFuture = + Pin> + Send + 'static>>; +pub(super) type NonBlockingHandlerFuture = + Pin> + Send + 'static>>; + +pub(super) type BlockingHandler = + Arc, SyncEvent) -> BlockingHandlerFuture + Send + Sync>; +pub(super) type NonBlockingHandler = + Arc, SyncEvent) -> NonBlockingHandlerFuture + Send + Sync>; + +pub(super) struct ServiceInner +where + AUTH: TransactionAuthenticator + Send + Sync + 'static, +{ + pub(super) client: Mutex>, + pub(super) store: Arc, + pub(super) blocking_handlers: RwLock>>, + pub(super) non_blocking_handlers: RwLock>>, + pub(super) handler_seq: AtomicU64, + + pub(super) sync_trigger: Notify, + pub(super) shutdown: AtomicBool, + pub(super) sync_lock: Mutex<()>, + pub(super) config: ClientServiceConfig, +} + +impl ServiceInner +where + AUTH: TransactionAuthenticator + Send + Sync + 'static, +{ + pub(super) fn new(client: Client, config: ClientServiceConfig) -> Arc { + Arc::new(Self { + store: client.store(), + client: Mutex::new(client), + blocking_handlers: RwLock::new(HashMap::new()), + non_blocking_handlers: RwLock::new(HashMap::new()), + handler_seq: AtomicU64::new(0), + sync_trigger: Notify::new(), + shutdown: AtomicBool::new(false), + sync_lock: Mutex::new(()), + config, + }) + } + + pub(super) fn store(&self) -> Arc { + self.store.clone() + } + + pub(super) fn generate_handler_id(&self) -> HandlerId { + HandlerId::next(&self.handler_seq) + } + + pub(super) fn is_shutdown(&self) -> bool { + self.shutdown.load(Ordering::Relaxed) + } + + pub(super) fn signal_shutdown(&self) { + if !self.shutdown.swap(true, Ordering::Relaxed) { + self.sync_trigger.notify_waiters(); + } + } + + pub(super) async fn sync_once(this: &Arc) -> Result { + let _sync_guard = this.sync_lock.lock().await; + let mut client = this.client.lock().await; + let summary = client.sync_state().await?; + drop(client); + + Ok(summary) + } + + pub(super) async fn dispatch_handlers( + this: &Arc, + handle: ClientHandle, + event: SyncEvent, + ) -> Result<(), ClientServiceError> { + let blocking_handlers: Vec<_> = { + let guard = this.blocking_handlers.read().await; + guard.values().cloned().collect() + }; + + for handler in blocking_handlers { + handler(handle.clone(), event.clone()).await?; + } + + let non_blocking_handlers: Vec<_> = { + let guard = this.non_blocking_handlers.read().await; + guard.values().cloned().collect() + }; + + for handler in non_blocking_handlers { + let handle = handle.clone(); + let event = event.clone(); + tokio::spawn(async move { + if let Err(err) = handler(handle, event).await { + error!(?err, "non-blocking sync handler failed"); + } + }); + } + + trace!("handlers dispatched"); + + Ok(()) + } +} diff --git a/crates/miden-client/src/service/mod.rs b/crates/miden-client/src/service/mod.rs new file mode 100644 index 000000000..bdaa88fe6 --- /dev/null +++ b/crates/miden-client/src/service/mod.rs @@ -0,0 +1,12 @@ +mod config; +mod error; +mod event; +mod handle; +mod inner; +mod runtime; + +pub use config::ClientServiceConfig; +pub use error::{ClientServiceError, HandlerError}; +pub use event::{HandlerId, SyncEvent}; +pub use handle::ClientHandle; +pub use runtime::ClientRuntime; diff --git a/crates/miden-client/src/service/runtime.rs b/crates/miden-client/src/service/runtime.rs new file mode 100644 index 000000000..0d90433c6 --- /dev/null +++ b/crates/miden-client/src/service/runtime.rs @@ -0,0 +1,129 @@ +use std::sync::Arc; + +use miden_client_core::Client; +use miden_client_core::transaction::TransactionAuthenticator; +use tokio::select; +use tokio::task::JoinHandle; +use tracing::{debug, error, trace}; + +use super::config::ClientServiceConfig; +use super::error::ClientServiceError; +use super::event::SyncEvent; +use super::handle::ClientHandle; +use super::inner::ServiceInner; + +pub struct ClientRuntime +where + AUTH: TransactionAuthenticator + Send + Sync + 'static, +{ + inner: Arc>, + sync_task: Option>, +} + +impl std::fmt::Debug for ClientRuntime +where + AUTH: TransactionAuthenticator + Send + Sync + 'static, +{ + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("ClientRuntime").finish_non_exhaustive() + } +} + +impl ClientRuntime +where + AUTH: TransactionAuthenticator + Send + Sync + 'static, +{ + pub async fn start( + client: Client, + config: ClientServiceConfig, + ) -> Result { + let inner = ServiceInner::new(client, config); + let handle = ClientHandle::new(inner.clone()); + + if handle.config().initial_sync { + let summary = ServiceInner::sync_once(&inner).await?; + let event = SyncEvent::new(summary.clone()); + ServiceInner::dispatch_handlers(&inner, handle.clone(), event).await?; + } + + let sync_task = Some(spawn_sync_loop(inner.clone())); + + Ok(Self { inner, sync_task }) + } + + pub fn handle(&self) -> ClientHandle { + ClientHandle::new(self.inner.clone()) + } + + pub fn config(&self) -> ClientServiceConfig { + self.inner.config.clone() + } + + pub async fn shutdown(mut self) { + self.inner.signal_shutdown(); + if let Some(task) = self.sync_task.take() { + task.abort(); + let _ = task.await; + } + } +} + +impl Drop for ClientRuntime +where + AUTH: TransactionAuthenticator + Send + Sync + 'static, +{ + fn drop(&mut self) { + self.inner.signal_shutdown(); + if let Some(task) = &self.sync_task { + task.abort(); + } + } +} + +fn spawn_sync_loop(inner: Arc>) -> JoinHandle<()> +where + AUTH: TransactionAuthenticator + Send + Sync + 'static, +{ + tokio::spawn(async move { + let mut interval = inner.config.sync_interval.map(tokio::time::interval); + let handle = ClientHandle::new(inner.clone()); + + loop { + if inner.is_shutdown() { + break; + } + + match &mut interval { + Some(interval) => { + select! { + _ = interval.tick() => {}, + _ = inner.sync_trigger.notified() => {}, + } + }, + None => { + inner.sync_trigger.notified().await; + }, + } + + if inner.is_shutdown() { + break; + } + + match ServiceInner::sync_once(&inner).await { + Ok(summary) => { + let event = SyncEvent::new(summary.clone()); + if let Err(err) = + ServiceInner::dispatch_handlers(&inner, handle.clone(), event).await + { + error!(?err, "error running sync handlers"); + } else { + trace!("client state synced"); + } + }, + Err(err) => error!(?err, "background sync failed"), + } + } + + debug!("client sync loop stopped"); + }) +} diff --git a/crates/rust-client/src/store/web_store/tsconfig.tsbuildinfo b/crates/rust-client/src/store/web_store/tsconfig.tsbuildinfo deleted file mode 100644 index adb11bb0e..000000000 --- a/crates/rust-client/src/store/web_store/tsconfig.tsbuildinfo +++ /dev/null @@ -1 +0,0 @@ -{"fileNames":["./node_modules/typescript/lib/lib.es5.d.ts","./node_modules/typescript/lib/lib.es2015.d.ts","./node_modules/typescript/lib/lib.es2016.d.ts","./node_modules/typescript/lib/lib.es2017.d.ts","./node_modules/typescript/lib/lib.es2018.d.ts","./node_modules/typescript/lib/lib.es2019.d.ts","./node_modules/typescript/lib/lib.es2020.d.ts","./node_modules/typescript/lib/lib.es2021.d.ts","./node_modules/typescript/lib/lib.es2022.d.ts","./node_modules/typescript/lib/lib.es2023.d.ts","./node_modules/typescript/lib/lib.es2024.d.ts","./node_modules/typescript/lib/lib.esnext.d.ts","./node_modules/typescript/lib/lib.dom.d.ts","./node_modules/typescript/lib/lib.dom.iterable.d.ts","./node_modules/typescript/lib/lib.dom.asynciterable.d.ts","./node_modules/typescript/lib/lib.webworker.importscripts.d.ts","./node_modules/typescript/lib/lib.scripthost.d.ts","./node_modules/typescript/lib/lib.es2015.core.d.ts","./node_modules/typescript/lib/lib.es2015.collection.d.ts","./node_modules/typescript/lib/lib.es2015.generator.d.ts","./node_modules/typescript/lib/lib.es2015.iterable.d.ts","./node_modules/typescript/lib/lib.es2015.promise.d.ts","./node_modules/typescript/lib/lib.es2015.proxy.d.ts","./node_modules/typescript/lib/lib.es2015.reflect.d.ts","./node_modules/typescript/lib/lib.es2015.symbol.d.ts","./node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","./node_modules/typescript/lib/lib.es2016.array.include.d.ts","./node_modules/typescript/lib/lib.es2016.intl.d.ts","./node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","./node_modules/typescript/lib/lib.es2017.date.d.ts","./node_modules/typescript/lib/lib.es2017.object.d.ts","./node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2017.string.d.ts","./node_modules/typescript/lib/lib.es2017.intl.d.ts","./node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","./node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","./node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","./node_modules/typescript/lib/lib.es2018.intl.d.ts","./node_modules/typescript/lib/lib.es2018.promise.d.ts","./node_modules/typescript/lib/lib.es2018.regexp.d.ts","./node_modules/typescript/lib/lib.es2019.array.d.ts","./node_modules/typescript/lib/lib.es2019.object.d.ts","./node_modules/typescript/lib/lib.es2019.string.d.ts","./node_modules/typescript/lib/lib.es2019.symbol.d.ts","./node_modules/typescript/lib/lib.es2019.intl.d.ts","./node_modules/typescript/lib/lib.es2020.bigint.d.ts","./node_modules/typescript/lib/lib.es2020.date.d.ts","./node_modules/typescript/lib/lib.es2020.promise.d.ts","./node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2020.string.d.ts","./node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","./node_modules/typescript/lib/lib.es2020.intl.d.ts","./node_modules/typescript/lib/lib.es2020.number.d.ts","./node_modules/typescript/lib/lib.es2021.promise.d.ts","./node_modules/typescript/lib/lib.es2021.string.d.ts","./node_modules/typescript/lib/lib.es2021.weakref.d.ts","./node_modules/typescript/lib/lib.es2021.intl.d.ts","./node_modules/typescript/lib/lib.es2022.array.d.ts","./node_modules/typescript/lib/lib.es2022.error.d.ts","./node_modules/typescript/lib/lib.es2022.intl.d.ts","./node_modules/typescript/lib/lib.es2022.object.d.ts","./node_modules/typescript/lib/lib.es2022.string.d.ts","./node_modules/typescript/lib/lib.es2022.regexp.d.ts","./node_modules/typescript/lib/lib.es2023.array.d.ts","./node_modules/typescript/lib/lib.es2023.collection.d.ts","./node_modules/typescript/lib/lib.es2023.intl.d.ts","./node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","./node_modules/typescript/lib/lib.es2024.collection.d.ts","./node_modules/typescript/lib/lib.es2024.object.d.ts","./node_modules/typescript/lib/lib.es2024.promise.d.ts","./node_modules/typescript/lib/lib.es2024.regexp.d.ts","./node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2024.string.d.ts","./node_modules/typescript/lib/lib.esnext.array.d.ts","./node_modules/typescript/lib/lib.esnext.collection.d.ts","./node_modules/typescript/lib/lib.esnext.intl.d.ts","./node_modules/typescript/lib/lib.esnext.disposable.d.ts","./node_modules/typescript/lib/lib.esnext.promise.d.ts","./node_modules/typescript/lib/lib.esnext.decorators.d.ts","./node_modules/typescript/lib/lib.esnext.iterator.d.ts","./node_modules/typescript/lib/lib.esnext.float16.d.ts","./node_modules/typescript/lib/lib.esnext.error.d.ts","./node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts","./node_modules/typescript/lib/lib.decorators.d.ts","./node_modules/typescript/lib/lib.decorators.legacy.d.ts","./node_modules/typescript/lib/lib.esnext.full.d.ts","./node_modules/dexie/dist/dexie.d.ts","./node_modules/dexie/import-wrapper.d.mts","./ts/utils.ts","./ts/schema.ts","./ts/accounts.ts","./ts/chaindata.ts","./ts/export.ts","./ts/import.ts","./ts/notes.ts","./ts/transactions.ts","./ts/sync.ts","./node_modules/@types/estree/index.d.ts","./node_modules/@types/json-schema/index.d.ts"],"fileIdsList":[[87],[89,90],[88,89],[88,89,90,91,95,96],[88,89,90],[88]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","impliedFormat":1},{"version":"8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","impliedFormat":1},{"version":"2ab096661c711e4a81cc464fa1e6feb929a54f5340b46b0a07ac6bbf857471f0","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2e80ee7a49e8ac312cc11b77f1475804bee36b3b2bc896bead8b6e1266befb43","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a","affectsGlobalScope":true,"impliedFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4","affectsGlobalScope":true,"impliedFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9","affectsGlobalScope":true,"impliedFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedFormat":1},{"version":"22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47","affectsGlobalScope":true,"impliedFormat":1},{"version":"4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d","affectsGlobalScope":true,"impliedFormat":1},{"version":"73f78680d4c08509933daf80947902f6ff41b6230f94dd002ae372620adb0f60","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5239f5c01bcfa9cd32f37c496cf19c61d69d37e48be9de612b541aac915805b","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4","impliedFormat":1},{"version":"89c5457ba4071e4c53a700195bc8e676ffa9cd0de990081e4911e71ba48316f0","affectsGlobalScope":true,"impliedFormat":1},{"version":"7db2c6924a1c673b6ea804f001683463adb336bde64698673dc130059e1c15a0","impliedFormat":99},{"version":"32df82919876280b76352a67ad8b6a3aa37f2ef49e9e60118c60dadcf08dc032","signature":"9ef4472ab03740503457dee2391c07de116685c333a40363590b9845d2989764"},{"version":"e1e58dd6e2a0e9d5cebc8a25954a7c9b77635cb28cfbef6039e2c035bf00379e","signature":"4ee21b06d6facc87eab05b61f44850931d0e9ee6ba71b28bf93de865fa79f878"},{"version":"b3f14ac0cc1dfc7d6ca57e93467ddee894ad1f5d4579bb243c34e93a274cd12e","signature":"df8ee13699bc4201d76e363a2095e517bdb93420c4015b47583a022eff0e13c1"},{"version":"70e736447e467ca8bb14c4ee0778cc00e5ba7d865bbc715acf38c7c8d4d42f41","signature":"2a8f48ac4f5ecff2f963a553e6d5cd7d75daa1ca54957e6a5529b00232c93dc2"},{"version":"5198fe2b20994eb8ce29066b12e2cf6830f404e81e667058a99590c8825bbdb7","signature":"fbc663063a706edce82ca36e81085a54e9b412d60f638a1d84100552cc193cfc"},{"version":"a2ce3d3bba32ece20e938fbea55bc069d66f6c671ece28e481712971d6067d63","signature":"f69b536df9fd1382e82e671912b9f5985582aa0cb6faf8d1b7288463b7726d3a"},{"version":"fd5b45663197c9093fc9da6f51eba7145f72256a7aedc051e84bcaa0a7b16800","signature":"14d5d080396c5b95bc7a406a46ba1519814f6e4b688f733c86e3f3787af3b520"},{"version":"364cc6ea06b1a620e955587bf820847fe6e3bb8f2a3d59cdf9a668aa2a4784db","signature":"2387a845165ef276caeb840dadad0287080b9634fd7c0cc0151175c31105270e"},{"version":"286319cd404edd026fb4fe48a8f9d4751c6523edf147555415e02f1c24f98b43","signature":"5391aac25065f701d909aa59b7ff52c4d5299bc82248154e1df730384f220682"},{"version":"151ff381ef9ff8da2da9b9663ebf657eac35c4c9a19183420c05728f31a6761d","impliedFormat":1},{"version":"f3d8c757e148ad968f0d98697987db363070abada5f503da3c06aefd9d4248c1","impliedFormat":1}],"root":[[89,97]],"options":{"allowJs":true,"checkJs":false,"declaration":true,"module":99,"noEmitOnError":true,"outDir":"./js","removeComments":false,"sourceMap":true,"strict":true,"target":99,"tsBuildInfoFile":"./tsconfig.tsbuildinfo"},"referencedMap":[[88,1],[91,2],[92,2],[93,2],[94,2],[95,2],[90,3],[97,4],[96,5],[89,6]],"version":"5.9.2"} \ No newline at end of file diff --git a/crates/sqlite-store/Cargo.toml b/crates/sqlite-store/Cargo.toml index ce9f81f43..f1b539241 100644 --- a/crates/sqlite-store/Cargo.toml +++ b/crates/sqlite-store/Cargo.toml @@ -13,7 +13,7 @@ crate-type = ["lib"] [dependencies] # Miden dependencies -miden-client = { path = "../rust-client" } +miden-client = { path = "../miden-client" } miden-protocol = { workspace = true } # Workspace dependencies @@ -34,5 +34,5 @@ workspace = true [dev-dependencies] # Enable client testing utilities only for tests -miden-client = { features = ["testing"], path = "../rust-client" } -miden-standards = { features = ["testing"], workspace = true } +miden-client = { features = ["testing"], path = "../miden-client" } +miden-protocol = { default-features = false, features = ["testing"], workspace = true } diff --git a/crates/testing/miden-client-tests/Cargo.toml b/crates/testing/miden-client-tests/Cargo.toml index e0cefb3c1..b5704421c 100644 --- a/crates/testing/miden-client-tests/Cargo.toml +++ b/crates/testing/miden-client-tests/Cargo.toml @@ -6,7 +6,7 @@ rust-version.workspace = true version.workspace = true [dev-dependencies] -miden-client = { features = ["std", "testing"], path = "../../rust-client" } +miden-client = { features = ["std", "testing"], path = "../../miden-client" } miden-client-sqlite-store = { path = "../../sqlite-store" } miden-protocol = { default-features = false, features = ["testing"], workspace = true } miden-standards = { features = ["testing"], workspace = true } diff --git a/crates/web-client/Cargo.toml b/crates/web-client/Cargo.toml index bd0ac6482..b75bc2a8a 100644 --- a/crates/web-client/Cargo.toml +++ b/crates/web-client/Cargo.toml @@ -19,13 +19,13 @@ ignored = ["wasm-bindgen-futures"] crate-type = ["cdylib"] [features] -testing = ["miden-client/testing"] +testing = ["miden-client-core/testing"] [dependencies] # Workspace dependencies -idxdb-store = { package = "miden-idxdb-store", path = "../idxdb-store" } -miden-client = { default-features = false, features = ["testing", "tonic"], path = "../rust-client" } -miden-protocol = { workspace = true } +idxdb-store = { package = "miden-idxdb-store", path = "../idxdb-store" } +miden-client-core = { default-features = false, features = ["testing", "tonic"], path = "../miden-client-core" } +miden-protocol = { workspace = true } # External dependencies console_error_panic_hook = { version = "0.1.7" } diff --git a/crates/web-client/README.md b/crates/web-client/README.md index d1efd1c7b..b64837ebd 100644 --- a/crates/web-client/README.md +++ b/crates/web-client/README.md @@ -17,7 +17,7 @@ Whether you're building a wallet, dApp, or other blockchain-integrated applicati ### SDK Structure and Build Process -This SDK is published as an NPM package, built from the `web-client` crate. The `web-client` crate is a Rust crate targeting WebAssembly (WASM), and it uses `wasm-bindgen` to generate JavaScript bindings. It depends on the lower-level `rust-client` crate, which implements the core functionality for interacting with the Miden chain. +This SDK is published as an NPM package, built from the `web-client` crate. The `web-client` crate is a Rust crate targeting WebAssembly (WASM), and it uses `wasm-bindgen` to generate JavaScript bindings. It depends on the lower-level `miden-client-core` crate, which implements the core functionality for interacting with the Miden chain. Both a `Cargo.toml` and a `package.json` are present in the `web-client` directory to support Rust compilation and NPM packaging respectively. diff --git a/crates/web-client/src/account.rs b/crates/web-client/src/account.rs index e4e4eefff..3ff114c1b 100644 --- a/crates/web-client/src/account.rs +++ b/crates/web-client/src/account.rs @@ -1,4 +1,4 @@ -use miden_client::account::Account as NativeAccount; +use miden_client_core::account::Account as NativeAccount; use wasm_bindgen::prelude::*; use crate::models::account::Account; diff --git a/crates/web-client/src/export.rs b/crates/web-client/src/export.rs index b868eed89..e9611bdea 100644 --- a/crates/web-client/src/export.rs +++ b/crates/web-client/src/export.rs @@ -1,8 +1,8 @@ -use miden_client::Word; -use miden_client::account::AccountFile as NativeAccountFile; -use miden_client::note::NoteId; -use miden_client::store::NoteExportType; -use miden_client::utils::get_public_keys_from_account; +use miden_client_core::Word; +use miden_client_core::account::AccountFile as NativeAccountFile; +use miden_client_core::note::NoteId; +use miden_client_core::store::NoteExportType; +use miden_client_core::utils::get_public_keys_from_account; use wasm_bindgen::prelude::*; use crate::models::account_file::AccountFile; diff --git a/crates/web-client/src/helpers.rs b/crates/web-client/src/helpers.rs index d0847ea3f..2eefb3860 100644 --- a/crates/web-client/src/helpers.rs +++ b/crates/web-client/src/helpers.rs @@ -1,6 +1,6 @@ -use miden_client::account::component::{AccountComponent, BasicWallet}; -use miden_client::account::{Account, AccountBuilder, AccountType}; -use miden_client::auth::{ +use miden_client_core::account::component::BasicWallet; +use miden_client_core::account::{Account, AccountBuilder, AccountComponent, AccountType}; +use miden_client_core::auth::{ AuthEcdsaK256Keccak, AuthRpoFalcon512, AuthSchemeId as NativeAuthScheme, diff --git a/crates/web-client/src/import.rs b/crates/web-client/src/import.rs index 99f87a6bd..b117b9c7a 100644 --- a/crates/web-client/src/import.rs +++ b/crates/web-client/src/import.rs @@ -1,4 +1,4 @@ -use miden_client::account::{AccountFile as NativeAccountFile, AccountId as NativeAccountId}; +use miden_client_core::account::{AccountFile as NativeAccountFile, AccountId as NativeAccountId}; use wasm_bindgen::prelude::*; use crate::helpers::generate_wallet; diff --git a/crates/web-client/src/lib.rs b/crates/web-client/src/lib.rs index affa75cbd..d8f1ab853 100644 --- a/crates/web-client/src/lib.rs +++ b/crates/web-client/src/lib.rs @@ -5,13 +5,13 @@ use core::fmt::Write; use idxdb_store::WebStore; use js_sys::{Function, Reflect}; -use miden_client::crypto::RpoRandomCoin; -use miden_client::note_transport::NoteTransportClient; -use miden_client::note_transport::grpc::GrpcNoteTransportClient; -use miden_client::rpc::{Endpoint, GrpcClient, NodeRpcClient}; -use miden_client::testing::mock::MockRpcApi; -use miden_client::testing::note_transport::MockNoteTransportApi; -use miden_client::{ +use miden_client_core::crypto::RpoRandomCoin; +use miden_client_core::note_transport::NoteTransportClient; +use miden_client_core::note_transport::grpc::GrpcNoteTransportClient; +use miden_client_core::rpc::{Endpoint, GrpcClient, NodeRpcClient}; +use miden_client_core::testing::mock::MockRpcApi; +use miden_client_core::testing::note_transport::MockNoteTransportApi; +use miden_client_core::{ Client, ClientError, ErrorHint, diff --git a/crates/web-client/src/mock.rs b/crates/web-client/src/mock.rs index 39fcb4c22..f1f17820f 100644 --- a/crates/web-client/src/mock.rs +++ b/crates/web-client/src/mock.rs @@ -1,9 +1,9 @@ use alloc::sync::Arc; -use miden_client::testing::MockChain; -use miden_client::testing::mock::MockRpcApi; -use miden_client::testing::note_transport::{MockNoteTransportApi, MockNoteTransportNode}; -use miden_client::utils::{Deserializable, RwLock, Serializable}; +use miden_client_core::testing::MockChain; +use miden_client_core::testing::mock::MockRpcApi; +use miden_client_core::testing::note_transport::{MockNoteTransportApi, MockNoteTransportNode}; +use miden_client_core::utils::{Deserializable, RwLock, Serializable}; use wasm_bindgen::prelude::*; use crate::{WebClient, js_error_with_context}; diff --git a/crates/web-client/src/models/account.rs b/crates/web-client/src/models/account.rs index 45f4d6e42..dcd31a70e 100644 --- a/crates/web-client/src/models/account.rs +++ b/crates/web-client/src/models/account.rs @@ -1,5 +1,5 @@ -use miden_client::account::{Account as NativeAccount, AccountType as NativeAccountType}; -use miden_client::utils::get_public_keys_from_account; +use miden_client_core::account::{Account as NativeAccount, AccountType as NativeAccountType}; +use miden_client_core::utils::get_public_keys_from_account; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys::Uint8Array; diff --git a/crates/web-client/src/models/account_builder.rs b/crates/web-client/src/models/account_builder.rs index 5c550ab7e..b650529c3 100644 --- a/crates/web-client/src/models/account_builder.rs +++ b/crates/web-client/src/models/account_builder.rs @@ -1,6 +1,6 @@ -use miden_client::account::AccountBuilder as NativeAccountBuilder; -use miden_client::account::component::BasicWallet; -use miden_client::auth::NoAuth; +use miden_client_core::account::AccountBuilder as NativeAccountBuilder; +use miden_client_core::account::component::BasicWallet; +use miden_client_core::auth::NoAuth; use wasm_bindgen::prelude::*; use crate::js_error_with_context; diff --git a/crates/web-client/src/models/account_code.rs b/crates/web-client/src/models/account_code.rs index 2ede20b2b..1a95f2712 100644 --- a/crates/web-client/src/models/account_code.rs +++ b/crates/web-client/src/models/account_code.rs @@ -1,4 +1,4 @@ -use miden_client::account::AccountCode as NativeAccountCode; +use miden_client_core::account::AccountCode as NativeAccountCode; use wasm_bindgen::prelude::*; use super::word::Word; diff --git a/crates/web-client/src/models/account_component.rs b/crates/web-client/src/models/account_component.rs index 0f80d1972..1823224ae 100644 --- a/crates/web-client/src/models/account_component.rs +++ b/crates/web-client/src/models/account_component.rs @@ -1,17 +1,17 @@ -use miden_client::Word as NativeWord; -use miden_client::account::component::AccountComponent as NativeAccountComponent; -use miden_client::account::{ +use miden_client_core::Word as NativeWord; +use miden_client_core::account::component::AccountComponent as NativeAccountComponent; +use miden_client_core::account::{ AccountComponentCode as NativeAccountComponentCode, StorageSlot as NativeStorageSlot, }; -use miden_client::assembly::{Library as NativeLibrary, MastNodeExt}; -use miden_client::auth::{ +use miden_client_core::assembly::{Library as NativeLibrary, MastNodeExt}; +use miden_client_core::auth::{ AuthEcdsaK256Keccak as NativeEcdsaK256Keccak, AuthRpoFalcon512 as NativeRpoFalcon512, AuthSecretKey as NativeSecretKey, PublicKeyCommitment, }; -use miden_client::vm::Package as NativePackage; +use miden_client_core::vm::Package as NativePackage; use wasm_bindgen::prelude::*; use crate::js_error_with_context; diff --git a/crates/web-client/src/models/account_component_code.rs b/crates/web-client/src/models/account_component_code.rs index ae65ffbec..f0cf0bd07 100644 --- a/crates/web-client/src/models/account_component_code.rs +++ b/crates/web-client/src/models/account_component_code.rs @@ -1,4 +1,4 @@ -use miden_client::account::AccountComponentCode as NativeAccountComponentCode; +use miden_client_core::account::AccountComponentCode as NativeAccountComponentCode; use wasm_bindgen::prelude::*; use crate::models::library::Library; diff --git a/crates/web-client/src/models/account_delta/mod.rs b/crates/web-client/src/models/account_delta/mod.rs index 19bcb21e4..b4fa65bca 100644 --- a/crates/web-client/src/models/account_delta/mod.rs +++ b/crates/web-client/src/models/account_delta/mod.rs @@ -1,4 +1,4 @@ -use miden_client::account::AccountDelta as NativeAccountDelta; +use miden_client_core::account::AccountDelta as NativeAccountDelta; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys::Uint8Array; diff --git a/crates/web-client/src/models/account_delta/storage.rs b/crates/web-client/src/models/account_delta/storage.rs index 9561c6e2b..2236f7136 100644 --- a/crates/web-client/src/models/account_delta/storage.rs +++ b/crates/web-client/src/models/account_delta/storage.rs @@ -1,4 +1,4 @@ -use miden_client::asset::AccountStorageDelta as NativeAccountStorageDelta; +use miden_client_core::asset::AccountStorageDelta as NativeAccountStorageDelta; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys::Uint8Array; diff --git a/crates/web-client/src/models/account_delta/vault.rs b/crates/web-client/src/models/account_delta/vault.rs index d485ef32c..bd5e7263a 100644 --- a/crates/web-client/src/models/account_delta/vault.rs +++ b/crates/web-client/src/models/account_delta/vault.rs @@ -1,5 +1,5 @@ -use miden_client::account::AccountId as NativeAccountId; -use miden_client::asset::{ +use miden_client_core::account::AccountId as NativeAccountId; +use miden_client_core::asset::{ AccountVaultDelta as NativeAccountVaultDelta, FungibleAssetDelta as NativeFungibleAssetDelta, }; diff --git a/crates/web-client/src/models/account_file.rs b/crates/web-client/src/models/account_file.rs index 9154eedfe..0baa769c8 100644 --- a/crates/web-client/src/models/account_file.rs +++ b/crates/web-client/src/models/account_file.rs @@ -1,4 +1,4 @@ -use miden_client::account::AccountFile as NativeAccountFile; +use miden_client_core::account::AccountFile as NativeAccountFile; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys::Uint8Array; diff --git a/crates/web-client/src/models/account_header.rs b/crates/web-client/src/models/account_header.rs index b3693df2d..66fac4726 100644 --- a/crates/web-client/src/models/account_header.rs +++ b/crates/web-client/src/models/account_header.rs @@ -1,4 +1,4 @@ -use miden_client::account::AccountHeader as NativeAccountHeader; +use miden_client_core::account::AccountHeader as NativeAccountHeader; use wasm_bindgen::prelude::*; use super::account_id::AccountId; diff --git a/crates/web-client/src/models/account_id.rs b/crates/web-client/src/models/account_id.rs index 41b58afe4..0c34ae5aa 100644 --- a/crates/web-client/src/models/account_id.rs +++ b/crates/web-client/src/models/account_id.rs @@ -1,8 +1,8 @@ use alloc::str::FromStr; -use miden_client::Felt as NativeFelt; -use miden_client::account::{AccountId as NativeAccountId, NetworkId as NativeNetworkId}; -use miden_client::address::{ +use miden_client_core::Felt as NativeFelt; +use miden_client_core::account::{AccountId as NativeAccountId, NetworkId as NativeNetworkId}; +use miden_client_core::address::{ Address, AddressId, AddressInterface as NativeAccountInterface, diff --git a/crates/web-client/src/models/account_storage.rs b/crates/web-client/src/models/account_storage.rs index 362afbe8b..6391cbefb 100644 --- a/crates/web-client/src/models/account_storage.rs +++ b/crates/web-client/src/models/account_storage.rs @@ -1,5 +1,5 @@ use idxdb_store::account::JsStorageMapEntry; -use miden_client::account::{ +use miden_client_core::account::{ AccountStorage as NativeAccountStorage, StorageSlotContent, StorageSlotName, diff --git a/crates/web-client/src/models/account_storage_mode.rs b/crates/web-client/src/models/account_storage_mode.rs index 990aecac0..e66c469f3 100644 --- a/crates/web-client/src/models/account_storage_mode.rs +++ b/crates/web-client/src/models/account_storage_mode.rs @@ -1,6 +1,6 @@ use core::str::FromStr; -use miden_client::account::AccountStorageMode as NativeAccountStorageMode; +use miden_client_core::account::AccountStorageMode as NativeAccountStorageMode; use wasm_bindgen::prelude::*; /// Storage visibility mode for an account. diff --git a/crates/web-client/src/models/account_storage_requirements.rs b/crates/web-client/src/models/account_storage_requirements.rs index 0cf320b72..950cad073 100644 --- a/crates/web-client/src/models/account_storage_requirements.rs +++ b/crates/web-client/src/models/account_storage_requirements.rs @@ -1,7 +1,7 @@ use alloc::string::String; -use miden_client::account::StorageSlotName as NativeStorageSlotName; -use miden_client::rpc::domain::account::{ +use miden_client_core::account::StorageSlotName as NativeStorageSlotName; +use miden_client_core::rpc::domain::account::{ AccountStorageRequirements as NativeAccountStorageRequirements, StorageMapKey as NativeStorageMapKey, }; diff --git a/crates/web-client/src/models/account_type.rs b/crates/web-client/src/models/account_type.rs index c7d59bab6..6110b2ef0 100644 --- a/crates/web-client/src/models/account_type.rs +++ b/crates/web-client/src/models/account_type.rs @@ -1,4 +1,4 @@ -use miden_client::account::AccountType as NativeAccountType; +use miden_client_core::account::AccountType as NativeAccountType; use wasm_bindgen::prelude::*; #[derive(Clone)] diff --git a/crates/web-client/src/models/address.rs b/crates/web-client/src/models/address.rs index e9a4cfdf6..5a94cd4d8 100644 --- a/crates/web-client/src/models/address.rs +++ b/crates/web-client/src/models/address.rs @@ -1,6 +1,6 @@ use js_sys::Uint8Array; -use miden_client::account::AccountId as NativeAccountId; -use miden_client::address::{ +use miden_client_core::account::AccountId as NativeAccountId; +use miden_client_core::address::{ Address as NativeAddress, AddressId, AddressInterface as NativeAddressInterface, diff --git a/crates/web-client/src/models/advice_inputs.rs b/crates/web-client/src/models/advice_inputs.rs index 3924678e0..87549ac83 100644 --- a/crates/web-client/src/models/advice_inputs.rs +++ b/crates/web-client/src/models/advice_inputs.rs @@ -1,4 +1,4 @@ -use miden_client::vm::AdviceInputs as NativeAdviceInputs; +use miden_client_core::vm::AdviceInputs as NativeAdviceInputs; use wasm_bindgen::prelude::*; use super::felt::Felt; @@ -25,7 +25,7 @@ impl AdviceInputs { /// Returns mapped values for a given key if present. #[wasm_bindgen(js_name = "mappedValues")] pub fn mapped_values(&self, key: &Word) -> Option> { - let native_key: miden_client::Word = key.into(); + let native_key: miden_client_core::Word = key.into(); self.0 .map .get(&native_key) diff --git a/crates/web-client/src/models/advice_map.rs b/crates/web-client/src/models/advice_map.rs index 4fddcc288..0c6266f75 100644 --- a/crates/web-client/src/models/advice_map.rs +++ b/crates/web-client/src/models/advice_map.rs @@ -1,7 +1,7 @@ use alloc::sync::Arc; -use miden_client::vm::AdviceMap as NativeAdviceMap; -use miden_client::{Felt as NativeFelt, Word as NativeWord}; +use miden_client_core::vm::AdviceMap as NativeAdviceMap; +use miden_client_core::{Felt as NativeFelt, Word as NativeWord}; use wasm_bindgen::prelude::*; use super::felt::Felt; diff --git a/crates/web-client/src/models/asset_vault.rs b/crates/web-client/src/models/asset_vault.rs index d0d664a75..d98b3dda9 100644 --- a/crates/web-client/src/models/asset_vault.rs +++ b/crates/web-client/src/models/asset_vault.rs @@ -1,4 +1,4 @@ -use miden_client::asset::AssetVault as NativeAssetVault; +use miden_client_core::asset::AssetVault as NativeAssetVault; use wasm_bindgen::prelude::*; use super::account_id::AccountId; diff --git a/crates/web-client/src/models/auth_scheme.rs b/crates/web-client/src/models/auth_scheme.rs index a3d132445..f77a66026 100644 --- a/crates/web-client/src/models/auth_scheme.rs +++ b/crates/web-client/src/models/auth_scheme.rs @@ -1,7 +1,7 @@ use core::convert::TryFrom; use core::fmt::Debug; -use miden_client::auth::AuthSchemeId as NativeAuthSchemeId; +use miden_client_core::auth::AuthSchemeId as NativeAuthSchemeId; use wasm_bindgen::prelude::*; /// Authentication schemes supported by the web client. diff --git a/crates/web-client/src/models/auth_secret_key.rs b/crates/web-client/src/models/auth_secret_key.rs index f370a24d3..65bc066b8 100644 --- a/crates/web-client/src/models/auth_secret_key.rs +++ b/crates/web-client/src/models/auth_secret_key.rs @@ -1,6 +1,6 @@ -use miden_client::auth::AuthSecretKey as NativeAuthSecretKey; -use miden_client::utils::Serializable; -use miden_client::{Felt as NativeFelt, Word as NativeWord}; +use miden_client_core::auth::AuthSecretKey as NativeAuthSecretKey; +use miden_client_core::utils::Serializable; +use miden_client_core::{Felt as NativeFelt, Word as NativeWord}; use rand::SeedableRng; use rand::rngs::StdRng; use wasm_bindgen::prelude::*; diff --git a/crates/web-client/src/models/basic_fungible_faucet_component.rs b/crates/web-client/src/models/basic_fungible_faucet_component.rs index 68d890d3e..5027609c1 100644 --- a/crates/web-client/src/models/basic_fungible_faucet_component.rs +++ b/crates/web-client/src/models/basic_fungible_faucet_component.rs @@ -1,5 +1,5 @@ -use miden_client::account::Account as NativeAccount; -use miden_client::account::component::BasicFungibleFaucet as NativeBasicFungibleFaucet; +use miden_client_core::account::Account as NativeAccount; +use miden_client_core::account::component::BasicFungibleFaucet as NativeBasicFungibleFaucet; use wasm_bindgen::prelude::*; use super::account::Account; diff --git a/crates/web-client/src/models/block_header.rs b/crates/web-client/src/models/block_header.rs index 806086f43..81926f582 100644 --- a/crates/web-client/src/models/block_header.rs +++ b/crates/web-client/src/models/block_header.rs @@ -1,4 +1,4 @@ -use miden_client::block::BlockHeader as NativeBlockHeader; +use miden_client_core::block::BlockHeader as NativeBlockHeader; use wasm_bindgen::prelude::*; use super::word::Word; diff --git a/crates/web-client/src/models/code_builder.rs b/crates/web-client/src/models/code_builder.rs index c1530dd2e..760d0e344 100644 --- a/crates/web-client/src/models/code_builder.rs +++ b/crates/web-client/src/models/code_builder.rs @@ -1,7 +1,7 @@ use alloc::sync::Arc; -use miden_client::account::AccountComponentCode as NativeAccountComponentCode; -use miden_client::assembly::{ +use miden_client_core::account::AccountComponentCode as NativeAccountComponentCode; +use miden_client_core::assembly::{ Assembler, CodeBuilder as NativeCodeBuilder, Library as NativeLibrary, diff --git a/crates/web-client/src/models/committed_note.rs b/crates/web-client/src/models/committed_note.rs index 054b506ee..293c9a5f6 100644 --- a/crates/web-client/src/models/committed_note.rs +++ b/crates/web-client/src/models/committed_note.rs @@ -1,4 +1,4 @@ -use miden_client::rpc::domain::note::CommittedNote as NativeCommittedNote; +use miden_client_core::rpc::domain::note::CommittedNote as NativeCommittedNote; use wasm_bindgen::prelude::*; use super::note_id::NoteId; diff --git a/crates/web-client/src/models/consumable_note_record.rs b/crates/web-client/src/models/consumable_note_record.rs index cacf6fae5..b6152e32e 100644 --- a/crates/web-client/src/models/consumable_note_record.rs +++ b/crates/web-client/src/models/consumable_note_record.rs @@ -1,8 +1,8 @@ -use miden_client::note::{ +use miden_client_core::note::{ NoteConsumability as NativeNoteConsumability, NoteConsumptionStatus as NativeNoteConsumptionStatus, }; -use miden_client::store::InputNoteRecord as NativeInputNoteRecord; +use miden_client_core::store::InputNoteRecord as NativeInputNoteRecord; use wasm_bindgen::prelude::*; use super::account_id::AccountId; diff --git a/crates/web-client/src/models/endpoint.rs b/crates/web-client/src/models/endpoint.rs index 53e0e1a7c..06c0bd7f4 100644 --- a/crates/web-client/src/models/endpoint.rs +++ b/crates/web-client/src/models/endpoint.rs @@ -1,4 +1,4 @@ -use miden_client::rpc::Endpoint as NativeEndpoint; +use miden_client_core::rpc::Endpoint as NativeEndpoint; use wasm_bindgen::prelude::*; /// The `Endpoint` struct represents a network endpoint, consisting of a protocol, a host, and a diff --git a/crates/web-client/src/models/executed_transaction.rs b/crates/web-client/src/models/executed_transaction.rs index 83142caeb..fab85b6e2 100644 --- a/crates/web-client/src/models/executed_transaction.rs +++ b/crates/web-client/src/models/executed_transaction.rs @@ -1,5 +1,5 @@ -use miden_client::account::AccountHeader as NativeAccountHeader; -use miden_client::transaction::ExecutedTransaction as NativeExecutedTransaction; +use miden_client_core::account::AccountHeader as NativeAccountHeader; +use miden_client_core::transaction::ExecutedTransaction as NativeExecutedTransaction; use wasm_bindgen::prelude::*; use super::account_delta::AccountDelta; diff --git a/crates/web-client/src/models/felt.rs b/crates/web-client/src/models/felt.rs index 668ef881d..4da3073ce 100644 --- a/crates/web-client/src/models/felt.rs +++ b/crates/web-client/src/models/felt.rs @@ -1,4 +1,4 @@ -use miden_client::Felt as NativeFelt; +use miden_client_core::Felt as NativeFelt; use wasm_bindgen::prelude::*; use crate::models::miden_arrays::FeltArray; diff --git a/crates/web-client/src/models/fetched_account.rs b/crates/web-client/src/models/fetched_account.rs index 423beabe0..70ce24850 100644 --- a/crates/web-client/src/models/fetched_account.rs +++ b/crates/web-client/src/models/fetched_account.rs @@ -1,4 +1,4 @@ -use miden_client::rpc::domain::account::FetchedAccount as NativeFetchedAccount; +use miden_client_core::rpc::domain::account::FetchedAccount as NativeFetchedAccount; use wasm_bindgen::prelude::*; use super::account::Account; diff --git a/crates/web-client/src/models/foreign_account.rs b/crates/web-client/src/models/foreign_account.rs index 6aea70646..51e8df11f 100644 --- a/crates/web-client/src/models/foreign_account.rs +++ b/crates/web-client/src/models/foreign_account.rs @@ -1,4 +1,4 @@ -use miden_client::transaction::ForeignAccount as NativeForeignAccount; +use miden_client_core::transaction::ForeignAccount as NativeForeignAccount; use wasm_bindgen::prelude::*; use crate::js_error_with_context; diff --git a/crates/web-client/src/models/fungible_asset.rs b/crates/web-client/src/models/fungible_asset.rs index 2d133acd2..1e23552e4 100644 --- a/crates/web-client/src/models/fungible_asset.rs +++ b/crates/web-client/src/models/fungible_asset.rs @@ -1,6 +1,6 @@ -use miden_client::Word as NativeWord; -use miden_client::account::AccountId as NativeAccountId; -use miden_client::asset::{Asset as NativeAsset, FungibleAsset as FungibleAssetNative}; +use miden_client_core::Word as NativeWord; +use miden_client_core::account::AccountId as NativeAccountId; +use miden_client_core::asset::{Asset as NativeAsset, FungibleAsset as FungibleAssetNative}; use wasm_bindgen::prelude::*; use super::account_id::AccountId; diff --git a/crates/web-client/src/models/input_note.rs b/crates/web-client/src/models/input_note.rs index bc8ad1c58..e56653734 100644 --- a/crates/web-client/src/models/input_note.rs +++ b/crates/web-client/src/models/input_note.rs @@ -1,5 +1,5 @@ -use miden_client::note::{Note as NativeNote, NoteInclusionProof as NativeNoteInclusionProof}; -use miden_client::transaction::InputNote as NativeInputNote; +use miden_client_core::note::{Note as NativeNote, NoteInclusionProof as NativeNoteInclusionProof}; +use miden_client_core::transaction::InputNote as NativeInputNote; use wasm_bindgen::prelude::*; use super::note::Note; diff --git a/crates/web-client/src/models/input_note_record.rs b/crates/web-client/src/models/input_note_record.rs index 6770910b1..5b76e9419 100644 --- a/crates/web-client/src/models/input_note_record.rs +++ b/crates/web-client/src/models/input_note_record.rs @@ -1,6 +1,6 @@ -use miden_client::note::Note as NativeNote; -use miden_client::store::InputNoteRecord as NativeInputNoteRecord; -use miden_client::transaction::InputNote as NativeInputNote; +use miden_client_core::note::Note as NativeNote; +use miden_client_core::store::InputNoteRecord as NativeInputNoteRecord; +use miden_client_core::transaction::InputNote as NativeInputNote; use wasm_bindgen::prelude::*; use super::input_note_state::InputNoteState; diff --git a/crates/web-client/src/models/input_note_state.rs b/crates/web-client/src/models/input_note_state.rs index 6492b0cca..28ad9c8b4 100644 --- a/crates/web-client/src/models/input_note_state.rs +++ b/crates/web-client/src/models/input_note_state.rs @@ -1,4 +1,4 @@ -use miden_client::store::InputNoteState as NativeNoteState; +use miden_client_core::store::InputNoteState as NativeNoteState; use wasm_bindgen::prelude::*; #[derive(Clone)] diff --git a/crates/web-client/src/models/input_notes.rs b/crates/web-client/src/models/input_notes.rs index 27138c13b..a4d6a1e61 100644 --- a/crates/web-client/src/models/input_notes.rs +++ b/crates/web-client/src/models/input_notes.rs @@ -1,4 +1,7 @@ -use miden_client::transaction::{InputNote as NativeInputNote, InputNotes as NativeInputNotes}; +use miden_client_core::transaction::{ + InputNote as NativeInputNote, + InputNotes as NativeInputNotes, +}; use wasm_bindgen::prelude::*; use super::input_note::InputNote; diff --git a/crates/web-client/src/models/library.rs b/crates/web-client/src/models/library.rs index b9506820e..821e213d1 100644 --- a/crates/web-client/src/models/library.rs +++ b/crates/web-client/src/models/library.rs @@ -1,4 +1,4 @@ -use miden_client::assembly::Library as NativeLibrary; +use miden_client_core::assembly::Library as NativeLibrary; use wasm_bindgen::prelude::*; #[wasm_bindgen] diff --git a/crates/web-client/src/models/merkle_path.rs b/crates/web-client/src/models/merkle_path.rs index 504a6a75a..8cf270fd4 100644 --- a/crates/web-client/src/models/merkle_path.rs +++ b/crates/web-client/src/models/merkle_path.rs @@ -1,4 +1,4 @@ -use miden_client::crypto::MerklePath as NativeMerklePath; +use miden_client_core::crypto::MerklePath as NativeMerklePath; use wasm_bindgen::prelude::*; use super::word::Word; diff --git a/crates/web-client/src/models/note.rs b/crates/web-client/src/models/note.rs index e065a78eb..469d5051e 100644 --- a/crates/web-client/src/models/note.rs +++ b/crates/web-client/src/models/note.rs @@ -1,13 +1,13 @@ -use miden_client::asset::Asset as NativeAsset; -use miden_client::block::BlockNumber as NativeBlockNumber; -use miden_client::crypto::RpoRandomCoin; -use miden_client::note::{ +use miden_client_core::asset::Asset as NativeAsset; +use miden_client_core::block::BlockNumber as NativeBlockNumber; +use miden_client_core::crypto::RpoRandomCoin; +use miden_client_core::note::{ Note as NativeNote, NoteAssets as NativeNoteAssets, create_p2id_note, create_p2ide_note, }; -use miden_client::{Felt as NativeFelt, Word as NativeWord}; +use miden_client_core::{Felt as NativeFelt, Word as NativeWord}; use rand::rngs::StdRng; use rand::{Rng, SeedableRng}; use wasm_bindgen::prelude::*; @@ -89,7 +89,7 @@ impl Note { /// Returns the note nullifier as a word. pub fn nullifier(&self) -> Word { let nullifier = self.0.nullifier(); - let elements: [miden_client::Felt; 4] = + let elements: [miden_client_core::Felt; 4] = nullifier.as_elements().try_into().expect("nullifier has 4 elements"); let native_word: NativeWord = NativeWord::from(&elements); native_word.into() diff --git a/crates/web-client/src/models/note_assets.rs b/crates/web-client/src/models/note_assets.rs index bbdc29500..371dcb66c 100644 --- a/crates/web-client/src/models/note_assets.rs +++ b/crates/web-client/src/models/note_assets.rs @@ -1,5 +1,5 @@ -use miden_client::asset::Asset as NativeAsset; -use miden_client::note::NoteAssets as NativeNoteAssets; +use miden_client_core::asset::Asset as NativeAsset; +use miden_client_core::note::NoteAssets as NativeNoteAssets; use wasm_bindgen::prelude::*; use super::fungible_asset::FungibleAsset; diff --git a/crates/web-client/src/models/note_details.rs b/crates/web-client/src/models/note_details.rs index 5e9cd82da..b961da9d7 100644 --- a/crates/web-client/src/models/note_details.rs +++ b/crates/web-client/src/models/note_details.rs @@ -1,5 +1,5 @@ -use miden_client::Word as NativeWord; -use miden_client::note::NoteDetails as NativeNoteDetails; +use miden_client_core::Word as NativeWord; +use miden_client_core::note::NoteDetails as NativeNoteDetails; use wasm_bindgen::prelude::*; use super::note_assets::NoteAssets; @@ -40,7 +40,7 @@ impl NoteDetails { /// Returns the note nullifier as a word. pub fn nullifier(&self) -> Word { let nullifier = self.0.nullifier(); - let elements: [miden_client::Felt; 4] = + let elements: [miden_client_core::Felt; 4] = nullifier.as_elements().try_into().expect("nullifier has 4 elements"); let native_word: NativeWord = NativeWord::from(&elements); native_word.into() diff --git a/crates/web-client/src/models/note_execution_hint.rs b/crates/web-client/src/models/note_execution_hint.rs index 67d352932..93d677eb1 100644 --- a/crates/web-client/src/models/note_execution_hint.rs +++ b/crates/web-client/src/models/note_execution_hint.rs @@ -1,4 +1,4 @@ -use miden_client::note::NoteExecutionHint as NativeNoteExecutionHint; +use miden_client_core::note::NoteExecutionHint as NativeNoteExecutionHint; use wasm_bindgen::prelude::*; /// Hint describing when a note can be consumed. diff --git a/crates/web-client/src/models/note_execution_mode.rs b/crates/web-client/src/models/note_execution_mode.rs index d7c1128e0..ba99500c7 100644 --- a/crates/web-client/src/models/note_execution_mode.rs +++ b/crates/web-client/src/models/note_execution_mode.rs @@ -1,4 +1,4 @@ -use miden_client::note::NoteExecutionMode as NativeNoteExecutionMode; +use miden_client_core::note::NoteExecutionMode as NativeNoteExecutionMode; use wasm_bindgen::prelude::*; /// Specifies whether a note is executable locally or across the network. diff --git a/crates/web-client/src/models/note_file.rs b/crates/web-client/src/models/note_file.rs index cbd303712..678663798 100644 --- a/crates/web-client/src/models/note_file.rs +++ b/crates/web-client/src/models/note_file.rs @@ -1,6 +1,6 @@ -use miden_client::note::{NoteDetails as NativeNoteDetails, NoteId as NativeNoteId}; -use miden_client::notes::NoteFile as NativeNoteFile; -use miden_client::{Deserializable, Serializable}; +use miden_client_core::note::{NoteDetails as NativeNoteDetails, NoteId as NativeNoteId}; +use miden_client_core::notes::NoteFile as NativeNoteFile; +use miden_client_core::{Deserializable, Serializable}; use wasm_bindgen::prelude::*; use super::input_note::InputNote; diff --git a/crates/web-client/src/models/note_filter.rs b/crates/web-client/src/models/note_filter.rs index 2f46608b7..3e8199d10 100644 --- a/crates/web-client/src/models/note_filter.rs +++ b/crates/web-client/src/models/note_filter.rs @@ -1,4 +1,4 @@ -use miden_client::store::NoteFilter as NativeNoteFilter; +use miden_client_core::store::NoteFilter as NativeNoteFilter; use wasm_bindgen::prelude::*; use super::note_id::NoteId; diff --git a/crates/web-client/src/models/note_header.rs b/crates/web-client/src/models/note_header.rs index 60365f70a..870b2e01d 100644 --- a/crates/web-client/src/models/note_header.rs +++ b/crates/web-client/src/models/note_header.rs @@ -1,4 +1,4 @@ -use miden_client::note::NoteHeader as NativeNoteHeader; +use miden_client_core::note::NoteHeader as NativeNoteHeader; use wasm_bindgen::prelude::*; use super::note_id::NoteId; diff --git a/crates/web-client/src/models/note_id.rs b/crates/web-client/src/models/note_id.rs index a0da0ab1f..745512f0a 100644 --- a/crates/web-client/src/models/note_id.rs +++ b/crates/web-client/src/models/note_id.rs @@ -1,4 +1,4 @@ -use miden_client::note::NoteId as NativeNoteId; +use miden_client_core::note::NoteId as NativeNoteId; use wasm_bindgen::prelude::*; use super::word::Word; diff --git a/crates/web-client/src/models/note_inclusion_proof.rs b/crates/web-client/src/models/note_inclusion_proof.rs index f38a38449..07989c3c5 100644 --- a/crates/web-client/src/models/note_inclusion_proof.rs +++ b/crates/web-client/src/models/note_inclusion_proof.rs @@ -1,5 +1,5 @@ -use miden_client::crypto::MerklePath as NativeMerklePath; -use miden_client::note::NoteInclusionProof as NativeNoteInclusionProof; +use miden_client_core::crypto::MerklePath as NativeMerklePath; +use miden_client_core::note::NoteInclusionProof as NativeNoteInclusionProof; use wasm_bindgen::prelude::*; use super::merkle_path::MerklePath; diff --git a/crates/web-client/src/models/note_inputs.rs b/crates/web-client/src/models/note_inputs.rs index f1caf0c59..cddf398a5 100644 --- a/crates/web-client/src/models/note_inputs.rs +++ b/crates/web-client/src/models/note_inputs.rs @@ -1,4 +1,4 @@ -use miden_client::note::NoteInputs as NativeNoteInputs; +use miden_client_core::note::NoteInputs as NativeNoteInputs; use wasm_bindgen::prelude::*; use super::felt::Felt; diff --git a/crates/web-client/src/models/note_location.rs b/crates/web-client/src/models/note_location.rs index 0fd992afe..9af8d9b06 100644 --- a/crates/web-client/src/models/note_location.rs +++ b/crates/web-client/src/models/note_location.rs @@ -1,4 +1,4 @@ -use miden_client::note::NoteLocation as NativeNoteLocation; +use miden_client_core::note::NoteLocation as NativeNoteLocation; use wasm_bindgen::prelude::*; /// Contains information about the location of a note. diff --git a/crates/web-client/src/models/note_metadata.rs b/crates/web-client/src/models/note_metadata.rs index fb53522c9..92842bb1b 100644 --- a/crates/web-client/src/models/note_metadata.rs +++ b/crates/web-client/src/models/note_metadata.rs @@ -1,4 +1,4 @@ -use miden_client::note::NoteMetadata as NativeNoteMetadata; +use miden_client_core::note::NoteMetadata as NativeNoteMetadata; use wasm_bindgen::prelude::*; use super::account_id::AccountId; @@ -54,7 +54,7 @@ impl NoteMetadata { note_type.into(), note_tag.into(), note_execution_hint.into(), - aux.map_or(miden_client::Felt::default(), Into::into), + aux.map_or(miden_client_core::Felt::default(), Into::into), ) .unwrap(); NoteMetadata(native_note_metadata) diff --git a/crates/web-client/src/models/note_recipient.rs b/crates/web-client/src/models/note_recipient.rs index 23825c62b..504ee1298 100644 --- a/crates/web-client/src/models/note_recipient.rs +++ b/crates/web-client/src/models/note_recipient.rs @@ -1,5 +1,5 @@ -use miden_client::Word as NativeWord; -use miden_client::note::{ +use miden_client_core::Word as NativeWord; +use miden_client_core::note::{ NoteInputs as NativeNoteInputs, NoteRecipient as NativeNoteRecipient, NoteScript as NativeNoteScript, diff --git a/crates/web-client/src/models/note_script.rs b/crates/web-client/src/models/note_script.rs index 9051325cb..eeb339b52 100644 --- a/crates/web-client/src/models/note_script.rs +++ b/crates/web-client/src/models/note_script.rs @@ -1,5 +1,5 @@ -use miden_client::PrettyPrint; -use miden_client::note::{NoteScript as NativeNoteScript, WellKnownNote}; +use miden_client_core::PrettyPrint; +use miden_client_core::note::{NoteScript as NativeNoteScript, WellKnownNote}; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys::Uint8Array; diff --git a/crates/web-client/src/models/note_sync_info.rs b/crates/web-client/src/models/note_sync_info.rs index 328f206a8..b840be5a9 100644 --- a/crates/web-client/src/models/note_sync_info.rs +++ b/crates/web-client/src/models/note_sync_info.rs @@ -1,4 +1,4 @@ -use miden_client::rpc::domain::note::NoteSyncInfo as NativeNoteSyncInfo; +use miden_client_core::rpc::domain::note::NoteSyncInfo as NativeNoteSyncInfo; use wasm_bindgen::prelude::*; use super::block_header::BlockHeader; diff --git a/crates/web-client/src/models/note_tag.rs b/crates/web-client/src/models/note_tag.rs index 48c152cf1..c10d18a48 100644 --- a/crates/web-client/src/models/note_tag.rs +++ b/crates/web-client/src/models/note_tag.rs @@ -1,5 +1,8 @@ -use miden_client::account::AccountId as NativeAccountId; -use miden_client::note::{NoteExecutionMode as NativeNoteExecutionMode, NoteTag as NativeNoteTag}; +use miden_client_core::account::AccountId as NativeAccountId; +use miden_client_core::note::{ + NoteExecutionMode as NativeNoteExecutionMode, + NoteTag as NativeNoteTag, +}; use wasm_bindgen::prelude::*; use super::account_id::AccountId; diff --git a/crates/web-client/src/models/note_type.rs b/crates/web-client/src/models/note_type.rs index 8401f47f5..e0e7e2fe4 100644 --- a/crates/web-client/src/models/note_type.rs +++ b/crates/web-client/src/models/note_type.rs @@ -1,4 +1,4 @@ -use miden_client::note::NoteType as NativeNoteType; +use miden_client_core::note::NoteType as NativeNoteType; use wasm_bindgen::prelude::*; /// Visibility level for note contents when published to the network. diff --git a/crates/web-client/src/models/output_note.rs b/crates/web-client/src/models/output_note.rs index a5cbc86d9..b41a723f5 100644 --- a/crates/web-client/src/models/output_note.rs +++ b/crates/web-client/src/models/output_note.rs @@ -1,9 +1,9 @@ -use miden_client::note::{ +use miden_client_core::note::{ Note as NativeNote, NoteHeader as NativeNoteHeader, PartialNote as NativePartialNote, }; -use miden_client::transaction::OutputNote as NativeOutputNote; +use miden_client_core::transaction::OutputNote as NativeOutputNote; use wasm_bindgen::prelude::*; use super::note::Note; diff --git a/crates/web-client/src/models/output_note_record.rs b/crates/web-client/src/models/output_note_record.rs index 897ef5758..9ac3ec9b0 100644 --- a/crates/web-client/src/models/output_note_record.rs +++ b/crates/web-client/src/models/output_note_record.rs @@ -1,4 +1,4 @@ -use miden_client::store::OutputNoteRecord as NativeOutputNoteRecord; +use miden_client_core::store::OutputNoteRecord as NativeOutputNoteRecord; use wasm_bindgen::prelude::*; use super::note_assets::NoteAssets; diff --git a/crates/web-client/src/models/output_note_state.rs b/crates/web-client/src/models/output_note_state.rs index 12460128e..ad92993e7 100644 --- a/crates/web-client/src/models/output_note_state.rs +++ b/crates/web-client/src/models/output_note_state.rs @@ -1,4 +1,4 @@ -use miden_client::store::OutputNoteState as NativeOutputNoteState; +use miden_client_core::store::OutputNoteState as NativeOutputNoteState; use wasm_bindgen::prelude::*; #[derive(Clone)] diff --git a/crates/web-client/src/models/output_notes.rs b/crates/web-client/src/models/output_notes.rs index 262082e1b..1aa9e3ddd 100644 --- a/crates/web-client/src/models/output_notes.rs +++ b/crates/web-client/src/models/output_notes.rs @@ -1,4 +1,4 @@ -use miden_client::transaction::OutputNotes as NativeOutputNotes; +use miden_client_core::transaction::OutputNotes as NativeOutputNotes; use wasm_bindgen::prelude::*; use super::output_note::OutputNote; diff --git a/crates/web-client/src/models/package.rs b/crates/web-client/src/models/package.rs index d4ab49dd7..230a7ec4e 100644 --- a/crates/web-client/src/models/package.rs +++ b/crates/web-client/src/models/package.rs @@ -1,4 +1,4 @@ -use miden_client::vm::Package as NativePackage; +use miden_client_core::vm::Package as NativePackage; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys::Uint8Array; diff --git a/crates/web-client/src/models/partial_note.rs b/crates/web-client/src/models/partial_note.rs index 1ee46c47a..13383cd72 100644 --- a/crates/web-client/src/models/partial_note.rs +++ b/crates/web-client/src/models/partial_note.rs @@ -1,4 +1,4 @@ -use miden_client::note::PartialNote as NativePartialNote; +use miden_client_core::note::PartialNote as NativePartialNote; use wasm_bindgen::prelude::*; use super::note_assets::NoteAssets; diff --git a/crates/web-client/src/models/program.rs b/crates/web-client/src/models/program.rs index 3aaef14c2..adb148475 100644 --- a/crates/web-client/src/models/program.rs +++ b/crates/web-client/src/models/program.rs @@ -1,4 +1,4 @@ -use miden_client::vm::Program as NativeProgram; +use miden_client_core::vm::Program as NativeProgram; use wasm_bindgen::prelude::*; #[wasm_bindgen] diff --git a/crates/web-client/src/models/proven_transaction.rs b/crates/web-client/src/models/proven_transaction.rs index eff42c710..debbf1e5d 100644 --- a/crates/web-client/src/models/proven_transaction.rs +++ b/crates/web-client/src/models/proven_transaction.rs @@ -1,5 +1,5 @@ -use miden_client::account::AccountId as NativeAccountId; -use miden_client::transaction::ProvenTransaction as NativeProvenTransaction; +use miden_client_core::account::AccountId as NativeAccountId; +use miden_client_core::transaction::ProvenTransaction as NativeProvenTransaction; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys::Uint8Array; diff --git a/crates/web-client/src/models/provers.rs b/crates/web-client/src/models/provers.rs index cc5bce8c2..626904653 100644 --- a/crates/web-client/src/models/provers.rs +++ b/crates/web-client/src/models/provers.rs @@ -1,8 +1,8 @@ use alloc::sync::Arc; use core::time::Duration; -use miden_client::RemoteTransactionProver; -use miden_client::transaction::{ +use miden_client_core::RemoteTransactionProver; +use miden_client_core::transaction::{ LocalTransactionProver, ProvingOptions, TransactionProver as TransactionProverTrait, diff --git a/crates/web-client/src/models/public_key.rs b/crates/web-client/src/models/public_key.rs index ac451fa57..93884d75f 100644 --- a/crates/web-client/src/models/public_key.rs +++ b/crates/web-client/src/models/public_key.rs @@ -1,5 +1,5 @@ -use miden_client::auth::{PublicKey as NativePublicKey, Signature as NativeSignature}; -use miden_client::{Deserializable, Word as NativeWord}; +use miden_client_core::auth::{PublicKey as NativePublicKey, Signature as NativeSignature}; +use miden_client_core::{Deserializable, Word as NativeWord}; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys::Uint8Array; @@ -48,7 +48,7 @@ impl PublicKey { match native_signature { NativeSignature::RpoFalcon512(falcon_signature) => { - let public_key = miden_client::crypto::rpo_falcon512::PublicKey::recover_from( + let public_key = miden_client_core::crypto::rpo_falcon512::PublicKey::recover_from( native_message, &falcon_signature, ); diff --git a/crates/web-client/src/models/rpo256.rs b/crates/web-client/src/models/rpo256.rs index 885b3bb80..780ab4936 100644 --- a/crates/web-client/src/models/rpo256.rs +++ b/crates/web-client/src/models/rpo256.rs @@ -1,5 +1,5 @@ -use miden_client::Felt as NativeFelt; -use miden_client::crypto::Rpo256 as NativeRpo256; +use miden_client_core::Felt as NativeFelt; +use miden_client_core::crypto::Rpo256 as NativeRpo256; use wasm_bindgen::prelude::*; use super::felt::Felt; diff --git a/crates/web-client/src/models/signature.rs b/crates/web-client/src/models/signature.rs index b27fa552d..f986ae3a6 100644 --- a/crates/web-client/src/models/signature.rs +++ b/crates/web-client/src/models/signature.rs @@ -1,4 +1,4 @@ -use miden_client::auth::Signature as NativeSignature; +use miden_client_core::auth::Signature as NativeSignature; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys::Uint8Array; diff --git a/crates/web-client/src/models/signing_inputs.rs b/crates/web-client/src/models/signing_inputs.rs index 26ca38a43..6ed56b611 100644 --- a/crates/web-client/src/models/signing_inputs.rs +++ b/crates/web-client/src/models/signing_inputs.rs @@ -1,4 +1,4 @@ -use miden_client::auth::SigningInputs as NativeSigningInputs; +use miden_client_core::auth::SigningInputs as NativeSigningInputs; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys::Uint8Array; diff --git a/crates/web-client/src/models/storage_map.rs b/crates/web-client/src/models/storage_map.rs index c889af9cd..085ada927 100644 --- a/crates/web-client/src/models/storage_map.rs +++ b/crates/web-client/src/models/storage_map.rs @@ -1,4 +1,4 @@ -use miden_client::account::StorageMap as NativeStorageMap; +use miden_client_core::account::StorageMap as NativeStorageMap; use wasm_bindgen::prelude::*; use crate::models::word::Word; diff --git a/crates/web-client/src/models/storage_slot.rs b/crates/web-client/src/models/storage_slot.rs index b4ed447c2..dcdf17d1b 100644 --- a/crates/web-client/src/models/storage_slot.rs +++ b/crates/web-client/src/models/storage_slot.rs @@ -1,4 +1,4 @@ -use miden_client::account::{ +use miden_client_core::account::{ StorageSlot as NativeStorageSlot, StorageSlotName as NativeStorageSlotName, }; diff --git a/crates/web-client/src/models/sync_summary.rs b/crates/web-client/src/models/sync_summary.rs index 691fd610e..3aae6ea05 100644 --- a/crates/web-client/src/models/sync_summary.rs +++ b/crates/web-client/src/models/sync_summary.rs @@ -1,4 +1,4 @@ -use miden_client::sync::SyncSummary as NativeSyncSummary; +use miden_client_core::sync::SyncSummary as NativeSyncSummary; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys::Uint8Array; diff --git a/crates/web-client/src/models/token_symbol.rs b/crates/web-client/src/models/token_symbol.rs index da4f0391c..35e13819c 100644 --- a/crates/web-client/src/models/token_symbol.rs +++ b/crates/web-client/src/models/token_symbol.rs @@ -1,4 +1,4 @@ -use miden_client::asset::TokenSymbol as NativeTokenSymbol; +use miden_client_core::asset::TokenSymbol as NativeTokenSymbol; use wasm_bindgen::prelude::*; use crate::js_error_with_context; diff --git a/crates/web-client/src/models/transaction_args.rs b/crates/web-client/src/models/transaction_args.rs index 278a9b24d..b7abc4c74 100644 --- a/crates/web-client/src/models/transaction_args.rs +++ b/crates/web-client/src/models/transaction_args.rs @@ -1,4 +1,4 @@ -use miden_client::transaction::TransactionArgs as NativeTransactionArgs; +use miden_client_core::transaction::TransactionArgs as NativeTransactionArgs; use wasm_bindgen::prelude::*; use super::advice_inputs::AdviceInputs; diff --git a/crates/web-client/src/models/transaction_filter.rs b/crates/web-client/src/models/transaction_filter.rs index 5d03906a2..f5930bb12 100644 --- a/crates/web-client/src/models/transaction_filter.rs +++ b/crates/web-client/src/models/transaction_filter.rs @@ -1,5 +1,5 @@ -use miden_client::store::TransactionFilter as NativeTransactionFilter; -use miden_client::transaction::TransactionId as NativeTransactionId; +use miden_client_core::store::TransactionFilter as NativeTransactionFilter; +use miden_client_core::transaction::TransactionId as NativeTransactionId; use wasm_bindgen::prelude::*; use super::transaction_id::TransactionId; diff --git a/crates/web-client/src/models/transaction_id.rs b/crates/web-client/src/models/transaction_id.rs index 4f0ce5abf..5f975b810 100644 --- a/crates/web-client/src/models/transaction_id.rs +++ b/crates/web-client/src/models/transaction_id.rs @@ -1,4 +1,4 @@ -use miden_client::transaction::TransactionId as NativeTransactionId; +use miden_client_core::transaction::TransactionId as NativeTransactionId; use wasm_bindgen::prelude::*; use super::felt::Felt; diff --git a/crates/web-client/src/models/transaction_kernel.rs b/crates/web-client/src/models/transaction_kernel.rs index 0583c7e00..99e2b5321 100644 --- a/crates/web-client/src/models/transaction_kernel.rs +++ b/crates/web-client/src/models/transaction_kernel.rs @@ -1,4 +1,4 @@ -use miden_client::transaction::TransactionKernel as NativeTransactionKernel; +use miden_client_core::transaction::TransactionKernel as NativeTransactionKernel; use wasm_bindgen::prelude::*; use crate::models::assembler::Assembler; diff --git a/crates/web-client/src/models/transaction_record.rs b/crates/web-client/src/models/transaction_record.rs index 8af11a5ad..ea7278d32 100644 --- a/crates/web-client/src/models/transaction_record.rs +++ b/crates/web-client/src/models/transaction_record.rs @@ -1,4 +1,4 @@ -use miden_client::transaction::TransactionRecord as NativeTransactionRecord; +use miden_client_core::transaction::TransactionRecord as NativeTransactionRecord; use wasm_bindgen::prelude::*; use super::account_id::AccountId; diff --git a/crates/web-client/src/models/transaction_request/mod.rs b/crates/web-client/src/models/transaction_request/mod.rs index 31f3c1c6e..dfc939e44 100644 --- a/crates/web-client/src/models/transaction_request/mod.rs +++ b/crates/web-client/src/models/transaction_request/mod.rs @@ -1,5 +1,5 @@ -use miden_client::note::Note as NativeNote; -use miden_client::transaction::TransactionRequest as NativeTransactionRequest; +use miden_client_core::note::Note as NativeNote; +use miden_client_core::transaction::TransactionRequest as NativeTransactionRequest; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys::Uint8Array; diff --git a/crates/web-client/src/models/transaction_request/note_and_args.rs b/crates/web-client/src/models/transaction_request/note_and_args.rs index f52bf943a..e0550640f 100644 --- a/crates/web-client/src/models/transaction_request/note_and_args.rs +++ b/crates/web-client/src/models/transaction_request/note_and_args.rs @@ -1,5 +1,5 @@ -use miden_client::note::Note as NativeNote; -use miden_client::transaction::NoteArgs as NativeNoteArgs; +use miden_client_core::note::Note as NativeNote; +use miden_client_core::transaction::NoteArgs as NativeNoteArgs; use wasm_bindgen::prelude::*; use crate::models::miden_arrays::NoteAndArgsArray; diff --git a/crates/web-client/src/models/transaction_request/note_details_and_tag.rs b/crates/web-client/src/models/transaction_request/note_details_and_tag.rs index cff1d4095..adb32940e 100644 --- a/crates/web-client/src/models/transaction_request/note_details_and_tag.rs +++ b/crates/web-client/src/models/transaction_request/note_details_and_tag.rs @@ -1,4 +1,4 @@ -use miden_client::note::{NoteDetails as NativeNoteDetails, NoteTag as NativeNoteTag}; +use miden_client_core::note::{NoteDetails as NativeNoteDetails, NoteTag as NativeNoteTag}; use wasm_bindgen::prelude::*; use crate::models::NoteTag; diff --git a/crates/web-client/src/models/transaction_request/note_id_and_args.rs b/crates/web-client/src/models/transaction_request/note_id_and_args.rs index 2d71ec160..e3313d79e 100644 --- a/crates/web-client/src/models/transaction_request/note_id_and_args.rs +++ b/crates/web-client/src/models/transaction_request/note_id_and_args.rs @@ -1,5 +1,5 @@ -use miden_client::note::NoteId as NativeNoteId; -use miden_client::transaction::NoteArgs as NativeNoteArgs; +use miden_client_core::note::NoteId as NativeNoteId; +use miden_client_core::transaction::NoteArgs as NativeNoteArgs; use wasm_bindgen::prelude::*; use crate::models::miden_arrays::NoteIdAndArgsArray; diff --git a/crates/web-client/src/models/transaction_request/transaction_request_builder.rs b/crates/web-client/src/models/transaction_request/transaction_request_builder.rs index 4388635be..013929c84 100644 --- a/crates/web-client/src/models/transaction_request/transaction_request_builder.rs +++ b/crates/web-client/src/models/transaction_request/transaction_request_builder.rs @@ -1,18 +1,18 @@ -use miden_client::Word as NativeWord; -use miden_client::note::{ +use miden_client_core::Word as NativeWord; +use miden_client_core::note::{ Note as NativeNote, NoteDetails as NativeNoteDetails, NoteRecipient as NativeNoteRecipient, NoteTag as NativeNoteTag, }; -use miden_client::transaction::{ +use miden_client_core::transaction::{ ForeignAccount as NativeForeignAccount, NoteArgs as NativeNoteArgs, OutputNote as NativeOutputNote, TransactionRequestBuilder as NativeTransactionRequestBuilder, TransactionScript as NativeTransactionScript, }; -use miden_client::vm::AdviceMap as NativeAdviceMap; +use miden_client_core::vm::AdviceMap as NativeAdviceMap; use wasm_bindgen::prelude::*; use crate::models::advice_map::AdviceMap; diff --git a/crates/web-client/src/models/transaction_result.rs b/crates/web-client/src/models/transaction_result.rs index a25cd985a..d415920eb 100644 --- a/crates/web-client/src/models/transaction_result.rs +++ b/crates/web-client/src/models/transaction_result.rs @@ -1,4 +1,4 @@ -use miden_client::transaction::TransactionResult as NativeTransactionResult; +use miden_client_core::transaction::TransactionResult as NativeTransactionResult; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys::Uint8Array; diff --git a/crates/web-client/src/models/transaction_script.rs b/crates/web-client/src/models/transaction_script.rs index 3e601bae3..b93b2f194 100644 --- a/crates/web-client/src/models/transaction_script.rs +++ b/crates/web-client/src/models/transaction_script.rs @@ -1,4 +1,4 @@ -use miden_client::transaction::TransactionScript as NativeTransactionScript; +use miden_client_core::transaction::TransactionScript as NativeTransactionScript; use wasm_bindgen::prelude::*; use crate::models::package::Package; diff --git a/crates/web-client/src/models/transaction_script_inputs.rs b/crates/web-client/src/models/transaction_script_inputs.rs index f9d6fbee9..e8d39d08e 100644 --- a/crates/web-client/src/models/transaction_script_inputs.rs +++ b/crates/web-client/src/models/transaction_script_inputs.rs @@ -1,4 +1,4 @@ -use miden_client::{Felt as NativeFelt, Word as NativeWord}; +use miden_client_core::{Felt as NativeFelt, Word as NativeWord}; use wasm_bindgen::prelude::*; use super::miden_arrays::FeltArray; diff --git a/crates/web-client/src/models/transaction_status.rs b/crates/web-client/src/models/transaction_status.rs index de0aac514..01b69ce28 100644 --- a/crates/web-client/src/models/transaction_status.rs +++ b/crates/web-client/src/models/transaction_status.rs @@ -1,4 +1,4 @@ -use miden_client::transaction::{DiscardCause, TransactionStatus as NativeTransactionStatus}; +use miden_client_core::transaction::{DiscardCause, TransactionStatus as NativeTransactionStatus}; use wasm_bindgen::prelude::*; /// Status of a transaction in the node or store. diff --git a/crates/web-client/src/models/transaction_store_update.rs b/crates/web-client/src/models/transaction_store_update.rs index 37571ee3b..913395fe9 100644 --- a/crates/web-client/src/models/transaction_store_update.rs +++ b/crates/web-client/src/models/transaction_store_update.rs @@ -1,5 +1,5 @@ -use miden_client::transaction::TransactionStoreUpdate as NativeTransactionStoreUpdate; -use wasm_bindgen::prelude::{wasm_bindgen, *}; +use miden_client_core::transaction::TransactionStoreUpdate as NativeTransactionStoreUpdate; +use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys::Uint8Array; use crate::models::account_delta::AccountDelta; diff --git a/crates/web-client/src/models/transaction_summary.rs b/crates/web-client/src/models/transaction_summary.rs index 38036719f..388f49788 100644 --- a/crates/web-client/src/models/transaction_summary.rs +++ b/crates/web-client/src/models/transaction_summary.rs @@ -1,4 +1,4 @@ -use miden_client::transaction::TransactionSummary as NativeTransactionSummary; +use miden_client_core::transaction::TransactionSummary as NativeTransactionSummary; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys::Uint8Array; diff --git a/crates/web-client/src/models/word.rs b/crates/web-client/src/models/word.rs index 7f2bd634d..a20ca04ab 100644 --- a/crates/web-client/src/models/word.rs +++ b/crates/web-client/src/models/word.rs @@ -1,4 +1,4 @@ -use miden_client::{Felt as NativeFelt, Word as NativeWord}; +use miden_client_core::{Felt as NativeFelt, Word as NativeWord}; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys::Uint8Array; diff --git a/crates/web-client/src/new_account.rs b/crates/web-client/src/new_account.rs index 9242b4b36..cc40741ec 100644 --- a/crates/web-client/src/new_account.rs +++ b/crates/web-client/src/new_account.rs @@ -1,8 +1,8 @@ -use miden_client::Felt; -use miden_client::account::component::BasicFungibleFaucet; -use miden_client::account::{AccountBuilder, AccountComponent, AccountType}; -use miden_client::asset::TokenSymbol; -use miden_client::auth::{ +use miden_client_core::Felt; +use miden_client_core::account::component::BasicFungibleFaucet; +use miden_client_core::account::{AccountBuilder, AccountComponent, AccountType}; +use miden_client_core::asset::TokenSymbol; +use miden_client_core::auth::{ AuthEcdsaK256Keccak, AuthRpoFalcon512, AuthSchemeId as NativeAuthScheme, diff --git a/crates/web-client/src/new_transactions.rs b/crates/web-client/src/new_transactions.rs index a11e086e0..3b14b52f5 100644 --- a/crates/web-client/src/new_transactions.rs +++ b/crates/web-client/src/new_transactions.rs @@ -1,6 +1,6 @@ -use miden_client::asset::FungibleAsset; -use miden_client::note::{BlockNumber, Note as NativeNote}; -use miden_client::transaction::{ +use miden_client_core::asset::FungibleAsset; +use miden_client_core::note::{BlockNumber, Note as NativeNote}; +use miden_client_core::transaction::{ PaymentNoteDescription, ProvenTransaction as NativeProvenTransaction, SwapTransactionData, diff --git a/crates/web-client/src/notes.rs b/crates/web-client/src/notes.rs index b47392b6b..0d8dfd043 100644 --- a/crates/web-client/src/notes.rs +++ b/crates/web-client/src/notes.rs @@ -1,5 +1,5 @@ -use miden_client::Word; -use miden_client::note::NoteId; +use miden_client_core::Word; +use miden_client_core::note::NoteId; use wasm_bindgen::prelude::*; use crate::models::account_id::AccountId; diff --git a/crates/web-client/src/rpc_client/mod.rs b/crates/web-client/src/rpc_client/mod.rs index 65694c180..88317c5a3 100644 --- a/crates/web-client/src/rpc_client/mod.rs +++ b/crates/web-client/src/rpc_client/mod.rs @@ -6,10 +6,10 @@ use alloc::collections::BTreeSet; use alloc::sync::Arc; use alloc::vec::Vec; -use miden_client::block::BlockNumber; -use miden_client::note::{NoteId as NativeNoteId, Nullifier}; -use miden_client::rpc::domain::note::FetchedNote as NativeFetchedNote; -use miden_client::rpc::{GrpcClient, NodeRpcClient}; +use miden_client_core::block::BlockNumber; +use miden_client_core::note::{NoteId as NativeNoteId, Nullifier}; +use miden_client_core::rpc::domain::note::FetchedNote as NativeFetchedNote; +use miden_client_core::rpc::{GrpcClient, NodeRpcClient}; use note::FetchedNote; use wasm_bindgen::prelude::*; @@ -73,7 +73,8 @@ impl RpcClient { FetchedNote::from_header(header, None, inclusion_proof) }, NativeFetchedNote::Public(note, inclusion_proof) => { - let header = miden_client::note::NoteHeader::new(note.id(), *note.metadata()); + let header = + miden_client_core::note::NoteHeader::new(note.id(), *note.metadata()); FetchedNote::from_header(header, Some(note.into()), inclusion_proof) }, }) @@ -163,7 +164,7 @@ impl RpcClient { nullifier: Word, block_num: u32, ) -> Result, JsValue> { - let native_word: miden_client::Word = nullifier.into(); + let native_word: miden_client_core::Word = nullifier.into(); // TODO: nullifier JS binding let nullifier = Nullifier::from_raw(native_word); let block_num = BlockNumber::from(block_num); diff --git a/crates/web-client/src/rpc_client/note.rs b/crates/web-client/src/rpc_client/note.rs index 3ab14dcef..093fa8ebe 100644 --- a/crates/web-client/src/rpc_client/note.rs +++ b/crates/web-client/src/rpc_client/note.rs @@ -1,4 +1,4 @@ -use miden_client::note::{ +use miden_client_core::note::{ NoteHeader as NativeNoteHeader, NoteInclusionProof as NativeNoteInclusionProof, }; diff --git a/crates/web-client/src/sync.rs b/crates/web-client/src/sync.rs index ba6b48bd5..2d48d2321 100644 --- a/crates/web-client/src/sync.rs +++ b/crates/web-client/src/sync.rs @@ -1,5 +1,5 @@ -use miden_client::asset::{Asset as NativeAsset, FungibleAsset as NativeFungibleAsset}; -use miden_client::note::build_swap_tag as native_build_swap_tag; +use miden_client_core::asset::{Asset as NativeAsset, FungibleAsset as NativeFungibleAsset}; +use miden_client_core::note::build_swap_tag as native_build_swap_tag; use wasm_bindgen::prelude::*; use crate::models::account_id::AccountId; diff --git a/crates/web-client/src/tags.rs b/crates/web-client/src/tags.rs index b7eec4e38..2aa7d07c1 100644 --- a/crates/web-client/src/tags.rs +++ b/crates/web-client/src/tags.rs @@ -1,4 +1,4 @@ -use miden_client::note::NoteTag; +use miden_client_core::note::NoteTag; use wasm_bindgen::prelude::*; use crate::{WebClient, js_error_with_context}; diff --git a/crates/web-client/src/transactions.rs b/crates/web-client/src/transactions.rs index 05111e694..48fed0c9b 100644 --- a/crates/web-client/src/transactions.rs +++ b/crates/web-client/src/transactions.rs @@ -1,4 +1,4 @@ -use miden_client::transaction::TransactionRecord as NativeTransactionRecord; +use miden_client_core::transaction::TransactionRecord as NativeTransactionRecord; use wasm_bindgen::prelude::*; use super::models::transaction_filter::TransactionFilter; diff --git a/crates/web-client/src/utils/mod.rs b/crates/web-client/src/utils/mod.rs index 05d61a25a..84f6a505d 100644 --- a/crates/web-client/src/utils/mod.rs +++ b/crates/web-client/src/utils/mod.rs @@ -1,5 +1,5 @@ -use miden_client::SliceReader; -use miden_client::utils::{Deserializable, Serializable}; +use miden_client_core::SliceReader; +use miden_client_core::utils::{Deserializable, Serializable}; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::js_sys::Uint8Array; @@ -26,7 +26,7 @@ pub fn deserialize_from_uint8array(bytes: &Uint8Array) -> Res #[cfg(test)] mod tests { - use miden_client::utils::{ByteReader, DeserializationError}; + use miden_client_core::utils::{ByteReader, DeserializationError}; use super::*; diff --git a/crates/web-client/src/utils/test_utils.rs b/crates/web-client/src/utils/test_utils.rs index df9b6f825..8b9f5cd35 100644 --- a/crates/web-client/src/utils/test_utils.rs +++ b/crates/web-client/src/utils/test_utils.rs @@ -1,10 +1,10 @@ use alloc::sync::Arc; -use miden_client::Serializable; -use miden_client::account::AccountId as NativeAccountId; -use miden_client::assembly::Assembler as NativeAssembler; -use miden_client::testing::account_id::ACCOUNT_ID_REGULAR_PRIVATE_ACCOUNT_UPDATABLE_CODE; -use miden_client::vm::{ +use miden_client_core::Serializable; +use miden_client_core::account::AccountId as NativeAccountId; +use miden_client_core::assembly::Assembler as NativeAssembler; +use miden_client_core::testing::account_id::ACCOUNT_ID_REGULAR_PRIVATE_ACCOUNT_UPDATABLE_CODE; +use miden_client_core::vm::{ MastArtifact as NativeMastArtifact, Package as NativePackage, PackageKind as NativePackageKind, diff --git a/crates/web-client/src/web_keystore.rs b/crates/web-client/src/web_keystore.rs index 79372ac48..8653f86d7 100644 --- a/crates/web-client/src/web_keystore.rs +++ b/crates/web-client/src/web_keystore.rs @@ -2,7 +2,7 @@ use alloc::string::ToString; use alloc::sync::Arc; use idxdb_store::auth::{get_account_auth_by_pub_key, insert_account_auth}; -use miden_client::auth::{ +use miden_client_core::auth::{ AuthSecretKey, PublicKey, PublicKeyCommitment, @@ -10,9 +10,9 @@ use miden_client::auth::{ SigningInputs, TransactionAuthenticator, }; -use miden_client::keystore::KeyStoreError; -use miden_client::utils::{RwLock, Serializable}; -use miden_client::{AuthenticationError, Word, Word as NativeWord}; +use miden_client_core::keystore::KeyStoreError; +use miden_client_core::utils::{RwLock, Serializable}; +use miden_client_core::{AuthenticationError, Word, Word as NativeWord}; use rand::Rng; use wasm_bindgen_futures::js_sys::Function; diff --git a/crates/web-client/src/web_keystore_callbacks.rs b/crates/web-client/src/web_keystore_callbacks.rs index b37f6e6e9..6982ed199 100644 --- a/crates/web-client/src/web_keystore_callbacks.rs +++ b/crates/web-client/src/web_keystore_callbacks.rs @@ -1,11 +1,11 @@ -use miden_client::auth::{ +use miden_client_core::auth::{ AuthSecretKey, Signature as NativeSignature, SigningInputs as NativeSigningInputs, }; -use miden_client::keystore::KeyStoreError; -use miden_client::utils::Deserializable; -use miden_client::{AuthenticationError, Word as NativeWord}; +use miden_client_core::keystore::KeyStoreError; +use miden_client_core::utils::Deserializable; +use miden_client_core::{AuthenticationError, Word as NativeWord}; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::JsFuture; use wasm_bindgen_futures::js_sys::{Function, Promise, Uint8Array}; diff --git a/docs/external/src/index.md b/docs/external/src/index.md index ae0461198..9099291a2 100644 --- a/docs/external/src/index.md +++ b/docs/external/src/index.md @@ -13,9 +13,10 @@ The Miden client currently has three main components: ### Miden client library -The Miden client library is a Rust library that can be integrated into projects, allowing developers to interact with the Miden rollup. +The Rust libraries are split into: -The library provides a set of APIs and functions for executing transactions, generating proofs, and managing activity on the Miden network. +- `miden-client-core`, a no_std-compatible crate with the core client logic and APIs for executing transactions, generating proofs, and managing activity on the Miden network. +- `miden-client`, a std-only facade that re-exports the core APIs and adds a background service for continuous sync and event hooks. ### Miden client CLI @@ -23,7 +24,8 @@ The Miden client also includes a command-line interface (CLI) that serves as a w The CLI provides commands for interacting with the Miden rollup, such as submitting transactions, syncing with the network, and managing account data. -More information about the CLI can be found in the [CLI section](./rust-client/cli). +More information about the CLI can be found in the [CLI section](./rust-client/cli), which now +documents the std-enabled `miden-client` service layer in addition to the core APIs. ### Miden web client diff --git a/docs/external/src/rust-client/cli/index.md b/docs/external/src/rust-client/cli/index.md index be1c4111a..b0ba543c4 100644 --- a/docs/external/src/rust-client/cli/index.md +++ b/docs/external/src/rust-client/cli/index.md @@ -8,6 +8,13 @@ The following document lists the commands that the CLI currently supports. Use `--help` as a flag on any command for more information. ::: +:::info +The CLI is built on top of the std-enabled `miden-client` crate, which wraps the shared +`miden-client-core` functionality together with the new background service runtime introduced in +this release. Existing workflows continue to work, but long-running applications can now rely on +the same crate to spawn a continuously syncing client service. +::: + ## Usage Call a command on the `miden-client` like this: @@ -65,7 +72,7 @@ miden-client init --remote-prover-endpoint miden-client init --note-transport-endpoint ``` -More information on the configuration file can be found in the [configuration section](https://github.com/0xMiden/miden-client/docs/typedoc/rust-client/cli-config.md). +More information on the configuration file can be found in the [configuration section](https://github.com/0xMiden/miden-client/docs/typedoc/miden-client-core/cli-config.md). ### `account` @@ -309,7 +316,7 @@ miden-client address remove 0x17f13f4f83a8e8100c19d2961dfda2 mlcl1qple0ejnutx8zy #### Tips -For `send` and `consume-notes`, you can omit the `--sender` and `--account` flags to use the default account defined in the [config](https://github.com/0xMiden/miden-client/docs/typedoc/rust-client/cli-config.md). If you omit the flag but have no default account defined in the config, you'll get an error instead. +For `send` and `consume-notes`, you can omit the `--sender` and `--account` flags to use the default account defined in the [config](https://github.com/0xMiden/miden-client/docs/typedoc/miden-client-core/cli-config.md). If you omit the flag but have no default account defined in the config, you'll get an error instead. For every command which needs an account ID (either wallet or faucet), you can also provide a partial ID instead of the full ID for each account. So instead of diff --git a/docs/external/src/web-client/index.md b/docs/external/src/web-client/index.md index 0f385702a..bf26b47cd 100644 --- a/docs/external/src/web-client/index.md +++ b/docs/external/src/web-client/index.md @@ -23,7 +23,7 @@ The SDK is built from the `web-client` crate, which: - Is implemented in Rust and compiled to WebAssembly - Uses `wasm-bindgen` to expose JavaScript-compatible bindings -- Depends on the rust-client crate, which contains core logic for blockchain interaction +- Depends on the `miden-client-core` crate, which contains the shared core logic for blockchain interaction A custom `rollup.config.js` bundles the WASM module, JS bindings, and web worker into a distributable NPM package. diff --git a/eslint.config.js b/eslint.config.js index 9c779bcdf..588bd45a7 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -54,7 +54,7 @@ module.exports = [ }, { files: ["**/*.ts", "**/*.tsx"], - ignores: ["crates/rust-client/*"], + ignores: ["crates/miden-client-core/*"], languageOptions: { parser: require("@typescript-eslint/parser"), parserOptions: {