First merge of a big block of code to star develop#21
Conversation
… for db save of taken order
|
Caution Review failedThe pull request is closed. WalkthroughThis PR introduces a comprehensive UI module with tabbed navigation and keyboard event handling, restructures the application to use polling-based order fetching with background tasks, updates database schema to support trade key management, adds dependency upgrades, and implements direct message utilities for Nostr-based order communication. Changes
Sequence DiagramsequenceDiagram
participant User as User (TUI)
participant MainLoop as Main Event Loop
participant BGTask as Background Tasks
participant Client as Nostr Client
participant DB as Database
participant Mostro as Mostro Relay
rect rgb(177, 204, 51, 0.1)
note over MainLoop: Initialization
MainLoop->>DB: Initialize pool & schema
MainLoop->>Client: Configure with identity keys
MainLoop->>Client: Add relays & connect()
MainLoop->>BGTask: Spawn fetch_events task
MainLoop->>BGTask: Spawn listen_for_order_messages task
end
rect rgb(177, 204, 51, 0.1)
note over MainLoop: Main UI Loop
User->>MainLoop: KeyEvent (e.g., Enter to create order)
MainLoop->>MainLoop: Route via key_handler
MainLoop->>MainLoop: Update AppState/UiMode
MainLoop->>MainLoop: Call ui_draw → Render frame
end
rect rgb(177, 204, 51, 0.1)
note over BGTask: Background Order Fetch
BGTask->>Client: fetch_events_list(Orders, Pending)
Client->>Mostro: Subscribe & query events
Mostro-->>Client: SmallOrder events
Client-->>BGTask: Events received
BGTask->>MainLoop: Send via order_result_tx channel
end
rect rgb(177, 204, 51, 0.1)
note over MainLoop: Create/Send New Order
User->>MainLoop: Fill form & press Enter
MainLoop->>MainLoop: Validate & construct Order
MainLoop->>Client: send_dm(take\\_order payload)
Client->>Mostro: Send PrivateDirectMessage/GiftWrap
Mostro-->>Client: Response event
MainLoop->>DB: Order::new() → persist to DB
MainLoop->>MainLoop: Show OrderResult popup
end
rect rgb(177, 204, 51, 0.1)
note over BGTask: Message Listener
BGTask->>DB: Get active_order_trade_indices
loop Every 5s
BGTask->>Client: Fetch GiftWrap events for trade keys
Client->>Mostro: Query recent events
Mostro-->>Client: GiftWrap/DM events
BGTask->>BGTask: Decrypt & parse DMs
BGTask->>MainLoop: Send MessageNotification via channel
end
end
rect rgb(177, 204, 51, 0.1)
note over MainLoop: Handle Message Notification
MainLoop->>User: Show NewMessageNotification popup
User->>MainLoop: Enter invoice (AddInvoice action)
MainLoop->>Client: execute_add\\_invoice → send\\_dm
Client->>Mostro: Send AddInvoice payload
Mostro-->>MainLoop: Ack/response
MainLoop->>DB: Update order state
MainLoop->>MainLoop: Close popup, return to Orders tab
end
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120+ minutes Areas requiring detailed attention:
Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (24)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@grunch , @Catrya , @AndreaDiazCorreia ,
this is the first merge of a big block of code for new mostro tui client called MostriX, what is inside:
This is totally not usable at the moment and completely in develop.
Summary by CodeRabbit
New Features
Improvements
Chores
✏️ Tip: You can customize this high-level summary in your review settings.