plutus-wallet-api-0.1.0.0: Wallet API

Safe HaskellNone
LanguageHaskell2010

Ledger.Validation

Contents

Synopsis

Pending transactions and related types

data PendingTx' i Source #

A pending transaction. This is the view as seen by validator scripts, so some details are stripped out.

Constructors

PendingTx 

Fields

Instances
Functor PendingTx' Source # 
Instance details

Defined in Ledger.Validation

Methods

fmap :: (a -> b) -> PendingTx' a -> PendingTx' b Source #

(<$) :: a -> PendingTx' b -> PendingTx' a Source #

Functor PendingTx' Source # 
Instance details

Defined in Ledger.Validation

Methods

fmap :: (a -> b) -> PendingTx' a -> PendingTx' b

Generic (PendingTx' i) Source # 
Instance details

Defined in Ledger.Validation

Associated Types

type Rep (PendingTx' i) :: Type -> Type Source #

Methods

from :: PendingTx' i -> Rep (PendingTx' i) x Source #

to :: Rep (PendingTx' i) x -> PendingTx' i Source #

(Typeable i, Lift i) => Lift (PendingTx' i) Source # 
Instance details

Defined in Ledger.Validation

Methods

lift :: PendingTx' i -> RTCompile (Term TyName Name ())

Typeable PendingTx' Source # 
Instance details

Defined in Ledger.Validation

Methods

typeRep :: Proxy PendingTx' -> RTCompile (Type TyName ())

type Rep (PendingTx' i) Source # 
Instance details

Defined in Ledger.Validation

data PendingTxOut Source #

An output of a pending transaction.

Constructors

PendingTxOut 

Fields

Instances
Generic PendingTxOut Source # 
Instance details

Defined in Ledger.Validation

Associated Types

type Rep PendingTxOut :: Type -> Type Source #

Lift PendingTxOut Source # 
Instance details

Defined in Ledger.Validation

Methods

lift :: PendingTxOut -> RTCompile (Term TyName Name ())

Typeable PendingTxOut Source # 
Instance details

Defined in Ledger.Validation

Methods

typeRep :: Proxy PendingTxOut -> RTCompile (Type TyName ())

type Rep PendingTxOut Source # 
Instance details

Defined in Ledger.Validation

type Rep PendingTxOut = D1 (MetaData "PendingTxOut" "Ledger.Validation" "plutus-wallet-api-0.1.0.0-BdsTjp7uGUGANkPkvyfvD2-plutus-ledger" False) (C1 (MetaCons "PendingTxOut" PrefixI True) (S1 (MetaSel (Just "pendingTxOutValue") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Value) :*: (S1 (MetaSel (Just "pendingTxOutHashes") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe (ValidatorHash, DataScriptHash))) :*: S1 (MetaSel (Just "pendingTxOutData") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PendingTxOutType))))

data PendingTxOutRef Source #

A reference to a transaction output in a pending transaction.

Constructors

PendingTxOutRef 

Fields

Instances
Generic PendingTxOutRef Source # 
Instance details

Defined in Ledger.Validation

Associated Types

type Rep PendingTxOutRef :: Type -> Type Source #

Lift PendingTxOutRef Source # 
Instance details

Defined in Ledger.Validation

Methods

lift :: PendingTxOutRef -> RTCompile (Term TyName Name ())

Typeable PendingTxOutRef Source # 
Instance details

Defined in Ledger.Validation

Methods

typeRep :: Proxy PendingTxOutRef -> RTCompile (Type TyName ())

type Rep PendingTxOutRef Source # 
Instance details

Defined in Ledger.Validation

type Rep PendingTxOutRef = D1 (MetaData "PendingTxOutRef" "Ledger.Validation" "plutus-wallet-api-0.1.0.0-BdsTjp7uGUGANkPkvyfvD2-plutus-ledger" False) (C1 (MetaCons "PendingTxOutRef" PrefixI True) (S1 (MetaSel (Just "pendingTxOutRefId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 TxHash) :*: S1 (MetaSel (Just "pendingTxOutRefIdx") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Integer)))

data PendingTxIn' w Source #

An input of a pending transaction, parameterised by its witness.

Constructors

PendingTxIn 

Fields

Instances
Functor PendingTxIn' Source # 
Instance details

Defined in Ledger.Validation

Methods

fmap :: (a -> b) -> PendingTxIn' a -> PendingTxIn' b Source #

(<$) :: a -> PendingTxIn' b -> PendingTxIn' a Source #

Functor PendingTxIn' Source # 
Instance details

Defined in Ledger.Validation

Methods

fmap :: (a -> b) -> PendingTxIn' a -> PendingTxIn' b

Generic (PendingTxIn' w) Source # 
Instance details

Defined in Ledger.Validation

Associated Types

type Rep (PendingTxIn' w) :: Type -> Type Source #

(Typeable w, Lift w) => Lift (PendingTxIn' w) Source # 
Instance details

Defined in Ledger.Validation

Methods

lift :: PendingTxIn' w -> RTCompile (Term TyName Name ())

Typeable PendingTxIn' Source # 
Instance details

Defined in Ledger.Validation

Methods

typeRep :: Proxy PendingTxIn' -> RTCompile (Type TyName ())

type Rep (PendingTxIn' w) Source # 
Instance details

Defined in Ledger.Validation

type Rep (PendingTxIn' w) = D1 (MetaData "PendingTxIn'" "Ledger.Validation" "plutus-wallet-api-0.1.0.0-BdsTjp7uGUGANkPkvyfvD2-plutus-ledger" False) (C1 (MetaCons "PendingTxIn" PrefixI True) (S1 (MetaSel (Just "pendingTxInRef") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PendingTxOutRef) :*: (S1 (MetaSel (Just "pendingTxInWitness") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 w) :*: S1 (MetaSel (Just "pendingTxInValue") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Value))))

data PendingTxOutType Source #

The type of a transaction output in a pending transaction.

Constructors

PubKeyTxOut PubKey

Pub key address

DataTxOut

The data script of the pending transaction output (see note [Script types in pending transactions])

Instances
Generic PendingTxOutType Source # 
Instance details

Defined in Ledger.Validation

Associated Types

type Rep PendingTxOutType :: Type -> Type Source #

Lift PendingTxOutType Source # 
Instance details

Defined in Ledger.Validation

Methods

lift :: PendingTxOutType -> RTCompile (Term TyName Name ())

Typeable PendingTxOutType Source # 
Instance details

Defined in Ledger.Validation

Methods

typeRep :: Proxy PendingTxOutType -> RTCompile (Type TyName ())

type Rep PendingTxOutType Source # 
Instance details

Defined in Ledger.Validation

type Rep PendingTxOutType = D1 (MetaData "PendingTxOutType" "Ledger.Validation" "plutus-wallet-api-0.1.0.0-BdsTjp7uGUGANkPkvyfvD2-plutus-ledger" False) (C1 (MetaCons "PubKeyTxOut" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PubKey)) :+: C1 (MetaCons "DataTxOut" PrefixI False) (U1 :: Type -> Type))

findDataScriptOutputs :: DataScriptHash -> PendingTx -> [Integer] Source #

Look up a DataScriptHash in the transaction outputs, returning the indexs of the outputs that have that hash, if there are any.

findContinuingOutputs :: PendingTx -> [Integer] Source #

Finds all the outputs that pay to the same script address that we are currently spending from, if any.

Hashes (see note [Hashes in validator scripts])

newtype TxHash Source #

Script runtime representation of a Digest SHA256.

Constructors

TxHash ByteString 
Instances
Eq TxHash Source # 
Instance details

Defined in Ledger.Validation

Ord TxHash Source # 
Instance details

Defined in Ledger.Validation

Show TxHash Source # 
Instance details

Defined in Ledger.Validation

IsString TxHash Source # 
Instance details

Defined in Ledger.Validation

Generic TxHash Source # 
Instance details

Defined in Ledger.Validation

Associated Types

type Rep TxHash :: Type -> Type Source #

Serialise TxHash Source # 
Instance details

Defined in Ledger.Validation

Methods

encode :: TxHash -> Encoding

decode :: Decoder s TxHash

encodeList :: [TxHash] -> Encoding

decodeList :: Decoder s [TxHash]

Hashable TxHash Source # 
Instance details

Defined in Ledger.Validation

Methods

hashWithSalt :: Int -> TxHash -> Int

hash :: TxHash -> Int

FromJSON TxHash Source # 
Instance details

Defined in Ledger.Validation

Methods

parseJSON :: Value -> Parser TxHash

parseJSONList :: Value -> Parser [TxHash]

FromJSONKey TxHash Source # 
Instance details

Defined in Ledger.Validation

Methods

fromJSONKey :: FromJSONKeyFunction TxHash

fromJSONKeyList :: FromJSONKeyFunction [TxHash]

ToJSON TxHash Source # 
Instance details

Defined in Ledger.Validation

Methods

toJSON :: TxHash -> Value

toEncoding :: TxHash -> Encoding

toJSONList :: [TxHash] -> Value

toEncodingList :: [TxHash] -> Encoding

ToJSONKey TxHash Source # 
Instance details

Defined in Ledger.Validation

Methods

toJSONKey :: ToJSONKeyFunction TxHash

toJSONKeyList :: ToJSONKeyFunction [TxHash]

Lift TxHash Source # 
Instance details

Defined in Ledger.Validation

Methods

lift :: TxHash -> RTCompile (Term TyName Name ())

Eq TxHash Source # 
Instance details

Defined in Ledger.Validation

Methods

(==) :: TxHash -> TxHash -> Bool

Ord TxHash Source # 
Instance details

Defined in Ledger.Validation

Typeable TxHash Source # 
Instance details

Defined in Ledger.Validation

Methods

typeRep :: Proxy TxHash -> RTCompile (Type TyName ())

type Rep TxHash Source # 
Instance details

Defined in Ledger.Validation

type Rep TxHash = D1 (MetaData "TxHash" "Ledger.Validation" "plutus-wallet-api-0.1.0.0-BdsTjp7uGUGANkPkvyfvD2-plutus-ledger" True) (C1 (MetaCons "TxHash" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ByteString)))

plcTxHash :: TxId -> TxHash Source #

Compute the hash of a redeemer script.

plcDigest :: Digest SHA256 -> ByteString Source #

Convert a `Digest SHA256` to a PLC Hash

Oracles

data OracleValue a Source #

OracleValue a is a value observed at a time signed by an oracle. See note [Oracles].

Constructors

OracleValue 

Fields

Instances
Generic (OracleValue a) Source # 
Instance details

Defined in Ledger.Validation

Associated Types

type Rep (OracleValue a) :: Type -> Type Source #

(Typeable a, Lift a) => Lift (OracleValue a) Source # 
Instance details

Defined in Ledger.Validation

Methods

lift :: OracleValue a -> RTCompile (Term TyName Name ())

Typeable OracleValue Source # 
Instance details

Defined in Ledger.Validation

Methods

typeRep :: Proxy OracleValue -> RTCompile (Type TyName ())

type Rep (OracleValue a) Source # 
Instance details

Defined in Ledger.Validation

type Rep (OracleValue a) = D1 (MetaData "OracleValue" "Ledger.Validation" "plutus-wallet-api-0.1.0.0-BdsTjp7uGUGANkPkvyfvD2-plutus-ledger" False) (C1 (MetaCons "OracleValue" PrefixI True) (S1 (MetaSel (Just "ovSignature") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PubKey) :*: (S1 (MetaSel (Just "ovSlot") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Slot) :*: S1 (MetaSel (Just "ovValue") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a))))

Validator functions

Signatures

txSignedBy :: PendingTx -> PubKey -> Bool Source #

Check if a transaction was signed by the given public key.

Transactions

pubKeyOutput :: PendingTxOut -> Maybe PubKey Source #

Get the public key that locks the transaction output, if any.

scriptOutputsAt :: ValidatorHash -> PendingTx -> [(DataScriptHash, Value)] Source #

Get the list of PendingTxOut outputs of the pending transaction at a given script address.

pubKeyOutputsAt :: PubKey -> PendingTx -> [Value] Source #

Get the values paid to a public key address by a pending transaction.

valueLockedBy :: PendingTx -> ValidatorHash -> Value Source #

Get the total value locked by the given validator in this transaction.

valuePaidTo :: PendingTx -> PubKey -> Value Source #

Get the total value paid to a public key address by a pending transaction.

adaLockedBy :: PendingTx -> ValidatorHash -> Ada Source #

Get the total amount of Ada locked by the given validator in this transaction.

signsTransaction :: Signature -> PubKey -> PendingTx -> Bool Source #

Check if the provided signature is the result of signing the pending transaction (without witnesses) with the given public key.

spendsOutput :: PendingTx -> TxHash -> Integer -> Bool Source #

Check if the pending transaction spends a specific transaction output (identified by the hash of a transaction and an index into that transactions' outputs)

valueSpent :: PendingTx -> Value Source #

Get the total value of inputs spent by this transaction.

ownCurrencySymbol :: PendingTx -> CurrencySymbol Source #

The CurrencySymbol of the current validator script.

ownHashes :: PendingTx -> (ValidatorHash, RedeemerHash) Source #

Get the hashes of validator script and redeemer script that are currently being validated

ownHash :: PendingTx -> ValidatorHash Source #

Get the hash of the validator script that is currently being validated.