Skip to content

Commit

Permalink
fixup: use {getCached,fetch}RewardAccountBalance(s) naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Anviking committed Jun 8, 2021
1 parent aa41945 commit d81089b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/core/src/Cardano/Wallet.hs
Expand Up @@ -1056,7 +1056,7 @@ queryRewardBalance
-> RewardAccount
-> ExceptT ErrFetchRewards IO Coin
queryRewardBalance ctx acct = do
liftIO $ getCachedAccountBalance nw acct
liftIO $ getCachedRewardAccountBalance nw acct
where
nw = ctx ^. networkLayer

Expand Down
4 changes: 2 additions & 2 deletions lib/core/src/Cardano/Wallet/Api/Server.hs
Expand Up @@ -273,7 +273,7 @@ import Cardano.Wallet.Compat
import Cardano.Wallet.DB
( DBFactory (..) )
import Cardano.Wallet.Network
( NetworkLayer, fetchAccountBalances, timeInterpreter )
( NetworkLayer, fetchRewardAccountBalances, timeInterpreter )
import Cardano.Wallet.Primitive.AddressDerivation
( DelegationAddress (..)
, Depth (..)
Expand Down Expand Up @@ -2167,7 +2167,7 @@ listStakeKeys lookupStakeRef ctx (ApiT wid) = do
liftIO $ listStakeKeys' @n
utxo
lookupStakeRef
(fetchAccountBalances nl)
(fetchRewardAccountBalances nl)
ourKeys
where
nl = ctx ^. networkLayer
Expand Down
4 changes: 2 additions & 2 deletions lib/core/src/Cardano/Wallet/Network.hs
Expand Up @@ -175,7 +175,7 @@ data NetworkLayer m block = NetworkLayer
:: Coin -- Stake to consider for rewards
-> m StakePoolsSummary

, getCachedAccountBalance
, getCachedRewardAccountBalance
:: RewardAccount
-> m Coin
-- ^ Return the cached reward balance of an account.
Expand All @@ -184,7 +184,7 @@ data NetworkLayer m block = NetworkLayer
-- account to the internal set of observed account, such that it will be
-- fetched later.

, fetchAccountBalances
, fetchRewardAccountBalances
:: Set RewardAccount
-> m (Map RewardAccount Coin)
-- ^ Fetch the reward account balance of a set of accounts without
Expand Down
Expand Up @@ -165,8 +165,8 @@ dummyNetworkLayer = NetworkLayer
, currentSlottingParameters = error "currentSlottingParameters: not implemented"
, postTx = error "postTx: not implemented"
, stakeDistribution = error "stakeDistribution: not implemented"
, getCachedAccountBalance = error "getCachedAccountBalance: not implemented"
, fetchAccountBalances = error "fetchAccountBalances: not implemented"
, getCachedRewardAccountBalance = error "getRewardCachedAccountBalance: not implemented"
, fetchRewardAccountBalances = error "fetchRewardAccountBalances: not implemented"
, timeInterpreter = error "timeInterpreter: not implemented"
, syncProgress = error "syncProgress: not implemented"
}
16 changes: 8 additions & 8 deletions lib/shelley/src/Cardano/Wallet/Shelley/Network.hs
Expand Up @@ -355,9 +355,9 @@ withNetworkLayerBase tr np conn (versionData, _) tol action = do
_postTx localTxSubmissionQ era sealed
, stakeDistribution =
_stakeDistribution queryRewardQ
, getCachedAccountBalance =
_getAccountBalance rewardsObserver
, fetchAccountBalances =
, getCachedRewardAccountBalance =
_getCachedAccountBalance rewardsObserver
, fetchRewardAccountBalances =
fetchRewardAccounts tr queryRewardQ
, timeInterpreter =
_timeInterpreter (contramap MsgInterpreterLog tr) interpreterVar
Expand Down Expand Up @@ -547,7 +547,7 @@ withNetworkLayerBase tr np conn (versionData, _) tol action = do

-- TODO(#2042): Make wallets call manually, with matching
-- stopObserving.
_getAccountBalance rewardsObserver k = do
_getCachedRewardAccountBalance rewardsObserver k = do
startObserving rewardsObserver k
fromMaybe (W.Coin 0) <$> query rewardsObserver k

Expand Down Expand Up @@ -866,7 +866,7 @@ fetchRewardAccounts
-> IO (Map W.RewardAccount W.Coin)
fetchRewardAccounts tr queryRewardQ accounts = do
liftIO $ traceWith tr $
MsgGetRewardAccountBalance accounts
MsgFetchRewardAccountBalance accounts

let qry = byronOrShelleyBased (pure (byronValue, [])) $
fmap fromBalanceResult
Expand Down Expand Up @@ -1154,7 +1154,7 @@ data NetworkLayerLog where
MsgProtocolParameters :: W.ProtocolParameters -> W.SlottingParameters -> NetworkLayerLog
MsgLocalStateQueryError :: QueryClientName -> String -> NetworkLayerLog
MsgLocalStateQueryEraMismatch :: MismatchEraInfo (CardanoEras StandardCrypto) -> NetworkLayerLog
MsgGetRewardAccountBalance
MsgFetchRewardAccountBalance
:: Set W.RewardAccount
-> NetworkLayerLog
MsgAccountDelegationAndRewards
Expand Down Expand Up @@ -1234,7 +1234,7 @@ instance ToText NetworkLayerLog where
MsgLocalStateQueryEraMismatch mismatch ->
"Local state query for the wrong era - this is fine. " <>
T.pack (show mismatch)
MsgGetRewardAccountBalance accts -> T.unwords
MsgGetchRewardAccountBalance accts -> T.unwords
[ "Querying the reward account balance for"
, fmt $ listF accts
]
Expand Down Expand Up @@ -1303,7 +1303,7 @@ instance HasSeverityAnnotation NetworkLayerLog where
| isSlowQuery qry dt -> Notice
| otherwise -> Debug
MsgInterpreterLog msg -> getSeverityAnnotation msg
MsgGetRewardAccountBalance{} -> Debug
MsgFetchRewardAccountBalance{} -> Debug
MsgObserverLog (MsgDidChange _) -> Notice
MsgObserverLog{} -> Debug

Expand Down

0 comments on commit d81089b

Please sign in to comment.