Skip to main content

Crate godark

Crate godark 

Source
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§

AccountMarginSummary
Authoritative account-level margin summary. All amounts are decimal strings. free_collateral is the server-computed amount available to open new orders (already deducts margin reserved by resting orders), so render it directly rather than recomputing it.
AccountMarginUpdate
Dedicated account-margin push for a user. Emitted whenever collateral, positions, or resting-order holds change.
BalanceUpdate
Sequencer trading-collateral snapshot (BalanceUpdateMessage).
BatchCancelAck
Batch-level result of a batch cancel: one entry per submitted order id.
BatchCancelLegResult
Outcome of cancelling one order id in a batch-cancel request.
BatchModifyAck
Batch-level result of a batch modify: one entry per submitted leg.
BatchModifyLegInput
One amend leg of a batch modify. At least one of new_price/new_quantity must be set.
BatchModifyLegResult
Outcome of amending one resting order in a batch-modify request.
CountAck
Ack for account-wide cancel_all, close_all, or per-symbol reverse.
FundingRateUpdate
Funding rate tick for a symbol.
GodarkClient
GodarkConfig
Resolved configuration for a GodarkClient.
GodarkConfigBuilder
Builder for GodarkClient configuration.
GodarkRestClient
REST trading orchestrator. Encrypts every order client-side; the edge only forwards.
GodarkRestClientBuilder
Builder for GodarkRestClient — separate from GodarkConfigBuilder (WS) to keep the WS surface unchanged and allow REST-only consumers to compose a client without touching WS-specific knobs (TLS, heartbeat, etc.).
LeverageSetting
One row from GET /api/v1/leverage — per-symbol leverage setting.
LeverageSettings
Cached leverage settings for the authenticated user.
MarketDataClient
MassQuoteAck
Batch-level result of a mass quote: one entry per submitted leg.
MassQuoteLegInput
One cancel-replace leg of a mass quote. Mirrors the Python SDK leg dict.
MassQuoteLegResult
Outcome of one cancel-replace leg in a mass-quote batch.
MeProfile
Authenticated user profile (GET /api/v1/auth/me, session JWT only).
OpenOrderRow
One working order from a OpenOrdersSnapshot.
OpenOrdersSnapshot
Reply to encrypted POST /api/v1/openOrders (GetOpenOrders).
OrderAck
OrderErrorEntry
Static description of one canonical OrderErrorCode variant.
OrderUpdate
PlaceOrderOptions
Optional place-order flags mirrored from gdx-web / sequencer PlaceOrderInput.
PositionRow
One row of a PositionsSnapshot — a single open position with the sequencer’s mark price and unrealized PnL at snapshot time.
PositionsSnapshot
Full per-user positions batch sent by the sequencer (initial / periodic / event-triggered).
SystemHealthUpdate
Unified component health report routed via the trading WS.
TpslAck
RPC reply for amend / cancel TP-SL (NodeResponse::tpsl_ack).
TransportConfig
Tunable WebSocket transport (TLS verify, headers, timeouts).

Enums§

CancelReason
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.
GodarkError
Unified error type for the GoDark SDK.
OrderStatus
OrderType
OrderUpdateType
PositionsSnapshotSource
Why a PositionsSnapshot was emitted by the sequencer.
ReconnectEvent
Lifecycle notifications for trading client reconnect (and market data reconnect).
Side
StpMode
TimeInForce

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.