convex-base-0.2.0.0: Base classes and types for working with cardano-api transactions
Safe HaskellSafe-Inferred
LanguageHaskell2010

Convex.Utils

Description

Conversion functions and other conveniences

Synopsis

Documentation

scriptAddress ∷ NetworkId → PlutusScript PlutusScriptV2 → AddressInEra BabbageEra Source #

Script address without staking key

Plutus V1

scriptAddressV1 ∷ NetworkId → PlutusScript PlutusScriptV1 → AddressInEra BabbageEra Source #

Script address without staking key

Serialised transactions

Dealing with errors

liftResult ∷ MonadError e m ⇒ (String → e) → ResultT m a → m a Source #

liftEither ∷ MonadError e m ⇒ (ee → e) → m (Either ee a) → m a Source #

mapError ∷ MonadError e m ⇒ (ee → e) → ExceptT ee m a → m a Source #

failOnLeft ∷ MonadIO m ⇒ (e → String) → Either e a → m a Source #

failOnLeftLog ∷ (MonadLog m, MonadIO m) ⇒ (e → String) → Either e a → m a Source #

Reading key files

readSigningKeyFromFile ∷ FilePath → IO (SigningKey PaymentKey) Source #

Read a serialised signing key from a file

readVerificationKeyFromFile ∷ FilePath → IO (VerificationKey PaymentKey) Source #

Read a serialised verification key from a file. Try bech32 encoding first, then text envelope (JSON)

readStakingKeyFromFile ∷ FilePath → IO (VerificationKey StakeKey) Source #

Read a serialised signing key from a file

Etc.

extractTx ∷ ∀ m. MonadIO m ⇒ Set TxId → BlockInMode CardanoMode → m () Source #

Search for interesting transactions in a block and serialise them to JSON files

txnUtxos ∷ Tx era → [(TxIn, TxOut CtxTx era)] Source #

The UTxOs produced by the transaction

slotToUtcTime ∷ EraHistory mode → SystemStart → SlotNo → Either String UTCTime Source #

Convert a slot number to UTC time

utcTimeToSlot ∷ EraHistory mode → SystemStart → UTCTime → Either String (SlotNo, NominalDiffTime, NominalDiffTime) Source #

Convert a UTC time to slot no. Returns the time spent and time left in this slot.

utcTimeToSlotUnsafe ∷ EraHistory mode → SystemStart → UTCTime → Either String (SlotNo, NominalDiffTime, NominalDiffTime) Source #

Convert a UTC time to slot no. Returns the time spent and time left in this slot. Extends the interpreter range to infinity before running the query, ignoring any future hard forks. This avoids horizon errors for times that are in the future. It may still fail for times that are in the past (before the beginning of the horizin)

posixTimeToSlot ∷ EraHistory mode → SystemStart → POSIXTime → Either String (SlotNo, NominalDiffTime, NominalDiffTime) Source #

Convert a POSIXTime to slot no. Returns the time spent and time left in this slot.

posixTimeToSlotUnsafe ∷ EraHistory mode → SystemStart → POSIXTime → Either String (SlotNo, NominalDiffTime, NominalDiffTime) Source #

Convert a POSIXTime to slot no. Returns the time spent and time left in this slot.