plutus-ledger-0.1.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

ToJSON AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

FromJSON AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

Ixed AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

At AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

Serialise AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

type Rep AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

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

Defined in Ledger.AddressMap

type IxValue AddressMap Source # 
Instance details

Defined in Ledger.AddressMap

addAddress :: Address -> AddressMap -> AddressMap Source #

Add an address with no unspent outputs to a map. If the address already exists, do nothing.

addAddresses :: [Address] -> AddressMap -> AddressMap Source #

Add a list of Addresses with no unspent outputs to the map.

filterRefs :: (TxOutRef -> TxOutTx -> Bool) -> AddressMap -> AddressMap Source #

Filter the transaction output references in the map

fundsAt :: Address -> Lens' AddressMap UtxoMap Source #

Get the funds available at a particular address.

values :: AddressMap -> Map Address Value Source #

The total value of unspent outputs (which the map knows about) at an address.

traverseWithKey :: Applicative f => (Address -> Map TxOutRef TxOutTx -> f (Map TxOutRef TxOutTx)) -> AddressMap -> f AddressMap Source #

Walk through the address map, applying an effectful function to each entry.

singleton :: (Address, TxOutRef, Tx, 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 Address 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 Address -> AddressMap Source #

Restrict an AddressMap to a set of addresses.

addressesTouched :: AddressMap -> OnChainTx -> Set Address Source #

Get the set of all addresses that the transaction spends outputs from or produces outputs to

fromChain :: Blockchain -> AddressMap Source #

The unspent transaction outputs of the ledger as a whole.