module Blockfrost.Client.Cardano.Scripts
( listScripts
, listScripts'
, getScript
, getScriptRedeemers
, getScriptRedeemers'
, getScriptDatum
, getScriptJSON
, getScriptCBOR
) where
import Blockfrost.API
import Blockfrost.Client.Types
import Blockfrost.Types
scriptsClient :: MonadBlockfrost m => Project -> ScriptsAPI (AsClientT m)
scriptsClient :: Project -> ScriptsAPI (AsClientT m)
scriptsClient = (((Paged -> SortOrder -> m [ScriptHash])
:<|> ((ScriptHash -> m Script)
:<|> (ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer])))
:<|> ((DatumHash -> m ScriptDatum)
:<|> ((ScriptHash -> m ScriptJSON)
:<|> (ScriptHash -> m ScriptCBOR))))
-> ScriptsAPI (AsClientT m)
forall (routes :: * -> *) mode.
GenericServant routes mode =>
ToServant routes mode -> routes mode
fromServant ((((Paged -> SortOrder -> m [ScriptHash])
:<|> ((ScriptHash -> m Script)
:<|> (ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer])))
:<|> ((DatumHash -> m ScriptDatum)
:<|> ((ScriptHash -> m ScriptJSON)
:<|> (ScriptHash -> m ScriptCBOR))))
-> ScriptsAPI (AsClientT m))
-> (Project
-> ((Paged -> SortOrder -> m [ScriptHash])
:<|> ((ScriptHash -> m Script)
:<|> (ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer])))
:<|> ((DatumHash -> m ScriptDatum)
:<|> ((ScriptHash -> m ScriptJSON)
:<|> (ScriptHash -> m ScriptCBOR))))
-> Project
-> ScriptsAPI (AsClientT m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CardanoAPI (AsClientT m)
-> ((Paged -> SortOrder -> m [ScriptHash])
:<|> ((ScriptHash -> m Script)
:<|> (ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer])))
:<|> ((DatumHash -> m ScriptDatum)
:<|> ((ScriptHash -> m ScriptJSON)
:<|> (ScriptHash -> m ScriptCBOR)))
forall route.
CardanoAPI route
-> route
:- ("scripts"
:> (Tag "Cardano \187 Scripts" :> ToServantApi ScriptsAPI))
_scripts (CardanoAPI (AsClientT m)
-> ((Paged -> SortOrder -> m [ScriptHash])
:<|> ((ScriptHash -> m Script)
:<|> (ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer])))
:<|> ((DatumHash -> m ScriptDatum)
:<|> ((ScriptHash -> m ScriptJSON)
:<|> (ScriptHash -> m ScriptCBOR))))
-> (Project -> CardanoAPI (AsClientT m))
-> Project
-> ((Paged -> SortOrder -> m [ScriptHash])
:<|> ((ScriptHash -> m Script)
:<|> (ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer])))
:<|> ((DatumHash -> m ScriptDatum)
:<|> ((ScriptHash -> m ScriptJSON)
:<|> (ScriptHash -> m ScriptCBOR)))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> CardanoAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> CardanoAPI (AsClientT m)
cardanoClient
listScripts_ :: MonadBlockfrost m => Project -> Paged -> SortOrder -> m [ScriptHash]
listScripts_ :: Project -> Paged -> SortOrder -> m [ScriptHash]
listScripts_ = ScriptsAPI (AsClientT m) -> Paged -> SortOrder -> m [ScriptHash]
forall route.
ScriptsAPI route
-> route
:- (Summary "Scripts"
:> (Description "List of scripts."
:> (Pagination :> (Sorting :> Get '[JSON] [ScriptHash]))))
_listScripts (ScriptsAPI (AsClientT m) -> Paged -> SortOrder -> m [ScriptHash])
-> (Project -> ScriptsAPI (AsClientT m))
-> Project
-> Paged
-> SortOrder
-> m [ScriptHash]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> ScriptsAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> ScriptsAPI (AsClientT m)
scriptsClient
listScripts' :: MonadBlockfrost m => Paged -> SortOrder -> m [ScriptHash]
listScripts' :: Paged -> SortOrder -> m [ScriptHash]
listScripts' Paged
pg SortOrder
s = (Project -> m [ScriptHash]) -> m [ScriptHash]
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> Project -> Paged -> SortOrder -> m [ScriptHash]
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> Paged -> SortOrder -> m [ScriptHash]
listScripts_ Project
p Paged
pg SortOrder
s)
listScripts :: MonadBlockfrost m => m [ScriptHash]
listScripts :: m [ScriptHash]
listScripts = Paged -> SortOrder -> m [ScriptHash]
forall (m :: * -> *).
MonadBlockfrost m =>
Paged -> SortOrder -> m [ScriptHash]
listScripts' Paged
forall a. Default a => a
def SortOrder
forall a. Default a => a
def
getScript_ :: MonadBlockfrost m => Project -> ScriptHash -> m Script
getScript_ :: Project -> ScriptHash -> m Script
getScript_ = ScriptsAPI (AsClientT m) -> ScriptHash -> m Script
forall route.
ScriptsAPI route
-> route
:- (Summary "Specific scripts"
:> (Description "Information about a specific script."
:> (Capture "script_hash" ScriptHash :> Get '[JSON] Script)))
_getScript (ScriptsAPI (AsClientT m) -> ScriptHash -> m Script)
-> (Project -> ScriptsAPI (AsClientT m))
-> Project
-> ScriptHash
-> m Script
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> ScriptsAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> ScriptsAPI (AsClientT m)
scriptsClient
getScript :: MonadBlockfrost m => ScriptHash -> m Script
getScript :: ScriptHash -> m Script
getScript ScriptHash
sh = (Project -> m Script) -> m Script
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (Project -> ScriptHash -> m Script
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> ScriptHash -> m Script
`getScript_` ScriptHash
sh)
getScriptRedeemers_ :: MonadBlockfrost m => Project -> ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer]
getScriptRedeemers_ :: Project -> ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer]
getScriptRedeemers_ = ScriptsAPI (AsClientT m)
-> ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer]
forall route.
ScriptsAPI route
-> route
:- (Summary "Redeemers of a specific script"
:> (Description "List of redeemers of a specific script."
:> (Capture "script_hash" ScriptHash
:> (Pagination
:> (Sorting :> ("redeemers" :> Get '[JSON] [ScriptRedeemer]))))))
_getScriptRedeemers (ScriptsAPI (AsClientT m)
-> ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer])
-> (Project -> ScriptsAPI (AsClientT m))
-> Project
-> ScriptHash
-> Paged
-> SortOrder
-> m [ScriptRedeemer]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> ScriptsAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> ScriptsAPI (AsClientT m)
scriptsClient
getScriptRedeemers' :: MonadBlockfrost m => ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer]
getScriptRedeemers' :: ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer]
getScriptRedeemers' ScriptHash
sh Paged
pg SortOrder
s = (Project -> m [ScriptRedeemer]) -> m [ScriptRedeemer]
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (\Project
p -> Project -> ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer]
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer]
getScriptRedeemers_ Project
p ScriptHash
sh Paged
pg SortOrder
s)
getScriptRedeemers :: MonadBlockfrost m => ScriptHash -> m [ScriptRedeemer]
getScriptRedeemers :: ScriptHash -> m [ScriptRedeemer]
getScriptRedeemers ScriptHash
sh = ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer]
forall (m :: * -> *).
MonadBlockfrost m =>
ScriptHash -> Paged -> SortOrder -> m [ScriptRedeemer]
getScriptRedeemers' ScriptHash
sh Paged
forall a. Default a => a
def SortOrder
forall a. Default a => a
def
getScriptDatum_ :: MonadBlockfrost m => Project -> DatumHash -> m ScriptDatum
getScriptDatum_ :: Project -> DatumHash -> m ScriptDatum
getScriptDatum_ = ScriptsAPI (AsClientT m) -> DatumHash -> m ScriptDatum
forall route.
ScriptsAPI route
-> route
:- (Summary "Datum value"
:> (Description "Query JSON value of a datum by its hash"
:> ("datum"
:> (Capture "datum_hash" DatumHash :> Get '[JSON] ScriptDatum))))
_getScriptDatum (ScriptsAPI (AsClientT m) -> DatumHash -> m ScriptDatum)
-> (Project -> ScriptsAPI (AsClientT m))
-> Project
-> DatumHash
-> m ScriptDatum
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> ScriptsAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> ScriptsAPI (AsClientT m)
scriptsClient
getScriptDatum :: MonadBlockfrost m => DatumHash -> m ScriptDatum
getScriptDatum :: DatumHash -> m ScriptDatum
getScriptDatum DatumHash
sh = (Project -> m ScriptDatum) -> m ScriptDatum
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (Project -> DatumHash -> m ScriptDatum
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> DatumHash -> m ScriptDatum
`getScriptDatum_` DatumHash
sh)
getScriptJSON_ :: MonadBlockfrost m => Project -> ScriptHash -> m ScriptJSON
getScriptJSON_ :: Project -> ScriptHash -> m ScriptJSON
getScriptJSON_ = ScriptsAPI (AsClientT m) -> ScriptHash -> m ScriptJSON
forall route.
ScriptsAPI route
-> route
:- (Summary "Script JSON"
:> (Description "JSON representation of a `timelock` script"
:> (Capture "script_hash" ScriptHash
:> ("json" :> Get '[JSON] ScriptJSON))))
_getScriptJSON (ScriptsAPI (AsClientT m) -> ScriptHash -> m ScriptJSON)
-> (Project -> ScriptsAPI (AsClientT m))
-> Project
-> ScriptHash
-> m ScriptJSON
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> ScriptsAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> ScriptsAPI (AsClientT m)
scriptsClient
getScriptJSON :: MonadBlockfrost m => ScriptHash -> m ScriptJSON
getScriptJSON :: ScriptHash -> m ScriptJSON
getScriptJSON ScriptHash
sh = (Project -> m ScriptJSON) -> m ScriptJSON
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (Project -> ScriptHash -> m ScriptJSON
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> ScriptHash -> m ScriptJSON
`getScriptJSON_` ScriptHash
sh)
getScriptCBOR_ :: MonadBlockfrost m => Project -> ScriptHash -> m ScriptCBOR
getScriptCBOR_ :: Project -> ScriptHash -> m ScriptCBOR
getScriptCBOR_ = ScriptsAPI (AsClientT m) -> ScriptHash -> m ScriptCBOR
forall route.
ScriptsAPI route
-> route
:- (Summary "Script CBOR"
:> (Description "CBOR representation of a `plutus` script"
:> (Capture "script_hash" ScriptHash
:> ("cbor" :> Get '[JSON] ScriptCBOR))))
_getScriptCBOR (ScriptsAPI (AsClientT m) -> ScriptHash -> m ScriptCBOR)
-> (Project -> ScriptsAPI (AsClientT m))
-> Project
-> ScriptHash
-> m ScriptCBOR
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Project -> ScriptsAPI (AsClientT m)
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> ScriptsAPI (AsClientT m)
scriptsClient
getScriptCBOR :: MonadBlockfrost m => ScriptHash -> m ScriptCBOR
getScriptCBOR :: ScriptHash -> m ScriptCBOR
getScriptCBOR ScriptHash
sh = (Project -> m ScriptCBOR) -> m ScriptCBOR
forall (m :: * -> *) a.
MonadBlockfrost m =>
(Project -> m a) -> m a
go (Project -> ScriptHash -> m ScriptCBOR
forall (m :: * -> *).
MonadBlockfrost m =>
Project -> ScriptHash -> m ScriptCBOR
`getScriptCBOR_` ScriptHash
sh)