From 539f83deb5595e4cbfa6dd0ad15e11efa563fceb Mon Sep 17 00:00:00 2001 From: Suhail Kakar Date: Tue, 31 Mar 2026 03:23:41 +0530 Subject: [PATCH 1/3] fix: add all missing fields to JSON output across all endpoints --- src/output/bridge.rs | 6 +++- src/output/clob/account.rs | 27 ++++++++++++++---- src/output/clob/orders.rs | 19 +++++++++++++ src/output/data.rs | 58 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 7 deletions(-) diff --git a/src/output/bridge.rs b/src/output/bridge.rs index 7944912..229ce52 100644 --- a/src/output/bridge.rs +++ b/src/output/bridge.rs @@ -73,7 +73,7 @@ pub fn print_supported_assets( println!("{table}"); } OutputFormat::Json => { - let data: Vec<_> = response + let assets: Vec<_> = response .supported_assets .iter() .map(|a| { @@ -88,6 +88,10 @@ pub fn print_supported_assets( }) }) .collect(); + let data = json!({ + "supported_assets": assets, + "note": response.note, + }); super::print_json(&data)?; } } diff --git a/src/output/clob/account.rs b/src/output/clob/account.rs index dd170a9..4ca2466 100644 --- a/src/output/clob/account.rs +++ b/src/output/clob/account.rs @@ -132,15 +132,28 @@ pub fn print_notifications( .map(|n| { json!({ "type": n.r#type, - "question": n.payload.question, - "side": n.payload.side.to_string(), - "price": n.payload.price.to_string(), - "outcome": n.payload.outcome, + "owner": n.owner.to_string(), + "asset_id": n.payload.asset_id.to_string(), + "condition_id": n.payload.condition_id.to_string(), + "event_slug": n.payload.event_slug, + "icon": n.payload.icon, + "image": n.payload.image, + "market": n.payload.market.to_string(), + "market_slug": n.payload.market_slug, "matched_size": n.payload.matched_size.to_string(), - "original_size": n.payload.original_size.to_string(), "order_id": n.payload.order_id, + "original_size": n.payload.original_size.to_string(), + "outcome": n.payload.outcome, + "outcome_index": n.payload.outcome_index, + "owner_payload": n.payload.owner.to_string(), + "price": n.payload.price.to_string(), + "question": n.payload.question, + "remaining_size": n.payload.remaining_size.to_string(), + "series_slug": n.payload.series_slug, + "side": n.payload.side.to_string(), "trade_id": n.payload.trade_id, - "market": n.payload.market.to_string(), + "transaction_hash": n.payload.transaction_hash.to_string(), + "order_type": n.payload.order_type.to_string(), }) }) .collect(); @@ -293,6 +306,7 @@ pub fn print_user_earnings_markets( "question": e.question, "market_slug": e.market_slug, "event_slug": e.event_slug, + "image": e.image, "earning_percentage": e.earning_percentage.to_string(), "rewards_max_spread": e.rewards_max_spread.to_string(), "rewards_min_size": e.rewards_min_size.to_string(), @@ -467,6 +481,7 @@ pub fn print_market_reward( "question": r.question, "market_slug": r.market_slug, "event_slug": r.event_slug, + "image": r.image, "rewards_max_spread": r.rewards_max_spread.to_string(), "rewards_min_size": r.rewards_min_size.to_string(), "market_competitiveness": r.market_competitiveness.to_string(), diff --git a/src/output/clob/orders.rs b/src/output/clob/orders.rs index 2a5711d..f6a0da7 100644 --- a/src/output/clob/orders.rs +++ b/src/output/clob/orders.rs @@ -60,12 +60,15 @@ pub fn print_orders(result: &Page, output: &OutputFormat) -> json!({ "id": o.id, "status": o.status.to_string(), + "owner": o.owner.to_string(), + "maker_address": o.maker_address.to_string(), "market": o.market.to_string(), "asset_id": o.asset_id.to_string(), "side": o.side.to_string(), "price": o.price.to_string(), "original_size": o.original_size.to_string(), "size_matched": o.size_matched.to_string(), + "associate_trades": o.associate_trades, "outcome": o.outcome, "order_type": o.order_type.to_string(), "created_at": o.created_at.to_rfc3339(), @@ -273,9 +276,25 @@ pub fn print_trades(result: &Page, output: &OutputFormat) -> anyh "fee_rate_bps": t.fee_rate_bps.to_string(), "status": t.status.to_string(), "match_time": t.match_time.to_rfc3339(), + "last_update": t.last_update.to_rfc3339(), "outcome": t.outcome, + "bucket_index": t.bucket_index, + "owner": t.owner.to_string(), + "maker_address": t.maker_address.to_string(), + "maker_orders": t.maker_orders.iter().map(|m| json!({ + "order_id": m.order_id, + "owner": m.owner.to_string(), + "maker_address": m.maker_address.to_string(), + "matched_amount": m.matched_amount.to_string(), + "price": m.price.to_string(), + "fee_rate_bps": m.fee_rate_bps.to_string(), + "asset_id": m.asset_id.to_string(), + "outcome": m.outcome, + "side": m.side.to_string(), + })).collect::>(), "trader_side": format!("{:?}", t.trader_side), "transaction_hash": t.transaction_hash.to_string(), + "error_msg": t.error_msg, }) }) .collect(); diff --git a/src/output/data.rs b/src/output/data.rs index 2b4b7c0..252a195 100644 --- a/src/output/data.rs +++ b/src/output/data.rs @@ -59,20 +59,30 @@ pub fn print_positions(positions: &[Position], output: &OutputFormat) -> anyhow: json!({ "title": p.title, "slug": p.slug, + "icon": p.icon, + "event_slug": p.event_slug, + "event_id": p.event_id, "outcome": p.outcome, "outcome_index": p.outcome_index, + "opposite_outcome": p.opposite_outcome, + "opposite_asset": p.opposite_asset.to_string(), + "asset": p.asset.to_string(), "size": p.size.to_string(), "avg_price": p.avg_price.to_string(), "initial_value": p.initial_value.to_string(), "current_value": p.current_value.to_string(), "cash_pnl": p.cash_pnl.to_string(), "percent_pnl": p.percent_pnl.to_string(), + "total_bought": p.total_bought.to_string(), "realized_pnl": p.realized_pnl.to_string(), + "percent_realized_pnl": p.percent_realized_pnl.to_string(), "cur_price": p.cur_price.to_string(), "condition_id": p.condition_id.to_string(), "proxy_wallet": p.proxy_wallet.to_string(), "redeemable": p.redeemable, "mergeable": p.mergeable, + "end_date": p.end_date.to_string(), + "negative_risk": p.negative_risk, }) }) .collect(); @@ -122,8 +132,13 @@ pub fn print_closed_positions( json!({ "title": p.title, "slug": p.slug, + "icon": p.icon, + "event_slug": p.event_slug, "outcome": p.outcome, "outcome_index": p.outcome_index, + "opposite_outcome": p.opposite_outcome, + "opposite_asset": p.opposite_asset.to_string(), + "asset": p.asset.to_string(), "avg_price": p.avg_price.to_string(), "total_bought": p.total_bought.to_string(), "realized_pnl": p.realized_pnl.to_string(), @@ -131,6 +146,7 @@ pub fn print_closed_positions( "condition_id": p.condition_id.to_string(), "proxy_wallet": p.proxy_wallet.to_string(), "timestamp": p.timestamp, + "end_date": p.end_date.to_rfc3339(), }) }) .collect(); @@ -228,15 +244,23 @@ pub fn print_trades(trades: &[Trade], output: &OutputFormat) -> anyhow::Result<( json!({ "title": t.title, "slug": t.slug, + "icon": t.icon, + "event_slug": t.event_slug, "side": t.side.to_string(), "outcome": t.outcome, "outcome_index": t.outcome_index, + "asset": t.asset.to_string(), "size": t.size.to_string(), "price": t.price.to_string(), "timestamp": t.timestamp, "condition_id": t.condition_id.to_string(), "proxy_wallet": t.proxy_wallet.to_string(), "transaction_hash": t.transaction_hash.to_string(), + "name": t.name, + "pseudonym": t.pseudonym, + "bio": t.bio, + "profile_image": t.profile_image, + "profile_image_optimized": t.profile_image_optimized, }) }) .collect(); @@ -259,6 +283,12 @@ pub fn print_activity(activity: &[Activity], output: &OutputFormat) -> anyhow::R activity_type: String, #[tabled(rename = "Market")] title: String, + #[tabled(rename = "Side")] + side: String, + #[tabled(rename = "Outcome")] + outcome: String, + #[tabled(rename = "Price")] + price: String, #[tabled(rename = "Size")] size: String, #[tabled(rename = "USDC")] @@ -271,6 +301,9 @@ pub fn print_activity(activity: &[Activity], output: &OutputFormat) -> anyhow::R .map(|a| Row { activity_type: a.activity_type.to_string(), title: truncate(a.title.as_deref().unwrap_or(DASH), 35), + side: a.side.as_ref().map(|s| s.to_string()).unwrap_or_default(), + outcome: a.outcome.as_deref().unwrap_or(DASH).into(), + price: a.price.map(|p| format!("{:.4}", p)).unwrap_or_default(), size: format!("{:.2}", a.size), usdc_size: format_decimal(a.usdc_size), tx: truncate(&a.transaction_hash.to_string(), 14), @@ -286,11 +319,25 @@ pub fn print_activity(activity: &[Activity], output: &OutputFormat) -> anyhow::R json!({ "activity_type": a.activity_type.to_string(), "title": a.title, + "slug": a.slug, + "icon": a.icon, + "event_slug": a.event_slug, + "side": a.side.as_ref().map(|s| s.to_string()), + "outcome": a.outcome, + "outcome_index": a.outcome_index, + "price": a.price.map(|p| p.to_string()), + "asset": a.asset.map(|a| a.to_string()), + "condition_id": a.condition_id.map(|c| c.to_string()), "size": a.size.to_string(), "usdc_size": a.usdc_size.to_string(), "timestamp": a.timestamp, "transaction_hash": a.transaction_hash.to_string(), "proxy_wallet": a.proxy_wallet.to_string(), + "name": a.name, + "pseudonym": a.pseudonym, + "bio": a.bio, + "profile_image": a.profile_image, + "profile_image_optimized": a.profile_image_optimized, }) }) .collect(); @@ -349,8 +396,14 @@ pub fn print_holders(meta_holders: &[MetaHolder], output: &OutputFormat) -> anyh "proxy_wallet": h.proxy_wallet.to_string(), "name": h.name, "pseudonym": h.pseudonym, + "bio": h.bio, + "asset": h.asset.to_string(), "amount": h.amount.to_string(), "outcome_index": h.outcome_index, + "display_username_public": h.display_username_public, + "profile_image": h.profile_image, + "profile_image_optimized": h.profile_image_optimized, + "verified": h.verified, }) }) .collect(); @@ -487,6 +540,9 @@ pub fn print_leaderboard( "user_name": e.user_name, "pnl": e.pnl.to_string(), "volume": e.vol.to_string(), + "profile_image": e.profile_image, + "x_username": e.x_username, + "verified_badge": e.verified_badge, }) }) .collect(); @@ -539,6 +595,7 @@ pub fn print_builder_leaderboard( "volume": e.volume.to_string(), "active_users": e.active_users, "verified": e.verified, + "builder_logo": e.builder_logo, }) }) .collect(); @@ -591,6 +648,7 @@ pub fn print_builder_volume( json!({ "date": e.dt.to_rfc3339(), "builder": e.builder, + "builder_logo": e.builder_logo, "volume": e.volume.to_string(), "active_users": e.active_users, "rank": e.rank, From 781d2e686715dd2c4de90344486a04fcee56a49a Mon Sep 17 00:00:00 2001 From: Suhail Kakar Date: Tue, 31 Mar 2026 03:38:06 +0530 Subject: [PATCH 2/3] fix end_data format --- src/output/data.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/output/data.rs b/src/output/data.rs index 252a195..cff3d35 100644 --- a/src/output/data.rs +++ b/src/output/data.rs @@ -81,7 +81,7 @@ pub fn print_positions(positions: &[Position], output: &OutputFormat) -> anyhow: "proxy_wallet": p.proxy_wallet.to_string(), "redeemable": p.redeemable, "mergeable": p.mergeable, - "end_date": p.end_date.to_string(), + "end_date": p.end_date.format("%Y-%m-%dT00:00:00+00:00").to_string(), "negative_risk": p.negative_risk, }) }) From b3b7dbfab5f7236604a392391de64bb88bc3e230 Mon Sep 17 00:00:00 2001 From: Suhail Kakar Date: Tue, 31 Mar 2026 03:48:49 +0530 Subject: [PATCH 3/3] fix end date field --- src/output/data.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/output/data.rs b/src/output/data.rs index cff3d35..673cad2 100644 --- a/src/output/data.rs +++ b/src/output/data.rs @@ -81,7 +81,7 @@ pub fn print_positions(positions: &[Position], output: &OutputFormat) -> anyhow: "proxy_wallet": p.proxy_wallet.to_string(), "redeemable": p.redeemable, "mergeable": p.mergeable, - "end_date": p.end_date.format("%Y-%m-%dT00:00:00+00:00").to_string(), + "end_date": p.end_date.to_string(), "negative_risk": p.negative_risk, }) }) @@ -146,7 +146,7 @@ pub fn print_closed_positions( "condition_id": p.condition_id.to_string(), "proxy_wallet": p.proxy_wallet.to_string(), "timestamp": p.timestamp, - "end_date": p.end_date.to_rfc3339(), + "end_date": p.end_date.date_naive().to_string(), }) }) .collect();