convex-testing-interface
Safe HaskellSafe-Inferred
LanguageHaskell2010

Convex.ThreatModel.TxModifier

Synopsis

Documentation

data Input Source #

A transaction input reference togheter with the corresponding TxOut from the UTxO set.

Constructors

Input 

class IsInputOrOutput t where Source #

Functions common to both Inputs and Outputs.

Methods

changeAddressOf :: t -> AddressAny -> TxModifier Source #

Change the target address of an input or an output. For outputs this means redirecting an output to a different address, and for inputs it means modifying the UTxO set, changing the owner of the given input.

Note: Does not work for script inputs.

changeValueOf :: t -> Value -> TxModifier Source #

Change the value of an input or an output.

changeDatumOf :: t -> Datum -> TxModifier Source #

Change the datum on an input or an output.

changeRefScriptOf :: t -> ReferenceScript Era -> TxModifier Source #

Change the reference script on an input or an output

addressOf :: t -> AddressAny Source #

Get the address (pubkey or script address) of an input or an output.

valueOf :: t -> Value Source #

Get the value at an input or an output.

refScriptOf :: t -> ReferenceScript Era Source #

Get the reference script at an input or an output.

type Datum = TxOutDatum CtxTx Era Source #

Type synonym for datums. The CtxTx context means that the actual datum value can be present, not just the hash.

type Redeemer = ScriptData Source #

Redeemers are plain ScriptData.

newtype TxModifier Source #

The type of transaction modifiers. When combined using the monoid instance, individual modifications are applied in left-to-right order.

Constructors

TxModifier [TxMod] 

data TxMod where Source #

Instances

Instances details
ToJSON TxMod Source # 
Instance details

Defined in Convex.ThreatModel.TxModifier

Show TxMod Source # 
Instance details

Defined in Convex.ThreatModel.TxModifier

Methods

showsPrec :: Int -> TxMod -> ShowS #

show :: TxMod -> String #

showList :: [TxMod] -> ShowS #

addOutput :: AddressAny -> Value -> Datum -> ReferenceScript Era -> TxModifier Source #

Add a new output of any type (public key or script)

removeOutput :: Output -> TxModifier Source #

Remove an output of any type.

addKeyInput :: AddressAny -> Value -> Datum -> ReferenceScript Era -> TxModifier Source #

Add a new public key input.

addKeyReferenceInput :: AddressAny -> Value -> Datum -> ReferenceScript Era -> TxModifier Source #

Add a new public key reference input.

removeInput :: Input -> TxModifier Source #

Remove an input of any type.

addReferenceScriptInput :: ScriptHash -> Value -> Datum -> Redeemer -> TxModifier Source #

Add a reference script input

addPlutusScriptInput :: IsPlutusScriptInEra lang => PlutusScript lang -> Value -> Datum -> Redeemer -> ReferenceScript Era -> TxModifier Source #

Add a plutus V2 script input.

addPlutusScriptReferenceInput :: IsPlutusScriptInEra lang => PlutusScript lang -> Value -> Datum -> ReferenceScript Era -> TxModifier Source #

Add a plutus script reference input.

addSimpleScriptReferenceInput :: SimpleScript -> Value -> ReferenceScript Era -> TxModifier Source #

Add a simple script reference input.

addPlutusScriptMint :: IsPlutusScriptInEra lang => PlutusScript lang -> AssetName -> Quantity -> ScriptData -> TxModifier Source #

Smart constructor for minting with a Plutus V2 script

alwaysSucceedsMintingPolicy :: PlutusScript PlutusScriptV2 Source #

Always-succeeds minting policy for testing Takes 2 arguments: redeemer and script context

changeRedeemerOf :: Input -> Redeemer -> TxModifier Source #

Change the redeemer of a script input.

changeValidityRange :: (TxValidityLowerBound Era, TxValidityUpperBound Era) -> TxModifier Source #

Change the validity range of the transaction.

changeValidityLowerBound :: TxValidityLowerBound Era -> TxModifier Source #

Change the validity lower bound of the transaction.

changeValidityUpperBound :: TxValidityUpperBound Era -> TxModifier Source #

Change the validity upper bound of the transaction.

removeRequiredSigner :: Hash PaymentKey -> TxModifier Source #

Remove a required signer from the transaction.

replaceTx :: Tx Era -> UTxO Era -> TxModifier Source #

The most general transaction modifier. Simply replace the original transaction and UTxO set by the given values. In most cases the modifiers above should be sufficient.

renderAddressAny :: AddressAny -> Text Source #

Render an AddressAny as text (bech32 for Shelley, show for Byron).

renderDatumAny :: Datum -> Maybe Text Source #

Render a Datum (TxOutDatum CtxTx Era) as a JSON-friendly text value.