Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type API = ("healthcheck" :> (Description "Is the server alive?" :> Get '[JSON] NoContent)) :<|> (("from-hash" :> FromHashAPI) :<|> (("tx-out" :> (Description "Get a transaction output from its reference." :> (ReqBody '[JSON] TxOutRef :> Post '[JSON] DecoratedTxOut))) :<|> (("unspent-tx-out" :> (Description "Get a unspent transaction output from its reference." :> (ReqBody '[JSON] TxOutRef :> Post '[JSON] DecoratedTxOut))) :<|> (("tx" :> (Description "Get a transaction from its id." :> (ReqBody '[JSON] TxId :> Post '[JSON] ChainIndexTx))) :<|> (("is-utxo" :> (Description "Check if the reference is an UTxO." :> (ReqBody '[JSON] TxOutRef :> Post '[JSON] IsUtxoResponse))) :<|> (("utxo-at-address" :> (Description "Get all UTxOs at an address." :> (ReqBody '[JSON] UtxoByAddressRequest :> Post '[JSON] UtxosResponse))) :<|> (("unspent-txouts-at-address" :> (Description "Get all unspent transaction output at an address." :> (ReqBody '[JSON] QueryAtAddressRequest :> Post '[JSON] (QueryResponse [(TxOutRef, DecoratedTxOut)])))) :<|> (("datums-at-address" :> (Description "Get all Datums at an address." :> (ReqBody '[JSON] QueryAtAddressRequest :> Post '[JSON] (QueryResponse [Datum])))) :<|> (("utxo-with-currency" :> (Description "Get all UTxOs with a currency." :> (ReqBody '[JSON] UtxoWithCurrencyRequest :> Post '[JSON] UtxosResponse))) :<|> (("txs" :> (Description "Get transactions from a list of their ids." :> (ReqBody '[JSON] [TxId] :> Post '[JSON] [ChainIndexTx]))) :<|> (("txo-at-address" :> (Description "Get TxOs at an address." :> (ReqBody '[JSON] TxoAtAddressRequest :> Post '[JSON] TxosResponse))) :<|> (("tip" :> (Description "Get the current synced tip." :> Get '[JSON] Tip)) :<|> (("collect-garbage" :> (Description "Collect chain index garbage to free up space." :> Put '[JSON] NoContent)) :<|> ("diagnostics" :> (Description "Get the current stats of the chain index." :> Get '[JSON] Diagnostics)))))))))))))))
- type FromHashAPI = ("datum" :> (Description "Get a datum from its hash." :> (ReqBody '[JSON] DatumHash :> Post '[JSON] Datum))) :<|> (("validator" :> (Description "Get a validator script from its hash." :> (ReqBody '[JSON] ValidatorHash :> Post '[JSON] (Versioned Validator)))) :<|> (("minting-policy" :> (Description "Get a minting policy from its hash." :> (ReqBody '[JSON] MintingPolicyHash :> Post '[JSON] (Versioned MintingPolicy)))) :<|> (("stake-validator" :> (Description "Get a stake validator from its hash." :> (ReqBody '[JSON] StakeValidatorHash :> Post '[JSON] (Versioned StakeValidator)))) :<|> ("redeemer" :> (Description "Get a redeemer from its hash." :> (ReqBody '[JSON] RedeemerHash :> Post '[JSON] Redeemer))))))
- type FullAPI = API :<|> SwaggerAPI
- data IsUtxoResponse = IsUtxoResponse {
- currentTip :: Tip
- isUtxo :: Bool
- type SwaggerAPI = "swagger" :> SwaggerSchemaUI "swagger-ui" "swagger.json"
- data UtxoByAddressRequest = UtxoByAddressRequest {}
- data UtxosResponse = UtxosResponse {
- currentTip :: Tip
- page :: Page TxOutRef
- data UtxoWithCurrencyRequest = UtxoWithCurrencyRequest {}
- swagger :: forall dir api. Server api ~ Handler Value => Server (SwaggerSchemaUI' dir api)
- data TxoAtAddressRequest = TxoAtAddressRequest {}
- data TxosResponse = TxosResponse {}
- data QueryAtAddressRequest = QueryAtAddressRequest {}
- data QueryResponse a = QueryResponse {
- queryResult :: a
- nextQuery :: Maybe (PageQuery TxOutRef)
- collectQueryResponse :: Monad m => (PageQuery TxOutRef -> m (QueryResponse a)) -> m [a]
Documentation
type API = ("healthcheck" :> (Description "Is the server alive?" :> Get '[JSON] NoContent)) :<|> (("from-hash" :> FromHashAPI) :<|> (("tx-out" :> (Description "Get a transaction output from its reference." :> (ReqBody '[JSON] TxOutRef :> Post '[JSON] DecoratedTxOut))) :<|> (("unspent-tx-out" :> (Description "Get a unspent transaction output from its reference." :> (ReqBody '[JSON] TxOutRef :> Post '[JSON] DecoratedTxOut))) :<|> (("tx" :> (Description "Get a transaction from its id." :> (ReqBody '[JSON] TxId :> Post '[JSON] ChainIndexTx))) :<|> (("is-utxo" :> (Description "Check if the reference is an UTxO." :> (ReqBody '[JSON] TxOutRef :> Post '[JSON] IsUtxoResponse))) :<|> (("utxo-at-address" :> (Description "Get all UTxOs at an address." :> (ReqBody '[JSON] UtxoByAddressRequest :> Post '[JSON] UtxosResponse))) :<|> (("unspent-txouts-at-address" :> (Description "Get all unspent transaction output at an address." :> (ReqBody '[JSON] QueryAtAddressRequest :> Post '[JSON] (QueryResponse [(TxOutRef, DecoratedTxOut)])))) :<|> (("datums-at-address" :> (Description "Get all Datums at an address." :> (ReqBody '[JSON] QueryAtAddressRequest :> Post '[JSON] (QueryResponse [Datum])))) :<|> (("utxo-with-currency" :> (Description "Get all UTxOs with a currency." :> (ReqBody '[JSON] UtxoWithCurrencyRequest :> Post '[JSON] UtxosResponse))) :<|> (("txs" :> (Description "Get transactions from a list of their ids." :> (ReqBody '[JSON] [TxId] :> Post '[JSON] [ChainIndexTx]))) :<|> (("txo-at-address" :> (Description "Get TxOs at an address." :> (ReqBody '[JSON] TxoAtAddressRequest :> Post '[JSON] TxosResponse))) :<|> (("tip" :> (Description "Get the current synced tip." :> Get '[JSON] Tip)) :<|> (("collect-garbage" :> (Description "Collect chain index garbage to free up space." :> Put '[JSON] NoContent)) :<|> ("diagnostics" :> (Description "Get the current stats of the chain index." :> Get '[JSON] Diagnostics))))))))))))))) Source #
type FromHashAPI = ("datum" :> (Description "Get a datum from its hash." :> (ReqBody '[JSON] DatumHash :> Post '[JSON] Datum))) :<|> (("validator" :> (Description "Get a validator script from its hash." :> (ReqBody '[JSON] ValidatorHash :> Post '[JSON] (Versioned Validator)))) :<|> (("minting-policy" :> (Description "Get a minting policy from its hash." :> (ReqBody '[JSON] MintingPolicyHash :> Post '[JSON] (Versioned MintingPolicy)))) :<|> (("stake-validator" :> (Description "Get a stake validator from its hash." :> (ReqBody '[JSON] StakeValidatorHash :> Post '[JSON] (Versioned StakeValidator)))) :<|> ("redeemer" :> (Description "Get a redeemer from its hash." :> (ReqBody '[JSON] RedeemerHash :> Post '[JSON] Redeemer)))))) Source #
type FullAPI = API :<|> SwaggerAPI Source #
data IsUtxoResponse Source #
Response type for the is-utxo endpoint.
IsUtxoResponse | |
|
Instances
type SwaggerAPI = "swagger" :> SwaggerSchemaUI "swagger-ui" "swagger.json" Source #
data UtxoByAddressRequest Source #
When requesting UTxOs of a given address, you need to provide the address, and optionnally the number of elements per page and the last item of the last requested page.
Here's an example for requesting the first page:
{ "credential": { "tag": PubKeyCredential, "contents": { "getPubKeyHash": "88ff402b0522f27649ac742238c697c579beeb344eb723099d1f16ce" } } }
or
{ "pageQuery": { "pageQuerySize": { "getPageSize": 10 } }, "credential": { "tag": PubKeyCredential, "contents": { "getPubKeyHash": "88ff402b0522f27649ac742238c697c579beeb344eb723099d1f16ce" } } }
Here's an example for requesting the next page:
{ "pageQuery": { "pageQuerySize": { "getPageSize": 10 }, "pageQueryLastItem": { "txOutRefId": { "getTxId": "009b8c674b878cc68bd1d40562c5f14cdbb21be9266f605cfb68ed978e1a965b" }, "txOutRefIdx": 0 } }, "credential": { "tag": PubKeyCredential, "contents": { "getPubKeyHash": "88ff402b0522f27649ac742238c697c579beeb344eb723099d1f16ce" } } }
Instances
data UtxosResponse Source #
Response type for the utxo-{at-address|with-currency} endpoints.
UtxosResponse | |
|
Instances
data UtxoWithCurrencyRequest Source #
See the comment on UtxoByAddressRequest
.
The difference is using currency
field instead of credential
.
{
"pageQuery": {
...
},
"currency": {
"unAssetClass": [
{
"unCurrencySymbol": ""
},
{
"unTokenName": ""
}
]
}
}
Instances
data TxoAtAddressRequest Source #
Instances
data TxosResponse Source #
Response type for the txo-at-address endpoint.
Instances
data QueryAtAddressRequest Source #
Instances
data QueryResponse a Source #
generic response type endpoint This type is introduced to avoid querying the chain index twice to obtain the expected info. Indeed, it returns the next page query if more items are available
QueryResponse | |
|
Instances
:: Monad m | |
=> (PageQuery TxOutRef -> m (QueryResponse a)) | query response function |
-> m [a] |
Go through each Page
s of QueryResponse
, and collect the results.
Orphan instances
ToSchema DatumFromQuery Source # | |
declareNamedSchema :: Proxy DatumFromQuery -> Declare (Definitions Schema) NamedSchema | |
ToSchema DecoratedTxOut Source # | |
declareNamedSchema :: Proxy DecoratedTxOut -> Declare (Definitions Schema) NamedSchema | |
ToSchema Credential Source # | |
declareNamedSchema :: Proxy Credential -> Declare (Definitions Schema) NamedSchema | |
ToSchema StakingCredential Source # | |
declareNamedSchema :: Proxy StakingCredential -> Declare (Definitions Schema) NamedSchema | |
ToSchema PubKeyHash Source # | |
declareNamedSchema :: Proxy PubKeyHash -> Declare (Definitions Schema) NamedSchema | |
ToSchema MintingPolicy Source # | |
declareNamedSchema :: Proxy MintingPolicy -> Declare (Definitions Schema) NamedSchema | |
ToSchema MintingPolicyHash Source # | |
declareNamedSchema :: Proxy MintingPolicyHash -> Declare (Definitions Schema) NamedSchema | |
ToSchema RedeemerHash Source # | |
declareNamedSchema :: Proxy RedeemerHash -> Declare (Definitions Schema) NamedSchema | |
ToSchema StakeValidator Source # | |
declareNamedSchema :: Proxy StakeValidator -> Declare (Definitions Schema) NamedSchema | |
ToSchema StakeValidatorHash Source # | |
declareNamedSchema :: Proxy StakeValidatorHash -> Declare (Definitions Schema) NamedSchema | |
ToSchema ValidatorHash Source # | |
declareNamedSchema :: Proxy ValidatorHash -> Declare (Definitions Schema) NamedSchema | |
ToSchema AssetClass Source # | |
declareNamedSchema :: Proxy AssetClass -> Declare (Definitions Schema) NamedSchema | |
ToSchema PageSize Source # | |
declareNamedSchema :: Proxy PageSize -> Declare (Definitions Schema) NamedSchema | |
ToSchema a => ToSchema (Page a) Source # | |
declareNamedSchema :: Proxy (Page a) -> Declare (Definitions Schema) NamedSchema | |
ToSchema a => ToSchema (PageQuery a) Source # | |
declareNamedSchema :: Proxy (PageQuery a) -> Declare (Definitions Schema) NamedSchema |