| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ledger.AddressMap
Description
AddressMaps and functions for working on them.
AddressMaps 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 {}
- type UtxoMap = Map TxOutRef (CardanoTx, TxOut)
- addAddress :: CardanoAddress -> AddressMap -> AddressMap
- addAddresses :: [CardanoAddress] -> AddressMap -> AddressMap
- filterRefs :: (TxOutRef -> (CardanoTx, TxOut) -> Bool) -> AddressMap -> AddressMap
- fundsAt :: CardanoAddress -> Lens' AddressMap UtxoMap
- values :: AddressMap -> Map CardanoAddress Value
- traverseWithKey :: Applicative f => (CardanoAddress -> Map TxOutRef (CardanoTx, TxOut) -> f (Map TxOutRef (CardanoTx, TxOut))) -> AddressMap -> f AddressMap
- singleton :: (CardanoAddress, TxOutRef, CardanoTx, TxOut) -> AddressMap
- fromTxOutputs :: OnChainTx -> AddressMap
- knownAddresses :: AddressMap -> Map TxOutRef CardanoAddress
- updateAddresses :: OnChainTx -> AddressMap -> AddressMap
- updateAllAddresses :: OnChainTx -> AddressMap -> AddressMap
- restrict :: AddressMap -> Set CardanoAddress -> AddressMap
- addressesTouched :: AddressMap -> OnChainTx -> Set CardanoAddress
- outRefMap :: AddressMap -> Map TxOutRef (CardanoTx, TxOut)
- outputsMapFromTxForAddress :: CardanoAddress -> OnChainTx -> Map TxOutRef (CardanoTx, TxOut)
- fromChain :: Blockchain -> AddressMap
Documentation
newtype AddressMap Source #
A map of Addresses and their unspent outputs.
Constructors
| AddressMap | |
Fields | |
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 Addresses with no unspent outputs to the map.
filterRefs :: (TxOutRef -> (CardanoTx, TxOut) -> Bool) -> AddressMap -> AddressMap Source #
Filter the transaction output references in 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 TxOutRef (CardanoTx, TxOut) -> f (Map TxOutRef (CardanoTx, TxOut))) -> AddressMap -> f AddressMap Source #
Walk through the address map, applying an effectful function to each entry.
singleton :: (CardanoAddress, TxOutRef, CardanoTx, TxOut) -> AddressMap Source #
An address map with a single unspent transaction output.
fromTxOutputs :: OnChainTx -> AddressMap Source #
Create an AddressMap with the unspent outputs of a single transaction.
knownAddresses :: AddressMap -> Map TxOutRef CardanoAddress Source #
Create a map of unspent transaction outputs to their addresses (the
"inverse" of an AddressMap, without the values)
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.
restrict :: AddressMap -> Set CardanoAddress -> AddressMap Source #
Restrict an AddressMap to a set of addresses.
addressesTouched :: AddressMap -> OnChainTx -> Set CardanoAddress Source #
Get the set of all addresses that the transaction spends outputs from or produces outputs to
outputsMapFromTxForAddress :: CardanoAddress -> OnChainTx -> Map TxOutRef (CardanoTx, TxOut) Source #
fromChain :: Blockchain -> AddressMap Source #
The unspent transaction outputs of the ledger as a whole.