{-# OPTIONS_HADDOCK hide #-}
module Blockfrost.API.Cardano.Utils
where
import Data.Text
import Servant.API
import Servant.API.Generic
import Servant.Docs (DocCapture (..), ToCapture (..))
import Blockfrost.Types.Cardano.Utils
import Blockfrost.Types.Shared.CBOR
data UtilsAPI route =
UtilsAPI
{
forall route.
UtilsAPI route
-> route
:- (Summary "Derive an address"
:> (Description "Derive Shelley address from an xpub."
:> ("addresses"
:> ("xpub"
:> (Capture "xpub" Text
:> (Capture "role" Integer
:> (Capture "index" Integer :> Get '[JSON] DerivedAddress)))))))
_deriveAddr
:: route
:- Summary "Derive an address"
:> Description "Derive Shelley address from an xpub."
:> "addresses"
:> "xpub"
:> Capture "xpub" Text
:> Capture "role" Integer
:> Capture "index" Integer
:> Get '[JSON] DerivedAddress
, forall route.
UtilsAPI route
-> route
:- (Summary "Submit a transaction for execution units evaluation"
:> (Description
"Submit an already serialized transaction to evaluate how much execution units it requires."
:> ("txs"
:> ("evaluate"
:> (ReqBody '[CBOR] CBORString :> Post '[JSON] TxEval)))))
_txEvaluate
:: route
:- Summary "Submit a transaction for execution units evaluation"
:> Description "Submit an already serialized transaction to evaluate \
\how much execution units it requires."
:> "txs"
:> "evaluate"
:> ReqBody '[CBOR] CBORString
:> Post '[JSON] TxEval
, forall route.
UtilsAPI route
-> route
:- (Summary
"Submit a transaction for execution units evaluation (additional UTXO set)"
:> (Description
"Submit a JSON payload with transaction CBOR and additional UTXO set to evaluate how much execution units it requires."
:> ("txs"
:> ("evaluate"
:> ("utxos"
:> (ReqBody '[JSON] TxEvalInput :> Post '[JSON] TxEval))))))
_txEvaluateUTXOs
:: route
:- Summary "Submit a transaction for execution units evaluation (additional UTXO set)"
:> Description "Submit a JSON payload with transaction CBOR and additional UTXO set \
\to evaluate how much execution units it requires."
:> "txs"
:> "evaluate"
:> "utxos"
:> ReqBody '[JSON] TxEvalInput
:> Post '[JSON] TxEval
} deriving ((forall x. UtilsAPI route -> Rep (UtilsAPI route) x)
-> (forall x. Rep (UtilsAPI route) x -> UtilsAPI route)
-> Generic (UtilsAPI route)
forall x. Rep (UtilsAPI route) x -> UtilsAPI route
forall x. UtilsAPI route -> Rep (UtilsAPI route) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall route x. Rep (UtilsAPI route) x -> UtilsAPI route
forall route x. UtilsAPI route -> Rep (UtilsAPI route) x
$cfrom :: forall route x. UtilsAPI route -> Rep (UtilsAPI route) x
from :: forall x. UtilsAPI route -> Rep (UtilsAPI route) x
$cto :: forall route x. Rep (UtilsAPI route) x -> UtilsAPI route
to :: forall x. Rep (UtilsAPI route) x -> UtilsAPI route
Generic)
instance ToCapture (Capture "role" Integer) where
toCapture :: Proxy (Capture "role" Integer) -> DocCapture
toCapture Proxy (Capture "role" Integer)
_ = String -> String -> DocCapture
DocCapture String
"role" String
"Account role"
instance ToCapture (Capture "index" Integer) where
toCapture :: Proxy (Capture "index" Integer) -> DocCapture
toCapture Proxy (Capture "index" Integer)
_ = String -> String -> DocCapture
DocCapture String
"index" String
"Address index"
instance ToCapture (Capture "xpub" Text) where
toCapture :: Proxy (Capture "xpub" Text) -> DocCapture
toCapture Proxy (Capture "xpub" Text)
_ = String -> String -> DocCapture
DocCapture String
"xpub" String
"Hexadecimal xpub"