Uniformise the log patterns somewhat, by making the 'Logger' classname
field width either 15 for the seednode & statsnode, or 40 for the other
applications (lengthened from 30 in a few cases).
Also clean up the logback XML files somewhat, in particular removing
references to the old Thali (thaliproject/Tor_Onion_Proxy_Library) Tor
library, which was replaced years ago with our own fork of NetLayer
(https://github.com/cd2357/netlayer).
Finally, add a missing space back to the log pattern for bisq-desktop,
to prevent DEBUG, ERROR or TRACE lines appearing as follows:
... [JavaFX Application Thread] ERRORb.c.s.CommonSetup: ...
(It isn't clear whether this recently introduced behaviour was really
intentional, though it did prevent two consecutive spaces appearing in
the majority INFO log lines.)
Returns volume weighted average BSQ price in BTC and USD over N days.
The need for this arose while creating a Java BSQ Swap bot example
(PR pending). API bots can use this to determine whether or not to
take swap offers based on their price distance above or below the 30
(or 90) day trade price average.
Returns name of the BTC network API daemon is connected to.
I am working on some Java bot examples in another repo, and want to stop
worrying about accidentally simulating trade payments on mainnet, despite
all the warnings I add in comments. The 'getnetwork' method allows bots
to know what network the API daemon is connected to, and gives API bot
devs and users a way to avoid one potential source of costly mistakes.
API CLI manpage and apitest case are included in this commit.
When category param value was uppercase, e.g.,
$ ./bisq-cli --password=xyz --port=9998 gettrades --category=OPEN
CLI validation failed:
Error: No enum constant bisq.cli.opts.GetTradesOptionParser.CATEGORY.OPEN
This fixes the bug, and --category=open now passes CLI validation.
Based on `master`.
Exceptions thrown by the core.api services for the daemon Grpc*Services
have to be converted into gRPC StatusRuntimeExceptions before being sent to
gRPC clients. Most of these gRPC StatusRuntimeExceptions had a gRPC
Status.Code.UNKNOWN, which not helpful to client error handlers.
This change partially resolves the issue by sending more meaningful
io.grpc.Status.Codes to clients, where possible. But it is not as
comprehensive as it an be for a webapp because HTTP has so many more
possible response status codes than the gRPC library (sixteen). See:
https://github.com/grpc/grpc-java/blob/master/api/src/main/java/io/grpc/Status.java
There are three types of changes:
- Create custom exceptions in bisq.core.api.exception.
- Map any custom bisq.core.api.exception to a meaningful
io.grpc.Status.Code within daemon Grpc*Service classes.
- Adjust apitest cases to new grpc status codes.
Based on branch `move-cli-crypto-offer-filter-to-server`, PR https://github.com/bisq-network/bisq/pull/6086
Some API reference & Python bot examples exposed an API bug the Java CLI
has been hiding. Due due this Bisq v1 Offer entity design:
- In fiat offers, the baseCurrencyCode=BTC, counterCurrencyCode=FiatCode
- In altcoin offers, baseCurrencyCode=AltcoinCode, counterCurrencyCode=BTC,
new API examples were not doing what the CLI has been doing for several
months, which is get (cryptocurrency) all BTC offers from the server,
and filter on the altcoin code. The CLI side filtering should have been
done on the server, as it is in this commit.
A lot of dead gRPC client side offer filtering code is removed as well.
Based on `master`.
Prerequisite for next PR: Add API method 'gettrades'
The `gettrades` method will show 'open', 'closed', and 'failed' trades.
Users already needed to be able to fail and unfail trades for the
same reasons they do in the UI. API test cases will need to be able to
fail and unfail trades to check correct behavior of 'gettrades' method.
Based on branch `rename-keepfunds2closetrade`.
Trade proceeds and deposits have already been transfered to Bisq wallets
before the `keepfunds` command is (was) executed; `keepfunds` merely moves
open trades to closed trades lists and persistence files. Renaming `keepfunds`
as `closetrade` makes its purpose clear to API users.
The commit modifies only method names and comments in api server+cli classes,
apitest cases, and api trade simulation scripts.
Based on `master`
The method 'getoffer' should support looking up a user's open-offers, and other users' available offers.
- Adjust api-beta-test-guide.md to use only 'getoffer'.
- Adjust trade simulation scripts to use only 'getoffer'.
- Adjust api testcases to use 'getoffer' in place of 'getmyoffer'.
- Mark appropriate methods and protobuf msgs as deprecated.
There are no asserts, but helpful for looking at affects of CLI commands
from terminal because apitest cases use gRPC service stubs instead of terminal.
The OfferIdOptionParser superclass reduces duplication for parsing
offer-id parameters, but it needs to let subclass parsers' other
options pass validation.