Commit Graph

257 Commits

Author SHA1 Message Date
Christoph Atteneder
444f2183e5
Merge pull request #6236 from jmacxx/xmr_subaddresses
Feat: XMR subaddresses per account
2022-06-20 20:40:20 +02:00
ghubstan
a12dd52b81
Add API method 'getavgbsqprice'
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.
2022-06-17 18:26:10 -03:00
ghubstan
ae41e98db9
Add API API method 'getnetwork'
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.
2022-06-16 15:31:03 -03:00
jmacxx
920e05562c
Feat: XMR subaddresses per account
incremente subaddress index at the start of the trade

Add subaccounts

Rename XmrAccountHelper to XmrAccountDelegate
Add map as final non null value

Persist subaccounts in User

Add display of used subaddresses and tradeId in account summary.
Main address and account index are the unique key for sub accounts.
Use the initial subaddress chosen by the user.

chimp1984 code review patch.

News badge/info for Account, disable old ones.

Show XMR subaddress popup info at Account (news badge), not startup.
2022-06-14 09:53:44 -05:00
Christoph Atteneder
98f355d3fa
Adapt navigational structure and offerbook handling to buy and sell different assets
Still missing correct create and take offer handling
2022-04-07 20:48:48 +02:00
ghubstan
a3990783a4
Send pretty payment details to api clients
Non-CLI clients need a better way of accessing payment details
than a contract json string.

- Add grpc.proto PaymentAccountPayloadInfo field: payment_details.
- Adjust proto wrapper PaymentAccountPayloadInfo to new field.
- Add test asserts to verify payment details are sent to client.
- Fix a test name: testKeepFunds -> testCloseTrade.

Based on branch `master` @ Sat 12 Mar 2022 01:42 PM -03 ,
         commit c6293b5273
2022-03-12 14:33:23 -03:00
ghubstan
b9b66b4826
Change grpc.proto TradeInfo field names
- is_fiat_sent		->	is_payment_started_message_sent
	Payment can be in altcoin.
- is_fiat_received	->	is_payment_received_message_sent
	Payment can be in altcoin.
- is_withdrawn		->	is_completed
	Trade can be closed with funds kept in Bisq wallet.
2022-02-27 18:09:36 -03:00
ghubstan
68ebdb2b08
Change grpc.proto field names to snake_case
Java client code can still use the camelCase field naming convention,
and other language bindings will not be forced to do the same.

Snake_case field names are also recommended in the Protocol Buffers
Sytle Guide:  https://developers.google.com/protocol-buffers/docs/style
2022-02-27 09:42:17 -03:00
ghubstan
2e9e51eb41
Remove GetTradeStatistics service from grpc.proto
This protobuf definition and service stub has been in place since
the start of work on the API, but was never fully implmented, nor
intended to be included in the API beta & v1 releases.

Its presence added a useless section to the gRPC API Reference doc.

	https://ghubstan.github.io/slate

Based on branch `7-more-grpcproto-comments`,
PR https://github.com/bisq-network/bisq/pull/6068.
2022-02-26 11:11:26 -03:00
ghubstan
c0631eb31f
Fix file/merge conflict 2022-02-25 20:51:55 -03:00
Stan
1499465c11
Merge branch 'master' into 7-more-grpcproto-comments 2022-02-25 20:46:05 -03:00
ghubstan
464c5a81c9
Be consistent in use of apostrophe 2022-02-21 08:13:13 -03:00
ghubstan
6e56660394
Fix comment error 2022-02-21 08:09:42 -03:00
ghubstan
9f013bd6c2
Fix errors in comments 2022-02-21 08:00:31 -03:00
ghubstan
fcd9c7e4d3
Finish 1st full pass of documenting grpc.proto for API reference site 2022-02-21 07:48:02 -03:00
ghubstan
8271920943
New comments through "message TxInfo { ... }" 2022-02-20 20:20:33 -03:00
ghubstan
5cc928a7e5
Disambiguate grpc.proto offer pct literal field names
Rename double marketPriceMargin -> marketPriceMarginPct.
Rename double buyerSecurityDeposit -> buyerSecurityDepositPct.
2022-02-20 15:16:02 -03:00
ghubstan
3b22aeeb98
Change TradeInfo .proto's price & volume fields to string 2022-02-19 15:06:42 -03:00
ghubstan
d42c58073f
Change OfferInfo proto's volume fields' type to string 2022-02-18 16:43:23 -03:00
ghubstan
62a0a1405d
Change existing uint64 triggerPrice field type in grpc.proto to string triggerPrice. 2022-02-18 11:23:41 -03:00
ghubstan
89267e5851
Fix typo in comment 2022-02-17 18:11:46 -03:00
ghubstan
461edff631
Change OfferInfo proto's 'price' field type to string
Much less ambiguous field value at cost of breaking backward compat in API.
2022-02-17 17:27:15 -03:00
ghubstan
ddd3ec3243
Fix comment about changing "all" number fields to string
We will consider each problematic number field one at a time.

