Skip to content

Commit dfd32b3

Browse files
authored
Merge pull request #1862 from input-output-hk/KtorZ/available-balance-rework
remove rewards from the available balance
2 parents d5919e4 + c59e19c commit dfd32b3

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

lib/core-integration/src/Test/Integration/Scenario/API/Shelley/StakePools.hs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,7 @@ spec = do
164164
verify r
165165
[ expectField (#balance . #getApiT . #reward) (.> (Quantity 0))
166166
]
167-
let Quantity totalBalance =
168-
getFromResponse (#balance . #getApiT . #total) r
169-
let Quantity rewardBalance =
170-
getFromResponse (#balance . #getApiT . #reward) r
171-
pure $ Quantity (totalBalance - rewardBalance)
167+
pure $ getFromResponse (#balance . #getApiT . #available) r
172168

173169
-- Use rewards
174170
addrs <- listAddresses @n ctx w

lib/core/src/Cardano/Wallet/Api/Server.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ mkShelleyWallet ctx wid cp meta pending progress = do
613613
pure ApiWallet
614614
{ addressPoolGap = ApiT $ getState cp ^. #externalPool . #gap
615615
, balance = ApiT $ WalletBalance
616-
{ available = Quantity $ reward + availableBalance pending cp
616+
{ available = Quantity $ availableBalance pending cp
617617
, total = Quantity $ reward + totalBalance pending cp
618618
, reward = Quantity reward
619619
}

specifications/api/swagger.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,13 @@ x-walletBalance: &walletBalance
341341
properties:
342342
available:
343343
<<: *amount
344-
description: Available balance (funds that can be spent)
344+
description: Available UTxO balance (funds that can be spent without condition).
345345
reward:
346346
<<: *amount
347347
description: The balance of the reward account for this wallet.
348348
total:
349349
<<: *amount
350-
description: Total balance (available balance plus pending change)
350+
description: Total balance (available balance plus pending change and reward balance).
351351

352352
x-byronWalletBalance: &byronWalletBalance
353353
description: Byron wallet's current balance(s)

0 commit comments

Comments
 (0)