Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Beyond the basic wallet functions, there are some functions
manipulating the FundQueue
held in a WalletRef
by side
effect, like createAndStore
and mangle
.
Synopsis
- type WalletRef = MVar FundQueue
- type TxStream m era = Stream (Of (Either TxGenError (Tx era))) m ()
- createAndStore :: ToUTxO era -> (Fund -> m ()) -> CreateAndStore m era
- initWallet :: IO WalletRef
- askWalletRef :: WalletRef -> (FundQueue -> a) -> IO a
- walletRefInsertFund :: WalletRef -> Fund -> IO ()
- mkWalletFundStoreList :: WalletRef -> FundToStoreList IO
- mkWalletFundStore :: WalletRef -> FundToStore IO
- walletSource :: WalletRef -> Int -> FundSource IO
- walletPreview :: WalletRef -> Int -> IO [Fund]
- mangleWithChange :: Monad m => CreateAndStore m era -> CreateAndStore m era -> CreateAndStoreList m era PayWithChange
- mangle :: Monad m => [CreateAndStore m era] -> CreateAndStoreList m era [Lovelace]
Documentation
type WalletRef = MVar FundQueue Source #
All the actual functionality of Wallet / WalletRef has been removed and WalletRef has been stripped down to MVar FundQueue. The implementation of Wallet has become trivial. Todo: Remove trivial wrapper functions.
type TxStream m era = Stream (Of (Either TxGenError (Tx era))) m () Source #
'ToUTxOList era' is more powerful than '[ ToUTxO era ]' but
'[ ToUTxO era ]` is easier to construct.
There is also a thought that a MonadError
might fit here, but that's a deprecated interface relative to
ExceptT
:
type TxStream m era = Stream (Of (Tx era)) m (Maybe TxGenError)
createAndStore :: ToUTxO era -> (Fund -> m ()) -> CreateAndStore m era Source #
createAndStore
hides its 3rd argument in the CreateAndStore
type alias. The sole uses are in Cardano.Benchmarking.Script.Core,
in interpretPayMode
. The 2nd
store
argument is always passed as mkWalletFundStore
applied
to a WalletRef
.
initWallet :: IO WalletRef Source #
This creates a new MVar
with an emptyFundQueue
vs. truly
initializing a preexisting WalletRef
.
askWalletRef :: WalletRef -> (FundQueue -> a) -> IO a Source #
This reads an MVar
and applies a function to the copied content.
walletRefInsertFund :: WalletRef -> Fund -> IO () Source #
This does an insertion into the MVar
contents.
mkWalletFundStoreList :: WalletRef -> FundToStoreList IO Source #
mkWalletFundStoreList
hides its second argument in
FundToStoreList
. This is not used anywhere.
mkWalletFundStore :: WalletRef -> FundToStore IO Source #
mkWalletFundStore
hides its second argument in FundToStore
.
This is only ever called in tandem with createAndStore
in
interpretPayMode
. It's only
ever partially applied to make a function that modifies the
WalletRef
MVar
by side effect.
walletSource :: WalletRef -> Int -> FundSource IO Source #
walletSource
is only ever used in
evalGenerator
to pass
to sourceToStoreTransaction
and
its associated functions.
walletPreview :: WalletRef -> Int -> IO [Fund] Source #
Just a preview of the wallet's funds; wallet remains unmodified.
mangleWithChange :: Monad m => CreateAndStore m era -> CreateAndStore m era -> CreateAndStoreList m era PayWithChange Source #
The second argument to mangleWithChange
is hidden in the
CreateAndStoreList
type. When there is change to be made,
it makes separate transactions to pay the change and sends
them off to mangle
to get zips of applications. This is
only ever used once, in
evalGenerator
for the
Split
case.
zipWith3 (x y z -> second ($ z) (x y))
but relatively obfuscated.
This appears to mostly be list processing and function application.
and is only ever used by
fkts@ argument is evalGenerator
to handle several of the cases of
Generator
, though it's also
indirectly invoked via mangleWithChange
once.
The only caller not passing a constant list built with repeat
as the first mangleWithChange
above. This
is likely worth refactoring for the sake of maintainability.
mangle :: Monad m => [CreateAndStore m era] -> CreateAndStoreList m era [Lovelace] Source #