plutus-ledger-0.1.0.0: Wallet API
Safe HaskellNone
LanguageHaskell2010

Ledger.Tx

Synopsis

Documentation

ChainIndexTxOut

data ChainIndexTxOut Source #

Transaction output that comes from a chain index query.

It is defined here instead of the plutus-chain-index because plutus-ledger uses that datatype, and plutus-ledger can't depend on plutus-chain-index because of a cyclic dependency.

This datatype was created in order to be used in processConstraint, specifically with the constraints MustSpendPubKeyOutput and MustSpendScriptOutput.

TODO Add 'Either DatumHash Datum' field for PublicKeyChainIndexTxOut.

Instances

Instances details
Eq ChainIndexTxOut Source # 
Instance details

Defined in Ledger.Tx

Show ChainIndexTxOut Source # 
Instance details

Defined in Ledger.Tx

Generic ChainIndexTxOut Source # 
Instance details

Defined in Ledger.Tx

Associated Types

type Rep ChainIndexTxOut :: Type -> Type Source #

ToJSON ChainIndexTxOut Source # 
Instance details

Defined in Ledger.Tx

FromJSON ChainIndexTxOut Source # 
Instance details

Defined in Ledger.Tx

ToSchema ChainIndexTxOut Source # 
Instance details

Defined in Ledger.Tx

Serialise ChainIndexTxOut Source # 
Instance details

Defined in Ledger.Tx

Pretty ChainIndexTxOut Source # 
Instance details

Defined in Ledger.Tx

type Rep ChainIndexTxOut Source # 
Instance details

Defined in Ledger.Tx

type Rep ChainIndexTxOut = D1 ('MetaData "ChainIndexTxOut" "Ledger.Tx" "plutus-ledger-0.1.0.0-BAhdPNOPbMF52ZvZJtxBkz" 'False) (C1 ('MetaCons "PublicKeyChainIndexTxOut" 'PrefixI 'True) (S1 ('MetaSel ('Just "_ciTxOutAddress") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Address) :*: S1 ('MetaSel ('Just "_ciTxOutValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value)) :+: C1 ('MetaCons "ScriptChainIndexTxOut" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_ciTxOutAddress") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Address) :*: S1 ('MetaSel ('Just "_ciTxOutValidator") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Either ValidatorHash Validator))) :*: (S1 ('MetaSel ('Just "_ciTxOutDatum") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Either DatumHash Datum)) :*: S1 ('MetaSel ('Just "_ciTxOutValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value))))

toTxOut :: ChainIndexTxOut -> TxOut Source #

Converts a transaction output from the chain index to the plutus-ledger-api transaction output.

Note that converting from ChainIndexTxOut to TxOut and back to ChainIndexTxOut loses precision (Datum and Validator are changed to DatumHash and ValidatorHash respectively)

fromTxOut :: TxOut -> Maybe ChainIndexTxOut Source #

Converts a plutus-ledger-api transaction output to the chain index transaction output.

Lenses and Prisms

data CardanoTx Source #

Instances

Instances details
Eq CardanoTx Source # 
Instance details

Defined in Ledger.Tx

Show CardanoTx Source # 
Instance details

Defined in Ledger.Tx

Generic CardanoTx Source # 
Instance details

Defined in Ledger.Tx

Associated Types

type Rep CardanoTx :: Type -> Type Source #

ToJSON CardanoTx Source # 
Instance details

Defined in Ledger.Tx

FromJSON CardanoTx Source # 
Instance details

Defined in Ledger.Tx

ToSchema CardanoTx Source # 
Instance details

Defined in Ledger.Tx

Pretty CardanoTx Source # 
Instance details

Defined in Ledger.Tx

Methods

pretty :: CardanoTx -> Doc ann Source #

prettyList :: [CardanoTx] -> Doc ann Source #

type Rep CardanoTx Source # 
Instance details

Defined in Ledger.Tx

onCardanoTx :: (Tx -> r) -> (SomeCardanoApiTx -> r) -> CardanoTx -> r Source #

mergeCardanoTxWith :: (Tx -> a) -> (SomeCardanoApiTx -> a) -> (a -> a -> a) -> CardanoTx -> a Source #

data SomeCardanoApiTx where Source #

Cardano tx from any era.

Constructors

SomeTx :: IsCardanoEra era => Tx era -> EraInMode era CardanoMode -> SomeCardanoApiTx 

Instances

Instances details
Eq SomeCardanoApiTx Source # 
Instance details

Defined in Ledger.Tx.CardanoAPI

Show SomeCardanoApiTx Source # 
Instance details

Defined in Ledger.Tx.CardanoAPI

ToJSON SomeCardanoApiTx Source # 
Instance details

Defined in Ledger.Tx.CardanoAPI

FromJSON SomeCardanoApiTx Source #

Converting SomeCardanoApiTx to JSON.

If the "tx" field is from an unknown era, the JSON parser will print an error at runtime while parsing.

Instance details

Defined in Ledger.Tx.CardanoAPI

ToSchema SomeCardanoApiTx Source # 
Instance details

Defined in Ledger.Tx.CardanoAPI

Serialise SomeCardanoApiTx Source # 
Instance details

Defined in Ledger.Tx.CardanoAPI

Pretty SomeCardanoApiTx Source # 
Instance details

Defined in Ledger.Tx.CardanoAPI

Transactions

addSignature :: PrivateKey -> Passphrase -> Tx -> Tx Source #

Sign the transaction with a PrivateKey and passphrase (ByteString) and add the signature to the transaction's list of signatures.

addSignature' :: PrivateKey -> Tx -> Tx Source #

Sign the transaction with a PrivateKey that has no passphrase and add the signature to the transaction's list of signatures

pubKeyTxOut :: Value -> PaymentPubKey -> Maybe StakePubKey -> TxOut Source #

Create a transaction output locked by a public payment key and optionnaly a public stake key.

scriptTxOut :: Value -> Validator -> Datum -> TxOut Source #

Create a transaction output locked by a validator script and with the given data script attached.

scriptTxOut' :: Value -> Address -> Datum -> TxOut Source #

Create a transaction output locked by a validator script hash with the given data script attached.

updateUtxo :: Tx -> Map TxOutRef TxOut -> Map TxOutRef TxOut Source #

Update a map of unspent transaction outputs and signatures based on the inputs and outputs of a transaction.

txOutRefs :: Tx -> [(TxOut, TxOutRef)] Source #

A list of a transaction's outputs paired with a TxOutRefs referring to them.

unspentOutputsTx :: Tx -> Map TxOutRef TxOut Source #

The unspent outputs of a transaction.

Hashing transactions

txId :: Tx -> TxId Source #

Compute the id of a transaction.

Orphan instances

Pretty Tx Source # 
Instance details

Methods

pretty :: Tx -> Doc ann Source #

prettyList :: [Tx] -> Doc ann Source #