The rpc GetBsqSwapTrade and TakeBsqSwapOffer services were a quick hack
to help test BSQ swap feature development more quickly, using apitest
cases. Their gRPC service method implementations are removed here and
the GetTrade & TakeOffer service methods are refactored to support BSQ
swaps.
PaymentMethod use an instance of TradeLimits and expect that it
has been injected, which is the case for desktop but not for
headless apps, so we enforce injection in the app base classes
used for headless apps.
The validation of trade statistics use a method in PaymentMethod
where that dependency is required.
Tha hack how the PaymentMethod use TradeLimits is not nice, but
would require more effort for refactoring.
- Made several adjustments to CLI's 'gettrade' output related code
so it can show single trade details for either Bisq v1 trades, or
BSQ swap trades.
- Did minor refactoring of API's core to retrieve # tx confirmations
for an addresses and transactions.
- Show # of tx confirmations in bsq swap trade detail.
This commit refactors the first cut of the BsqSwapTradeInfo and
TradeInfo gRPC proto defs and wrappers. The change avoids duplication
of fields between BsqSwapTradeInfo and TradeInfo, and adds a
bsqSwapTradeInfo field to the old TradeInfo proto & wrapper.
The immediate goal is moving towards getting the API's 'gettrade'
method to work for both Bisq v1 trades and BSQ swap trades: the TradeInfo
proto sent to the CLI should represent either a Bisq v1 trade or a BSQ
swap trade. A mid-term term goal is to also make a new 'gettrades' method
return a List<TradeInfo> to the CLI, where items in the List<TradeInfo>
can be either v1 trades or bsq-swap trades.
- Add GetOfferCategory service so CLI can determine what kind of takeoffer service is to be used.
- Adjust to removal of BsqSwapOfferInfo proto.
- Call new coreApi.getRole(BsqSwapTrade) before building BsqSwapTradeInfo proto.
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.
- Add editOffer to GrpcOffersService, CoreApi, CoreOffersService.
- Set editOffer call rate meter to 1 / minute.
- Use new EditOfferValidator to verify editOffer params OK.
- Adust getMyOffer(s) rpc impl and OfferInfo model to use OpenOffer
for accessing activation state and trigger price.
- 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).
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.
- 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.)
- GrpcErrorMessageHandler A new ErrorMessageHandler implementation
to get around the api specific problem of having to use Task
ErrorMessageHandlers that build task error messages for the UI.
- GrpcExceptionHandler A new method for working with the
ErrorMessageHandler interface.
- GrpcTradesService, CoreApi, CoreTradesService: Ajdusted takeoffer
error handling to give a failure reason provided by the new
GrpcErrorMessageHandler.
- 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.)
- GrpcErrorMessageHandler A new ErrorMessageHandler implementation
to get around the api specific problem of having to use Task
ErrorMessageHandlers that build task error messages for the UI.
- GrpcExceptionHandler A new method for working with the
ErrorMessageHandler interface.
- GrpcTradesService, CoreApi, CoreTradesService: Ajdusted takeoffer
error handling to give a failure reason provided by the new
GrpcErrorMessageHandler.
This change replaces the hard coded strings used as keys in
interceptor rate-metering lookup maps.
Now, the fullMethodName defined in each bisq.proto.grpc.* class'
io.grpc.MethodDescriptor is used, not a hard coded String.
For example, the rate metering lookup key for 'GetBalances',
in 'GrpcWalletsService', is the
fullMethodName = SERVICE_NAME + '/' + "GetBalances",
where SERVICE_NAME = "io.bisq.protobuffer.Wallets".
Also adjusted affected tests, and tidy'd up interceptor logging.
The gRPC interceptor was not using the correct method/ratemeter
map key, and failing to find a rate meter for the server call.
- Fix the rate meter key lookup bug.
- Disable most strict, default call rate meters in tests.
Made an adjustment to the test harness' scaffold setup so an interceptor
testing or disabling config file is always picked up by bob and alice
daemons.
- Set arbitration daemon's registerDisputeAgent rate @ 10/second, so
it does not interfere with the test harness. (There is no pre-existing
arb node appDataDir before that daemon starts.)
Note: The test harness cannot install the custom rate metering file in
an arb daemon's appDataDir before it starts because there is no dao-setup
file for that node type.
TODO: Adjust api simulation scripts to interceptor bug fix.
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.
The general rule is limit calls that change p2p data to 1/minute,
others to 1/second. An exception is made to set/remove wallet password
methods (1/5s), due to the latency of writing wallet changes to disk.
This change may affect api testing in the future. If that happens,
further changes to the call rate metering interceptor may be made to loosen
the constraints when running in regtest/dev mode.
Migrate RpcService over to the new block notification daemon and RPC
client based on jsonrpc4j. Drop in own DTO classes in place of the ones
defined by btcd-cli4j and rename requestBtcBlock & addNewBtcBlockHandler
to requestDtoBlock & addNewDtoBlockHandler respectively.
Also remove now redundant filtering from the logback config and update
grade-witness.
Adds all the gRPC server boilerplate, and a simple help service
that serves method help in man page format. Help text is maintained
in text files located in core/src/main/resources/help.
Only some of the method help text files are defined in this
change, more to be added.
This is a feature that will not be included in api v1, but partial
support is added in this change to the server. CLI will pass a
default triggerPrice of 0 (unused) with the createoffer command.
When fully implemented, an optional trigger-price param will be
added to the CLI's createoffer method, and the value will only be
visible to offer owners. New enableoffer and disableoffer
methods will also need to be added.
Similar to 'getoffers' and 'getoffer', but filters out offers not
created by the user. The new methods are so similar some offer list
filtering and sorting was refactored in CoreOffersService.
Also fixed some createoffer apitest cases in anticipation of a new OfferFilter,
which will filter out offers not matching any user payment account.
We need to be able to define call rate meters for time spans not limited
to TimeUnit intervals of 1 SECOND, 1 HOUR, or 1 DAY. This change allows
more flexibility, e.g., 10 per 5 seconds, 10 per 5 hrs, 100 per 7 days.