plutus-chain-index-core-1.2.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] 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 #

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 #

FromJSON IsUtxoResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Methods

parseJSON :: Value -> Parser IsUtxoResponse

parseJSONList :: Value -> Parser [IsUtxoResponse]

ToJSON IsUtxoResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Methods

toJSON :: IsUtxoResponse -> Value

toEncoding :: IsUtxoResponse -> Encoding

toJSONList :: [IsUtxoResponse] -> Value

toEncodingList :: [IsUtxoResponse] -> Encoding

ToSchema IsUtxoResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Methods

declareNamedSchema :: Proxy IsUtxoResponse -> Declare (Definitions Schema) NamedSchema

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.2.0.0-KXwe88sWnh3Kg9uXBYztrS" '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 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" } } }

Constructors

UtxoByAddressRequest 

Fields

Instances

Instances details
Eq UtxoByAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Show UtxoByAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Generic UtxoByAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Associated Types

type Rep UtxoByAddressRequest :: Type -> Type Source #

FromJSON UtxoByAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Methods

parseJSON :: Value -> Parser UtxoByAddressRequest

parseJSONList :: Value -> Parser [UtxoByAddressRequest]

ToJSON UtxoByAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

ToSchema UtxoByAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Methods

declareNamedSchema :: Proxy UtxoByAddressRequest -> Declare (Definitions Schema) NamedSchema

type Rep UtxoByAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

