| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Hydra.API.ServerOutput
Synopsis
- data ServerOutput tx
- = NetworkConnected
- | NetworkDisconnected
- | NetworkVersionMismatch { }
- | NetworkClusterIDMismatch {
- clusterPeers :: Text
- misconfiguredPeers :: Text
- | PeerConnected { }
- | PeerDisconnected { }
- | HeadIsOpen { }
- | HeadIsClosed {
- headId :: HeadId
- snapshotNumber :: SnapshotNumber
- contestationDeadline :: UTCTime
- | HeadIsContested {
- headId :: HeadId
- snapshotNumber :: SnapshotNumber
- contestationDeadline :: UTCTime
- | ReadyToFanout {
- headId :: HeadId
- | HeadPartiallyFannedOut {
- headId :: HeadId
- distributedUTxO :: UTxOType tx
- remainingUTxO :: UTxOType tx
- fanoutMode :: FanoutProgressMode
- | HeadIsFinalized {
- headId :: HeadId
- finalizedUTxO :: UTxOType tx
- | TxValid {
- headId :: HeadId
- transactionId :: TxIdType tx
- | TxInvalid {
- headId :: HeadId
- utxo :: UTxOType tx
- transaction :: tx
- validationError :: ValidationError
- | SnapshotConfirmed {
- headId :: HeadId
- snapshot :: Snapshot tx
- signatures :: MultiSignature (Snapshot tx)
- | IgnoredHeadInitializing {
- headId :: HeadId
- contestationPeriod :: ContestationPeriod
- parties :: [Party]
- participants :: [OnChainId]
- | DecommitRequested {
- headId :: HeadId
- decommitTx :: tx
- utxoToDecommit :: UTxOType tx
- | DecommitInvalid {
- headId :: HeadId
- decommitTx :: tx
- decommitInvalidReason :: DecommitInvalidReason tx
- | DecommitApproved {
- headId :: HeadId
- decommitTxId :: TxIdType tx
- utxoToDecommit :: UTxOType tx
- | DecommitFinalized {
- headId :: HeadId
- distributedUTxO :: UTxOType tx
- | CommitRecorded {
- headId :: HeadId
- utxoToCommit :: UTxOType tx
- pendingDeposit :: TxIdType tx
- deadline :: UTCTime
- | DepositActivated { }
- | DepositExpired { }
- | CommitApproved {
- headId :: HeadId
- utxoToCommit :: UTxOType tx
- | CommitFinalized {
- headId :: HeadId
- depositTxId :: TxIdType tx
- | CommitRecovered {
- headId :: HeadId
- recoveredUTxO :: UTxOType tx
- recoveredTxId :: TxIdType tx
- | SnapshotSideLoaded {
- headId :: HeadId
- snapshotNumber :: SnapshotNumber
- | EventLogRotated {
- checkpoint :: NodeState tx
- | NodeUnsynced {
- chainSlot :: ChainSlot
- chainTime :: UTCTime
- drift :: NominalDiffTime
- | NodeSynced {
- chainSlot :: ChainSlot
- chainTime :: UTCTime
- drift :: NominalDiffTime
- data ClientMessage tx
- = CommandFailed {
- clientInput :: ClientInput tx
- state :: HeadState tx
- | PostTxOnChainFailed {
- postChainTx :: PostChainTx tx
- postTxError :: PostTxError tx
- | RejectedInputBecauseUnsynced {
- clientInput :: ClientInput tx
- drift :: NominalDiffTime
- | SideLoadSnapshotRejected { }
- = CommandFailed {
- data CommitInfo
- = CannotCommit
- | IncrementalCommit HeadId
- data TimedServerOutput tx = TimedServerOutput {}
- data NetworkInfo = NetworkInfo {}
- data Greetings tx = Greetings {
- me :: Party
- headStatus :: HeadStatus
- hydraHeadId :: Maybe HeadId
- snapshotUtxo :: Maybe (UTxOType tx)
- hydraNodeVersion :: String
- env :: Environment
- networkInfo :: NetworkInfo
- chainSyncedStatus :: SyncedStatus
- currentSlot :: ChainSlot
- data HeadStatus
- = Idle
- | Open
- | Closed
- | FanoutPossible
- | FanningOut
- data InvalidInput = InvalidInput {}
- data ServerOutputConfig = ServerOutputConfig {}
- data WithAddressedTx
- = WithAddressedTx Text
- | WithoutAddressedTx
- data WithUTxO
- data DecommitInvalidReason tx
- = DecommitTxInvalid {
- localUTxO :: UTxOType tx
- validationError :: ValidationError
- | DecommitAlreadyInFlight {
- otherDecommitTxId :: TxIdType tx
- | DepositInFlight {
- depositTxId :: TxIdType tx
- commitUTxO :: UTxOType tx
- = DecommitTxInvalid {
- data ApiMessage tx
- data FanoutProgressMode
- getConfirmedSnapshot :: HeadState tx -> Maybe (ConfirmedSnapshot tx)
- getSeenSnapshot :: IsTx tx => HeadState tx -> SeenSnapshot tx
- getSnapshotUtxo :: IsTx tx => HeadState tx -> Maybe (UTxOType tx)
- fanoutProgressMode :: FanoutMode tx -> FanoutProgressMode
- handleUtxoInclusionTyped :: IsTx tx => ServerOutputConfig -> TimedServerOutput tx -> TimedServerOutput tx
- prepareServerOutput :: IsChainState tx => ServerOutputConfig -> TimedServerOutput tx -> ByteString
- decodeClientMessageBody :: IsChainState tx => Text -> Decoder s (ClientMessage tx)
- decodeGreetingsBody :: IsChainState tx => Decoder s (Greetings tx)
- decodeInvalidInputBody :: Decoder s InvalidInput
- removeSnapshotUTxO :: Value -> Value
- data ApiEncoding
Documentation
data ServerOutput tx Source #
Constructors
| NetworkConnected | |
| NetworkDisconnected | |
| NetworkVersionMismatch | |
Fields | |
| NetworkClusterIDMismatch | |
Fields
| |
| PeerConnected | |
| PeerDisconnected | |
| HeadIsOpen | |
| HeadIsClosed | |
Fields
| |
| HeadIsContested | |
Fields
| |
| ReadyToFanout | |
Fields
| |
| HeadPartiallyFannedOut | A selective partial fanout step has been observed on chain. Reports the
UTxO distributed in this step and what remains to be fanned out, so the
client can choose the next |
Fields
| |
| HeadIsFinalized | |
Fields
| |
| TxValid | Given transaction has been seen as valid in the Head. It is expected to
eventually be part of a |
Fields
| |
| TxInvalid | Given transaction was not not applicable to the given UTxO in time and has been dropped. |
Fields
| |
| SnapshotConfirmed | Given snapshot was confirmed and included transactions can be considered final. |
Fields
| |
| IgnoredHeadInitializing | |
Fields
| |
| DecommitRequested | |
Fields
| |
| DecommitInvalid | |
Fields
| |
| DecommitApproved | |
Fields
| |
| DecommitFinalized | |
Fields
| |
| CommitRecorded | |
Fields
| |
| DepositActivated | |
| DepositExpired | |
| CommitApproved | |
Fields
| |
| CommitFinalized | |
Fields
| |
| CommitRecovered | |
Fields
| |
| SnapshotSideLoaded | Snapshot was side-loaded, and the included transactions can be considered final. The local state has been reset, meaning pending transactions were pruned. Any signing round has been discarded, and the snapshot leader has changed accordingly. |
Fields
| |
| EventLogRotated | |
Fields
| |
| NodeUnsynced | |
Fields
| |
| NodeSynced | |
Fields
| |
Instances
data ClientMessage tx Source #
Individual messages as produced by the HeadLogic in
the ClientEffect.
Constructors
| CommandFailed | |
Fields
| |
| PostTxOnChainFailed | |
Fields
| |
| RejectedInputBecauseUnsynced | |
Fields
| |
| SideLoadSnapshotRejected | |
Fields | |
Instances
data CommitInfo Source #
All information needed to distinguish behavior of the commit endpoint.
Constructors
| CannotCommit | |
| IncrementalCommit HeadId |
data TimedServerOutput tx Source #
The type of messages sent to clients by the Server.
NOTE: The field order is the CBOR wire format (see ToCBOR below), so
reordering fields is a breaking format change.
Constructors
| TimedServerOutput | |
Instances
data NetworkInfo Source #
L2 Hydra network status information.
Constructors
| NetworkInfo | |
Instances
A friendly welcome message which tells a client something about the
node. Currently used for knowing what signing key the server uses (it
only knows one), HeadStatus and optionally (if HeadIsOpen or
SnapshotConfirmed message is emitted) UTxO's present in the Hydra Head.
Constructors
| Greetings | |
Fields
| |
Instances
data HeadStatus Source #
All possible Hydra states displayed in the API server outputs.
Constructors
| Idle | |
| Open | |
| Closed | |
| FanoutPossible | |
| FanningOut | A closed head whose UTxO is being distributed across multiple selective partial fanout transactions. |
Instances
data InvalidInput Source #
Constructors
| InvalidInput | |
Instances
data ServerOutputConfig Source #
Constructors
| ServerOutputConfig | |
Fields | |
Instances
| Show ServerOutputConfig Source # | |
Defined in Hydra.API.ServerOutput | |
| Eq ServerOutputConfig Source # | |
Defined in Hydra.API.ServerOutput Methods (==) :: ServerOutputConfig -> ServerOutputConfig -> Bool Source # (/=) :: ServerOutputConfig -> ServerOutputConfig -> Bool Source # | |
data WithAddressedTx Source #
Whether or not to filter transaction server outputs by given address.
Constructors
| WithAddressedTx Text | |
| WithoutAddressedTx |
Instances
| Show WithAddressedTx Source # | |
Defined in Hydra.API.ServerOutput | |
| Eq WithAddressedTx Source # | |
Defined in Hydra.API.ServerOutput Methods (==) :: WithAddressedTx -> WithAddressedTx -> Bool Source # (/=) :: WithAddressedTx -> WithAddressedTx -> Bool Source # | |
Whether or not to include full UTxO in server outputs.
Constructors
| WithUTxO | |
| WithoutUTxO |
data DecommitInvalidReason tx Source #
Constructors
| DecommitTxInvalid | |
Fields
| |
| DecommitAlreadyInFlight | |
Fields
| |
| DepositInFlight | A deposit (commit) is in flight: the decommit cannot be recorded until it
finalises or is recovered. Clients may need to recover the deposit before
another decommit is possible ( |
Fields
| |
Instances
data ApiMessage tx Source #
Union of all messages the hydra-node sends to clients. Only used for decoding on the client side; the server encodes and sends the individual types directly (their encodings are the same as the union's).
In CBOR, every server-sent message starts with a text tag that is unique across the whole API surface, so a single tag read suffices to dispatch.
Constructors
| ApiTimedServerOutput (TimedServerOutput tx) | |
| ApiClientMessage (ClientMessage tx) | |
| ApiGreetings (Greetings tx) | |
| ApiInvalidInput InvalidInput |
Instances
data FanoutProgressMode Source #
Client-facing projection of the node's fanout FanoutMode: whether a
fanning-out head will continue draining on its own or is waiting for the
client to choose the next PartialFanout. Surfacing this lets clients render
the correct affordance without inferring it from local actions.
Constructors
| AutoFanningOut | The node keeps draining automatically (a full |
| AwaitingFanoutSelection | The node has drained the current selection and is waiting for the next
|
Instances
getConfirmedSnapshot :: HeadState tx -> Maybe (ConfirmedSnapshot tx) Source #
Get latest confirmed snapshot from HeadState.
getSeenSnapshot :: IsTx tx => HeadState tx -> SeenSnapshot tx Source #
Get latest seen snapshot from HeadState.
getSnapshotUtxo :: IsTx tx => HeadState tx -> Maybe (UTxOType tx) Source #
Get latest confirmed snapshot UTxO from HeadState.
fanoutProgressMode :: FanoutMode tx -> FanoutProgressMode Source #
Project the internal FanoutMode to its client-facing FanoutProgressMode.
Both auto-drain and mid-selection draining present as AutoFanningOut (the
node advances by itself); only an exhausted selection awaits client input.
handleUtxoInclusionTyped :: IsTx tx => ServerOutputConfig -> TimedServerOutput tx -> TimedServerOutput tx Source #
Typed snapshot-utxo filter: with WithoutUTxO, the snapshot's utxo is
replaced by mempty before encoding. Used directly on CBOR connections
(which keep the empty utxo set on the wire) and on the JSON path combined
with removeSnapshotUTxO (which then drops the residual empty key).
NOTE: These are display-only filters and not meant to round-trip back into
a valid Snapshot.
Arguments
| :: IsChainState tx | |
| => ServerOutputConfig | Decide on tx representation |
| -> TimedServerOutput tx | Server output |
| -> ByteString | Final output |
Replaces the json encoded tx field with it's cbor representation.
NOTE: we deliberately pattern match on all ServerOutput constructors in
handleTxOutput so that we don't forget to update this function if they
change.
decodeClientMessageBody :: IsChainState tx => Text -> Decoder s (ClientMessage tx) Source #
Decode a ClientMessage given its already-decoded constructor tag (used
for tag-based dispatch in ApiMessage).
decodeGreetingsBody :: IsChainState tx => Decoder s (Greetings tx) Source #
Decode a Greetings after its Greetings tag has already been consumed
(used for tag-based dispatch in ApiMessage).
decodeInvalidInputBody :: Decoder s InvalidInput Source #
Decode an InvalidInput after its InvalidInput tag has already been
consumed (used for tag-based dispatch in ApiMessage).
removeSnapshotUTxO :: Value -> Value Source #
Drop the snapshot utxo key from an already-converted JSON Value.
Working on the Value (rather than encoded bytes) avoids a full re-parse
and re-encode of the message.
data ApiEncoding Source #
Which wire encoding a client negotiated: JSON (the default) or native
CBOR. WebSocket clients opt in via the ?encoding=cbor query parameter,
HTTP clients via Accept @Content-Type: applicationcbor@ headers.
Constructors
| JsonEncoding | |
| CborEncoding |
Instances
| Show ApiEncoding Source # | |
Defined in Hydra.API.WireFormat | |
| Eq ApiEncoding Source # | |
Defined in Hydra.API.WireFormat Methods (==) :: ApiEncoding -> ApiEncoding -> Bool Source # (/=) :: ApiEncoding -> ApiEncoding -> Bool Source # | |