Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/cli/wallet-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions rust/modality-cli-contract/src/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ pub async fn make(opts: &Opts) -> Result<Option<Committed>> {

// 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,
Expand Down
20 changes: 19 additions & 1 deletion rust/modality-cli-contract/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Value> = 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() {
Expand Down
Loading