Skip to content

Commit

Permalink
Add getCustomerHistories
Browse files Browse the repository at this point in the history
  • Loading branch information
HeinrichApfelmus committed Apr 16, 2024
1 parent 6dfef49 commit f6e6591
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/IO.hs
Expand Up @@ -20,6 +20,7 @@ module Cardano.Wallet.Deposit.IO
, getWalletTip
, availableBalance
, getCustomerHistory
, getCustomerHistories

-- ** Writing to the blockchain
, createPayment
Expand Down Expand Up @@ -59,6 +60,7 @@ import qualified Data.Delta as Delta
( Replace (..)
)
import qualified Data.Delta.Update as Delta
import qualified Data.Map as Map
import qualified Data.Store as Store

{-----------------------------------------------------------------------------
Expand Down Expand Up @@ -168,10 +170,17 @@ availableBalance :: WalletInstance -> IO Read.Value
availableBalance w =
Wallet.availableBalance <$> readWalletState w

getCustomerHistory :: WalletInstance -> Customer -> IO [Wallet.TxSummary]
getCustomerHistory w c =
getCustomerHistory :: Customer -> WalletInstance -> IO [Wallet.TxSummary]
getCustomerHistory c w =
Wallet.getCustomerHistory c <$> readWalletState w

getCustomerHistories
:: (Read.ChainPoint, Read.ChainPoint)
-> WalletInstance
-> IO (Map.Map Customer Wallet.ValueTransfer)
getCustomerHistories a w =
Wallet.getCustomerHistories a <$> readWalletState w

rollForward :: WalletInstance -> NonEmpty Read.Block -> tip -> IO ()
rollForward w blocks _nodeTip =
onWalletState w
Expand Down
Expand Up @@ -25,6 +25,7 @@ module Cardano.Wallet.Deposit.Pure
, TxSummary (..)
, ValueTransfer (..)
, getCustomerHistory
, getCustomerHistories

-- ** Writing to the blockchain
, createPayment
Expand Down Expand Up @@ -194,6 +195,12 @@ data ValueTransfer = ValueTransfer
getCustomerHistory :: Customer -> WalletState -> [TxSummary]
getCustomerHistory = undefined

getCustomerHistories
:: (Read.ChainPoint, Read.ChainPoint)
-> WalletState
-> Map Customer ValueTransfer
getCustomerHistories = undefined

{-----------------------------------------------------------------------------
Operations
Writing to blockchain
Expand Down

0 comments on commit f6e6591

Please sign in to comment.