Client Changes
This section covers client API updates for both Rust and Web clients.
These changes affect both Rust SDK users and JavaScript/TypeScript WebClient users. Check which sections apply to your stack.
Rust RPC Changes
The batch get_account_proofs method has been removed. Use individual get_account calls instead.
src/rpc.rs
- // Before: batch account proofs
- let proofs = client.get_account_proofs(&account_ids).await?;
+ // After: individual account calls
+ let mut accounts = Vec::new();
+ for account_id in &account_ids {
+ let account = client.get_account(account_id).await?;
+ accounts.push(account);
+ }
For better performance with many accounts, consider using futures::join_all to parallelize the requests.
RNG Requirements
Client RNG must implement Send + Sync:
src/client.rs
- use rand::rngs::ThreadRng;
- let client = Client::new(config, ThreadRng::default())?;
+ use rand::rngs::StdRng;
+ use rand::SeedableRng;
+ let rng = StdRng::from_entropy(); // StdRng is Send + Sync
+ let client = Client::new(config, rng)?;
CLI Changes
The swap command no longer accepts payback_note_type:
Terminal
# Before
- miden-client swap --amount 100 --payback-note-type private
# After
miden-client swap --amount 100
# Note type is now determined automatically
WebClient Store
WebClient store now requires optional store name for multiple instances.
src/client.ts
- // Before
- const client = await WebClient.create(config);
+ // After: optional store name for isolation
+ const client = await WebClient.create(config, {
+ storeName: 'my-app-store' // Optional, for multiple instances
+ });
Block Numbers
Block numbers changed from strings to numeric types:
src/api.ts
- // Before (JavaScript)
- const blockNum = response.blockNumber; // "12345"
- const parsed = parseInt(blockNum);
+ // After
+ const blockNum = response.blockNumber; // 12345 (number)
NetworkId
NetworkId replaced enum with class using static constructors:
src/network.ts
- // Before (TypeScript)
- import { NetworkId } from 'miden-client';
- const network = NetworkId.Testnet;
+ // After
+ import { NetworkId } from 'miden-client';
+ const network = NetworkId.testnet(); // Static constructor
+ const custom = NetworkId.custom(chainId);
Migration Steps
- Replace batch
get_account_proofswith individualget_accountcalls - Ensure RNG types implement
Send + Sync(useStdRng) - Remove
payback_note_typefrom swap CLI commands - Add store name parameter to WebClient if using multiple instances
- Update code expecting string block numbers to handle numeric types
- Replace
NetworkIdenum usage with static constructors
Common Errors
| Error | Cause | Fix |
|---|---|---|
get_account_proofs not found | API removed | Use get_account per account |
ThreadRng does not implement Send | RNG constraint | Use StdRng |
unexpected argument 'payback-note-type' | CLI changed | Remove the argument |
NetworkId.Testnet is not a function | Enum → class | Use NetworkId.testnet() |