Skip to content

Commit c74135c

Browse files
committed
fix: scope orders_info request to identity key
Orders info is account-scoped — Mostro indexes users by identity pubkey. Drop the trade_index from the message and run the whole exchange (send, wait, decrypt) on identity_keys, matching restore/last_trade_index.
1 parent 88ab6e7 commit c74135c

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/cli/orders_info.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ pub async fn execute_orders_info(order_ids: &[Uuid], ctx: &Context) -> Result<()
2727
// Create payload with the order IDs
2828
let payload = Payload::Ids(order_ids.to_vec());
2929

30-
// Create message using the proper Message structure
30+
// Orders info is account-scoped — Mostro indexes users by their identity
31+
// pubkey, so the message carries no trade_index and the whole exchange
32+
// (send, wait, decrypt) runs on `identity_keys`.
3133
let message = Message::new_order(
3234
None,
3335
Some(request_id),
34-
Some(ctx.trade_index),
36+
None,
3537
Action::Orders,
3638
Some(payload),
3739
);
@@ -45,18 +47,19 @@ pub async fn execute_orders_info(order_ids: &[Uuid], ctx: &Context) -> Result<()
4547
let sent_message = send_dm(
4648
&ctx.client,
4749
&ctx.identity_keys,
48-
&ctx.trade_keys,
50+
&ctx.identity_keys,
4951
&ctx.mostro_pubkey,
5052
message_json,
5153
None,
5254
false,
5355
);
5456

5557
// Wait for the DM response from mostro
56-
let recv_event = wait_for_dm(ctx, None, sent_message).await?;
58+
let recv_event = wait_for_dm(ctx, Some(&ctx.identity_keys), sent_message).await?;
5759

5860
// Parse the incoming DM and handle the response
59-
let messages = crate::parser::dms::parse_dm_events(recv_event, &ctx.trade_keys, None).await;
61+
let messages =
62+
crate::parser::dms::parse_dm_events(recv_event, &ctx.identity_keys, None).await;
6063
if let Some((message, _, _)) = messages.first() {
6164
let message_kind = message.get_inner_message_kind();
6265

0 commit comments

Comments
 (0)