Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement and test new getbalance(s) api methods #4799

Merged
merged 10 commits into from Dec 3, 2020

Conversation

ghubstan
Copy link
Member

@ghubstan ghubstan commented Nov 13, 2020

  • Added three new methods to CLI:

    getbalances returns complete bsq and btc balance info
    getbsqbalance returns complete bsq balance info
    getbtcbalance returns complete btc balance info

    The old getbalance method is deprecated and will be removed if there is agreement to do that.

  • Made the needed changes in the CLI's output formatting classes.

  • Added new tests to existing BsqWalletTest, added new BtcWalletTest and WalletBalancesTest.

  • Added disabled test methods for funding a bsq wallet (todo in next PR).

This is the 7th in a chain of PRs beginning with #4793.

PR #4798 should be reviewed before this one.

This change adds proto serivces and messages to support new api
implementations for serving bsq, btc or all wallet balances.

- RPC GetBsqBalances will return complete BSQ balance info.
- Message BsqBalanceInfo is proto returned by rpc GetBsqBalances.

- RPC GetBtcBalances wil return complete BTC balance info.
- Message BtcBalanceInfo is proto returned by rpc GetBtcBalances.

- RPC GetBalances returns complete BTC and BSQ balance info.
- Message BalancesInfo is proto returned by rpc GetBalances.

RPC GetBalance remains unchnaged, still returns only the available
BTC balance.  It may be deprecated and removed in a future PR.
This change adds proto wrappers for sending bsq, btc, or all balances
to the CLI.  They will be used in future api method implementations:
getbsqbalance, getbtcbalance and getbalances.
This change adds a proto to support a future api implementation for
getting an unused, bsq funding address.
This change adds the proto to support a future api implementation for
transfering bsq.
This change adds proto support for paying maker fees in bsq or btc.
The implementation will come in a future PR.

- Added makerFeeCurrencyCode field to CreateOfferRequest proto.

- Added isCurrencyForMakerFeeBtc field to OfferInfo proto wrapper.

- Add takerFeeCurrencyCode field to TakeOfferRequest proto.
- Added new method to CLI, split some long msg strings into two lines,
  and added a white space after a braceless else statement.

- Added the gRPC server boilerplate.

- Added the core implementation.

- Added a test, and moved method wallet tests into their own package.
- Added three new methods to CLI:

      getbalances   ...	returns complete bsq and btc balance info
      getbsqbalance ...	returns complete bsq balance info
      getbtcbalance ...	returns complete btc balance info

      The old getbalance method is deprecated and will be removed
      if there is agreement to do that.

- Made the needed changes in the CLI's output formatting classes.

- Added new tests to existing BsqWalletTest, added new BtcWalletTest
  and WalletBalancesTest.

- Added disabled tests for funding a bsq wallet (todo in next PR).
Copy link
Member

@sqrrm sqrrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

Will merge after 1.5.0 is merged to master

@Order(4)
public void testBalancesAfterSendingBsqAndGeneratingBtcBlock(final TestInfo testInfo) {
// There is a wallet persist delay; we have to
// wait for both wallets to be saved to disk.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Persistence has had some changes to increase the persist frequency, might not need to wait this long

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've noticed significant improvement while testing the api on top of v1.5.0. I'll be checking what wait times I can reduce in apitest.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I could not reduce that wait time without the test failing. There may be other wait times that can be reduced, like waiting for app startup & shutdown, but not this one.

cli/src/main/java/bisq/cli/CliMain.java Show resolved Hide resolved
@sqrrm sqrrm merged commit 7f0f949 into bisq-network:master Dec 3, 2020
Ship Bisq Daemon and API automation moved this from In progress to Done Dec 3, 2020
@ghubstan ghubstan deleted the 07-getbalances-impls branch December 3, 2020 13:46
@ripcurlx ripcurlx added this to the v1.5.2 milestone Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants