Commit Graph

202 Commits

Author SHA1 Message Date
ghubstan
542aa774b0
Fix typo in help text 2021-09-18 12:40:58 -03:00
ghubstan
a0f3d0a44c
Show correct altcoin trade amount (volume) in CLI console
This is a bug fix for the CLI's displayed altcoin trade amount
value, which should be trade.volume, not offer.volume.  It has been
hidden by the stability of the BSQ price, and exposed while testing
API support for XMR trades.
2021-09-17 16:28:07 -03:00
ghubstan
484f882077
Show frozen fiat trade cost in CLI console
This is a bug fix for the CLI's displayed fiat trade cost
value, which should be trade.volume, not offer.volume.  Offer volume
varies with BTC volatility, and the CLI should be showing the trade.volume
value instead, frozen when the contract is made.
2021-09-17 16:25:37 -03:00
ghubstan
71a61c63da
Display Enabled=PENDING in CLI 'createoffer' output
A newly created offer has no OpenOffer+State (AVAILABLE || DEACTIVATED)
when displayed in the CLI's console.  This change adds a 'bool isMyPendingOffer'
to the OfferInfo proto + wrapper, and the CLI's console offer output formatter
uses it to determine if it should display a new offer's Enabled column value
as PENDING, instead of an ambiguous NO value.
2021-08-14 16:58:47 -03:00
ghubstan
649c98a3f0
Always use Locale.US in CLI DecimalFormats
Avoid inconsistent CLI output decimal formats across different
systems' default locales.
2021-07-15 12:43:29 -03:00
ghubstan
eb62f9354a
Rename and move private function
And make sure function is not duplicated CLI side logic.
2021-07-12 11:28:33 -03:00
ghubstan
b74f084893
Optionally show ENABLED column in CLI's getoffer(bsq) output 2021-06-18 17:50:28 -03:00
ghubstan
063b52eb70
Add editoffer test case, suppress annoying warnings 2021-06-15 11:39:06 -03:00
ghubstan
4da64b9bd0
Improve 'editoffer' opt parsing, fix test pkg name 2021-06-15 11:27:23 -03:00
ghubstan
e2a205a31d
Show enable/trigger-price cols for 'getmyoffer' 2021-06-15 11:24:27 -03:00
ghubstan
05f3985447
Fix problems found in codacy check 2021-06-13 13:54:16 -03:00
ghubstan
be249c5e79
Add editoffer to CLI 2021-06-13 12:56:29 -03:00
ghubstan
d2939cc567
Add new EditOfferOptionParser and test 2021-06-13 12:43:02 -03:00
ghubstan
9231e48c43
Refactor GrpcClient: request builders moved bisq.cli.request pkg
Reduces size of GrpcClient while allowing for additional bot-friendly
variations of the new grpc editOffer method.
2021-06-13 12:35:43 -03:00
BtcContributor
a39da12ef6
Fix cli test that blocks building on Windows 2021-04-23 11:16:22 +02:00
ghubstan
2308afb41b
Adjust to changing minimum tx fee rates
- Append minFeeServiceRate to TxFeeRateInfo proto.
- Display min rate in CLI console.
- Fix broken test due to changing min fee rate.
2021-04-19 12:08:52 -03:00
ghubstan
40e76fb4ee
Remove white space in console msg 2021-04-15 14:57:44 -03:00
ghubstan
e96da16df8
Complete API support for BSQ/BTC trade pair
- Finished API server's verify bsq payment impl.
- Added verifybsqsenttoaddress method to CLI.
- Added verifybsqsenttoaddress-help.txt to server.
- Fixed client getoffers, getmyoffers to work with BSQ offers.
2021-04-15 14:21:25 -03:00
ghubstan
bddc273bb2
Fix spelling 2021-04-02 12:58:46 -03:00
ghubstan
6bde12ba40
Improve takeoffer output and failure reason messaging
- Added AvailabilityResultWithDescription proto for better takeoffer failure msgs.
- Added VerifyBsqSentToAddress impl to api, but don't expose to CLI yet.
- Show BSQ Buyer Address in gettrade output (changed cli output formatting classes).
- Fixed api.model.PaymentAccountPayloadInfo altcoin instant acct support bug
2021-04-01 16:40:08 -03:00
ghubstan
6299dc33d9
Merge branch '01-api-add-createcryptopaymentacct' into 02-api-trade-contract-details 2021-04-01 15:58:59 -03:00
ghubstan
58c885efc1
Add support for creating instant altcoin payment accounts in api
- Added bool tradeInstant field to proto message def.
- Adjusted core createcryptopaymentacct impl to new tradeInstant request param.
- Adjusted cli side createcryptopaymentacct impl to new tradeInstant request param.
- Fixed CliMain's takeoffer help text (was missing the --payment-account opt).
2021-04-01 15:43:48 -03:00
ghubstan
aad998cf3a
Fix maker/taker fee format bug, rename methods 2021-03-28 16:42:55 -03:00
ghubstan
9e035e5542
Provide more offer & contract detail available to CLI.
This change adds offer and trade contract detail to the API's Offer
and Trade protos, and improves CLI output formatting.

