plutus-ledger-1.2.0.0: Wallet API
Safe HaskellNone
LanguageHaskell2010

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

Documentation

newtype AddressMap Source #

A map of Addresses and their unspent outputs.

Constructors

AddressMap 

Instances

Instances details
Eq AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

Show AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

Generic AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

Associated Types

type Rep AddressMap :: Type -> Type Source #

Semigroup AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

Monoid AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

Serialise AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

Methods

encode :: AddressMap -> Encoding

decode :: Decoder s AddressMap

encodeList :: [AddressMap] -> Encoding

decodeList :: Decoder s [AddressMap]

FromJSON AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

Methods

parseJSON :: Value -> Parser AddressMap

parseJSONList :: Value -> Parser [AddressMap]

ToJSON AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

Methods

toJSON :: AddressMap -> Value

toEncoding :: AddressMap -> Encoding

toJSONList :: [AddressMap] -> Value

toEncodingList :: [AddressMap] -> Encoding

At AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

Methods

at :: Index AddressMap -> Lens' AddressMap (Maybe (IxValue AddressMap))

Ixed AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

Methods

ix :: Index AddressMap -> Traversal' AddressMap (IxValue AddressMap)

type Rep AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

type Rep AddressMap = D1 ('MetaData "AddressMap" "Ledger.AddressMap" "plutus-ledger-1.2.0.0-8dOSOspdVv7Hd909lHBnfn" 'True) (C1 ('MetaCons "AddressMap" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAddressMap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map CardanoAddress UtxoMap))))
type Index AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

type IxValue AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

type IxValue AddressMap = Map TxIn (CardanoTx, TxOut)

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.

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.