Copyright | © 2022 IOHK |
---|---|
License | Apache-2.0 |
Safe Haskell | None |
Language | Haskell2010 |
Pure data type which represents the entire wallet state, including all checkpoints.
FIXME during ADP-1043: Actually include everything, e.g. TxHistory, Pending transactions, …
Synopsis
-
data
WalletState
s =
WalletState
{
- prologue :: !( Prologue s)
- checkpoints :: !( Checkpoints ( WalletCheckpoint s))
- fromGenesis :: AddressBookIso s => Wallet s -> Maybe ( WalletState s)
- getLatest :: AddressBookIso s => WalletState s -> Wallet s
- findNearestPoint :: WalletState s -> Slot -> Maybe Slot
-
data
WalletCheckpoint
s =
WalletCheckpoint
{
- currentTip :: ! BlockHeader
- utxo :: ! UTxO
- discoveries :: !( Discoveries s)
- toWallet :: AddressBookIso s => Prologue s -> WalletCheckpoint s -> Wallet s
- fromWallet :: AddressBookIso s => Wallet s -> ( Prologue s, WalletCheckpoint s)
- getBlockHeight :: WalletCheckpoint s -> Word32
- getSlot :: WalletCheckpoint s -> Slot
-
data
DeltaWalletState1
s
- = ReplacePrologue ( Prologue s)
- | UpdateCheckpoints ( DeltasCheckpoints ( WalletCheckpoint s))
- type DeltaWalletState s = [ DeltaWalletState1 s]
- data DeltaMap key da
- newtype ErrNoSuchWallet = ErrNoSuchWallet WalletId
- adjustNoSuchWallet :: WalletId -> ( ErrNoSuchWallet -> e) -> (w -> Either e (dw, b)) -> Map WalletId w -> ( Maybe ( DeltaMap WalletId dw), Either e b)
Wallet state
data WalletState s Source #
Wallet state. Currently includes:
- Prologue of the address discovery state
- Checkpoints of UTxO and of discoveries of the address discovery state.
FIXME during ADP-1043: Include also TxHistory, pending transactions, …, everything.
WalletState | |
|
Instances
AddressBookIso s => Eq ( WalletState s) Source # | |
Defined in Cardano.Wallet.DB.WalletState (==) :: WalletState s -> WalletState s -> Bool Source # (/=) :: WalletState s -> WalletState s -> Bool Source # |
|
Generic ( WalletState s) Source # | |
Defined in Cardano.Wallet.DB.WalletState from :: WalletState s -> Rep ( WalletState s) x Source # to :: Rep ( WalletState s) x -> WalletState s Source # |
|
type Rep ( WalletState s) Source # | |
Defined in Cardano.Wallet.DB.WalletState
type
Rep
(
WalletState
s) =
D1
('
MetaData
"WalletState" "Cardano.Wallet.DB.WalletState" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" '
False
) (
C1
('
MetaCons
"WalletState" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"prologue") '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
(
Prologue
s))
:*:
S1
('
MetaSel
('
Just
"checkpoints") '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
(
Checkpoints
(
WalletCheckpoint
s)))))
|
fromGenesis :: AddressBookIso s => Wallet s -> Maybe ( WalletState s) Source #
Create a wallet from the genesis block.
getLatest :: AddressBookIso s => WalletState s -> Wallet s Source #
Get the wallet checkpoint with the largest slot number
findNearestPoint :: WalletState s -> Slot -> Maybe Slot Source #
Find the nearest
Checkpoint
that is either at the given point or before.
WalletCheckpoint (internal use mostly)
data WalletCheckpoint s Source #
Data stored in a single checkpoint.
Only includes the
UTxO
and the
Discoveries
, but not the
Prologue
.
WalletCheckpoint | |
|
Instances
toWallet :: AddressBookIso s => Prologue s -> WalletCheckpoint s -> Wallet s Source #
Convert a stored
WalletCheckpoint
to the legacy
Wallet
state.
fromWallet :: AddressBookIso s => Wallet s -> ( Prologue s, WalletCheckpoint s) Source #
Convert a legacy
Wallet
state to a
Prologue
and a
WalletCheckpoint
getBlockHeight :: WalletCheckpoint s -> Word32 Source #
Helper function: Get the block height of a wallet checkpoint.
getSlot :: WalletCheckpoint s -> Slot Source #
Helper function: Get the
Slot
of a wallet checkpoint.
Delta types
data DeltaWalletState1 s Source #
ReplacePrologue ( Prologue s) |
Replace the prologue of the address discovery state |
UpdateCheckpoints ( DeltasCheckpoints ( WalletCheckpoint s)) |
Update the wallet checkpoints. |
Instances
Show ( DeltaWalletState1 s) Source # | |
Defined in Cardano.Wallet.DB.WalletState |
|
Buildable ( DeltaWalletState1 s) Source # | |
Defined in Cardano.Wallet.DB.WalletState build :: DeltaWalletState1 s -> Builder Source # |
|
Delta ( DeltaWalletState1 s) Source # | |
Defined in Cardano.Wallet.DB.WalletState type Base ( DeltaWalletState1 s) Source # apply :: DeltaWalletState1 s -> Base ( DeltaWalletState1 s) -> Base ( DeltaWalletState1 s) Source # |
|
type Base ( DeltaWalletState1 s) Source # | |
Defined in Cardano.Wallet.DB.WalletState |
type DeltaWalletState s = [ DeltaWalletState1 s] Source #
Multiple wallets
Delta type for
Map
.
newtype ErrNoSuchWallet Source #
Can't perform given operation because there's no wallet
Instances
Eq ErrNoSuchWallet Source # | |
Defined in Cardano.Wallet.DB.WalletState (==) :: ErrNoSuchWallet -> ErrNoSuchWallet -> Bool Source # (/=) :: ErrNoSuchWallet -> ErrNoSuchWallet -> Bool Source # |
|
Show ErrNoSuchWallet Source # | |
Defined in Cardano.Wallet.DB.WalletState |
|
IsServerError ErrNoSuchWallet Source # | |
Defined in Cardano.Wallet.Api.Server |
adjustNoSuchWallet :: WalletId -> ( ErrNoSuchWallet -> e) -> (w -> Either e (dw, b)) -> Map WalletId w -> ( Maybe ( DeltaMap WalletId dw), Either e b) Source #
Adjust a specific wallet if it exists or return
ErrNoSuchWallet
.