Note: changing field types in following commits will break
the API's backward compatibility, but devs agree it's OK since
it is still in beta.
2022-02-17 13:39:06 -03:00
ghubstan
4596960191
Prepare API Offers .proto defs for significant changes
This commit adds comments to grpc.proto to be pulled into a new API
reference doc.  Some of the comments highlight issues to be resolved
in following PRs.

The main focus is on documenting gRPC Offers service definitions in
grpc.proto:

- Comment each field in the Offers service's messages.
- Add TODO comments about fixing field defs with usability &
  consistency problems.

Other API reference doc related changes to grpc.proto:

- Comment each gRPC service's rpc method definitions, however briefly.
- Improve some existing rpc method comments.
2022-02-17 13:31:17 -03:00
ghubstan
bcfb1cbf87
Remove "has no parameters" comments from grpc.proto 2022-02-13 17:57:53 -03:00
ghubstan
0fe850bf0e
Begin commenting grpc.proto for bisq-grpc-api-doc
Banner comments were replace by simple service description comments.

Rpc methods were commented, some field level comments were moved to
to bisq-grpc-api-doc comment conventions.
2022-02-12 17:52:03 -03:00
ghubstan
62e5aaf4f8
Add license comment 2022-02-12 17:03:35 -03:00
ghubstan
459aea803f
Remove banner style comments from pb.proto
The bisq-grpc-api-doc generator needs comments spefic to protobuf
message definitions, not groups of message defs.  This kind of
information can be included in the message specific comments.

Also changed some existing comments, and added others to suggest
a commenting style for .proto message and field defs.
2022-02-12 16:57:11 -03:00
Christoph Atteneder
fcb13ed772
Merge pull request #5976 from ghubstan/1-gettrades
Add API 'gettrades' method
2022-02-01 11:10:45 +01:00
jmacxx
57821b7474
Clear account payload info & chats from closed trades & disputes. 2022-01-31 14:58:22 -06:00
ghubstan
0e020e8987
Add payout fields to trade proto msgs, show optional trade/tx fees in swaps 2022-01-23 17:03:43 -03:00
ghubstan
69e6c9ce70
Remove duplicated buyer/seller proto fields (already exist no OfferInfo) 2022-01-20 16:50:08 -03:00
ghubstan
3cd1e05a9f
Try to display accurate status of closed trades, or "Pending" if still open 2022-01-18 13:01:42 -03:00
ghubstan
55a54f39b4
Add GetTrades proto message, + needed TradeInfo fields 2022-01-16 16:36:27 -03:00
Bisq GitHub Admin
ddead5ef54
Merge pull request #5953 from jmacxx/logs_upload
Feature enabling log file upload to mediators
2022-01-12 09:41:32 +01:00
ghubstan
7690ffd953
Add API methods 'failtrade', 'unfailtrade'
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`.
2022-01-07 19:11:34 -03:00
jmacxx
9334cffc89
Feature enabling log file upload to mediators 2022-01-06 13:22:44 -06:00
ghubstan
a9aaba87fa
Rename API method keepfunds -> closetrade
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`
2022-01-05 12:10:46 -03:00
Stan
53d693d710
Merge branch 'master' into 7-deprecate-api-getmyoffer 2021-12-27 12:09:22 -03:00
ghubstan
5f571cccca
Deprecate API 'getmyoffer'
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.
2021-12-27 12:05:17 -03:00
sqrrm
cf81fd451c
Merge pull request #5876 from ghubstan/5-api-bsqswap-simulation-n-docs-update
API BSQ swap simulation script and doc updates #5
2021-12-14 15:47:51 +01:00
Steven Barclay
db6025a08d
Add separate ProofOfWork.solution proto field for Equihash
Avoid repurposing the 'ProofOfWork.payload' field for Equihash puzzle
solutions, as that may be of later use in interactive PoW schemes such
as P2P network DoS protection (where the challenge may be a random nonce
instead of derived from the offer ID). Instead, make the payload the
UTF-8 bytes of the offer ID, just as with Hashcash.

