plutus-ledger-api-0.1.0.0: Interface to the Plutus ledger for the Cardano ledger.
Safe HaskellNone
LanguageHaskell2010

Plutus.V1.Ledger.Tx

Synopsis

Transactions

data Tx Source #

A transaction, including witnesses for its inputs.

Constructors

Tx 

Fields

Instances

Instances details
Eq Tx Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

(==) :: Tx -> Tx -> Bool Source #

(/=) :: Tx -> Tx -> Bool Source #

Show Tx Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Generic Tx Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Associated Types

type Rep Tx :: Type -> Type Source #

Methods

from :: Tx -> Rep Tx x Source #

to :: Rep Tx x -> Tx Source #

Semigroup Tx Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

(<>) :: Tx -> Tx -> Tx Source #

sconcat :: NonEmpty Tx -> Tx Source #

stimes :: Integral b => b -> Tx -> Tx Source #

Monoid Tx Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

mempty :: Tx Source #

mappend :: Tx -> Tx -> Tx Source #

mconcat :: [Tx] -> Tx Source #

ToJSON Tx Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

FromJSON Tx Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

NFData Tx Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

rnf :: Tx -> () Source #

ByteArrayAccess Tx Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

length :: Tx -> Int Source #

withByteArray :: Tx -> (Ptr p -> IO a) -> IO a Source #

copyByteArrayToPtr :: Tx -> Ptr p -> IO () Source #

Serialise Tx Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep Tx Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

inputs :: Lens' Tx (Set TxIn) Source #

The inputs of a transaction.

collateralInputs :: Lens' Tx (Set TxIn) Source #

The collateral inputs of a transaction for paying fees when validating the transaction fails.

outputs :: Lens' Tx [TxOut] Source #

The outputs of a transaction.

spentOutputs :: Tx -> Set TxOutRef Source #

The transaction output references consumed by a transaction.

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

Update a map of unspent transaction outputs and signatures for a failed transaction using its collateral inputs.

validValuesTx :: Tx -> Bool Source #

Check that all values in a transaction are non-negative.

data ScriptTag Source #

A tag indicating the type of script that we are pointing to. NOTE: Cert/Reward are not supported right now.

Constructors

Spend 
Mint 
Cert 
Reward 

Instances

Instances details
Eq ScriptTag Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Ord ScriptTag Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Show ScriptTag Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Generic ScriptTag Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Associated Types

type Rep ScriptTag :: Type -> Type Source #

ToJSON ScriptTag Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

FromJSON ScriptTag Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

NFData ScriptTag Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

rnf :: ScriptTag -> () Source #

