Safe Haskell | None |
---|---|
Language | Haskell2010 |
AddressMap
s and functions for working on them.
AddressMap
s are used to represent the limited knowledge about the state of the ledger that
the wallet retains. Rather than keeping the entire ledger (which can be very large) the wallet
only tracks the UTxOs at particular addresses.
Synopsis
- newtype AddressMap = AddressMap {
- getAddressMap :: Map CardanoAddress UtxoMap
- type UtxoMap = Map TxIn (CardanoTx, TxOut)
- addAddress :: CardanoAddress -> AddressMap -> AddressMap
- addAddresses :: [CardanoAddress] -> AddressMap -> AddressMap
- fundsAt :: CardanoAddress -> Lens' AddressMap UtxoMap
- values :: AddressMap -> Map CardanoAddress Value
- traverseWithKey :: Applicative f => (CardanoAddress -> Map TxIn (CardanoTx, TxOut) -> f (Map TxIn (CardanoTx, TxOut))) -> AddressMap -> f AddressMap
- singleton :: (CardanoAddress, TxIn, CardanoTx, TxOut) -> AddressMap
- updateAddresses :: OnChainTx -> AddressMap -> AddressMap
- updateAllAddresses :: OnChainTx -> AddressMap -> AddressMap
- lookupOutRef :: TxIn -> AddressMap -> Maybe TxOut
- fromChain :: Blockchain -> AddressMap
Documentation
newtype AddressMap Source #
A map of Address
es and their unspent outputs.
Instances
addAddress :: CardanoAddress -> AddressMap -> AddressMap Source #
Add an address with no unspent outputs to a map. If the address already exists, do nothing.
addAddresses :: [CardanoAddress] -> AddressMap -> AddressMap Source #
Add a list of Address
es with no unspent outputs to the map.
fundsAt :: CardanoAddress -> Lens' AddressMap UtxoMap Source #
Get the funds available at a particular address.
values :: AddressMap -> Map CardanoAddress Value Source #
The total value of unspent outputs (which the map knows about) at an address.
traverseWithKey :: Applicative f => (CardanoAddress -> Map TxIn (CardanoTx, TxOut) -> f (Map TxIn (CardanoTx, TxOut))) -> AddressMap -> f AddressMap Source #
Walk through the address map, applying an effectful function to each entry.
singleton :: (CardanoAddress, TxIn, CardanoTx, TxOut) -> AddressMap Source #
An address map with a single unspent transaction output.
updateAddresses :: OnChainTx -> AddressMap -> AddressMap Source #
Update an AddressMap
with the inputs and outputs of a new
transaction. updateAddresses
does not add or remove any keys from the map.
updateAllAddresses :: OnChainTx -> AddressMap -> AddressMap Source #
Update an AddressMap
with the inputs and outputs of a new
transaction, including all addresses in the transaction.
lookupOutRef :: TxIn -> AddressMap -> Maybe TxOut Source #
Determine the unspent output that an input refers to
fromChain :: Blockchain -> AddressMap Source #
The unspent transaction outputs of the ledger as a whole.