Also, make the puzzle seed the SHA-256 hash of the payload concatenated
with the challenge, instead of just the 256-bit challenge on its own, so
that the PoW is tied to a particular payload and cannot be reused for
other payloads in the case of future randomly chosen challenges.
2021-12-07 02:22:33 +00:00
Steven Barclay
24d2a7f222
Code cleanup: proto fields, duplicated expr & null char separator
1. Reorder the PoW fields in the 'Filter' proto by field index, instead
 of contextually.
2. Deduplicate expression for 'pow' & replace if-block with boolean op
 to simplify 'FilterManager::isProofOfWorkValid'.
3. Avoid slightly confusing use of null char as a separator to prevent
 hashing collisions in 'EquihashProofOfWorkService::getChallenge'. Use
 comma separator and escape the 'itemId' & 'ownerId' arguments instead.

(based on PR #5858 review comments)
2021-12-06 22:55:14 +00:00
ghubstan
64f228d872
Make rpc GetOfferCategory service work for my+avail offers
There are some use cases where the CLI needs to know what kind of offer
is being acted on before the request is made, For example:

There are differences between a BsqSwap 'takeoffer'request, and a v1
'takeoffer' request.

A BsqSwap offer cannot be edited by an 'editoffer' request, and an
attempt should be blocked by the CLI.

- Append isMyOffer GetOfferCategoryRequest rpc msg def.

- Adjust daemon.grpc services for new boolean GetOfferCategoryRequest param.

- Adjust core.api for new boolean GetOfferCategoryRequest param.

- Add validation check in core.api EditOfferValidator to block attempt to
  edit a BsqSwap offer.

- Refactor CoreOffersService get*offer(id) methods to optionally throw
  excpetions.
2021-11-27 14:01:14 -03:00
Steven Barclay
e0595aa284
Store difficulty as floating point in Filter & PoW
Change the type of the 'difficulty' field in the Filter & ProofOfWork
proto objects from int32/bytes to double and make it use a linear scale,
in place of the original logarithmic scale which counts the (effective)
number of required zeros.

This allows fine-grained difficulty control for Equihash, though for
Hashcash it simply rounds up to the nearest power of 2 internally.

NOTE: This is a breaking change to PoW & filter serialisation (unlike
the earlier PR commits), as the proto field version nums aren't updated.
2021-11-26 04:08:15 +00:00
ghubstan
3077be54f0
Remove API createoffer's paymentAcctId request param (BSQ swap) 2021-11-25 16:12:05 -03:00
ghubstan
17277c4c67
Remove Get/Take BSQSwap Offer/Trade rpc service defs
The old GetTrade and TakeOffer rpc service defs will be used
for getting BSQ swap trades, and taking BSQ swap offers.
2021-11-24 12:52:58 -03:00
Steven Barclay
d8d8ec3f97
Add PoW version(-list) fields to ProofOfWork & Filter
Add a numeric version field to the 'ProofOfWork' protobuf object, along
with a list of allowed version numbers, 'enabled_pow_versions', to the
filter. The versions are taken to be in order of preference from most to
least preferred when creating a PoW, with an empty list signifying use
of the default algorithm only (that is, version 0: Hashcash).

An explicit list is used instead of an upper & lower version bound, in
case a new PoW algorithm (or changed algorithm params) turns out to
provide worse resistance than an earlier version.

(The fields are unused for now, to be enabled in a later commit.)
2021-11-24 15:07:42 +00:00
ghubstan
b65cc9c1f4
Merge branch 'master' into 1-basic-api-bsqswap-support 2021-11-23 17:02:49 -03:00
Christoph Atteneder
ef7ce109ac
Merge pull request #5834 from jmacxx/dispute_ui_add_penalty
Add penalty calculation to dispute agent UI
2021-11-18 17:57:54 +01:00