diff --git a/crates/web-client/Cargo.toml b/crates/web-client/Cargo.toml index 43ff926c4..c251b3982 100644 --- a/crates/web-client/Cargo.toml +++ b/crates/web-client/Cargo.toml @@ -22,6 +22,7 @@ getrandom = { version = "0.2", features = ["js"] } miden-client = { path = "../rust-client", version = "0.5", default-features = false, features = ["idxdb", "web-tonic", "testing"] } miden-lib = { workspace = true } miden-objects = { workspace = true } +miden-tx-prover = { git = "https://github.com/0xPolygonMiden/miden-base", branch = "next", features = ["async", "testing"], default-features = false } rand = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } diff --git a/crates/web-client/src/lib.rs b/crates/web-client/src/lib.rs index a249ae7cd..2cd9770f6 100644 --- a/crates/web-client/src/lib.rs +++ b/crates/web-client/src/lib.rs @@ -4,10 +4,11 @@ use alloc::sync::Arc; use miden_client::{ rpc::WebTonicRpcClient, store::{web_store::WebStore, StoreAuthenticator}, - transactions::LocalTransactionProver, + transactions::{LocalTransactionProver, TransactionProver}, Client, }; use miden_objects::{crypto::rand::RpoRandomCoin, Felt}; +use miden_tx_prover::RemoteTransactionProver; use rand::{rngs::StdRng, Rng, SeedableRng}; use wasm_bindgen::prelude::*; @@ -45,7 +46,11 @@ impl WebClient { self.inner.as_mut() } - pub async fn create_client(&mut self, node_url: Option) -> Result { + pub async fn create_client( + &mut self, + node_url: Option, + proving_url: Option, + ) -> Result { let mut rng = StdRng::from_entropy(); let coin_seed: [u64; 4] = rng.gen(); @@ -59,7 +64,10 @@ impl WebClient { &node_url.unwrap_or_else(|| "http://18.203.155.106:57291".to_string()), )); - let tx_prover = Arc::new(LocalTransactionProver::default()); + let tx_prover: Arc = match proving_url { + Some(proving_url) => Arc::new(RemoteTransactionProver::new(&proving_url.to_string())), + None => Arc::new(LocalTransactionProver::new(Default::default())), + }; self.inner = Some(Client::new( web_rpc_client, diff --git a/crates/web-client/src/models/input_note_record.rs b/crates/web-client/src/models/input_note_record.rs index b619a2e4c..52551e984 100644 --- a/crates/web-client/src/models/input_note_record.rs +++ b/crates/web-client/src/models/input_note_record.rs @@ -1,7 +1,10 @@ use miden_client::store::InputNoteRecord as NativeInputNoteRecord; use wasm_bindgen::prelude::*; -use super::{input_note_state::InputNoteState, note_details::NoteDetails, note_id::NoteId}; +use super::{ + input_note_state::InputNoteState, note_details::NoteDetails, note_id::NoteId, + note_metadata::NoteMetadata, +}; #[derive(Clone)] #[wasm_bindgen] @@ -20,6 +23,13 @@ impl InputNoteRecord { pub fn details(&self) -> NoteDetails { self.0.details().into() } + + pub fn metadata(&self) -> Option { + match self.0.metadata() { + Some(metadata) => Some(metadata.into()), + None => None, + } + } } // CONVERSIONS