hydra-cardano-api-0.20.0: A Haskell API for Cardano, tailored to the Hydra project.
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Cardano.Api.TxOut

Synopsis

Extras

txOuts' :: Tx era -> [TxOut CtxTx era] Source #

setMinUTxOValue :: PParams LedgerEra -> TxOut CtxUTxO Era -> TxOut ctx Era Source #

Modify a TxOut to set the minimum ada on the value.

mkTxOutAutoBalance :: PParams LedgerEra -> AddressInEra Era -> Value -> TxOutDatum CtxTx Era -> ReferenceScript Era -> TxOut CtxTx Era Source #

Automatically balance a given output with the minimum required amount. Number of assets, presence of datum and/or reference scripts may affect this minimum value.

modifyTxOutAddress :: (AddressInEra era -> AddressInEra era) -> TxOut ctx era -> TxOut ctx era Source #

Alter the address of a TxOut with the given transformation.

modifyTxOutValue :: IsMaryBasedEra era => (Value -> Value) -> TxOut ctx era -> TxOut ctx era Source #

Alter the value of a TxOut with the given transformation.

modifyTxOutDatum :: (TxOutDatum ctx0 era -> TxOutDatum ctx1 era) -> TxOut ctx0 era -> TxOut ctx1 era Source #

Alter the datum of a TxOut with the given transformation.

findTxOutByAddress :: AddressInEra era -> Tx era -> Maybe (TxIn, TxOut CtxTx era) Source #

Find first TxOut which pays to given address and also return the corresponding TxIn to reference it.

findTxOutByScript :: forall lang. IsPlutusScriptLanguage lang => UTxO -> PlutusScript lang -> Maybe (TxIn, TxOut CtxUTxO Era) Source #

Find a single script output in some UTxO

isVkTxOut :: forall ctx era. VerificationKey PaymentKey -> TxOut ctx era -> Bool Source #

Predicate to find or filter TxOut owned by a key. This is better than comparing the full address as it does not require a network discriminator.

isScriptTxOut :: forall lang ctx era. IsPlutusScriptLanguage lang => PlutusScript lang -> TxOut ctx era -> Bool Source #

Predicate to find or filter TxOut which are governed by some script. This is better than comparing the full address as it does not require a network discriminator.

Type Conversions

fromLedgerTxOut :: IsShelleyBasedEra era => TxOut (ShelleyLedgerEra era) -> TxOut ctx era Source #

Convert a cardano-ledger TxOut into a cardano-api TxOut

toLedgerTxOut :: IsShelleyBasedEra era => TxOut CtxUTxO era -> TxOut (ShelleyLedgerEra era) Source #

Convert a cardano-api TxOut into a cardano-ledger TxOut

fromPlutusTxOut :: forall era. IsBabbageBasedEra era => Network -> TxOut -> Maybe (TxOut CtxUTxO era) Source #

Convert a plutus TxOut into a cardano-api TxOut. NOTE: Reference scripts are not resolvable right now. NOTE: Requires the Network discriminator (Testnet or Mainnet) because Plutus addresses are stripped off it.

toPlutusTxOut :: HasCallStack => TxOut CtxUTxO Era -> Maybe TxOut Source #

Convert a cardano-api TxOut into a plutus TxOut. Returns Nothing if a byron address is used in the given TxOut.