[−][src]Module nash_protocol::protocol
Implementation of Nash protocol. Most modules contain submodules for request and response
logic. The types.rs
submodule is a good place to start to understand any given protocol
request. All protocol requests follow logic described by the NashProtocol
or
NashProtocolSubscription
traits.
Modules
asset_nonces | Retrieve current asset nonces from Nash server. Asset nonces allow the smart contract to reason about whether a payload such as a sync state or fill order request is valid in relation to previous activity. Generally, only payloads with a higher nonce than the last seen nonce for an asset are considered valid. For fill order payloads, the nonce must equal the current nonce. |
cancel_all_orders | Cancel all open orders across markets for the account associated with current session |
cancel_order | Cancel a single open order by order id. Must be an order placed by the account associated with the current session |
dh_fill_pool | Retrieve pool of R-values to use for requests that require signing with threshold signatures |
get_account_order | Lookup information associated with an order via id |
get_ticker | Get market ticker. Contains information about recent trade prices, liquidity at order book tip, and market volume |
list_account_balances | Get assets balances associated with the current account session. Returns balances in the account's personal wallet and funds pending and at rest in the Nash state channels. |
list_account_orders | List orders associated with the current account session |
list_account_trades | Get trades associated with the current account session |
list_candles | Get exchange candle data |
list_markets | Get list of current markets running on Nash, as well as associated data. |
orderbook | Get orderbook data |
place_order | Place limit orders |
sign_all_states | |
sign_states | State signing manages the user signing of current account balances in the Nash state channel, as well as re-signing open orders (recycled orders) |
subscriptions |
Structs
DataResponse | Inner wrapper on valid GraphQL response data |
Error | |
ErrorResponse | Inner wrapper on error GraphQL response data |
RequestPayloadSignature | This signature format is used for GraphQL request payload signatures Data is SHA256 hashed and signed with a secp256k1 ECDSA key |
State | Client state shared across the protocol. |
Enums
ErrorOrData | |
NashProtocolRequest | An enum wrapping all the different protocol requests |
ProtocolHook | Captures and protocol request or pipeline that can be executed in a |
ResponseOrError | Wrapper type to account for GraphQL errors |
Traits
NashProtocol | Trait that all Nash protocol elements implement. Enforces transformation to GraphQL as well as state changes on response processing. |
NashProtocolPipeline | Trait to abstract over a series of linked protocol requests. For example we use this to abstract over repeated calls to sign_state until there are no more states to sign. |
NashProtocolSubscription | Trait that defines subscriptions over the Nash protocol. The main difference is that
the transformation of response data to |
Functions
general_canonical_string | Given an operation name, unstructured JSON object under the payload key (common to all mutations that require signatures) and list of fields to remove, return a canonical string representation for signing the mutation |
json_to_type_or_error | Helper to convert JSON to a response or error |
serializable_to_json | |
try_response_from_json | Helper to convert data corresponding to raw GraphQL types (B) into nicer library managed types A when failure is possible |