Serialise ScriptTag Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep ScriptTag Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep ScriptTag = D1 ('MetaData "ScriptTag" "Plutus.V1.Ledger.Tx" "plutus-ledger-api-0.1.0.0-6XBf4FRRdNK1B20rg7kZGy" 'False) ((C1 ('MetaCons "Spend" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Mint" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Cert" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Reward" 'PrefixI 'False) (U1 :: Type -> Type)))

data RedeemerPtr Source #

A redeemer pointer is a pair of a script type tag t and an index i, picking out the ith script of type t in the transaction.

Instances

Instances details
Eq RedeemerPtr Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Ord RedeemerPtr Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Show RedeemerPtr Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Generic RedeemerPtr Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Associated Types

type Rep RedeemerPtr :: Type -> Type Source #

ToJSON RedeemerPtr Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

ToJSONKey RedeemerPtr Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

FromJSON RedeemerPtr Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

FromJSONKey RedeemerPtr Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

NFData RedeemerPtr Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

rnf :: RedeemerPtr -> () Source #

Serialise RedeemerPtr Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep RedeemerPtr Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep RedeemerPtr = D1 ('MetaData "RedeemerPtr" "Plutus.V1.Ledger.Tx" "plutus-ledger-api-0.1.0.0-6XBf4FRRdNK1B20rg7kZGy" 'False) (C1 ('MetaCons "RedeemerPtr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ScriptTag) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))

Stripped transactions

data TxStripped Source #

A transaction without witnesses for its inputs.

Constructors

TxStripped 

Fields

Instances

Instances details
Eq TxStripped Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Show TxStripped Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Generic TxStripped Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Associated Types

type Rep TxStripped :: Type -> Type Source #

Serialise TxStripped Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep TxStripped Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep TxStripped = D1 ('MetaData "TxStripped" "Plutus.V1.Ledger.Tx" "plutus-ledger-api-0.1.0.0-6XBf4FRRdNK1B20rg7kZGy" 'False) (C1 ('MetaCons "TxStripped" 'PrefixI 'True) ((S1 ('MetaSel ('Just "txStrippedInputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set TxOutRef)) :*: S1 ('MetaSel ('Just "txStrippedOutputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [TxOut])) :*: (S1 ('MetaSel ('Just "txStrippedMint") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Value) :*: S1 ('MetaSel ('Just "txStrippedFee") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Value))))

Transaction outputs

data TxOut Source #

A transaction output, consisting of a target address, a value, and optionally a datum hash.

Instances

Instances details
Eq TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

(==) :: TxOut -> TxOut -> Bool Source #

(/=) :: TxOut -> TxOut -> Bool Source #

Show TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Generic TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Associated Types

type Rep TxOut :: Type -> Type Source #

Methods

from :: TxOut -> Rep TxOut x Source #

to :: Rep TxOut x -> TxOut Source #

ToJSON TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

FromJSON TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

NFData TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

rnf :: TxOut -> () Source #

Pretty TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

pretty :: TxOut -> Doc ann Source #

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

ToData TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

FromData TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

UnsafeFromData TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Eq TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

(==) :: TxOut -> TxOut -> Bool Source #

Serialise TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Lift DefaultUni TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Typeable DefaultUni TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep TxOut = D1 ('MetaData "TxOut" "Plutus.V1.Ledger.Tx" "plutus-ledger-api-0.1.0.0-6XBf4FRRdNK1B20rg7kZGy" 'False) (C1 ('MetaCons "TxOut" 'PrefixI 'True) (S1 ('MetaSel ('Just "txOutAddress") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Address) :*: (S1 ('MetaSel ('Just "txOutValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value) :*: S1 ('MetaSel ('Just "txOutDatumHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe DatumHash)))))

data TxOutTx Source #

A TxOut along with the Tx it comes from, which may have additional information e.g. the full data script that goes with the TxOut.

Constructors

TxOutTx 

Fields

Instances

Instances details
Eq TxOutTx Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Show TxOutTx Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Generic TxOutTx Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Associated Types

type Rep TxOutTx :: Type -> Type Source #

ToJSON TxOutTx Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

FromJSON TxOutTx Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Serialise TxOutTx Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep TxOutTx Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep TxOutTx = D1 ('MetaData "TxOutTx" "Plutus.V1.Ledger.Tx" "plutus-ledger-api-0.1.0.0-6XBf4FRRdNK1B20rg7kZGy" 'False) (C1 ('MetaCons "TxOutTx" 'PrefixI 'True) (S1 ('MetaSel ('Just "txOutTxTx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Tx) :*: S1 ('MetaSel ('Just "txOutTxOut") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxOut)))

data TxOutRef Source #

A reference to a transaction output. This is a pair of a transaction reference, and an index indicating which of the outputs of that transaction we are referring to.

Constructors

TxOutRef 

Fields

Instances

Instances details
Eq TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Ord TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Show TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Generic TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Associated Types

type Rep TxOutRef :: Type -> Type Source #

ToJSON TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

ToJSONKey TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

FromJSON TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

FromJSONKey TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

NFData TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

rnf :: TxOutRef -> () Source #

Pretty TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

pretty :: TxOutRef -> Doc ann Source #

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

ToData TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

FromData TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

UnsafeFromData TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Eq TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

(==) :: TxOutRef -> TxOutRef -> Bool Source #

Serialise TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Lift DefaultUni TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Typeable DefaultUni TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep TxOutRef = D1 ('MetaData "TxOutRef" "Plutus.V1.Ledger.Tx" "plutus-ledger-api-0.1.0.0-6XBf4FRRdNK1B20rg7kZGy" 'False) (C1 ('MetaCons "TxOutRef" 'PrefixI 'True) (S1 ('MetaSel ('Just "txOutRefId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxId) :*: S1 ('MetaSel ('Just "txOutRefIdx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))

isPubKeyOut :: TxOut -> Bool Source #

Whether the output is a pay-to-pubkey output.

isPayToScriptOut :: TxOut -> Bool Source #

Whether the output is a pay-to-script output.

outAddress :: Lens' TxOut Address Source #

The address of a transaction output.

outValue :: Lens' TxOut Value Source #

The value of a transaction output. | TODO: Compute address again

txOutPubKey :: TxOut -> Maybe PubKeyHash Source #

The public key attached to a TxOut, if there is one.

txOutDatum :: TxOut -> Maybe DatumHash Source #

The datum attached to a TxOut, if there is one.

pubKeyHashTxOut :: Value -> PubKeyHash -> TxOut Source #

Create a transaction output locked by a public key.

Transaction inputs

data TxInType Source #

The type of a transaction input.

Constructors

ConsumeScriptAddress !Validator !Redeemer !Datum

A transaction input that consumes a script address with the given validator, redeemer, and datum.

ConsumePublicKeyAddress

A transaction input that consumes a public key address.

ConsumeSimpleScriptAddress

Consume a simple script

Instances

Instances details
Eq TxInType Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Ord TxInType Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Show TxInType Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Generic TxInType Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Associated Types

type Rep TxInType :: Type -> Type Source #

ToJSON TxInType Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

FromJSON TxInType Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

NFData TxInType Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

rnf :: TxInType -> () Source #

Serialise TxInType Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep TxInType Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep TxInType = D1 ('MetaData "TxInType" "Plutus.V1.Ledger.Tx" "plutus-ledger-api-0.1.0.0-6XBf4FRRdNK1B20rg7kZGy" 'False) (C1 ('MetaCons "ConsumeScriptAddress" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Validator) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Redeemer) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Datum))) :+: (C1 ('MetaCons "ConsumePublicKeyAddress" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ConsumeSimpleScriptAddress" 'PrefixI 'False) (U1 :: Type -> Type)))

data TxIn Source #

A transaction input, consisting of a transaction output reference and an input type.

Constructors

TxIn 

Instances

Instances details
Eq TxIn Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

(==) :: TxIn -> TxIn -> Bool Source #

(/=) :: TxIn -> TxIn -> Bool Source #

Ord TxIn Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Show TxIn Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Generic TxIn Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Associated Types

type Rep TxIn :: Type -> Type Source #

Methods

from :: TxIn -> Rep TxIn x Source #

to :: Rep TxIn x -> TxIn Source #

ToJSON TxIn Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

FromJSON TxIn Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

NFData TxIn Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

rnf :: TxIn -> () Source #

Pretty TxIn Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

pretty :: TxIn -> Doc ann Source #

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

Serialise TxIn Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep TxIn Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep TxIn = D1 ('MetaData "TxIn" "Plutus.V1.Ledger.Tx" "plutus-ledger-api-0.1.0.0-6XBf4FRRdNK1B20rg7kZGy" 'False) (C1 ('MetaCons "TxIn" 'PrefixI 'True) (S1 ('MetaSel ('Just "txInRef") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TxOutRef) :*: S1 ('MetaSel ('Just "txInType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe TxInType))))

inRef :: Lens' TxIn TxOutRef Source #

The TxOutRef spent by a transaction input.

inType :: Lens' TxIn (Maybe TxInType) Source #

The type of a transaction input.

inScripts :: TxIn -> Maybe (Validator, Redeemer, Datum) Source #

Validator, redeemer, and data scripts of a transaction input that spends a "pay to script" output.

validRange :: Lens' Tx SlotRange Source #

The validity range of a transaction.

pubKeyTxIn :: TxOutRef -> TxIn Source #

A transaction input that spends a "pay to public key" output, given the witness.

scriptTxIn :: TxOutRef -> Validator -> Redeemer -> Datum -> TxIn Source #

A transaction input that spends a "pay to script" output, given witnesses.

pubKeyTxIns :: Fold (Set TxIn) TxIn Source #

Filter to get only the pubkey inputs.

scriptTxIns :: Fold (Set TxIn) TxIn Source #

Filter to get only the script inputs.

Addresses

data Address Source #

Address with two kinds of credentials, normal and staking.

Instances

Instances details
Eq Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

Ord Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

Show Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

Generic Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

Associated Types

type Rep Address :: Type -> Type Source #

Hashable Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

ToJSON Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

ToJSONKey Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

FromJSON Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

FromJSONKey Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

NFData Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

Methods

rnf :: Address -> () Source #

Pretty Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

Methods

pretty :: Address -> Doc ann Source #

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

ToData Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

FromData Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

UnsafeFromData Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

Eq Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

Methods

(==) :: Address -> Address -> Bool Source #

Serialise Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

Lift DefaultUni Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

Typeable DefaultUni Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

type Rep Address Source # 
Instance details

Defined in Plutus.V1.Ledger.Address

type Rep Address = D1 ('MetaData "Address" "Plutus.V1.Ledger.Address" "plutus-ledger-api-0.1.0.0-6XBf4FRRdNK1B20rg7kZGy" 'False) (C1 ('MetaCons "Address" 'PrefixI 'True) (S1 ('MetaSel ('Just "addressCredential") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Credential) :*: S1 ('MetaSel ('Just "addressStakingCredential") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe StakingCredential))))