[bisq-network/bisq] Refactor getbalance api (#4808)
Stan
notifications at github.com
Sat Nov 14 17:25:54 CET 2020
This change fixes the recently bloated wallet balances api. Now there is one CLI `getbalance [bsq|btc]` method that calls a getbalances(currency-code) on the server. The server returns full wallet balance information for BSQ, BTC, or both if the CLI's currency argument is absent.
- `grpc.proto`: Reduced number of getbalance(s) proto services from four to one.
- `GrpcWalletsService`: Reduced number of getbalance(s) gRPC service boilerplate methods from four to one.
- `CoreApi, CoreWalletsService`: Reduced number of getbalance(s) gRPC service implementation methods from four to one.
- `CliMain`: Reduced number of getbalance(s) commands from four to one.
- `BalancesInfo`: Changed `BsqBalanceInfo` & `BtcBalanceInfo` field names to `bsq` and `btc`, respectively, to make calling their accessors more readable, less verbose.
- `BtcBalanceInfo, BsqBalanceInfo`: Defined `static final EMPTY` instances as place holders in a `BalancesInfo` returned by the gRPC server, when one or the other balance types is not requested. Would be nice to serve `Optional.empty()` instead, but protobuf does not support it or null.
- Adjusted affected api tests and build doc.
This is the 12th in a chain of PRs beginning with https://github.com/bisq-network/bisq/pull/4793.
PR https://github.com/bisq-network/bisq/pull/4803 should be reviewed before this one.
You can view, comment on, or merge this pull request online at:
https://github.com/bisq-network/bisq/pull/4808
-- Commit Summary --
* Define new grpc bsq/btc balances protos
* Add proto wrappers for serving bsq, btc or all balances
* Define proto for api method 'getunusedbsqaddress'
* Define proto fapi method 'sendbsq'
* Add proto fields to support trade fee currency choice
* Implement and test api method 'getunusedbsqaddress'
* Add teardown to test case
* Remove trailing spaces in blank line
* Implement and test new getbalance(s) api methods
* Resolve unnecessary use of fully qualified name for codacy
* Stub out api method 'sendbsq' in core
* Re comment sendbsq tests so travis ci does not fail
* Refactor desktop's BsqSendView, share with api
* Resolve 'Avoid creating BigDecimal with a decimal' issue for codacy
* Support paying trade fees in bsq or btc (api)
* Delete deprecated api test, adjust api build/run doc
* Refactor api getbalance methods.
* Fix typo
-- File Changes --
M apitest/docs/build-run.md (2)
D apitest/src/test/java/bisq/apitest/method/GetBalanceTest.java (73)
M apitest/src/test/java/bisq/apitest/method/MethodTest.java (59)
M apitest/src/test/java/bisq/apitest/method/offer/AbstractOfferTest.java (24)
M apitest/src/test/java/bisq/apitest/method/offer/CancelOfferTest.java (1)
M apitest/src/test/java/bisq/apitest/method/offer/CreateOfferUsingFixedPriceTest.java (11)
M apitest/src/test/java/bisq/apitest/method/offer/CreateOfferUsingMarketPriceMarginTest.java (14)
M apitest/src/test/java/bisq/apitest/method/offer/ValidateCreateOfferTest.java (1)
M apitest/src/test/java/bisq/apitest/method/trade/AbstractTradeTest.java (20)
M apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferTest.java (18)
M apitest/src/test/java/bisq/apitest/method/trade/TakeSellBTCOfferTest.java (18)
A apitest/src/test/java/bisq/apitest/method/wallet/BsqWalletTest.java (244)
A apitest/src/test/java/bisq/apitest/method/wallet/BtcWalletTest.java (107)
R apitest/src/test/java/bisq/apitest/method/wallet/WalletProtectionTest.java (22)
D apitest/src/test/java/bisq/apitest/scenario/FundWalletScenarioTest.java (76)
M apitest/src/test/java/bisq/apitest/scenario/WalletTest.java (50)
M cli/src/main/java/bisq/cli/CliMain.java (82)
M cli/src/main/java/bisq/cli/ColumnHeaderConstants.java (13)
M cli/src/main/java/bisq/cli/CurrencyFormat.java (9)
M cli/src/main/java/bisq/cli/TableFormat.java (76)
M core/src/main/java/bisq/core/api/CoreApi.java (20)
M core/src/main/java/bisq/core/api/CoreOffersService.java (8)
M core/src/main/java/bisq/core/api/CoreTradesService.java (8)
M core/src/main/java/bisq/core/api/CoreWalletsService.java (133)
A core/src/main/java/bisq/core/api/model/BalancesInfo.java (45)
A core/src/main/java/bisq/core/api/model/BsqBalanceInfo.java (94)
A core/src/main/java/bisq/core/api/model/BtcBalanceInfo.java (75)
M core/src/main/java/bisq/core/api/model/OfferInfo.java (10)
A core/src/main/java/bisq/core/btc/model/BsqTransferModel.java (77)
A core/src/main/java/bisq/core/btc/wallet/BsqTransferService.java (59)
M core/src/main/java/bisq/core/offer/OfferUtil.java (18)
M daemon/src/main/java/bisq/daemon/grpc/GrpcOffersService.java (1)
M daemon/src/main/java/bisq/daemon/grpc/GrpcTradesService.java (1)
M daemon/src/main/java/bisq/daemon/grpc/GrpcWalletsService.java (75)
M desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java (41)
M proto/src/main/proto/grpc.proto (69)
-- Patch Links --
https://github.com/bisq-network/bisq/pull/4808.patch
https://github.com/bisq-network/bisq/pull/4808.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/4808
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20201114/5ed8548b/attachment-0001.html>
More information about the bisq-github
mailing list