Skip to content

feat: push websocket event when tx is not confirmed within TTL#152

Open
LukasDeco wants to merge 3 commits intomasterfrom
lukas/tx-fail-ws
Open

feat: push websocket event when tx is not confirmed within TTL#152
LukasDeco wants to merge 3 commits intomasterfrom
lukas/tx-fail-ws

Conversation

@LukasDeco
Copy link
Copy Markdown
Contributor

When transactions are not confirmed on-chain within the gateway retry window, the gateway currently only logs tx was not confirmed: <signature> and nothing is sent over the websocket. This change adds a websocket notification so clients can handle dropped/expired transactions without relying only on polling the transactionEvent HTTP endpoint.

Changes:

  • New transaction channel with txNotConfirmed event payload (signature + subAccountId)
  • Broadcast channel from controller to WS server; when the confirmation loop times out, the gateway sends (sub_account_id, signature) so all clients subscribed to that subaccount receive the event
  • Subaccount context is threaded through send_tx and all tx-producing endpoints (cancel/place/modify/swap/set_leverage/titan_swap)
  • README WebSocket API section updated with the new event shape
  • Serialization test for txNotConfirmed payload

The HTTP transactionEvent endpoint is unchanged; the websocket event is an additional signal for timeout/drop handling.

Made with Cursor

When a transaction is not confirmed on-chain within the gateway retry
window, the gateway now broadcasts a txNotConfirmed event on the
transaction channel to all websocket clients subscribed to the same
subAccountId. This allows clients to handle dropped/expired txs without
relying only on polling the transactionEvent HTTP endpoint.

- Add Channel::Transaction and AccountEvent::TxNotConfirmed in websocket
- Add broadcast channel from controller to WS server for tx-not-confirmed
- Thread sub_account_id through send_tx and all tx-producing endpoints
- Document new event in README WebSocket API section
- Add serialization test for txNotConfirmed payload

Made-with: Cursor
Made-with: Cursor
- controller: allow dead_code/unused_imports in test cfg
- websocket: use _ for unused Swap arm bindings (user, fee)
- main: ignore 5 tests that require JUPITER_API_KEY or flaky RPC (run with --ignored when env set)

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant