Commit Graph

304 Commits

Author SHA1 Message Date
Steven Barclay
5a3b072692
Withhold witnesses in buyer->seller depositTx data, until last step
Strip all input witnesses from the depositTx message fields sent from
the buyer, until the last (DelayedPayoutTxSignatureResponse) message is
sent, where they can be bundled in as an extra field. Since the witness
data doesn't affect the final deposit tx id, the seller does not need to
know it until actually publishing the tx.

In the (fully) segwit case, this allows the buyer to prevent the seller
from publishing the deposit tx until the buyer has a valid, fully signed
delayedPayoutTx. Provide the final witness data in an extra 'depositTx'
field in DelayedPayoutTxSignatureResponse, which the seller can merge
with his depositTx witness block (for his own input signatures).
2020-11-19 17:19:13 +00:00
Steven Barclay
f02d5ee216
Send seller's delayedPayoutTx signature to peer ASAP
Include a new 'delayedPayoutTxSellerSignature' field with the prepared
delayed payout tx sent to the buyer, in DelayedPayoutTxSignatureRequest.
This will allow the buyer to compute the final, signed delayedPayoutTx
as early as possible and withhold their deposit tx witness from the
seller until they know they have a valid delayedPayoutTx, preventing its
premature publishing in the fully segwit case. (To be done in a later
commit - for now just save the seller's delayedPayoutTx signature.)

As part of this, run the SellerSignsDelayedPayoutTx trade task at an
earlier step (just after payout tx creation) to make its signature
available to the seller ASAP. Also rename 'delayedPayoutTxSignature' to
'delayedPayoutTxBuyerSignature' in DelayedPayoutTxSignatureResponse.
2020-11-19 17:19:12 +00:00
ghubstan
08228d07bc
Replace existing api method 'createpaymentacct' impl
In the CLI, this method now takes a single argument, the path to a json
file (a payment account form).  The json text is read from the file
and sent to the server, where it is serialized to a new PaymentAccount
instance, saved, and sent back to the CLI as a protobuf.PaymentAccount.

- Modified existing gRPC boilerplate in grpc.proto and GrpcPaymentAccountsService.

- Modified existing method signatures in CoreApi and CorePaymentAccountsService.

- Replaced existing method impl in CorePaymentAccountsService and
  removed dead code.

- Replaced the CLI's existing 'createpaymentacct' method impl.

- Modified existing tests.
2020-11-18 19:23:21 -03:00
ghubstan
8996fa1748
Add boilerplate for new 'getpaymentacctform' api method 2020-11-18 16:17:24 -03:00
ghubstan
ec381522ff
Add api method 'getpaymentmethods'
Returns a list of supported payment method IDs.  This gives CLI users
the correct payment method id for creating a new payment account.

- Added gRPC service GetPaymentMethods to grpc.proto.

- Added gRPC boilerplate method to GrpcPaymentAccountsService.

- Added implimentation to CoreApi -> CorePaymentAccountsService.

- Refactored PaymentAccountTest hierarchy.

- Add api method to CLI.
2020-11-18 12:03:22 -03:00
ghubstan
7e9ab22d65
Refactor api getbalance methods.
This change fixes the recently bloated wallet balances api.  Now there
is one CLI getbalance [bsq|btc] method that calls a getbalances(currency-code)
on the server.  The server returns full wallet balance information for
BSQ, BTC, or both if the CLI's currency argument is absent.

- grpc.proto:  Reduced number of getbalance(s) proto services from
  four to one.

- GrpcWalletsService:  Reduced number of getbalance(s) gRPC service
  boilerplate methods from four to one.

- CoreApi, CoreWalletsService:  Reduced number of getbalance(s) gRPC
  service implementation methods from four to one.

- CliMain:  Reduced number of getbalance(s) commands from four to one.

- BalancesInfo: Changed BsqBalanceInfo & BtcBalanceInfo field names
  to bsq and btc, respectively, to make calling their accessors
  more readable, less verbose.

- BtcBalanceInfo, BsqBalanceInfo: Defined static final EMPTY instances
  as place holders in a BalancesInfo returned by the gRPC server, when
  one or the other balance types is not requested.  Would be nice
  to serve Optional.empty() instead, but protobuf does not support
  it or null.

- Adjusted affected api tests and build doc.
2020-11-14 13:08:10 -03:00
ghubstan
9f033ee572
Add proto fields to support trade fee currency choice
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.
2020-11-13 12:03:15 -03:00
ghubstan
3e98910cc6
Define proto fapi method 'sendbsq'
This change adds the proto to support a future api implementation for
transfering bsq.
2020-11-13 11:44:42 -03:00
ghubstan
4c03b463fe
Define proto for api method 'getunusedbsqaddress'
This change adds a proto to support a future api implementation for
getting an unused, bsq funding address.
2020-11-13 11:35:06 -03:00
ghubstan
fc8af8c072
Define new grpc bsq/btc balances protos
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.
2020-11-13 11:01:02 -03:00
chimp1984
a238c205ab
Add Amazon eGift Card payment method 2020-11-13 00:26:23 -05:00
chimp1984
9cd5dc9e26
Add support for persisting MailboxMessageList 2020-11-11 22:19:44 -05:00
Oscar Guindzberg
c4131c7398
Rename "tx size" to "tx vsize" 2020-11-05 19:28:45 -03:00
Christoph Atteneder
8fe8261a1e
Clean up code 2020-11-03 15:42:46 +01:00
Luis Aranguren
ecf9d49f65
Resolve conflicts with master 2020-11-03 15:42:23 +01:00
sqrrm
9e1466417f
Merge pull request #4713 from ghubstan/12-stub-canceloffer
Stub out 'canceloffer offer-id' api method
2020-11-02 12:59:03 +01:00
Christoph Atteneder
9ab65459df
Merge pull request #4736 from jmacxx/add_autoconf_service_filter
Admin filter for auto-confirmation service addresses
2020-11-02 10:47:22 +01:00
jmacxx
15b8e72059
Admin filter for auto-confirmation service addresses
A service address can be filtered out using the admin key.  This would
be useful if a federated server failed, it could be filtered out so
that the auto-confirmation operates with the remaining services.  If
all federated service addresses were filtered out the user would have to
either confirm manually or use their own explorer service.
2020-11-01 08:20:33 -06:00
sqrrm
89620a02da
Merge pull request #4706 from chimp1984/remove-outliers-at-bsq-rate
Remove outliers when calculating BSQ rate
2020-10-31 23:07:40 +01:00
sqrrm
605f4b3015
Merge pull request #4726 from chimp1984/add-transferwise-payment-method
Add transferwise account
2020-10-31 13:20:41 +01:00
sqrrm
c4e2021e37
Merge pull request #4709 from ghubstan/9-closetrade-protos
Stub out api methods 'keepfunds', 'withdrawfunds'
2020-10-30 14:05:16 +01:00
sqrrm
3c56268149
Merge pull request #4701 from ghubstan/5-refactor-trade-utils
Add getRole(tradeId) to core api
2020-10-30 13:43:15 +01:00
sqrrm
3356c8f632
Merge pull request #4696 from ghubstan/1-add-grpc-trade-proto-fields
Add fields to grpc TradeInfo proto & wrapper
2020-10-29 22:31:26 +01:00
chimp1984
ebce18c338
Add transferwise account 2020-10-28 21:35:47 -05:00
ghubstan
027a7d5cd3
Stub out canceloffer api method
The implementation will be added to CoreOffersService in the next PR.
2020-10-27 14:54:50 -03:00
ghubstan
a8decafc2f
Stub out api methods 'keepfunds', 'withdrawfunds'
This PR adds trade closing method stubs to keep funds in the
Bisq wallet or send them to an external BTC wallet.

- Add grpc protos
- Add new methods to GrpcTradesService, CoreApi
- Stub out implementations in CoreTradesService
- Add methods to CLI
2020-10-26 17:43:08 -03:00
chimp1984
8bfe9b82c8
Remove outliers when calculating BSQ rate
Add percentage for upper and lower threshold for outlier detection.
2020-10-25 18:34:22 -05:00
ghubstan
161dbade0d
Add getRole(tradeId) to core api
API users will need to see their role as maker/taker when looking at trade details.

- Add getRole(trade) to TradeUtil.
- Add getTradeRole(tradeId) to CoreApi, CoreTradesService.
- Add role field to TradeInfo proto and its wrapper class.
2020-10-25 16:22:20 -03:00
ghubstan
63cf436990
Add fields to grpc TradeInfo proto & wrapper 2020-10-24 16:27:03 -03:00
chimp1984
21bd85c488
Remove signature from GetInventoryRequest (as monitor is public it does not make sense to limit requests).
Add html output and webserver
2020-10-23 01:17:33 -05:00
chimp1984
ca7fe94c06
Add signature to request to limit the feature to requests from trusted nodes (monitor) 2020-10-23 01:17:32 -05:00
chimp1984
9dab186086
Move inventory package to core as we want to include other domain data as well like DAO state
Add more data to inventory map and change type of value to String.
2020-10-23 01:17:32 -05:00
ghubstan
e809af37cc
Add 'takeoffer' API method
- Add new core.offer.takeoffer.TakeOfferModel

	Would have been nice to move more logic from
	bisq.desktop.main.offer.takeoffer.TakeOfferDataModel,
	but it has JFX dependencies that cannot be use in :core.

- Add grpc protos to support takeoffer, confirmpaymentsent, confirmpaymentreceived

	Only takeoffer is implemented in this commit.

- Refactor OfferInfo grpc proto wrapper, and add offer state field

- Add new TradeInfo grpc proto wrapper

- Implement takeoffer on server and cli side

- Refactor offer/trade tests, add test cases
2020-10-20 16:00:05 -03:00
Christoph Atteneder
ebe4618bfe
Merge pull request #4655 from bisq-network/release/v1.4.0
Release/v1.4.0 and v1.4.1
2020-10-20 09:10:12 +02:00
chimp1984
5f9d3d1f0d
Add GetInventory messages
This will be used for monitoring seed nodes.
Instead of requesting all data (we cannot request all in fact as it is too large)
we request the number of items the node has.

This code will not have any impact atm. It will be triggered once a new monitor module gets added which
will send the GetInventoryRequest to the seeds.
2020-10-13 23:30:39 -05:00
chimp1984
6766835af6
Use TradeStatistics3 in protobuf file 2020-10-08 18:49:14 -05:00
chimp1984
6d43c09b33
Delete TradeStatistics (version 1) 2020-10-08 18:48:52 -05:00
chimp1984
00bed02839
Add TradeStatistics3 and related classes
Add TRADE_STATISTICS_3 Capability
Add TradeStatistics3 to proto resolvers
Make message TradeStatistics2 deprecated
2020-10-08 18:48:17 -05:00
Oscar Guindzberg
ced357ce25
AddressEntry: Add boolean segwit flag 2020-10-08 16:33:49 -03:00
ghubstan
29d1905f31
Add new 'getoffer offer-id' api method
There are a number of use cases where a user may want to see a single
offer instead of every offer for a currency pair on the buy or sell side.
The changes are:

- Add getoffer to grpc.proto
- Add new method to GrpcOffersService, CoreApi, CoreOffersService
- Add new method to CLI
- Adjust create offer tests to use this new convenience
2020-10-07 12:09:13 -03:00
chimp1984
ccfda5b043
Cleanups, add generics, add final, remove unused code/comments/todos, 2020-10-03 12:48:21 -05:00
chimp1984
fa0d261397
Fix remaining issues, cleanups, add persit calls, remove unused code,...
Sorry too tired to create another 20 commits...
2020-10-03 12:48:21 -05:00
sqrrm
f051a03d29
Merge pull request #4559 from ghubstan/cli-create-offer
Build out 'createoffer' API method
2020-10-03 17:04:11 +02:00
chimp1984
ef7f5a7f63
Revert nonce index at PreliminaryGetDataRequest protobuf entry to 21 as it was the version used in master as well. We cannot change that without breaking compatibility. 2020-10-02 13:13:45 -05:00
chimp1984
5027c861e3
Fix proto field index 2020-10-01 16:33:33 -05:00
chimp1984
384152fb6b
Add version field to data requests classes 2020-10-01 15:05:31 -05:00
chimp1984
fb41a1984b
Merge branch 'master_upstream' into fix-delayed-payout-tx-issues
# Conflicts:
#	core/src/main/java/bisq/core/trade/TradeManager.java
#	desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java
2020-10-01 09:24:46 -05:00
sqrrm
0b1894a939
Merge pull request #4554 from ghubstan/create-offer
Change 'createoffer' api method return type
2020-10-01 14:48:38 +02:00
ghubstan
2f3e3a31e1
Add simple mkt-price service & test calculated offer prices
A gRPC price service was added, and api create-offer tests can check
mkt based price margin calculations.
2020-09-25 20:48:26 -03:00
chimp1984
10bedee803
Merge branch 'dispute-agent-branch' into fix-delayed-payout-tx-issues
# Conflicts:
#	core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerSetupDepositTxListener.java
2020-09-25 15:03:28 -05:00
chimp1984
25c4b4d0fc
Merge branch 'master_upstream' into dispute-agent-branch
# Conflicts:
#	core/src/main/java/bisq/core/trade/DelayedPayoutTxValidation.java
2020-09-25 14:53:20 -05:00
ghubstan
6cdbc137c1
Move 'createoffer' price arg transform to server & test it
The CreateOfferRequest's price field type was changed from long to string,
so a CLI param like 10000.0055 can be passed to the server as is, to be
scaled and converted there.  In general, we want to keep validation logic
on the CLI as simple as possible, and use existing core logic to
validate args and convert arg types when needed.
2020-09-24 18:13:19 -03:00
chimp1984
0fa45650b6
Merge branch 'dispute-agent-branch' into wip-merge-tradeprot
# Conflicts:
#	core/src/main/java/bisq/core/trade/DelayedPayoutTxValidation.java
#	core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerVerifiesFinalDelayedPayoutTx.java
#	desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesDataModel.java
#	desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep1View.java
#	desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep2View.java
2020-09-23 08:27:09 -05:00
ghubstan
3c0c443680
Change API's createoffer return value from bool to Offer 2020-09-22 22:13:42 -03:00
ghubstan
1f307c8263
Fix indentation 2020-09-22 16:31:31 -03:00
chimp1984
527f1537a9
Add listener on BuyerSendCounterCurrencyTransferStartedMessage to resend msg case it has not arrived
Add signed witness to PayoutTxPublishedMessage
Remove usage of RefreshTradeStateRequest but leave it for backward compatibility
Move removeMailboxMessageAfterProcessing calls in finally branch
Rename methods
2020-09-22 00:32:28 -05:00
chimp1984
2943316f90
Remove agentsUid from protobuf, rename to uid 2020-09-20 21:31:51 -05:00
ghubstan
e2bd89f39a
Refactor API & add registerdisputeagent method to CLI
This commit contains most of the changes suggested by @chimp1984 in
his api-suggestions branch.  See
961703ecea

A new 'registerdisputeagent' method was also added to MainCli, finishing
the work to support registration of mediators and refund agents on
arbitration daemons running in regtest mode.  This method cannot be
used to register dispute agents on mainnet;  users will see an error
msg if they try.
2020-09-18 11:33:16 -03:00
chimp1984
45cee2a272
Add check for disputes with duplicated trade ID or payout tx ids 2020-09-17 19:05:55 -05:00
chimp1984
1c0bef787a
Merge branch 'master_upstream' into verify-donation-address-for-refund-agent 2020-09-16 20:40:08 -05:00
ghubstan
15b6044587
Add dispute agents service proto def to grpc.proto 2020-09-14 10:44:19 -03:00
ghubstan
359037a3ba
Move version service proto def to bottom of grpc.proto 2020-09-14 10:43:31 -03:00
chimp1984
4f1cbbd00e
Add check for refund agent if donation address is valid 2020-09-11 15:35:47 -05:00
chimp1984
039860935d
Merge master
- fix tests
2020-09-01 19:53:23 -05:00
sqrrm
5b1d9cb759
Merge pull request #4453 from chimp1984/add-username-to-revolut
Add support for user name for Revolut accounts
2020-09-01 19:52:40 +02:00
chimp1984
d36306a73c
More refactoring.... 2020-09-01 00:56:54 -05:00
chimp1984
9a142be86e
Add bannedPrivilegedDevPubKeys field 2020-08-31 12:51:01 -05:00
chimp1984
cc20a3b6c7
- Add support for multiple pubKeys
- Add more validation
- Add SignerPubKeyAsHex to filter
- Refactor add/remove filter code
2020-08-31 12:33:45 -05:00
chimp1984
f8b5c30fb4
Refactor:
- Rename AutoConfirmResult to AssetTxProofResult
- Update protobuf entry
2020-08-30 19:35:26 -05:00
chimp1984
595c968f2d
Various small cleanups... 2020-08-30 16:44:45 -05:00
chimp1984
ed5078c0f1
Add abstract AutoConfirmResult class to get better support if we want
to add auto confirm for other currencies in the future. The generic part
is only used where we would have issues with backward compatibility like
in the protobuf objects. Most of the current classes are kept XMR
specific and could be generalized once we add other assets, but that
would be an internal refactoring without breaking any network or
storage data. I think it would be premature to go further here as we
don't know the details of other use cases. I added the methods used from
clients to AutoConfirmResult, not sure if the API is well defined by
that, but as said that could become subject of a future refactoring once
another auto confirm feature gets added. Goal of that refactoring was
to avoid that we need more fields for trade and the the UI would have to
deal with lots of switch cases based on currency.

Sorry that is a larger commit, would have been hard to break up...
2020-08-30 15:45:47 -05:00
chimp1984
3e728c69f7
- Remove AutoConfirmResult enum from protobuf and add a AutoConfirmResult
instead which stores the stateName. [1]

- Adjust protobuf methods

- Add UNDEFINED to AutoConfirmResult.State to support cases where we
get no data to set the enum.

- Add NO_MATCH_FOUND (used in follow up commits)

- Refactoring: Improve constructors

[1]
Enums in protobuf are not well supported. They are global so an enum
with name (e.g. State) inside Trade conflicts with another enum inside
Message with the same name. So they do not reflect encapsulation in the
class like in java.
We moved over time to the strategy to use strings (from enum.name())
instead of the enum, avoiding also cumbersome fromProto and toProto
code and being more flexible with updates.
The autoConfirmResultState enum inside Trade was a bit confusing to me
as it was a different structure as in the java code. We try to mirror
the structure as far as possible.
2020-08-30 14:39:44 -05:00
chimp1984
6c60e1739d
Add support for user name for Revolut accounts
If a user has an existing account with phone number or email as
account ID we show a popup at startup where we require that he sets the
user name. This popup has no close button so he is forced to enter a
value. If there are multiple account multiple popups will be shown.

To not break signed accounts we keep accountId as internal id used for signing.
Old accounts get a popup to add the new required field userName but accountId is
left unchanged. Newly created accounts fill accountId with the value of userName.
In the UI we only use userName.

Input validation does only check for length (5-100 chars). Not sure what
are the requirements at Revolut. Can be changes easily if anyone gets
the specs.
2020-08-30 12:58:31 -05:00
chimp1984
5501822128
Merge branch 'master_upstream' into xmr 2020-08-29 23:03:13 -05:00
chimp1984
7a4fc3d6b7
Merge branch 'master_upstream' into refactor-filter 2020-08-29 12:56:29 -05:00
chimp1984
f52beadc47
Improve dispute views
Add re-open dispute button to mediation views (not refund agent as
there it might be dangerous if he would close 2 times and pay out twice.

If a dispute was reopened and a message was sent afterwards the receiver
will auto-reopen the dispute as well and the UI shows the number
indicator.

Add search field to traders dispute views.

Fix DisputeMsgEvents which was handling only legacy arbitration cases
and now uses mediation and refund agent. Used to update state in case
the UI is not selected.

Add "send private notification" button for mediators and refund agents.

Add report button for mediators and refund agents
Generates report text of all disputes with more detailed information
which should be used for reporting.

Add "Dump text of all disputes" button for getting a text representation
of all disputes including the messages for mediators and refund agents.
This is not used for report but might be useful for search, etc.

Do not show legacy arbitration tabs (for traders as well for
arbitrators) if no cases available.

Add 5 new enum entries for Reason for dispute:
OPTION_TRADE
SELLER_NOT_RESPONDING
WRONG_SENDER_ACCOUNT,
TRADE_ALREADY_SETTLED,
PEER_WAS_LATE

Hide NO_REPLY, SCAM and PROTOCOL_VIOLATION in UI (still in code if we still
need it and re-activate them).
2020-08-28 22:15:11 -05:00
chimp1984
fa9f799186
Improve dispute views
Add report button:
Generates report text of all disputes with more detailed information
which should be used for reporting.

Add "Dump text of all disputes" button for getting a text representation
of all disputes including the messages. This is not used for report but
might be useful for search, etc.

Do not show legacy arbitration tabs (for traders as well for
arbitrators) if no cases available.

Add 3 new enum entries for Reason for dispute:
OPTION_TRADE
SELLER_NOT_RESPONDING
WRONG_SENDER_ACCOUNT
Hide NO_REPLY and PROTOCOL_VIOLATION in UI (still in code if we still
need it and re-activate them)
2020-08-28 13:48:28 -05:00
jmacxx
e3bf0735f7
Persist the auto confirm state of Trade object
Auto confirmed trades will be indicated as such on Trade details.
2020-08-28 12:13:50 -05:00
chimp1984
2f291a6acb
Cleanup Filter value object. Remove nullables from old versions. Keep signatureAsBase64 nullable as it is set null at creation time and set later after signing. We use filter protobuf data as input for signature so we have to set signature to null and apply the signature afterwards. To keep object immutable we clone it with static clone method. Similar we handle signature verification. We clone the filter with a null value for the signature and do the validation with that cloned object.
Use now the complete object data for signature creation. We use the protobuf data for creating the signature with DER encoding. We restict ourself more regarding backward compatibility but I think it is not a big problem.
If a new field is added to Filter and deployed the maintainer needs to publishes a new filter object. By using the new version he cannot remove the old filter from the network as the protobuf data is different and sig verification on the P2P datastorage level will fail. This is intended to keep the old filter alive for some time to support not updated users. We do not remove invalid filters anymore from our local storage to enable seed nodes to support also old filter objects.
For not updated users the new filter will fail at sig verification because the protobuf data is different. So they ignore the new filter and still use the old filter. For updated users the old filter will fail and the new filter is accepted. As it has a newer date it would also replace the old filter anyway. If the maintainer wants to delete the old filter from the network he can use the old app version and remove the filter. It is recommended to keep a copy of the data directory before the update so that the removal of the older filter is possible.

Refacorings:
- Rename isPeersPaymentAccountDataAreBanned to arePeersPaymentAccountDataBanned
- Rename isSignerPubKeyBanned to isWitnessSignerPubKeyBanned
2020-08-27 21:23:02 -05:00
jmacxx
ca8f53c2c2
Implement XMR tx proof autoconfirm feature
* XMR seller is prompted to enter txId and viewkey.
* looks up the XMR transaction to verify that it has confirmed
* user can run their own validating service, or use the ones provided
* 100% agreement of all chosen services is necessary for confirmation
* feature can be configured and turned on/off from settings screen
* feature can be globally turned off via admin filter
* two code review passes from chimp1984
* one text review from m52go
2020-08-26 21:51:14 -05:00
chimp1984
43e4809d81
Add basic support for validation for XMR transfer with tx key
Main part missing is the XMR proof service request processing. I did not
get the service compiled yet, so could not test response data and error
conditions.

Further it is missing a "news badge" and popup to guide the user to the
new feature.

Only basic dev tested so far.

Anyone welcome to pick the project up from here as I might not have
time soon to continue.
2020-07-26 18:55:07 -05:00
sqrrm
44c71bd704
Add TraderSignedWitnessMessage 2020-07-03 18:14:10 +02:00
sqrrm
a54eeeabcc
Merge pull request #4329 from ghubstan/6-getoffers
Add rpc method 'getoffers'
2020-06-25 20:41:34 +02:00
sqrrm
79f0dacc24
Merge pull request #4324 from ghubstan/5A-print-addressinfo-as-table
Return protos from funding address methods
2020-06-25 19:44:24 +02:00
sqrrm
ca98654725
Merge pull request #4304 from ghubstan/2-getaddressbalance
Add rpc method 'getaddressbalance'
2020-06-25 19:41:21 +02:00
ghubstan
88cb90e209
Add rpc method 'getoffers'
The new method returns current buy or sell offers for a fiat ccy.

These changes need refactoring and polishing before merging, but they're
committed in this state to be safe (don't lose work).  Changes include:

* New core.grpc classes
    CoreOffersService
    GrpcOffersService
    model.OfferInfo

* CoreApi -- The new CoreOffersService is injected into CoreApi and
  the old getOffers() and placeOffer() impls were moved into the
  new CoreOffersService.  The getOffers implementation was re-done.
  Other changes are just rearranging location of core method calls.

* GrpcServer -- The new GrpcOffersService replaced the old
  GetOffersService and PlaceOfferService.

* grpc.proto -- The old GetOffers and PlaceOffer services were combined
  into a single Offers service, and the PlaceOffer rpc was renamed
  as CreateOffer.  These are the only substantive changes; the rest
  is just rearranging location of the service defs in the file.
  Also created a lighterweight OfferInfo proto message wrapper to
  be passed between server & client (client has no access to core's
  Offer and OfferPayload).

* OfferInfo -- A new wrapper around the OfferInfo proto message.

* CliMain -- The new GetOffers service stub was added.
  Some (maybe too much) number and ccy formatting logic was
  copied & modified from core.  Some tedius string formatting
  was added too (needs to be tidied up).

* License comments were also copied to several classes, and I
  made a mistake in reverting changes to the wrong file.

TODO add unit tests
2020-06-20 19:56:28 -03:00
ghubstan
331f488057
Return protos from funding address methods
The 'getaddressbalance' and 'getfundingaddresses' methods now send
new AddressBalanceInfo proto messages instead of a formatted String
to the client.  The AddressBalanceInfo message contains addressString,
balance, and # of confirmations (transaction confidence) fields.

Changes include:
* A new AddressBalanceInfo proto message
* A wrapper class for the new AddressBalanceInfo proto
* New 'getaddressbalance' and 'getfundingaddresses' signatures in server
* AddressBalanceInfo display logic in client
* Removal of balance formatting logic in server
* Refactoring of balance formatting logic in client
2020-06-19 20:00:28 -03:00
ghubstan
bac3ed5697
Call core wallets service methods from CoreApi
This change is a refactoring of the gRPC Wallets service
for the purpose of making CoreApi the entry point to
all core implementations.  These changes should have been
made in PR 4295.
See https://github.com/bisq-network/bisq/pull/4295

The gRPC Wallet proto def name was changed to Wallets because
this service manages BSQ and BTC wallets, and GrpcWalletService
was changed to GrpcWalletsService for the same reason.

This PR should be reviewed/merged after PR 4308.
See https://github.com/bisq-network/bisq/pull/4308

This PR's branch was created from the PR 4308 branch.
2020-06-15 16:43:26 -03:00
ghubstan
a7542e98bf
Add rpc method 'createpaymentacct'
This addresses task 4 in issue 4257.
    https://github.com/bisq-network/bisq/issues/4257

This PR should be reviewed/merged after PR 4304.
    https://github.com/bisq-network/bisq/pull/4304

This new gRPC PaymentAccounts service method creates a dummy
PerfectMoney payment account for the given name, number and fiat
currency code, as part of the required "simplest possible trading
API" (for demo).   An implementation supporting all payment
methods is not in the scope.

Changes specific to the new rpc method implementation follow:

* New createpaymentacct method + help text was added to CliMain.
  Help text formatting was also changed to make room for larger
  method names and argument lists.

* The PaymentAccount proto service def was renamed PaymentAccounts
  to avoid a name collision, and the new rpc CreatePaymentAccount
  was made part of the newly named PaymentAccounts service def.

* New GrpcPaymentAccountsService (gRPC boilerplate) and
  CorePaymentAccountsService (method implementations) classes were
  added.

* The gRPC GetPaymentAccountsService stub was moved from GrpcServer
  to the new GrpcPaymentAccountsService class, and
  GrpcPaymentAccountsService is injected into GrpcServer.

* A new createpaymentacct unit test was added to the bats test
  suite (checks for successful return status code).

Maybe bit out of scope, some small changes were made towards making
sure the entire API is defined in CoreApi, which is used as a
pass-through object to the new CorePaymentAccountsService.  In the
next PR, similar refactoring will be done to make CoreApi the
pass-through object for all of the existing CoreWalletsService
methods.  (CoreWalletsService will be injected into CoreApi.)
In the future, all Grpc*Service implementations will call core
services through CoreApi, for the sake of consistency.
2020-06-15 14:32:14 -03:00
ghubstan
b1228e5ea7
Add rpc method 'getaddressbalance'
This addresses task 2 in issue 4257
	https://github.com/bisq-network/bisq/issues/4257

This new gRPC Wallet service method displays the balance and number
of confimirmations of the most recent transaction for the given BTC
wallet address.

The new method required the usual boilerplate changes to grpc.proto,
CliMain, and GrpcWalletService.

Two unit tests to check error msgs was added to cli/test.sh.
2020-06-14 14:23:47 -03:00
ghubstan
85c96764fb
Add rpc method 'getfundingaddresses'
This addresses task #1 in issue https://github.com/bisq-network/bisq/issues/4257.

This new gRPC WalletService method displays the BTC wallet's list of
receiving addresses.  The balance and number of confirmations
for the most recent transaction is displayed to the right of each
address.  Instead of returning a gRPC data structure to the client,
the service method returns a formatted String.

If the BTC wallet has no unused addresses, one will be created and
included in the returned list, and it can be used to fund the wallet.

The new method required injection of the BtcWalletService into CoreWalletsService,
and the usual boilerplate changes to grpc.proto, CliMain, and GrpcWalletService.

Some of the next PRs (for #4257) will require some common functionality within
CoreWalletsService, so these additional changes were included:

  * a private, class level formatSatoshis function
  * a public getNumConfirmationsForMostRecentTransaction method
  * a public getAddressBalance method
  * a private getAddressEntry method

A unit test that verifies a successful return status was added to cli/test.sh.
2020-06-13 19:59:45 -03:00
chimp1984
77362ff642
Add list to filter to set btc fee receiver addresses 2020-06-11 19:00:05 +02:00
Chris Beams
2e33c2c87a
Merge pull request #4214 from ghubstan/rpc-wallet-protection
Add rpc wallet protection endpoints
2020-05-18 14:18:05 +02:00
sqrrm
c07988faf3
Merge pull request #4159 from stejbac/remove-unused-PersistableEnvelope-types
Remove PersistableNetworkPayloadList & TradeStatisticsList
2020-05-11 14:52:04 +02:00
Chris Beams
c7a6c87bd1
Refactor grpc wallet service
Previously, each wallet-related method was implemented with its own grpc
service. There is no need to do this, as a grpc service may declare
multiple rpc methods. This commit refactors everything wallet-related
into a single GrpcWalletService and also extracts a CoreWalletService
from CoreApi in order to avoid the latter becoming overly large.
Ideally, there would be no need for an abstraction in bisq.grpc called
CoreWalletService; we would ideally use such a service implemented in
bisq.core. The closest we have is WalletsManager, but it is not designed
to be used the way we are using it here in the grpc context. Rather than
making changes directly to core (which can be very risky), we will
rather make them here in this layer, designing exactly the "core wallet
service" we need, and can then later see about folding it into the
actual core.
2020-05-03 15:46:41 +02:00
ghubstan
2a9d1f6d34
Improve gRPC error handling
This change removes non-idiomatic gRPC *Reply proto message fields.
The client should not receive success/fail values from server methods
with a void return type, nor an optional error_message from any server
method.  This change improves error handling by wrapping an appropriate
gRPC Status with a meaningful error description in a StatusRuntimeException,
and placing it in the server's response StreamObserver.  User error
messages are mapped to general purpose gRPC Status codes in a new ApiStatus
enum class.  (Maybe ApiStatus should be renamed to CoreApiStatus.)
2020-05-01 17:29:14 -03:00
ghubstan
de50692daa
Add rpc wallet protection endpoints
Implemented lockwallet, unlockwallet, removewalletpassword, and
setwalletpassword methods with basic error handling.

Also added basic error handling to existing getbalance method,
and removed unused BalancePresentation from CoreAPI.

TODO:  update help text
2020-04-29 19:25:23 -03:00
Chris Beams
4277e62135
Merge pull request #4199 from cbeams/refactor-rpc-server
Refactor rpc server implementation
2020-04-29 16:23:42 +02:00
Christoph Atteneder
91ce44ad96
Merge pull request #4102 from stejbac/tidy-persistable-envelope-inheritance
Tidy PersistableEnvelope inheritance
2020-04-28 16:22:41 +02:00
Chris Beams
01580ae36a
Remove StopServer rpc method
There is no actual requirement for this method, so removing it. It also
helps improve the implementation by removing the need for the static
'instance' field.
2020-04-27 19:49:08 +02:00
Steven Barclay
e5ed365239
Remove PersistableNetworkPayloadList & TradeStatisticsList
The former class is dead code, together with its store service, as they
were only referenced from CorePersistenceProtoResolver::fromProto, the
binding logic and from AppendOnlyDataStoreService by orphaned migration
code. However, migration from the old persisted data was completed long
ago and the store file is no longer being read or written from anywhere
in the codebase.

Also remove the associated PersistableEnvelope proto message type, along
with the TradeStatisticsList message type. The latter is long deprecated
and has no corresponding Java class implementing PersistableEnvelope, so
removing it won't change behaviour (outside the exception message thrown
when attempting to resolve it).
2020-04-11 15:07:16 +08:00
sqrrm
09141eba92
Add signed witness filter (#4124)
* Add signed witness filter

- Add a filter to pubkeys used in AccountAgeWitness signing
- Fix inverted arbitrator signing of initial account age witnesses from
disputes
- Add test to verify that signed witness filter works
- Add test to verify that the arbitrator signing was fixed

* Fix codacy complaints

* Prevent NullPointerException during toggle group initialization

* Add scrollbar to filter window

* Format test class

Co-authored-by: Christoph Atteneder <christoph.atteneder@gmail.com>
2020-04-10 15:14:01 +02:00
Steven Barclay
74022e0cc4
Make MeritList & VoteWithProposalTxIdList standalone classes
Remove an unnecessary PersistableEnvelope interface by making them
standalone @Value classes with private List fields, instead of extending
PersistableList. As they weren't using any functionality of the latter
other than the getList() and stream() methods, this should not alter
behaviour, outside MeritList::toString.

Also comment out the MERIT_LIST PersistableEnvelope protobuf message
type, which shouldn't be encountered as merit lists were never persisted
directly to a storage file.

This removes the last superfluous PersistableEnvelope implementations,
leaving the following type hierarchy:

  PersistableEnvelope *
  +- NavigationPath
  +- PeerList
  +- PersistableList *
  +- ThreadedPersistableEnvelope *
  |  +- AccountAgeWitnessStore
  |  +- BlindVoteStore
  |  +- DaoStateStore
  |  +- PersistableNetworkPayloadList              *  is abstract
  |  +- ProposalStore
  |  +- SequenceNumberMap
  |  +- SignedWitnessStore
  |  +- TempProposalStore
  |  \- TradeStatistics2Store
  \- UserThreadMappedPersistableEnvelope *
     +- AddressEntryList
     +- DisputeList *
     |  +- ArbitrationDisputeList
     |  +- MediationDisputeList
     |  \- RefundDisputeList
     +- UserThreadMappedPersistableList *
     |  +- BallotList
     |  +- MyBlindVoteList
     |  +- MyProofOfBurnList
     |  +- MyProposalList
     |  +- MyReputationList
     |  +- MyVoteList
     |  +- PaymentAccountList
     |  \- UnconfirmedBsqChangeOutputList
     +- PreferencesPayload
     +- TradableList
     \- UserPayload
2020-03-29 21:13:49 +08:00
Chris Beams
ccde089af3
Rename :protodefintion subproject to :proto
This is done primarily for concision. This change also repackages
bisq.grpc => bisq.proto.grpc in anticipation of repackaging the
definitions in pb.proto from 'protobuf' to 'bisq.proto'. There should
not be any compatibility issues with doing this, but it's out of scope
here. When complete, the relationship between bisq.proto.grpc and
bisq.proto will be more intuitively clear, i.e. that bisq.proto.grpc has
certain dependencies on bisq.proto classes, but not the other way
around.
2020-03-26 17:37:37 +01:00