Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type CreateAndStore m era = Lovelace -> (TxOut CtxTx era, TxIx -> TxId -> m ())
- type CreateAndStoreList m era split = split -> ([TxOut CtxTx era], TxId -> m ())
- genTx :: forall era. IsShelleyBasedEra era => ShelleyBasedEra era -> LedgerProtocolParameters era -> (TxInsCollateral era, [Fund]) -> TxFee era -> TxMetadataInEra era -> TxGenerator era
- sourceToStoreTransaction :: Monad m => TxGenerator era -> FundSource m -> ([Lovelace] -> split) -> ToUTxOList era split -> FundToStoreList m -> m (Either TxGenError (Tx era))
- sourceToStoreTransactionNew :: Monad m => TxGenerator era -> FundSource m -> ([Lovelace] -> split) -> CreateAndStoreList m era split -> m (Either TxGenError (Tx era))
- sourceTransactionPreview :: TxGenerator era -> [Fund] -> ([Lovelace] -> split) -> CreateAndStoreList m era split -> Either TxGenError (Tx era)
- txSizeInBytes :: forall era. IsShelleyBasedEra era => Tx era -> Int
Documentation
type CreateAndStore m era = Lovelace -> (TxOut CtxTx era, TxIx -> TxId -> m ()) Source #
CreateAndStore
is meant to represent building a transaction
from a single number and presenting a function to carry out the
needed side effects.
This type alias is only used in Cardano.Benchmarking.Wallet.
type CreateAndStoreList m era split = split -> ([TxOut CtxTx era], TxId -> m ()) Source #
CreateAndStoreList
is meant to represent building a transaction
and presenting a function to carry out the needed side effects.
This type alias is also only used in Cardano.Benchmarking.Wallet.
The split
parameter seems to actualy be used for not much more
than lists and records containing lists.
genTx :: forall era. IsShelleyBasedEra era => ShelleyBasedEra era -> LedgerProtocolParameters era -> (TxInsCollateral era, [Fund]) -> TxFee era -> TxMetadataInEra era -> TxGenerator era Source #
genTx
seems to mostly be a wrapper for
createAndValidateTransactionBody
, which uses
the Either
convention in lieu of e.g.
ExceptT
. Then the pure function
makeSignedTransaction
is composed with it and
the Error
is lifted to TxGenError
as an ApiError
case.
The txGenerator
arguments of the rest of the functions in this
module are all partial applications of this to its first 5 arguments.
The 7th argument comes from TxGenerator
being a being a type alias
for a function type -- of two arguments.
sourceToStoreTransaction :: Monad m => TxGenerator era -> FundSource m -> ([Lovelace] -> split) -> ToUTxOList era split -> FundToStoreList m -> m (Either TxGenError (Tx era)) Source #
sourceToStoreTransaction
builds a transaction out of several
arguments. Cardano.Benchmarking.Script.PureExample is the sole caller.
txGenerator
is just genTx
partially applied in all uses of all
these functions.
inputFunds
for this is a list of Lovelace
with some extra
fields to throw away and coproducts maintaining distinctions that
don't matter to these functions.
The inToOut
argument seems to just sum and subtract the fee in
seemingly all callers.
mkTxOut
gets built from functions in Cardano.TxGenerator.UTxO.
The other functions take CreateAndStoreList
arguments and name
them valueSplitter
and callers construct the argument from the
mangling functions in 'Cardano.TxGenerator.Utils".
fundToStore
commits the single-threaded fund state in its sole
caller with put
, using a State
monad.
sourceToStoreTransactionNew :: Monad m => TxGenerator era -> FundSource m -> ([Lovelace] -> split) -> CreateAndStoreList m era split -> m (Either TxGenError (Tx era)) Source #
sourceToStoreTransactionNew
builds a new transaction out of
several things. evalGenerator
in Cardano.Benchmarking.Script.Core is the sole caller.
txGenerator
is just genTx
partially applied in every use.
inputFunds
for this is a list of Lovelace
with some extra
fields to throw away and coproducts maintaining distinctions that
don't matter to these functions.
valueSplitter
is just includeChange
or
inputsToOutputsWithFee
at every use,
which just sum the inputs and subtract the fee.
toStore
is just a partial application of either
mangleWithChange
or mangle
at every use.
sourceTransactionPreview :: TxGenerator era -> [Fund] -> ([Lovelace] -> split) -> CreateAndStoreList m era split -> Either TxGenError (Tx era) Source #
sourceTransactionPreview
is only used at one point in
evalGenerator
within
Cardano.Benchmarking.Script.Core to generate a hopefully pure
transaction to examine.
This only constructs a preview of a transaction not intended
to be submitted. Funds remain unchanged by dint of a different
method of wallet access.
txGenerator
is the same genTx
partial application passed
to other functions here.
inputFunds
for this is a list of Lovelace
with some extra
fields to throw away and coproducts maintaining distinctions that
don't matter to these functions. This is the only argument that
differs -- from sourceToStoreTransactionNew
, being drawn from
a use of walletPreview
.
valueSplitter
is just
inputsToOutputsWithFee
at the sole use, with the same variable for monad lifting
etc. as the other companion functions.
toStore
is just a partial application of
mangle
at the sole use, with the
same expression involving the same function returned as a
product of createAndStore
as the
nearby invocation of sourceToStoreTransactionNew
in
Cardano.Benchmarking.Script.Core.
txSizeInBytes :: forall era. IsShelleyBasedEra era => Tx era -> Int Source #