- Appended missing fields to OfferInfo proto message:
	uint64 sellerSecurityDeposit = 20;
	string offerFeePaymentTxId = 21;
	uint64 txFee = 22;
	uint64 makerFee = 23;

- Added new api proto messages ContractInfo and PaymentAccountPayloadInfo.
  Lighterweight protos are needed because core Trade/Contract classes are
  not visible to CLI.

- Appended ContractInfo field to api proto message TradeInfo.

- Added proto / model converters for ContractInfo and PaymentAccountPayloadInfo,
  and adjusted OfferInfo & TradeInfo.

- Improved CLI output formatting.  Added more trade detail to CLI's gettrade output,
  and prepared to support BTC/BSQ trading pair.  Note a reviewer is advised to
  look at the CLI outout formatting class files instead getting bogged down in the
  many commit changes.
2021-03-25 19:23:06 -03:00
ghubstan
27b090005d
Add cli side help for createcryptopaymentacct 2021-03-25 18:46:41 -03:00
ghubstan
c3f5669cf8
Add api method createcryptopaymentacct
This change supports creation of BSQ BLOCKCHAIN payment method accounts.

- Added proto message defs to grpc.proto.
- Added grpc server boilerplate to GrpcPaymentAccountsService.
- Added server impl to CoreApi, CorePaymentAccountsService.
- Added createcryptopaymentacct-help.txt.
- Added CLI side support for new api method.
- Added opt parsing unit tests to OptionParsersTest.

This is the 1st PR in a series, with the goal of supporting the BTC/BSQ trading
pair.  Support for other crypto currency payment accounts will be added later.
2021-03-25 18:36:26 -03:00
ghubstan
8f092a6b4d
Fix comment, left justify non-numeric column value 2021-03-20 19:08:21 -03:00
ghubstan
8783889c36
Fix api getfundingaddresses bug
This change uses recently added walletService.isAddressUnused to ensure
the api's CoreWalletsService creates an unused address if none exists.

- grpc.proto:  Add bool isAddressUnused field to message AddressBalanceInfo.
- AddressBalanceInfo:  Adjust AddressBalanceInfo proto wrapper.
- CoreWalletsService:  Use walletService.isAddressUnused in getFundingAddresses.
- GrpcClient:  Adjust to modified AddressBalanceInfo.
- TableFormat, ColumnHeaderConstants:  Add 'Is Used' column to getfundingaddresses output.

Note: bugfix is out of scope for this PR, but the test case helped expose this bug.
2021-03-15 16:15:06 -03:00
ghubstan
588541ed15
Add bot convenience: getMyOffersSortedByDate(String currencyCode) 2021-03-15 13:48:32 -03:00
ghubstan
10e721767f
Add convenience (get all offers, both directions), and make sorter public 2021-03-15 13:20:05 -03:00
ghubstan
1d56d79457
Refactor takeoffer reply proto & ErrorMessageHandler
- Add description msg TakeOfferReply proto, and fromProto method
  to core.offer.enum AvailabilityResult.  The description field
  maps a client usable error message to the enum.

- Adjust GrpcErrorMessageHandler to add AvailabilityResult.description()
  to takeoffer reply.

- Refactor (split up) GrpcClient's takeOffer.  Add getTakeOfferReply()
  to give clients a chance to make choices based on the reply's
  AvailabilityResult when the takeoffer command did not result in a
  trade. (Some errors are fatal, some not.)
2021-03-15 11:17:09 -03:00
ghubstan
697cf66d7c
Convert AvailabilityResult to error msg when takeoffer fails 2021-03-10 14:16:43 -03:00
ghubstan
389abf459d
Check valid createoffer opt values with asserts 2021-03-09 10:43:05 -03:00
ghubstan
de59c0a5f9
Assign selected trading currency on new payment accts (api only)
If a new account has a trading currency, assign it as the selected trading currency.

Also fixed a payment acct console formatting issue (left justify the ccy code).
2021-03-08 15:22:28 -03:00
ghubstan
a13ef79e6e
Handle require-arg options missing the = sign
This change ensure a stylistically consistent error message is printed
to the CLI console if an option is present, but without the '=' sign.
2021-03-05 12:28:10 -03:00
ghubstan
9c12b31019
Add new cli option parser test
Does not check every combination of options for every method, but
we finally have an option parser test case to build on.
2021-03-05 07:16:36 -03:00
ghubstan
d01a7b7fee
Improve required-argument opt validation
Make sure non-empty opt values are present in the parsers' custom
validation, or jsimpleopt will throw exceptions with stylistically
inconsisent messages.
2021-03-05 07:10:42 -03:00
ghubstan
62ff79d718
Update cli getoffers smoke test to posix style opts 2021-03-05 07:09:41 -03:00
ghubstan
cfaa539a5e
Fix opt validation bugs in CLI
Unset empty string default values on some the createoffer method's
required option declarations in CreateOfferOptionParser, and adds a
check for presence of required currency-code option.

