module Cardano.CLI.Read.GovernanceActionId ( readGoveranceActionIdHexText ) where import Cardano.Api.Governance import Cardano.Api.Ledger qualified as L import Cardano.Api.Parser.Text as P import Cardano.Api.Tx import Data.Text (Text) readGoveranceActionIdHexText :: Text -> Either String L.GovActionId readGoveranceActionIdHexText :: Text -> Either String GovActionId readGoveranceActionIdHexText Text hexText = do TxIn TxId txid (TxIx Word index) <- Parser TxIn -> Text -> Either String TxIn forall a. Parser a -> Text -> Either String a P.runParser Parser TxIn parseTxIn Text hexText GovActionId -> Either String GovActionId forall a. a -> Either String a forall (m :: * -> *) a. Monad m => a -> m a return (GovActionId -> Either String GovActionId) -> GovActionId -> Either String GovActionId forall a b. (a -> b) -> a -> b $ TxId -> Word16 -> GovActionId createGovernanceActionId TxId txid (Word16 -> GovActionId) -> Word16 -> GovActionId forall a b. (a -> b) -> a -> b $ Word -> Word16 forall a b. (Integral a, Num b) => a -> b fromIntegral Word index