plutus-chain-index-core-1.1.0.0
Safe HaskellNone
LanguageHaskell2010

Plutus.ChainIndex.Api

Synopsis

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] UtxoAtAddressRequest :> 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 #

data IsUtxoResponse Source #

Response type for the is-utxo endpoint.

Constructors

IsUtxoResponse 

Fields

Instances

Instances details
Eq IsUtxoResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Show IsUtxoResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Generic IsUtxoResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Associated Types

type Rep IsUtxoResponse :: Type -> Type Source #

ToJSON IsUtxoResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

FromJSON IsUtxoResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

ToSchema IsUtxoResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

type Rep IsUtxoResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

type Rep IsUtxoResponse = D1 ('MetaData "IsUtxoResponse" "Plutus.ChainIndex.Api" "plutus-chain-index-core-1.1.0.0-K7whjMLv5AnJVt0avXcbFn" 'False) (C1 ('MetaCons "IsUtxoResponse" 'PrefixI 'True) (S1 ('MetaSel ('Just "currentTip") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Tip) :*: S1 ('MetaSel ('Just "isUtxo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))

type SwaggerAPI = "swagger" :> SwaggerSchemaUI "swagger-ui" "swagger.json" Source #

data UtxoAtAddressRequest 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

Instances details
Eq UtxoAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Show UtxoAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Generic UtxoAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Associated Types

type Rep UtxoAtAddressRequest :: Type -> Type Source #

ToJSON UtxoAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

FromJSON UtxoAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

ToSchema UtxoAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

type Rep UtxoAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

type Rep UtxoAtAddressRequest = D1 ('MetaData "UtxoAtAddressRequest" "Plutus.ChainIndex.Api" "plutus-chain-index-core-1.1.0.0-K7whjMLv5AnJVt0avXcbFn" 'False) (C1 ('MetaCons "UtxoAtAddressRequest" 'PrefixI 'True) (S1 ('MetaSel ('Just "pageQuery") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (PageQuery TxOutRef))) :*: S1 ('MetaSel ('Just "credential") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Credential)))

data UtxosResponse Source #

Response type for the utxo-{at-address|with-currency} endpoints.

Constructors

UtxosResponse 

Instances

Instances details
Eq UtxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Show UtxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Generic UtxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Associated Types

type Rep UtxosResponse :: Type -> Type Source #

ToJSON UtxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

FromJSON UtxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

ToSchema UtxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

type Rep UtxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

type Rep UtxosResponse = D1 ('MetaData "UtxosResponse" "Plutus.ChainIndex.Api" "plutus-chain-index-core-1.1.0.0-K7whjMLv5AnJVt0avXcbFn" 'False) (C1 ('MetaCons "UtxosResponse" 'PrefixI 'True) (S1 ('MetaSel ('Just "currentTip") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Tip) :*: S1 ('MetaSel ('Just "page") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Page TxOutRef))))

data UtxoWithCurrencyRequest Source #

See the comment on UtxoAtAddressRequest.

The difference is using currency field instead of credential. { "pageQuery": { ... }, "currency": { "unAssetClass": [ { "unCurrencySymbol": "" }, { "unTokenName": "" } ] } }

Instances

Instances details
Eq UtxoWithCurrencyRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Show UtxoWithCurrencyRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Generic UtxoWithCurrencyRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Associated Types

type Rep UtxoWithCurrencyRequest :: Type -> Type Source #

ToJSON UtxoWithCurrencyRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

FromJSON UtxoWithCurrencyRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

ToSchema UtxoWithCurrencyRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

type Rep UtxoWithCurrencyRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

type Rep UtxoWithCurrencyRequest = D1 ('MetaData "UtxoWithCurrencyRequest" "Plutus.ChainIndex.Api" "plutus-chain-index-core-1.1.0.0-K7whjMLv5AnJVt0avXcbFn" 'False) (C1 ('MetaCons "UtxoWithCurrencyRequest" 'PrefixI 'True) (S1 ('MetaSel ('Just "pageQuery") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (PageQuery TxOutRef))) :*: S1 ('MetaSel ('Just "currency") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AssetClass)))

swagger :: forall dir api. Server api ~ Handler Value => Server (SwaggerSchemaUI' dir api) Source #

data TxoAtAddressRequest Source #

Instances

Instances details
Eq TxoAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Show TxoAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Generic TxoAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Associated Types

type Rep TxoAtAddressRequest :: Type -> Type Source #

ToJSON TxoAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

FromJSON TxoAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

ToSchema TxoAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

type Rep TxoAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

type Rep TxoAtAddressRequest = D1 ('MetaData "TxoAtAddressRequest" "Plutus.ChainIndex.Api" "plutus-chain-index-core-1.1.0.0-K7whjMLv5AnJVt0avXcbFn" 'False) (C1 ('MetaCons "TxoAtAddressRequest" 'PrefixI 'True) (S1 ('MetaSel ('Just "pageQuery") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (PageQuery TxOutRef))) :*: S1 ('MetaSel ('Just "credential") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Credential)))

data TxosResponse Source #

Response type for the txo-at-address endpoint.

Constructors

TxosResponse 

Fields

Instances

Instances details
Eq TxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Show TxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Generic TxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Associated Types

type Rep TxosResponse :: Type -> Type Source #

ToJSON TxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

FromJSON TxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

ToSchema TxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

type Rep TxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

type Rep TxosResponse = D1 ('MetaData "TxosResponse" "Plutus.ChainIndex.Api" "plutus-chain-index-core-1.1.0.0-K7whjMLv5AnJVt0avXcbFn" 'False) (C1 ('MetaCons "TxosResponse" 'PrefixI 'True) (S1 ('MetaSel ('Just "paget") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Page TxOutRef))))

data QueryAtAddressRequest Source #

Instances

Instances details
Eq QueryAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Show QueryAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Generic QueryAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Associated Types

type Rep QueryAtAddressRequest :: Type -> Type Source #

ToJSON QueryAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

FromJSON QueryAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

ToSchema QueryAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

type Rep QueryAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

type Rep QueryAtAddressRequest = D1 ('MetaData "QueryAtAddressRequest" "Plutus.ChainIndex.Api" "plutus-chain-index-core-1.1.0.0-K7whjMLv5AnJVt0avXcbFn" 'False) (C1 ('MetaCons "QueryAtAddressRequest" 'PrefixI 'True) (S1 ('MetaSel ('Just "pageQuery") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (PageQuery TxOutRef))) :*: S1 ('MetaSel ('Just "credential") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Credential)))

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

Constructors

QueryResponse 

Instances

Instances details
Eq a => Eq (QueryResponse a) Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Show a => Show (QueryResponse a) Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Generic (QueryResponse a) Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Associated Types

type Rep (QueryResponse a) :: Type -> Type Source #

(ToJSON a, Generic a) => ToJSON (QueryResponse a) Source # 
Instance details

Defined in Plutus.ChainIndex.Api

(FromJSON a, Generic a) => FromJSON (QueryResponse a) Source # 
Instance details

Defined in Plutus.ChainIndex.Api

(ToSchema a, Generic a) => ToSchema (QueryResponse a) Source # 
Instance details

Defined in Plutus.ChainIndex.Api

type Rep (QueryResponse a) Source # 
Instance details

Defined in Plutus.ChainIndex.Api

type Rep (QueryResponse a) = D1 ('MetaData "QueryResponse" "Plutus.ChainIndex.Api" "plutus-chain-index-core-1.1.0.0-K7whjMLv5AnJVt0avXcbFn" 'False) (C1 ('MetaCons "QueryResponse" 'PrefixI 'True) (S1 ('MetaSel ('Just "queryResult") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just "nextQuery") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (PageQuery TxOutRef)))))

collectQueryResponse Source #

Arguments

:: Monad m 
=> (PageQuery TxOutRef -> m (QueryResponse a))

query response function

-> m [a] 

Go through each Pages of QueryResponse, and collect the results.