mantra-0.4.0.0
Safe HaskellNone
LanguageHaskell2010

Mantra.Transaction

Description

Handling transactions.

Synopsis
  • makeTransaction :: IsCardanoEra era => [TxIn] -> [TxOut era] -> Maybe SlotNo -> Maybe TxMetadata -> Maybe (PolicyId, SimpleScript SimpleScriptV2, Value) -> TxBodyContent BuildTx era
  • includeFee :: IsShelleyBasedEra era => MonadFail m => MonadIO m => NetworkId -> ProtocolParameters -> Int -> Int -> Int -> Int -> TxBodyContent BuildTx era -> MantraM m (TxBodyContent BuildTx era)
  • readMetadata :: MonadIO m => FilePath -> MantraM m TxMetadata
  • printUTxO :: MonadIO m => String -> UTxO era -> MantraM m ()
  • printValue :: MonadIO m => String -> Value -> MantraM m ()
  • printValueIO :: String -> Value -> IO ()
  • summarizeValues :: UTxO era -> (Int, Value)
  • makeMinting :: Value -> String -> Integer -> Hash PaymentKey -> Maybe SlotNo -> ((PolicyId, SimpleScript SimpleScriptV2, Value), Value)
  • readMinting :: MonadFail m => MonadIO m => PolicyId -> FilePath -> MantraM m (Value, TxMetadata, Value)

Transactions

makeTransaction Source #

Arguments

:: IsCardanoEra era 
=> [TxIn]

The UTxOs to be spent.

-> [TxOut era]

The output UTxOs.

-> Maybe SlotNo

The latest slot for the transaction.

-> Maybe TxMetadata

The metadata.

-> Maybe (PolicyId, SimpleScript SimpleScriptV2, Value)

The value to be minted.

-> TxBodyContent BuildTx era

Action for building the transaction.

Build a transaction.

includeFee Source #

Arguments

:: IsShelleyBasedEra era 
=> MonadFail m 
=> MonadIO m 
=> NetworkId

The network.

-> ProtocolParameters

The protocol parameters.

-> Int

The number of inputs.

-> Int

The number of outputs.

-> Int

The number of Shelley witnesses.

-> Int

The number of Byron witnesses.

-> TxBodyContent BuildTx era

The transaction body.

-> MantraM m (TxBodyContent BuildTx era)

Action for the transaction body with fee included.

Include the fee in a transaction.

Metadata

readMetadata Source #

Arguments

:: MonadIO m 
=> FilePath

Path to the metadata file.

-> MantraM m TxMetadata

Action for reading the file as metadata.

Read JSON metadata from a file.

Printing

printUTxO Source #

Arguments

:: MonadIO m 
=> String

How much to indent the output.

-> UTxO era

The UTxO.

-> MantraM m ()

Action to print the information.

Print information about a UTxO.

printValue Source #

Arguments

:: MonadIO m 
=> String

How much to indent the output.

-> Value

The value.

-> MantraM m ()

Action to print the information.

Print a value.

printValueIO Source #

Arguments

:: String 
-> Value

The value.

-> IO ()

Action to print the information.

Print a value.

summarizeValues Source #

Arguments

:: UTxO era

The UTxO.

-> (Int, Value)

The number of values and their total.

Summarize the values in a UTxO.

Minting

makeMinting Source #

Arguments

:: Value

The value to which minting will be added.

-> String

The asset name.

-> Integer

The number of tokens to omit.

-> Hash PaymentKey

Hash of the payment key.

-> Maybe SlotNo

The last slot number for minting.

-> ((PolicyId, SimpleScript SimpleScriptV2, Value), Value)

The minting script, value minted, and total value.

Prepare a minting script.

readMinting Source #

Arguments

:: MonadFail m 
=> MonadIO m 
=> PolicyId

The policy ID.

-> FilePath

Path to the metadata file.

-> MantraM m (Value, TxMetadata, Value)

Action reading the metadata file and returning the JSON, metadata, and value for minting.

Prepare for minting from a JSON file specifying NFTs.