From b4c4cf676be0dbce1eeb583ae412ddf047d5e144 Mon Sep 17 00:00:00 2001 From: RajMandaliya Date: Fri, 6 Mar 2026 17:52:11 -0500 Subject: [PATCH 1/4] fix(data): include missing fields in activity output Add side, price, outcome, outcome_index, condition_id, slug, and asset to both JSON and table output for the data activity command. All fields were present on the Activity struct but not included in the output renderer. This caused side (BUY/SELL) to be absent from JSON output, making it impossible to distinguish buys from sells for non-CLOB activity records. Fixes #29 --- src/output/data.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/output/data.rs b/src/output/data.rs index 9f46955..754133a 100644 --- a/src/output/data.rs +++ b/src/output/data.rs @@ -259,8 +259,14 @@ pub fn print_activity(activity: &[Activity], output: &OutputFormat) -> anyhow::R struct Row { #[tabled(rename = "Type")] activity_type: String, + #[tabled(rename = "Side")] + side: String, #[tabled(rename = "Market")] title: String, + #[tabled(rename = "Outcome")] + outcome: String, + #[tabled(rename = "Price")] + price: String, #[tabled(rename = "Size")] size: String, #[tabled(rename = "USDC")] @@ -272,7 +278,10 @@ pub fn print_activity(activity: &[Activity], output: &OutputFormat) -> anyhow::R .iter() .map(|a| Row { activity_type: a.activity_type.to_string(), + side: a.side.as_ref().map(|s| s.to_string()).unwrap_or("—".into()), title: truncate(a.title.as_deref().unwrap_or("—"), 35), + outcome: a.outcome.as_deref().unwrap_or("—").into(), + price: a.price.as_ref().map(|p| format!("{:.4}", p)).unwrap_or("—".into()), size: format!("{:.2}", a.size), usdc_size: format_decimal(a.usdc_size), tx: truncate(&a.transaction_hash.to_string(), 14), @@ -293,6 +302,13 @@ pub fn print_activity(activity: &[Activity], output: &OutputFormat) -> anyhow::R "timestamp": a.timestamp, "transaction_hash": a.transaction_hash.to_string(), "proxy_wallet": a.proxy_wallet.to_string(), + "side": a.side.as_ref().map(|s| s.to_string()), + "price": a.price.as_ref().map(|p| p.to_string()), + "asset": a.asset.as_ref().map(|a| a.to_string()), + "outcome": a.outcome, + "outcome_index": a.outcome_index, + "condition_id": a.condition_id.as_ref().map(|c| c.to_string()), + "slug": a.slug, }) }) .collect(); From 1139ba6546af05dacd9f3a7f2da845424f10d43c Mon Sep 17 00:00:00 2001 From: RajMandaliya Date: Fri, 6 Mar 2026 18:03:25 -0500 Subject: [PATCH 2/4] fix(data): include missing fields in activity output Add side, price, outcome, outcome_index, condition_id, slug, and asset to both JSON and table output for the data activity command. All fields were present on the Activity struct but not included in the output renderer. This caused side (BUY/SELL) to be absent from JSON output, making it impossible to distinguish buys from sells for non-CLOB activity records. Fixes #29" --- tests/cli_integration.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/cli_integration.rs b/tests/cli_integration.rs index 41d3d11..5097b87 100644 --- a/tests/cli_integration.rs +++ b/tests/cli_integration.rs @@ -67,7 +67,26 @@ fn events_help_lists_subcommands() { .and(predicate::str::contains("tags")), ); } +#[test] +fn data_activity_help_shows_subcommand() { + polymarket() + .args(["data", "activity", "--help"]) + .assert() + .success() + .stdout( + predicate::str::contains("address") + .and(predicate::str::contains("limit")) + .and(predicate::str::contains("offset")), + ); +} +#[test] +fn data_activity_requires_address() { + polymarket() + .args(["data", "activity"]) + .assert() + .failure(); +} #[test] fn wallet_help_lists_subcommands() { polymarket() From 2f7b1dde3bfab7a3d8e3507e577b44d58f8ea039 Mon Sep 17 00:00:00 2001 From: RajMandaliya Date: Fri, 6 Mar 2026 18:14:27 -0500 Subject: [PATCH 3/4] fix: rename shadowed closure parameter in print_activity --- src/output/data.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/output/data.rs b/src/output/data.rs index 754133a..b500895 100644 --- a/src/output/data.rs +++ b/src/output/data.rs @@ -248,6 +248,12 @@ pub fn print_trades(trades: &[Trade], output: &OutputFormat) -> anyhow::Result<( Ok(()) } +/// Renders on-chain activity records to the configured output format. +/// +/// In JSON mode, all fields from the [`Activity`] struct are included — +/// notably `side`, `price`, `outcome`, `outcome_index`, `condition_id`, +/// `slug`, and `asset` which are required to distinguish buy/sell trades +/// and identify the market and outcome for non-CLOB activity records. pub fn print_activity(activity: &[Activity], output: &OutputFormat) -> anyhow::Result<()> { match output { OutputFormat::Table => { @@ -304,7 +310,7 @@ pub fn print_activity(activity: &[Activity], output: &OutputFormat) -> anyhow::R "proxy_wallet": a.proxy_wallet.to_string(), "side": a.side.as_ref().map(|s| s.to_string()), "price": a.price.as_ref().map(|p| p.to_string()), - "asset": a.asset.as_ref().map(|a| a.to_string()), + "asset": a.asset.as_ref().map(|asset| asset.to_string()), "outcome": a.outcome, "outcome_index": a.outcome_index, "condition_id": a.condition_id.as_ref().map(|c| c.to_string()), From 01eddea0a1eaa0bb05860654de8d36ee1535cb3d Mon Sep 17 00:00:00 2001 From: RajMandaliya Date: Wed, 11 Mar 2026 08:31:14 -0400 Subject: [PATCH 4/4] Updated code with DASH --- src/output/data.rs | 10 +++++----- src/output/mod.rs | 2 ++ tests/cli_integration.rs | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/output/data.rs b/src/output/data.rs index b500895..26b286e 100644 --- a/src/output/data.rs +++ b/src/output/data.rs @@ -8,7 +8,7 @@ use serde_json::json; use tabled::settings::Style; use tabled::{Table, Tabled}; -use super::{OutputFormat, format_decimal, truncate}; +use super::{DASH,OutputFormat, format_decimal, truncate}; fn format_market(m: &Market) -> String { match m { @@ -284,10 +284,10 @@ pub fn print_activity(activity: &[Activity], output: &OutputFormat) -> anyhow::R .iter() .map(|a| Row { activity_type: a.activity_type.to_string(), - side: a.side.as_ref().map(|s| s.to_string()).unwrap_or("—".into()), - title: truncate(a.title.as_deref().unwrap_or("—"), 35), - outcome: a.outcome.as_deref().unwrap_or("—").into(), - price: a.price.as_ref().map(|p| format!("{:.4}", p)).unwrap_or("—".into()), + side: a.side.as_ref().map(|s| s.to_string()).unwrap_or(DASH.into()), + title: truncate(a.title.as_deref().unwrap_or(DASH), 35), + outcome: a.outcome.as_deref().unwrap_or(DASH).into(), + price: a.price.as_ref().map(|p| format!("{:.4}", p)).unwrap_or(DASH.into()), size: format!("{:.2}", a.size), usdc_size: format_decimal(a.usdc_size), tx: truncate(&a.transaction_hash.to_string(), 14), diff --git a/src/output/mod.rs b/src/output/mod.rs index cc76acd..2b0d8b6 100644 --- a/src/output/mod.rs +++ b/src/output/mod.rs @@ -17,6 +17,8 @@ use tabled::Table; use tabled::settings::object::Columns; use tabled::settings::{Modify, Style, Width}; +pub(crate) const DASH: &str = "—"; + #[derive(Clone, Copy, Debug, clap::ValueEnum)] pub enum OutputFormat { Table, diff --git a/tests/cli_integration.rs b/tests/cli_integration.rs index 5097b87..65d2256 100644 --- a/tests/cli_integration.rs +++ b/tests/cli_integration.rs @@ -87,6 +87,7 @@ fn data_activity_requires_address() { .assert() .failure(); } + #[test] fn wallet_help_lists_subcommands() { polymarket()