Expand description
GoDark DEX Rust SDK — HPKE-encrypted trading over gdx-edge.
Protocol source of truth: gdx-edge + gdx-sequencer (HPKE Base,
TradingWsBinaryFrame, REST one-shot HPKE).
Modules§
- pb
- Raw protobuf types (
gdx.sequencer.v1,gdx.edge.v1).
Structs§
- Account
Margin Summary - Authoritative account-level margin summary. All amounts are decimal strings.
free_collateralis the server-computed amount available to open new orders (already deducts margin reserved by resting orders), so render it directly rather than recomputing it. - Account
Margin Update - Dedicated account-margin push for a user. Emitted whenever collateral, positions, or resting-order holds change.
- Balance
Update - Sequencer trading-collateral snapshot (
BalanceUpdateMessage). - Batch
Cancel Ack - Batch-level result of a batch cancel: one entry per submitted order id.
- Batch
Cancel LegResult - Outcome of cancelling one order id in a batch-cancel request.
- Batch
Modify Ack - Batch-level result of a batch modify: one entry per submitted leg.
- Batch
Modify LegInput - One amend leg of a batch modify. At least one of
new_price/new_quantitymust be set. - Batch
Modify LegResult - Outcome of amending one resting order in a batch-modify request.
- Count
Ack - Ack for account-wide
cancel_all,close_all, or per-symbolreverse. - Funding
Rate Update - Funding rate tick for a symbol.
- Godark
Client - Godark
Config - Resolved configuration for a GodarkClient.
- Godark
Config Builder - Builder for GodarkClient configuration.
- Godark
Rest Client - REST trading orchestrator. Encrypts every order client-side; the edge only forwards.
- Godark
Rest Client Builder - Builder for
GodarkRestClient— separate fromGodarkConfigBuilder(WS) to keep the WS surface unchanged and allow REST-only consumers to compose a client without touching WS-specific knobs (TLS, heartbeat, etc.). - Leverage
Setting - One row from
GET /api/v1/leverage— per-symbol leverage setting. - Leverage
Settings - Cached leverage settings for the authenticated user.
- Market
Data Client - Mass
Quote Ack - Batch-level result of a mass quote: one entry per submitted leg.
- Mass
Quote LegInput - One cancel-replace leg of a mass quote. Mirrors the Python SDK leg dict.
- Mass
Quote LegResult - Outcome of one cancel-replace leg in a mass-quote batch.
- MeProfile
- Authenticated user profile (
GET /api/v1/auth/me, session JWT only). - Open
Order Row - One working order from a
OpenOrdersSnapshot. - Open
Orders Snapshot - Reply to encrypted
POST /api/v1/openOrders(GetOpenOrders). - Order
Ack - Order
Error Entry - Static description of one canonical
OrderErrorCodevariant. - Order
Update - Place
Order Options - Optional place-order flags mirrored from gdx-web / sequencer
PlaceOrderInput. - Position
Row - One row of a
PositionsSnapshot— a single open position with the sequencer’s mark price and unrealized PnL at snapshot time. - Positions
Snapshot - Full per-user positions batch sent by the sequencer (initial / periodic / event-triggered).
- System
Health Update - Unified component health report routed via the trading WS.
- TpslAck
- RPC reply for amend / cancel TP-SL (
NodeResponse::tpsl_ack). - Transport
Config - Tunable WebSocket transport (TLS verify, headers, timeouts).
Enums§
- Cancel
Reason - Confirmation
- Confirmation boundary for high-level
crate::GodarkClient::place_order. - Environment
- Named deployment target. Selects the default edge / REST URL and, when known, a baked-in sequencer HPKE public key pin.
- Godark
Error - Unified error type for the GoDark SDK.
- Order
Status - Order
Type - Order
Update Type - Positions
Snapshot Source - Why a
PositionsSnapshotwas emitted by the sequencer. - Reconnect
Event - Lifecycle notifications for trading client reconnect (and market data reconnect).
- Side
- StpMode
- Time
InForce
Constants§
- ORDER_
ERROR_ CODES - All canonical order-error codes the sequencer can emit. Keep in sync with
gdx-protocol/src/order_error.rs.
Functions§
- find_
order_ error - Look up an entry by its numeric wire code.
- resolve_
passphrase - Resolve passphrase: constructor arg wins, then env vars.