Skip to content

Commit

Permalink
Merge pull request #1862 from input-output-hk/KtorZ/available-balance…
Browse files Browse the repository at this point in the history
…-rework

remove rewards from the available balance
  • Loading branch information
KtorZ authored Jul 6, 2020
2 parents d5919e4 + c59e19c commit dfd32b3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,7 @@ spec = do
verify r
[ expectField (#balance . #getApiT . #reward) (.> (Quantity 0))
]
let Quantity totalBalance =
getFromResponse (#balance . #getApiT . #total) r
let Quantity rewardBalance =
getFromResponse (#balance . #getApiT . #reward) r
pure $ Quantity (totalBalance - rewardBalance)
pure $ getFromResponse (#balance . #getApiT . #available) r

-- Use rewards
addrs <- listAddresses @n ctx w
Expand Down
2 changes: 1 addition & 1 deletion lib/core/src/Cardano/Wallet/Api/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ mkShelleyWallet ctx wid cp meta pending progress = do
pure ApiWallet
{ addressPoolGap = ApiT $ getState cp ^. #externalPool . #gap
, balance = ApiT $ WalletBalance
{ available = Quantity $ reward + availableBalance pending cp
{ available = Quantity $ availableBalance pending cp
, total = Quantity $ reward + totalBalance pending cp
, reward = Quantity reward
}
Expand Down
4 changes: 2 additions & 2 deletions specifications/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -341,13 +341,13 @@ x-walletBalance: &walletBalance
properties:
available:
<<: *amount
description: Available balance (funds that can be spent)
description: Available UTxO balance (funds that can be spent without condition).
reward:
<<: *amount
description: The balance of the reward account for this wallet.
total:
<<: *amount
description: Total balance (available balance plus pending change)
description: Total balance (available balance plus pending change and reward balance).

x-byronWalletBalance: &byronWalletBalance
description: Byron wallet's current balance(s)
Expand Down

0 comments on commit dfd32b3

Please sign in to comment.