diff --git a/lib/core/src/Cardano/Wallet.hs b/lib/core/src/Cardano/Wallet.hs index 66cb7320bb9..fe75849e39c 100644 --- a/lib/core/src/Cardano/Wallet.hs +++ b/lib/core/src/Cardano/Wallet.hs @@ -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 diff --git a/lib/core/src/Cardano/Wallet/Api/Server.hs b/lib/core/src/Cardano/Wallet/Api/Server.hs index 446e2b761cf..90d495f1fcf 100644 --- a/lib/core/src/Cardano/Wallet/Api/Server.hs +++ b/lib/core/src/Cardano/Wallet/Api/Server.hs @@ -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 (..) @@ -2167,7 +2167,7 @@ listStakeKeys lookupStakeRef ctx (ApiT wid) = do liftIO $ listStakeKeys' @n utxo lookupStakeRef - (fetchAccountBalances nl) + (fetchRewardAccountBalances nl) ourKeys where nl = ctx ^. networkLayer diff --git a/lib/core/src/Cardano/Wallet/Network.hs b/lib/core/src/Cardano/Wallet/Network.hs index e93e9b9ce4d..8df7cd1e9ac 100644 --- a/lib/core/src/Cardano/Wallet/Network.hs +++ b/lib/core/src/Cardano/Wallet/Network.hs @@ -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. @@ -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 diff --git a/lib/core/test/shared/Cardano/Wallet/DummyTarget/Primitive/Types.hs b/lib/core/test/shared/Cardano/Wallet/DummyTarget/Primitive/Types.hs index de00e0a928d..6daf56c9470 100644 --- a/lib/core/test/shared/Cardano/Wallet/DummyTarget/Primitive/Types.hs +++ b/lib/core/test/shared/Cardano/Wallet/DummyTarget/Primitive/Types.hs @@ -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" } diff --git a/lib/shelley/src/Cardano/Wallet/Shelley/Network.hs b/lib/shelley/src/Cardano/Wallet/Shelley/Network.hs index 5ebee4418f4..0613d7b87ef 100644 --- a/lib/shelley/src/Cardano/Wallet/Shelley/Network.hs +++ b/lib/shelley/src/Cardano/Wallet/Shelley/Network.hs @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 ] @@ -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