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

Support paying trade fees in bsq or btc in api #4802

Closed

Conversation

ghubstan
Copy link
Member

  • Add optional makerFeeCurrencyCode argument to CLI's createoffer.

  • Add optional takerFeeCurrencyCode argument to CLI's takeoffer.

  • Add isCurrencyForMakerFeeBtc field to OfferInfo proto wrapper.

  • Pass fee currency argument down to CoreOffersService & CoreTradesService's create & take offer methods.

  • Add maybeSetFeePaymentCurrencyPreference method to OfferUtil to conditionally set the payFeeInBtc preference before creating or taking an offer.

  • Adjust tests to assert create & take offer fee currencies are correct.

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

PR #4801 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).
All the boilerplate for this method is included in this change, but
the implementation in CoreWalletsService#sendBsq is commented out
until the needed logic to send bsq is refactored out of desktop's
BsqSendView class -- to be included in the next PR.

- Added new method to CLI.

- Added the gRPC server boilerplate.

- Added the core implementation, commented out.

- Enabled tests.
Moved just enough code out of BsqSendView to avoid desktop/api
'sendbsq' duplication, at the cost of adding 1 new method to
BsqSendView.

- Created new BsqTransferModel to hold tx details shared by desktop and api.

- Created new BsqTransferService to send bsq using a BsqTransferModel shared
  by desktop and api.

- Uncommented CoreWalletsService#sendBsq implementation.

- Uncommented sendbsq tests.
- Add optional makerFeeCurrencyCode argument to CLI's 'createoffer'.

- Add optional takerFeeCurrencyCode argument to CLI's 'takeoffer'.

- Add isCurrencyForMakerFeeBtc field to OfferInfo proto wrapper.

- Pass fee currency argument down to CoreOffersService and CoreTradesService's
  create and take offer methods.

- Add maybeSetFeePaymentCurrencyPreference method to OfferUtil to
  conditionally set the 'payFeeInBtc' preference before creating
  or taking an offer.

- Adjust affected tests.
@ghubstan
Copy link
Member Author

Force travis-cl build due to jar download problem.

@ghubstan ghubstan closed this Nov 13, 2020
Ship Bisq Daemon and API automation moved this from In progress to Done Nov 13, 2020
@ghubstan ghubstan reopened this Nov 13, 2020
Ship Bisq Daemon and API automation moved this from Done to In progress Nov 13, 2020
Restore BsqSendView to version @ commit 48a515b.
Author: jmacxx
Date:   Tue Nov 10 19:35:31 2020 -0600

    Add encrypted wallet password prompt when sending funds from BSQ wallet

    Correct wording of transaction confirmation popup to use 'mining fee'
    instead of 'transaction fee' to make it consistent with wording of
    the BTC confirmation popup.
@ghubstan
Copy link
Member Author

Backing out the changes made to BsqSendView in commit 446bd32 does not affect the sendbsq functionality in the api or desktop, but the small bit of duplication resulting from this single file revert should be removed in a later 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

@ghubstan
Copy link
Member Author

ghubstan commented Dec 3, 2020

This PR is being closed after requested changes were committed in a the final, downstream PR (#4858) in this chain.

Merging of the final PR in the chain implies approval and merging of this PR.

@ghubstan ghubstan closed this Dec 3, 2020
Ship Bisq Daemon and API automation moved this from In progress to Done Dec 3, 2020
@ghubstan ghubstan deleted the 10-support-bsq-fee-payment branch December 3, 2020 13:47
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