plutus-ledger-api-1.70.0.0: Interface to the Plutus ledger for the Cardano ledger.
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusLedgerApi.Test.ScriptContextBuilder.Builder

Synopsis

Documentation

data UnitTestArgs Source #

Arguments for a unit test: a script context and additional parameters.

Instances

Instances details
Generic UnitTestArgs Source # 
Instance details

Defined in PlutusLedgerApi.Test.ScriptContextBuilder.Builder

Associated Types

type Rep UnitTestArgs ∷ Type → Type Source #

type Rep UnitTestArgs Source # 
Instance details

Defined in PlutusLedgerApi.Test.ScriptContextBuilder.Builder

type Rep UnitTestArgs = D1 ('MetaData "UnitTestArgs" "PlutusLedgerApi.Test.ScriptContextBuilder.Builder" "plutus-ledger-api-1.70.0.0-inplace-plutus-ledger-api-testlib" 'False) (C1 ('MetaCons "UnitTestArgs" 'PrefixI 'True) (S1 ('MetaSel ('Just "utaScriptContext") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ScriptContext) :*: S1 ('MetaSel ('Just "utaParameters") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [BuiltinData])))

newtype InputBuilder Source #

A composable builder for constructing transaction inputs.

Constructors

InputBuilder 

Fields

newtype TxOutBuilder Source #

A composable builder for constructing transaction outputs.

Constructors

TxOutBuilder 

Fields

withRedeemer ∷ BuiltinData → ScriptContextBuilder Source #

Set the top-level redeemer for the script context.

withFee ∷ Integer → ScriptContextBuilder Source #

Set the transaction fee.

withSigner ∷ PubKeyHash → ScriptContextBuilder Source #

Add a signatory to the transaction.

withSigners ∷ [PubKeyHash] → ScriptContextBuilder Source #

Add multiple signatories to the transaction.

withMint ∷ Value → BuiltinData → ScriptContextBuilder Source #

Add a minting entry with the given value and redeemer.

withMintingScript ∷ Value → BuiltinData → ScriptContextBuilder Source #

Set the script purpose to minting and add a mint entry.

withSpendingScript ∷ BuiltinData → InputBuilder → ScriptContextBuilder Source #

Set the script purpose to spending and add the script input.

withRewardingScript ∷ BuiltinData → Credential → Integer → ScriptContextBuilder Source #

Set the script purpose to rewarding with a fixed redeemer.

withRewardingScriptWithBuilder ∷ (ScriptContextBuilderState → BuiltinData) → Credential → Integer → ScriptContextBuilder Source #

Set the script purpose to rewarding with a redeemer computed from the builder state.

withOutput ∷ TxOutBuilder → ScriptContextBuilder Source #

Add a transaction output.

withInput ∷ InputBuilder → ScriptContextBuilder Source #

Add a public-key input. Errors if the address is a script address.

withScriptInput ∷ BuiltinData → InputBuilder → ScriptContextBuilder Source #

Add a script input with a redeemer. Errors if the address is not a script address.

withReferenceInput ∷ InputBuilder → ScriptContextBuilder Source #

Add a reference input (read-only, not spent).

withValue ∷ Value → InputBuilder Source #

Set the value for an input.

withValidRange ∷ POSIXTimeRange → ScriptContextBuilder Source #

Set the transaction validity time range.

withOutRef ∷ TxOutRef → InputBuilder Source #

Set the UTXO reference for an input.

withInlineDatum ∷ BuiltinData → InputBuilder Source #

Attach an inline datum to an input.

withReferenceScript ∷ ScriptHash → InputBuilder Source #

Attach a reference script to an input.

withAddress ∷ Address → InputBuilder Source #

Set the address for an input.

withWithdrawal ∷ Credential → Integer → ScriptContextBuilder Source #

Add a withdrawal entry for a credential and ADA amount.

addInput ∷ TxInInfo → ScriptContext → ScriptContext Source #

Add a transaction input to an existing ScriptContext, sorted by TxOutRef.

addMint ∷ ScriptContext → Value → BuiltinData → ScriptContext Source #

Add a minting entry to an existing ScriptContext.

mkMintingScriptWithPurpose ∷ Value → BuiltinData → ScriptContext Source #

Create a minimal ScriptContext for a minting script.

addChangeOutput ∷ PubKeyHash → ScriptContext → ScriptContext Source #

Compute and add a change output to the given public key hash.

signAndAddChangeOutput ∷ PubKeyHash → ScriptContext → ScriptContext Source #

Add a signatory and compute a change output for the same public key hash.

mkAdaValue ∷ Lovelace → Value Source #

Create a Value containing only ADA from a Lovelace amount.

mkTxOut ∷ TxOutBuilder → TxOut Source #

Finalize a TxOutBuilder into a TxOut.

withTxOutReferenceScript ∷ ScriptHash → TxOutBuilder Source #

Attach a reference script to a transaction output.

withTxOutInlineDatum ∷ BuiltinData → TxOutBuilder Source #

Attach an inline datum to a transaction output.

withTxOutValue ∷ Value → TxOutBuilder Source #

Add value to a transaction output (accumulates with existing value).

withTxOutAddress ∷ Address → TxOutBuilder Source #

Set the address for a transaction output.

addOutput ∷ TxOut → ScriptContext → ScriptContext Source #

Prepend a transaction output to an existing ScriptContext.

addReferenceInput ∷ TxInInfo → ScriptContext → ScriptContext Source #

Add a reference input to an existing ScriptContext, sorted by TxOutRef.

buildBalancedScriptContext ∷ ScriptContextBuilder → ScriptContext Source #

Build a ScriptContext and automatically balance it with a change output.

balanceWithChangeOutput ∷ ScriptContext → ScriptContext Source #

Balance the transaction by adding a change output to the first public key input.

builderPlaceHolderTxOutRef ∷ TxOutRef Source #

Default placeholder TxOutRef used when none is specified.

Helpers

currencySymbolFromHex ∷ String → CurrencySymbol Source #

Convert a hex encoded Haskell String to a CurrencySymbol.

singleCurrencySymbol ∷ Value → CurrencySymbol Source #

Extract the single currency symbol from a Value. Errors if the value contains zero or more than one currency symbol.

Orphan instances

Eq ScriptPurpose Source # 
Instance details