- Removes default "" value from required opt direction.
- Removes default "" value from required opt currency-code.
- Removes default "" value from required opt amount.
- Removes default "" value from required opt min-amount.
- Removes default "" value from required opt fixed-price.
- Removes default "" value from required opt security-deposit.
- Check for required currency-code option.

Unset empty string default values on some of the createoffer method's
required option declarations in TakeOfferOptionParser.

- Removes default "" value from required opt offer-id.
- Removes default "" value from required opt payment-account.

Other opt parser default values removed from:

- CancelOfferOptionParser#offer-id
- CreatePaymentAcctOptionParser#payment-account-form
- GetAddressBalanceOptionParser#address
- GetBTCMarketPriceOptionParser#currency-code
- GetOfferOptionParser#offer-id
- GetOffersOptionParser#direction
- GetOffersOptionParser#currency-code
- GetPaymentAcctFormOptionParser#payment-method-id
- GetTradeOptionParser#trade-id
- GetTransactionOptionParser#transaction-id
- RegisterDisputeAgentOptionParser#registration-key
- RegisterDisputeAgentOptionParser#dispute-agent-type
- RemoveWalletPasswordOptionParser#wallet-password
- SendBsqOptionParser#address
- SendBsqOptionParser#amount
- SendBtcOptionParser#address
- SendBtcOptionParser#amount
- SetTxFeeRateOptionParser#tx-fee-rate
- SetWalletPasswordOptionParser#wallet-password
- UnlockWalletOptionParser#wallet-password
- UnlockWalletOptionParser#timeout
- WithdrawFundsOptionParser#trade-id
- WithdrawFundsOptionParser#address
2021-03-04 13:03:04 -03:00
ghubstan
8590c67670
Remove warning supression 2021-03-02 14:40:36 -03:00
ghubstan
2473ff6374
Fix tx-fee-rate formatting (and math) bug in cli/CurrencyFormat
Now prints '<integer> sats/byte' to console.
2021-03-02 13:28:51 -03:00
ghubstan
392c0f58af
Fix CLI number opt validation, improve server-not-up msg
- Fix tx-fee-rate opt validation bug.

- Tell user what option value is not a number.

- Append ", server may not be running" text to "io exception" exception msg.
2021-03-01 15:20:08 -03:00
ghubstan
d60c0dd3ca
Display buyer's cost in api's gettrade output
The offer volume is shown so traders know how much fiat
they are sending or receiving without having to call getoffer.

Changed the 'Fiat Sent' and 'Fiat Received' column headers
to show which fiat is being transfered, e.g., 'EUR Sent',
'EUR Received'.

Adjusted apitest's trade-simulation-utils.sh to the modified
gettrade output.
2021-02-26 15:25:31 -03:00
ghubstan
ce2a523309
Remove unused imports 2021-02-25 22:24:56 -03:00
ghubstan
3bc5d05bb6
Refactor apitest cases to use GrpcClient
This is a follow up to PR https://github.com/bisq-network/bisq/pull/5240,
which moved client side gRPC boilerplate to a new, reusable GrpcClient class.

From this change forward, all (including test) client side gRPC request/response
boilerplate should now live in GrpcClient.
2021-02-25 22:05:21 -03:00
ghubstan
a5e5b9fc39
Refactor grpc stub boilerplate from CliMain to GrpcClient
CliMain no longer uses gRPC stubs directly, just parses &
validates command options, and prints responses.

Also, anticipates reuse by java bots (avoiding grpc boilerplate
duplication on the client side), reduces size of CliMain class, and
will allow clean up of duplicated grpc boilerplate in apitest cases.
2021-02-25 14:27:55 -03:00
ghubstan
7c3ec458b9
Make @VisibleForTesting 2021-02-18 12:50:47 -03:00
ghubstan
1154085632
Add api method 'stop'
This change gives CLI users a 'stop' command to shutdown a daemon.

- Server side gRPC boilerpate was added to :proto and :daemon.

- When the new GrpcShutdownService accepts a 'stop' request from the CLI,
  it calls UserThread.runAfter(BisqHeadlessApp.getShutDownHandler(), 500, MILLISECONDS);

- Method help file 'stop-help.txt' was added to :core.

- Client side gRPC boiler plate and 'stop' implementation was added to :cli.
2021-02-18 11:54:10 -03:00
ghubstan
ced422e930
Add new api CLI method 'getbtcprice'
The server impl was there, but it is now needed by the trading
sim scripts (CLI) to get the price from the Bisq server instead
of the feed.  (The server does not request prices more than
once a minute.)
2021-01-20 15:01:16 -03:00
ghubstan
8907d6b4a8
Keep CLI method enum members in alphabetical order 2021-01-17 13:05:07 -03:00