diff --git a/docs/cli/wallet-commands.md b/docs/cli/wallet-commands.md index 2475c93d..54364c86 100644 --- a/docs/cli/wallet-commands.md +++ b/docs/cli/wallet-commands.md @@ -53,7 +53,10 @@ modal wallet incoming `decimals`, and how many sends wait to be received. `incoming` lists each waiting `SEND`: amount, asset, sender, and the `SEND` commit and index. Both read the remote node's `/contract/account`, so a send counts once it is -sequenced there. +sequenced there. With `incoming --output json`, `amount` remains in the +asset's smallest units; `shown` is the decimal display amount and `asset` +is the readable name (for example, `MOD`). The contract and asset IDs remain +in the output for unambiguous processing. ## Receive diff --git a/rust/modality-cli-contract/src/commit.rs b/rust/modality-cli-contract/src/commit.rs index d14cea59..0d93b858 100644 --- a/rust/modality-cli-contract/src/commit.rs +++ b/rust/modality-cli-contract/src/commit.rs @@ -382,6 +382,7 @@ pub async fn make(opts: &Opts) -> Result> { // Validate against contract rules (signature predicates, etc.) store.validate_commit_against_rules(&commit)?; + #[cfg_attr(not(feature = "model-status"), allow(unused_mut))] let mut model_repair = None; let theory_preview = match validate_commit_against_model(&dir, &store, &commit, &opts.theory) { Ok(preview) => preview, diff --git a/rust/modality-cli-contract/src/wallet.rs b/rust/modality-cli-contract/src/wallet.rs index 9b21526b..00acb068 100644 --- a/rust/modality-cli-contract/src/wallet.rs +++ b/rust/modality-cli-contract/src/wallet.rs @@ -542,7 +542,25 @@ async fn incoming(opts: &WalletOpts) -> Result<()> { let wallet = Wallet::open(opts)?; let account = wallet.account().await?; if opts.output == "json" { - println!("{}", serde_json::to_string_pretty(&account.incoming)?); + let sends: Vec = account + .incoming + .iter() + .map(|send| { + json!({ + "send_commit_id": send.send_commit_id, + "send_index": send.send_index, + "from_contract": send.from_contract, + "asset_contract": send.asset_contract, + "asset_id": send.asset_id, + "amount": send.amount, + "memo": send.memo, + "decimals": send.decimals, + "asset": account.name(&send.asset_contract, &send.asset_id), + "shown": format_amount(send.amount, send.decimals), + }) + }) + .collect(); + println!("{}", serde_json::to_string_pretty(&sends)?); return Ok(()); } if account.incoming.is_empty() {