type Rep UtxoByAddressRequest = D1 ('MetaData "UtxoByAddressRequest" "Plutus.ChainIndex.Api" "plutus-chain-index-core-1.2.0.0-KXwe88sWnh3Kg9uXBYztrS" 'False) (C1 ('MetaCons "UtxoByAddressRequest" 'PrefixI 'True) (S1 ('MetaSel ('Just "pageQuery") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (PageQuery TxOutRef))) :*: S1 ('MetaSel ('Just "address") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CardanoAddress)))

data UtxosResponse Source #

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

Constructors

UtxosResponse 

Fields

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 #

FromJSON UtxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Methods

parseJSON :: Value -> Parser UtxosResponse

parseJSONList :: Value -> Parser [UtxosResponse]

ToJSON UtxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Methods

toJSON :: UtxosResponse -> Value

toEncoding :: UtxosResponse -> Encoding

toJSONList :: [UtxosResponse] -> Value

toEncodingList :: [UtxosResponse] -> Encoding

ToSchema UtxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Methods

declareNamedSchema :: Proxy UtxosResponse -> Declare (Definitions Schema) NamedSchema

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.2.0.0-KXwe88sWnh3Kg9uXBYztrS" '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 UtxoByAddressRequest.

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

Constructors

UtxoWithCurrencyRequest 

Fields

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 #

FromJSON UtxoWithCurrencyRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Methods

parseJSON :: Value -> Parser UtxoWithCurrencyRequest

parseJSONList :: Value -> Parser [UtxoWithCurrencyRequest]

ToJSON UtxoWithCurrencyRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

ToSchema UtxoWithCurrencyRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Methods

declareNamedSchema :: Proxy UtxoWithCurrencyRequest -> Declare (Definitions Schema) NamedSchema

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.2.0.0-KXwe88sWnh3Kg9uXBYztrS" '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 #

Constructors

TxoAtAddressRequest 

Fields

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 #

FromJSON TxoAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Methods

parseJSON :: Value -> Parser TxoAtAddressRequest

parseJSONList :: Value -> Parser [TxoAtAddressRequest]

ToJSON TxoAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

ToSchema TxoAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Methods

declareNamedSchema :: Proxy TxoAtAddressRequest -> Declare (Definitions Schema) NamedSchema

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.2.0.0-KXwe88sWnh3Kg9uXBYztrS" 'False) (C1 ('MetaCons "TxoAtAddressRequest" 'PrefixI 'True) (S1 ('MetaSel ('Just "pageQuery") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (PageQuery TxOutRef))) :*: S1 ('MetaSel ('Just "address") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CardanoAddress)))

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 #

FromJSON TxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Methods

parseJSON :: Value -> Parser TxosResponse

parseJSONList :: Value -> Parser [TxosResponse]

ToJSON TxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Methods

toJSON :: TxosResponse -> Value

toEncoding :: TxosResponse -> Encoding

toJSONList :: [TxosResponse] -> Value

toEncodingList :: [TxosResponse] -> Encoding

ToSchema TxosResponse Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Methods

declareNamedSchema :: Proxy TxosResponse -> Declare (Definitions Schema) NamedSchema

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.2.0.0-KXwe88sWnh3Kg9uXBYztrS" 'False) (C1 ('MetaCons "TxosResponse" 'PrefixI 'True) (S1 ('MetaSel ('Just "paget") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Page TxOutRef))))

data QueryAtAddressRequest Source #

Constructors

QueryAtAddressRequest 

Fields

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 #

FromJSON QueryAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Methods

parseJSON :: Value -> Parser QueryAtAddressRequest

parseJSONList :: Value -> Parser [QueryAtAddressRequest]

ToJSON QueryAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

ToSchema QueryAtAddressRequest Source # 
Instance details

Defined in Plutus.ChainIndex.Api

Methods

declareNamedSchema :: Proxy QueryAtAddressRequest -> Declare (Definitions Schema) NamedSchema

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.2.0.0-KXwe88sWnh3Kg9uXBYztrS" 'False) (C1 ('MetaCons "QueryAtAddressRequest" 'PrefixI 'True) (S1 ('MetaSel ('Just "pageQuery") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (PageQuery TxOutRef))) :*: S1 ('MetaSel ('Just "address") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CardanoAddress)))

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 

Fields

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 #

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

Defined in Plutus.ChainIndex.Api

Methods

parseJSON :: Value -> Parser (QueryResponse a)

parseJSONList :: Value -> Parser [QueryResponse a]

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

Defined in Plutus.ChainIndex.Api

Methods

toJSON :: QueryResponse a -> Value

toEncoding :: QueryResponse a -> Encoding

toJSONList :: [QueryResponse a] -> Value

toEncodingList :: [QueryResponse a] -> Encoding

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

Defined in Plutus.ChainIndex.Api

Methods

declareNamedSchema :: Proxy (QueryResponse a) -> Declare (Definitions Schema) NamedSchema

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.2.0.0-KXwe88sWnh3Kg9uXBYztrS" '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.

Orphan instances

ToSchema DatumFromQuery Source # 
Instance details

Methods

declareNamedSchema :: Proxy DatumFromQuery -> Declare (Definitions Schema) NamedSchema

ToSchema DecoratedTxOut Source # 
Instance details

Methods

declareNamedSchema :: Proxy DecoratedTxOut -> Declare (Definitions Schema) NamedSchema

ToSchema Credential Source # 
Instance details

Methods

declareNamedSchema :: Proxy Credential -> Declare (Definitions Schema) NamedSchema

ToSchema StakingCredential Source # 
Instance details

Methods

declareNamedSchema :: Proxy StakingCredential -> Declare (Definitions Schema) NamedSchema

ToSchema PubKeyHash Source # 
Instance details

Methods

declareNamedSchema :: Proxy PubKeyHash -> Declare (Definitions Schema) NamedSchema

ToSchema MintingPolicy Source # 
Instance details

Methods

declareNamedSchema :: Proxy MintingPolicy -> Declare (Definitions Schema) NamedSchema

ToSchema MintingPolicyHash Source # 
Instance details

Methods

declareNamedSchema :: Proxy MintingPolicyHash -> Declare (Definitions Schema) NamedSchema

ToSchema RedeemerHash Source # 
Instance details

Methods

declareNamedSchema :: Proxy RedeemerHash -> Declare (Definitions Schema) NamedSchema

ToSchema StakeValidator Source # 
Instance details

Methods

declareNamedSchema :: Proxy StakeValidator -> Declare (Definitions Schema) NamedSchema

ToSchema StakeValidatorHash Source # 
Instance details

Methods

declareNamedSchema :: Proxy StakeValidatorHash -> Declare (Definitions Schema) NamedSchema

ToSchema ValidatorHash Source # 
Instance details

Methods

declareNamedSchema :: Proxy ValidatorHash -> Declare (Definitions Schema) NamedSchema

ToSchema AssetClass Source # 
Instance details

Methods

declareNamedSchema :: Proxy AssetClass -> Declare (Definitions Schema) NamedSchema

ToSchema PageSize Source # 
Instance details

Methods

declareNamedSchema :: Proxy PageSize -> Declare (Definitions Schema) NamedSchema

ToSchema a => ToSchema (Page a) Source # 
Instance details

Methods

declareNamedSchema :: Proxy (Page a) -> Declare (Definitions Schema) NamedSchema

ToSchema a => ToSchema (PageQuery a) Source # 
Instance details

Methods

declareNamedSchema :: Proxy (PageQuery a) -> Declare (Definitions Schema) NamedSchema