| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Hydra.API.HTTPServer
Contents
Synopsis
- newtype DraftCommitTxResponse tx = DraftCommitTxResponse {
- commitTx :: tx
- data DraftCommitTxRequest tx
- = SimpleCommitRequest {
- utxoToCommit :: UTxOType tx
- | FullCommitRequest {
- blueprintTx :: tx
- utxo :: UTxOType tx
- changeAddress :: Maybe AddressInEra
- = SimpleCommitRequest {
- newtype SubmitTxRequest tx = SubmitTxRequest {
- txToSubmit :: tx
- data TransactionSubmitted = TransactionSubmitted
- newtype SideLoadSnapshotRequest tx = SideLoadSnapshotRequest {
- snapshot :: ConfirmedSnapshot tx
- newtype SubmitL2TxRequest tx = SubmitL2TxRequest {
- submitL2Tx :: tx
- data SubmitL2TxResponse
- data HeadInitializationDetails = HeadInitializationDetails {}
- jsonContent :: ResponseHeaders
- cborContent :: ResponseHeaders
- data OperationTimedOut = OperationTimedOut {
- tag :: Text
- timeoutMessage :: Text
- operationTimedOut :: Text -> ApiTransactionTimeout -> OperationTimedOut
- responseEncodingFor :: Request -> ApiEncoding
- requestEncodingFor :: Request -> ApiEncoding
- respondApi :: (ToJSON a, ToCBOR a) => ApiEncoding -> Status -> a -> Response
- httpApp :: forall tx. IsChainState tx => Tracer IO APIServerLog -> Value -> Chain tx IO -> Environment -> PParams LedgerEra -> IO (NodeState tx) -> IO CommitInfo -> IO [TxIdType tx] -> (ClientInput tx -> IO ()) -> ApiTransactionTimeout -> TChan (Either (TimedServerOutput tx) (ClientMessage tx)) -> Application
- respondPParams :: ApiEncoding -> PParams LedgerEra -> Response
- handleDraftCommitUtxo :: forall tx. IsChainState tx => Tracer IO APIServerLog -> Environment -> PParams LedgerEra -> Chain tx IO -> IO (NodeState tx) -> IO CommitInfo -> ApiEncoding -> ApiEncoding -> ByteString -> IO Response
- handleRecoverCommitUtxo :: forall tx. IsChainState tx => (ClientInput tx -> IO ()) -> ApiTransactionTimeout -> TChan (Either (TimedServerOutput tx) (ClientMessage tx)) -> Text -> ApiEncoding -> ByteString -> IO Response
- handleSubmitUserTx :: forall tx. (FromJSON tx, FromCBOR tx) => Chain tx IO -> ApiEncoding -> ApiEncoding -> ByteString -> IO Response
- handleDecommit :: forall tx. (FromJSON tx, FromCBOR tx) => (ClientInput tx -> IO ()) -> ApiTransactionTimeout -> TChan (Either (TimedServerOutput tx) (ClientMessage tx)) -> ApiEncoding -> ApiEncoding -> ByteString -> IO Response
- handleSideLoadSnapshot :: forall tx. IsChainState tx => (ClientInput tx -> IO ()) -> ApiTransactionTimeout -> TChan (Either (TimedServerOutput tx) (ClientMessage tx)) -> ApiEncoding -> ApiEncoding -> ByteString -> IO Response
- handleSubmitL2Tx :: forall tx. IsChainState tx => (ClientInput tx -> IO ()) -> ApiTransactionTimeout -> TChan (Either (TimedServerOutput tx) (ClientMessage tx)) -> ApiEncoding -> ApiEncoding -> ByteString -> IO Response
- badRequest :: IsChainState tx => ApiEncoding -> PostTxError tx -> Response
- notFound :: ApiEncoding -> Response
Documentation
newtype DraftCommitTxResponse tx Source #
Constructors
| DraftCommitTxResponse | |
Fields
| |
Instances
data DraftCommitTxRequest tx Source #
Constructors
| SimpleCommitRequest | |
Fields
| |
| FullCommitRequest | |
Fields
| |
Instances
newtype SubmitTxRequest tx Source #
Constructors
| SubmitTxRequest | |
Fields
| |
Instances
data TransactionSubmitted Source #
Constructors
| TransactionSubmitted |
Instances
newtype SideLoadSnapshotRequest tx Source #
Constructors
| SideLoadSnapshotRequest | |
Fields
| |
Instances
newtype SubmitL2TxRequest tx Source #
Request to submit a transaction to the head
Constructors
| SubmitL2TxRequest | |
Fields
| |
Instances
data SubmitL2TxResponse Source #
Response for transaction submission
Constructors
| SubmitTxConfirmed Integer | Transaction was included in a confirmed snapshot |
| SubmitTxInvalidResponse Text | Transaction was rejected due to validation errors |
| SubmitTxRejectedResponse Text | Transaction was rejected due to node out of sync |
| SubmitTxSubmitted | Transaction was accepted but not yet confirmed |
Instances
data HeadInitializationDetails Source #
Constructors
| HeadInitializationDetails | |
Instances
| Show HeadInitializationDetails Source # | |
Defined in Hydra.API.HTTPServer | |
| Eq HeadInitializationDetails Source # | |
Defined in Hydra.API.HTTPServer Methods (==) :: HeadInitializationDetails -> HeadInitializationDetails -> Bool Source # (/=) :: HeadInitializationDetails -> HeadInitializationDetails -> Bool Source # | |
jsonContent :: ResponseHeaders Source #
cborContent :: ResponseHeaders Source #
data OperationTimedOut Source #
Response body sent when an operation was accepted but did not finish within the API transaction timeout.
Constructors
| OperationTimedOut | |
Fields
| |
Instances
operationTimedOut :: Text -> ApiTransactionTimeout -> OperationTimedOut Source #
responseEncodingFor :: Request -> ApiEncoding Source #
Which encoding the client wants for the response, negotiated via the
Accept header. Anything but application/cbor (including no header)
yields JSON.
requestEncodingFor :: Request -> ApiEncoding Source #
Which encoding the request body uses, negotiated via the Content-Type
header. Anything but application/cbor (including no header) is treated
as JSON.
respondApi :: (ToJSON a, ToCBOR a) => ApiEncoding -> Status -> a -> Response Source #
Respond in the given encoding, with matching Content-Type.
Arguments
| :: forall tx. IsChainState tx | |
| => Tracer IO APIServerLog | |
| -> Value | Pre-rendered effective configuration (served at GET /config). |
| -> Chain tx IO | |
| -> Environment | |
| -> PParams LedgerEra | |
| -> IO (NodeState tx) | Get latest |
| -> IO CommitInfo | A means to get commit info. |
| -> IO [TxIdType tx] | Get the pending commits (deposits) |
| -> (ClientInput tx -> IO ()) | Callback to yield a |
| -> ApiTransactionTimeout | Timeout for transaction submission |
| -> TChan (Either (TimedServerOutput tx) (ClientMessage tx)) | Channel to listen for events |
| -> Application |
Hydra HTTP server
respondPParams :: ApiEncoding -> PParams LedgerEra -> Response Source #
Respond with protocol parameters; the ledger PParams have no plain
ToCBOR instance, so the CBOR case goes through the ledger's EncCBOR.
Handlers
handleDraftCommitUtxo Source #
Arguments
| :: forall tx. IsChainState tx | |
| => Tracer IO APIServerLog | |
| -> Environment | |
| -> PParams LedgerEra | |
| -> Chain tx IO | |
| -> IO (NodeState tx) | Get latest |
| -> IO CommitInfo | A means to get commit info. |
| -> ApiEncoding | Request body encoding. |
| -> ApiEncoding | Response encoding. |
| -> ByteString | Request body. |
| -> IO Response |
Handle request to obtain a draft commit tx.
handleRecoverCommitUtxo :: forall tx. IsChainState tx => (ClientInput tx -> IO ()) -> ApiTransactionTimeout -> TChan (Either (TimedServerOutput tx) (ClientMessage tx)) -> Text -> ApiEncoding -> ByteString -> IO Response Source #
Handle request to recover a pending deposit.
Arguments
| :: forall tx. (FromJSON tx, FromCBOR tx) | |
| => Chain tx IO | |
| -> ApiEncoding | Request body encoding. |
| -> ApiEncoding | Response encoding. |
| -> ByteString | Request body. |
| -> IO Response |
Handle request to submit a cardano transaction.
handleDecommit :: forall tx. (FromJSON tx, FromCBOR tx) => (ClientInput tx -> IO ()) -> ApiTransactionTimeout -> TChan (Either (TimedServerOutput tx) (ClientMessage tx)) -> ApiEncoding -> ApiEncoding -> ByteString -> IO Response Source #
handleSideLoadSnapshot :: forall tx. IsChainState tx => (ClientInput tx -> IO ()) -> ApiTransactionTimeout -> TChan (Either (TimedServerOutput tx) (ClientMessage tx)) -> ApiEncoding -> ApiEncoding -> ByteString -> IO Response Source #
Handle request to side load confirmed snapshot.
handleSubmitL2Tx :: forall tx. IsChainState tx => (ClientInput tx -> IO ()) -> ApiTransactionTimeout -> TChan (Either (TimedServerOutput tx) (ClientMessage tx)) -> ApiEncoding -> ApiEncoding -> ByteString -> IO Response Source #
Handle request to submit a transaction to the head.
badRequest :: IsChainState tx => ApiEncoding -> PostTxError tx -> Response Source #
notFound :: ApiEncoding -> Response Source #