[bisq-network/bisq] Refactor BtcWalletService to add tx-fee-rate param to 'sendbsq' (#4867)

Stan notifications at github.com
Mon Nov 30 17:28:09 CET 2020


This change gives an API user the option to transfer bsq with a one off tx fee rate, overriding both the network `FeeService`'s tx fee rate, and the user preference set in the UI or API.  

Use of this optional `sendbsq` param does not alter any preferences, nor does its existence affect the functionality of the UI.

- Refactored `BtcWalletService`.

	Renamed `completePreparedSendBsqTx` -> `completePreparedBsqTx`.

	Removed the `isSendTx` parmater in `completePreparedBsqTx(Transaction preparedBsqTx, boolean isSendTx)`,

	Overloaded `Transaction completePreparedBsqTx` to make it possible for the api to override the `txFeePerVbyte` via the `sendbsq` command, instead of having to set preferences. (Added new `txFeePerVbyte` param.)
		
- Adjusted `BsqSendView`, `UnlockTxService` and `LockupTxService` to the refactored `BtcWalletService`.  (Removed redundant params, used new method name.)

- Added `txFeePerVbyte` param to `BsqTransferService#getBsqTransferModel` signature.

- Adjusted `GrpcWalletsService`, `CoreApi`, `CoreWalletsService`, `BsqTransferService` to allow `txFeePerVbyte` override via `sendbsq` api method, and wrap a `TxInfo` in the gRPC response.

- Aded new `SendBsqRequest` gRPC param: `txFeeRate`.

- Added `SendBsqReply` gRPC return value: `TxInfo`.
  
- Added new `Transactions` section to `grpc.proto`, moved existing `TxFeeRateInfo` message def into it, and added new `TxInfo` message def.

- Added new `TxInfo` proto wrapper, now returned to CLI from api's `sendbsq`.

- Adjusted CLI for new `sendbsq` param and `TxInfo` return value.

- Adjusted affected tests.
  
This is the 22st in a chain of PRs beginning with https://github.com/bisq-network/bisq/pull/4793.  

PR https://github.com/bisq-network/bisq/pull/4858 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/4867

-- 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
  * Remove unnecessary fully qualified name
  * Remove unused imports
  * Add api method 'getpaymentmethods'
  * Avoid codacy issue over use of fully qualified name
  * Revert "Avoid codacy issue over use of fully qualified name"
  * Print the payment method id (only)
  * Avoid codacy issue over use of fully qualified name
  * Make codacy happy again
  * Add ReflectionUtils to common.util pkg
  * Add new (gson) PaymentAccountTypeAdapter to core.api.model
  * Add isCountryBasedPaymentAccount to abstract PaymentAccount
  * Add new PaymentAccountForm to core.api.model
  * Add boilerplate for new 'getpaymentacctform' api method
  * Add new api method 'getpaymentacctform' to CLI
  * Test new api method 'getpaymentacctform'
  * Ensure EXPECTED_FORM.clear() is never skipped
  * Replace existing api method 'createpaymentacct' impl
  * Avoid 'unnecessary use of fully qualified name' codacy issue
  * Tidy up payment accts api related msgs on CLI
  * Fix createpaymentacct validation problems
  * Log server stack traces, pass concise err msgs to CLI
  * Add create payment account (api) tests
  * Reverse argument order for assert(expected, actual) convention
  * Add isMoneyGramAccount to abstract PaymentAccount
  * Refactor didReadCountryField to set country on MoneyGram acct
  * Enable CreateMoneyGramAccount test
  * Fix broken tests
  * Add two new api method tests
  * Fix getbalance out bug in CLI
  * Print 'no offers found' msg in CLI if list is empty
  * Fix minor error & help msg bugs
  * Resolve BsqSendView file conflict
  * Remove deprecated method long getAvailableBalance
  * Add missing newlines to console output statements
  * Implement fromProto
  * Merge branch 'master' into 20-pr-change-requests-A
  * Adjust to changed CoinUtil
  * Adjust test for a new payment method
  * Add protobuf defs for gettxfeerate, settxfeerate, unsettxfeerate
  * Add protbuf TxFeeRateInfo
  * Add TxFeeRateInfo proto wrapper
  * Add gettxfeerate, settxfeerate, unsettxfeerate implementations
  * Test new tx fee rate api methods
  * Remove unnecessary use of fully qualified name for codacy
  * Refactor BtcWalletService to add tx-fee-rate param to 'sendbsq'
  * Remove debugging log statements
  * Merge branch 'master' into 22-refactor-btcwalletservice-override-feerate

-- File Changes --

    M apitest/docs/build-run.md (2)
    M apitest/scripts/mainnet-test.sh (20)
    D apitest/src/test/java/bisq/apitest/method/CreatePaymentAccountTest.java (99)
    D apitest/src/test/java/bisq/apitest/method/GetBalanceTest.java (73)
    M apitest/src/test/java/bisq/apitest/method/MethodTest.java (171)
    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)
    A apitest/src/test/java/bisq/apitest/method/payment/AbstractPaymentAccountTest.java (196)
    A apitest/src/test/java/bisq/apitest/method/payment/CreatePaymentAccountTest.java (839)
    A apitest/src/test/java/bisq/apitest/method/payment/GetPaymentMethodsTest.java (53)
    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 (259)
    A apitest/src/test/java/bisq/apitest/method/wallet/BtcTxFeeRateTest.java (77)
    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)
    A apitest/src/test/java/bisq/apitest/scenario/PaymentAccountTest.java (90)
    M apitest/src/test/java/bisq/apitest/scenario/StartupTest.java (8)
    M apitest/src/test/java/bisq/apitest/scenario/WalletTest.java (67)
    M cli/src/main/java/bisq/cli/CliMain.java (278)
    M cli/src/main/java/bisq/cli/ColumnHeaderConstants.java (13)
    M cli/src/main/java/bisq/cli/CurrencyFormat.java (34)
    M cli/src/main/java/bisq/cli/TableFormat.java (76)
    A common/src/main/java/bisq/common/util/ReflectionUtils.java (108)
    M core/src/main/java/bisq/core/api/CoreApi.java (53)
    M core/src/main/java/bisq/core/api/CoreOffersService.java (8)
    M core/src/main/java/bisq/core/api/CorePaymentAccountsService.java (110)
    M core/src/main/java/bisq/core/api/CoreTradesService.java (8)
    M core/src/main/java/bisq/core/api/CoreWalletsService.java (181)
    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 (33)
    A core/src/main/java/bisq/core/api/model/PaymentAccountForm.java (242)
    A core/src/main/java/bisq/core/api/model/PaymentAccountTypeAdapter.java (347)
    A core/src/main/java/bisq/core/api/model/TxFeeRateInfo.java (61)
    A core/src/main/java/bisq/core/api/model/TxInfo.java (84)
    A core/src/main/java/bisq/core/btc/model/BsqTransferModel.java (77)
    A core/src/main/java/bisq/core/btc/wallet/BsqTransferService.java (62)
    M core/src/main/java/bisq/core/btc/wallet/BtcWalletService.java (46)
    M core/src/main/java/bisq/core/dao/governance/bond/lockup/LockupTxService.java (2)
    M core/src/main/java/bisq/core/dao/governance/bond/unlock/UnlockTxService.java (2)
    M core/src/main/java/bisq/core/offer/OfferUtil.java (18)
    M core/src/main/java/bisq/core/payment/PaymentAccount.java (8)
    M daemon/src/main/java/bisq/daemon/grpc/GrpcOffersService.java (1)
    M daemon/src/main/java/bisq/daemon/grpc/GrpcPaymentAccountsService.java (97)
    M daemon/src/main/java/bisq/daemon/grpc/GrpcTradesService.java (1)
    M daemon/src/main/java/bisq/daemon/grpc/GrpcWalletsService.java (140)
    M desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java (4)
    M proto/src/main/proto/grpc.proto (142)

-- Patch Links --

https://github.com/bisq-network/bisq/pull/4867.patch
https://github.com/bisq-network/bisq/pull/4867.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/4867
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20201130/bb783f77/attachment-0001.htm>


More information about the bisq-github mailing list