Commit Graph

379 Commits

Author SHA1 Message Date
ghubstan
4ca878a8e1
Adjust API 'gettrade' for Bsq swaps
- 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.
2021-11-14 13:48:12 -03:00
ghubstan
564303ac20
Normalize API gRPC bsq-swap related protos & wrappers
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.
2021-11-12 18:48:35 -03:00
ghubstan
c5f50b53e4
Paritally adjust bsq-swap-offer related apitest cases
- Adjust to removal of BsqSwapOfferInfo proto, use ammended OfferInfo instead.
- Remove currency-code param from all get(My)BsqSwapOffer(s) requests.
2021-11-11 13:24:45 -03:00
ghubstan
4f1899265f
Fix conflicts from previous master/merge 2021-11-09 09:48:33 -03:00
ghubstan
20cc085dc8
Merge branch 'master' into 02-cli-console-formatting-api 2021-11-09 09:20:06 -03:00
ghubstan
ec09d39832
Adjust apitest cases to new CLI console output api 2021-11-07 14:00:52 -03:00
ghubstan
eb234bf93a
Remove apitest's create bsq-swap account method
If not present, a default BSQ swap account is saved when a User object
is initialized.  Use the existing default account in API bsq-swap test
cases, and rename the legacy BSQ payment account fixtures to distinguish
them from the new default 'BSQ Swap' payment account.
2021-11-05 13:59:41 -03:00
chimp1984
aad658fc94
Add api test, Cleanup 2021-11-04 12:48:07 +01:00
chimp1984
d5d3a85bfb
Apply patch from @ghubstan 2021-11-02 16:18:50 +01:00
chimp1984
2f5c644aa3
Apply patch from @ghubstan 2021-11-02 16:18:50 +01:00
chimp1984
8ee8cba668
Apply patch from ghubstan
Remove currency params. Bsq swaps have statically defined currencies (BSQ/BTC).
2021-11-02 16:18:50 +01:00
chimp1984
74789b1cc5
Move Utilities.objectToJson to JsonUtil.objectToJson
Move inner class AnnotationExclusionStrategy to JsonUtil
Next commit includes changes why that move to core is needed.
2021-11-02 16:18:50 +01:00
chimp1984
f7fcaa915e
Add BSQ swap code 2021-11-02 16:18:50 +01:00
chimp1984
54f17b00af
Cleanups 2021-10-21 17:44:48 +02:00
chimp1984
611b944609
Move protobuf OfferPayload.Direction to OfferDirection 2021-10-21 15:40:25 +02:00
chimp1984
88198be7ff
Rename availableConfirmedBalance to availableBalance
It does not include only confirmed txs as we include
the unconfirmed own change outputs.
2021-10-20 13:25:29 +02:00
chimp1984
777287af95
Cleanups, refromatting, add final qualifier 2021-10-20 11:58:04 +02:00
chimp1984
d42242762f
Move Trade to bisq.core.trade.model.bisq_v1 package 2021-10-20 11:58:04 +02:00
Christoph Atteneder
d0dd91906d
Merge pull request #5708 from ghubstan/close-bobs-trade-in-api-trade-simulator
Call 'keepfunds' (close trade) on both sides of trade simulation
2021-09-27 11:19:03 +02:00
ghubstan
41f55b0650
Add custom bisq.properties to API test harness
This change adds a bisq.properties file to apitest/src/main/resources,
and makes sure it is copied to regtest/dev bisq instances' app data dirs
before they are started.  By default it is empty, but can be used to
override default BisqApp options during ad-hoc testing.

The change was necessary because the core's bisq.properties resource is
not copied to test harness bisq instance's regtest data dirs during a normal
build.
2021-09-22 18:40:57 -03:00
ghubstan
bfff30bcdd
Call 'keepfunds' (close trade) on both sides of trade simulation 2021-09-20 12:09:38 -03:00
ghubstan
429e943a36
Add TODO commment above placeholder for future swift test
Resolves https://github.com/bisq-network/bisq/pull/5685#discussion_r710005619.
2021-09-16 08:57:31 -03:00
ghubstan
343b14ec0a
Set apitest test case log level to INFO 2021-09-07 11:34:48 -03:00
ghubstan
ab929d4435
Remove spurious PaymentAccount#canSupportMultipleCurrencies()
Method was added on the false assumption `PaymentAccount#hasMultipleCurrencies()`
would not always return a correct value when a `PaymentAccount` instance is created
via reflection.  But `hasMultipleCurrencies()` will work as long as appropriate
PaymentAccount subclasses continue setting their `tradeCurrencies` fields within
their default constructors.
2021-09-07 11:31:56 -03:00
ghubstan
1adde70c7a
Do pay acct ccy checks, add tests, anticipate swift pay method
Define and verify trade currencies and selected trade currency values
in appropriate api test cases, and add test cases for new payment methods.
2021-09-06 12:27:39 -03:00
ghubstan
8a42109a7a
Override/disable gRPC call rate meters in test harness driver
Ad-hoc API testers need to be able to run the test harness without
interference from the production api method call rate meters.
This change overrides and disables most call rate meters when the
test harness is run from the ApiTestMain driver (no jupiter tests).
2021-09-02 15:37:50 -03:00
ghubstan
4a69b89dc7
Put ratemeters.json in resources/data dirs before they are copied to build dirs
This fixes an inconsistency in the scaffold setup.
2021-09-02 15:26:27 -03:00
ghubstan
7eb0a19651
Delete generated rate metering config files in cleanDaoSetup task 2021-09-02 15:20:32 -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
95bbb41e51
Add missing trigger-price param 2021-07-30 12:02:18 -03:00
ghubstan
b4ee6dbc12
Do not start test harness deamons in dbg mode by default 2021-07-30 11:58:12 -03:00
ghubstan
b8379e2003
Merge branch 'master' into 05-update-api-beta-test-guide 2021-07-30 11:53:34 -03:00
Christoph Atteneder
0b5f8edb1e
Increase MaxRam setting to 8g 2021-07-19 20:51:13 +02:00
Christoph Atteneder
14d9ee493f
Update remaining Java max ram default settings 2021-07-19 15:48:26 +02:00
ghubstan
a4278a4147
Fix typo 'enabled' -> 'enable' 2021-07-13 10:32:35 -03:00
ghubstan
622f7e9add
Remove old TODO because relevant refactoring was approved 2021-07-12 11:39:53 -03:00
ghubstan
1992bcb1c0
Do not duplicate Price.parse on CLI side for only one use case 2021-07-12 11:34:37 -03:00
ghubstan
06efcdfcb9
Delete tmp main() method 2021-07-11 12:08:40 -03:00
Christoph Atteneder
e5765aeef2
Delay sending of payment account information during trade by @chimp1984
It also removes the op return from the multisig transaction
2021-06-28 09:47:52 +02:00
ghubstan
05f4f4dd80
Fix header 2021-06-19 13:35:40 -03:00
ghubstan
9703b87379
Document api 'editoffer' usage 2021-06-19 13:27:02 -03:00
ghubstan
7880a84a00
Add BSQ offer editing tests to EditOfferTest
And log CLI's getoffer output to see getoffer formatting -- after adding
new ENABLED and TRIGGER-PRICE columns.
2021-06-18 17:52:03 -03:00
ghubstan
a3ea4ecbf6
Avoid duplicate test run 2021-06-15 13:22:07 -03:00
ghubstan
bc1576efbc
Throw exception is edit altcoin offer is attempted
Support for editing BSQ offers is in place, but will be added
in another PR.
2021-06-15 13:13:52 -03:00
ghubstan
063b52eb70
Add editoffer test case, suppress annoying warnings 2021-06-15 11:39:06 -03:00
ghubstan
54efad097d
Fix codacy issue 2021-06-13 14:05:00 -03:00
ghubstan
05f3985447
Fix problems found in codacy check 2021-06-13 13:54:16 -03:00
ghubstan
9a5e2d0df1
Remove unused import 2021-06-13 13:12:45 -03:00
ghubstan
571568a5e5
Remove chase quickpay acct test 2021-06-13 13:10:41 -03:00
ghubstan
929b28cb8c
Add editoffer api tests & minor apitest refactoring 2021-06-13 13:00:27 -03:00
ghubstan
2b1a7aac82
Remove unsupported create CHASE_QUICK_PAY apitest case 2021-06-12 17:46:55 -03:00
ghubstan
984aac713d
Fix NetworkParameters.fromID( incorrect-arg -> correct-arg ) 2021-04-28 12:22:26 -03:00
ghubstan
38eee59375
Fix flaky tx fee rate validation test (api)
Min tx fee rates move fast, sometimes so low the validation test fails.
Try to consistently force validation error by setting fee rate=1.
2021-04-28 12:01:25 -03:00
ghubstan
81f345b9ea
Fix bsq wallet testcase setup (api)
Regtest btc block was not being generated, and chain download not triggered.
Also ajusted testGetUnusedBsqAddress() for upcoming segwit bsq changes.
2021-04-28 12:00:54 -03:00
ghubstan
cff5e8163e
Update apitest docs for bitcoin-core v0.21 compat
The test harness is compatible with bitcoin-core 0.19, 0.20, 0.21.

Also removed some unnecessary comments about registering dispute
agents in the test harness because it now happens by default.
2021-04-19 12:35:13 -03: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
126885d570
Test BSQ/BTC trade pair
- Added CreateBSQOffersTest, TakeBuyBSQOfferTest, TakeSellBSQOfferTest.
  The first tests bsq offer creation, the second & third test bsq trade
  protocol, and includes bsq payment verification checks.

- Made test dispute agent registration a test harness opt.
  It was a test case option, now it happens by default.

- Moved some global test constants into ApiTestConfig.
  Adjusted affected test cases.
2021-04-15 14:23:32 -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
152f4591eb
Remove unused parameter 2021-03-26 11:04:51 -03:00
ghubstan
780be1a93c
Adjust maker gettrade output checks to new column
The number of gettrade output columns are the same for makers and takers.
2021-03-26 10:58:47 -03:00
Steven Barclay
f21379160b
Merge branch 'release/v1.6.0' into implement-segwit-for-bsq 2021-03-20 23:18:49 +00:00
ghubstan
e963391a87
Print trade info to console after successful trade 2021-03-19 21:21:09 +01:00
ghubstan
39cda43208
Add LongRunningTradesTest
This new api testcase can run long series' of regtest trades by looping
over modified TakeBuyBTCOfferTest and TakeSellBTCOfferTest cases.  The
purpose is to help reproduce problems and isolate bugs Bisq's core and
api layers.

LongRunningTradesTest is not enabled by default;  it will not run in a
default test environment (such a Travis CI).  Enviornment variable
LONG_RUNNING_TRADES_TEST_ENABLED must exist for the test to run.
The env variable can be set in a bash shell before running the test
case in a shell (using a gradle command), or the environment variable can
be set in an Intellij test launcher's Evironment variables field.

The modifed (short running) TakeBuyBTCOfferTest and TakeSellBTCOfferTest
cases run as before.

Changes include:

- Add static boolean isLongRunningTest to AbstractOfferTest.

- Add looping control Supplier maxTradeStateAndPhaseChecks to AbstractTradeTest.
  It uses the isLongRunningTest flag in the superclass to help define the
  wait times for trade state/phase changes during short and long running tests.

- Made AbstractTradeTest assert(true, trade.isDepositPublished) conditional upon
  isLongRunningTest value.  Long running trade test asserts have to be looser due
  to increasing latency of wallet, offer and trade operations in the server as the
  trade counts increase.

- Overload ApiTestCase#startSupportingApps with additional flag:
  startSupportingAppsInDebugMode. Default is false.  This makes
  starting background apps in debug mode a bit more convenient
  and self explanatory.
2021-03-19 21:21:02 +01:00
ghubstan
56345a2256
Add missing grpc exception catch blocks 2021-03-19 19:37:31 +01:00
sqrrm
53f42c4885
Merge pull request #5303 from ghubstan/03-add-long-running-trade-test
Add LongRunningTradesTest to apitest
2021-03-19 12:20:00 +01:00
sqrrm
1c3fc41c33
Merge pull request #5294 from ghubstan/01-fix-takeoffer-err-handling
Improve takeoffer error handing
2021-03-19 11:55:18 +01:00
ghubstan
0b22c98802
Disambiguate payment acct json form's "country" field
Make it clear the user needs to enter a two letter country code
in json form's "country" field, not a country name.

The json form's field name was not changed to "countryCode" in
this change for the following reason:

The API's payment account forms are dynamically generated using
reflection, and PaymentAccount class hierarchy @Setter methods
determine which form fields are included or excluded.  Reflection
and @Setter methods are also used when reading completed json
forms, to set the field values on a new PaymentAccount instance
before it is persisted.

CountryBasedPaymentAccount subclasses have a country field and a
@Setter, not a countryCode field, hence this shortcut to informing
the user the country field value is a country-code.
2021-03-18 20:34:10 +01:00
ghubstan
67252642c7
Disambiguate payment acct json form's "country" field
Make it clear the user needs to enter a two letter country code
in json form's "country" field, not a country name.

The json form's field name was not changed to "countryCode" in
this change for the following reason:

The API's payment account forms are dynamically generated using
reflection, and PaymentAccount class hierarchy @Setter methods
determine which form fields are included or excluded.  Reflection
and @Setter methods are also used when reading completed json
forms, to set the field values on a new PaymentAccount instance
before it is persisted.

CountryBasedPaymentAccount subclasses have a country field and a
@Setter, not a countryCode field, hence this shortcut to informing
the user the country field value is a country-code.
2021-03-18 16:14:28 -03:00
ghubstan
14b2bc2544
Make codacy happy (I hope) 2021-03-18 14:49:57 -03:00
ghubstan
f732983d6c
Make multi-line bash command copy/pastable from rendered md 2021-03-18 14:20:47 -03:00
ghubstan
514e7b74ce
Refactor, include section about running on mainnet 2021-03-18 13:22:31 -03:00
ghubstan
ec65c010f7
Don't be polite 2021-03-18 13:12:32 -03:00
ghubstan
d07a26d560
Add missing withdrawfunds options 2021-03-18 12:58:26 -03:00
ghubstan
d3b5e1ee4b
Alternate ports to improve api/protocol guide 2021-03-18 12:56:18 -03:00
ghubstan
bc6c1769ec
Print trade info to console after successful trade 2021-03-14 13:40:34 -03:00
ghubstan
1f28fc6836
Add LongRunningTradesTest
This new api testcase can run long series' of regtest trades by looping
over modified TakeBuyBTCOfferTest and TakeSellBTCOfferTest cases.  The
purpose is to help reproduce problems and isolate bugs Bisq's core and
api layers.

LongRunningTradesTest is not enabled by default;  it will not run in a
default test environment (such a Travis CI).  Enviornment variable
LONG_RUNNING_TRADES_TEST_ENABLED must exist for the test to run.
The env variable can be set in a bash shell before running the test
case in a shell (using a gradle command), or the environment variable can
be set in an Intellij test launcher's Evironment variables field.

The modifed (short running) TakeBuyBTCOfferTest and TakeSellBTCOfferTest
cases run as before.

Changes include:

- Add static boolean isLongRunningTest to AbstractOfferTest.

- Add looping control Supplier maxTradeStateAndPhaseChecks to AbstractTradeTest.
  It uses the isLongRunningTest flag in the superclass to help define the
  wait times for trade state/phase changes during short and long running tests.

- Made AbstractTradeTest assert(true, trade.isDepositPublished) conditional upon
  isLongRunningTest value.  Long running trade test asserts have to be looser due
  to increasing latency of wallet, offer and trade operations in the server as the
  trade counts increase.

- Overload ApiTestCase#startSupportingApps with additional flag:
  startSupportingAppsInDebugMode. Default is false.  This makes
  starting background apps in debug mode a bit more convenient
  and self explanatory.
2021-03-14 13:08:53 -03:00
ghubstan
d4d989d680
Add missing grpc exception catch blocks 2021-03-10 14:17:05 -03:00
ghubstan
04b52f873e
Fix setSelectedCurrency bug, and replace unnecessary reflection usage
Commit de59c0a5f9 did not persist the
assigned selected currency, this fixes the bug.
2021-03-08 16:02:18 -03:00
ghubstan
75d81d9095
Avoid test run repetition, add warning supressions 2021-03-08 15:26:15 -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
b4f4d90e05
Add tradeCurrencies field to Transferwise acct form
These changes make tradeCurrencies a required twise acct form field.

Addresses issue https://github.com/bisq-network/bisq/issues/5281

- Added comment to PaymentAccountForm about special 'tradeCurrencies' field handling.
- Added support for Transferwise 'tradeCurrencies' to PaymentAccountTypeAdapter.
- Added instance of isTransferwiseAccount check to PaymentAccount.
- Added methods to CurrencyUtil to convert comma delimited code list to TradeCurrency list.
- Added methods to ReflectionUtil for getting fields and methods on class.
- Added required field check to CorePaymentAccountsService.
- Added CreatePaymentAccount test cases.
2021-03-08 14:47:30 -03:00
ghubstan
99fea74e09
Validate offer <-> payment-acct in createoffer
This change prohibits creation of new offers with incompatible payment
accounts with the api.

- PaymentAccountUtil
  Renamed isAnyTakerPaymentAccountValidForOffer -> isAnyPaymentAccountValidForOffer.
  Renmaed isTakerPaymentAccountValidForOffer -> isPaymentAccountValidForOffer.
  Deleted commented code.

- PaymentAccounts: Adjusted to PaymentAccountUtil method name changes.

- OfferFilter: Adjusted to PaymentAccountUtil method name changes.

- OfferBookViewModelTest: Adjusted to PaymentAccountUtil method name changes.

- Add CoreOffersService#verifyPaymentAccountIsValidForOffer

- ValidateCreateOfferTest, OfferTest: Added test cases.
2021-03-07 19:51:29 -03:00
ghubstan
a2000bdc33
Explain how to manually register test dispute agents 2021-03-03 12:44:29 -03:00
ghubstan
e0bf773564
Add link to api-beta-test-guide.md 2021-03-03 12:43:21 -03:00
ghubstan
3f84246f59
Improve interceptor's rate metering key definition and lookup
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.
2021-02-28 17:10:51 -03:00
ghubstan
19aed84910
Fix getunusedbsqaddress test 2021-02-27 22:58:22 -03:00
ghubstan
b618776b1b
Wait 3 secs after removing password (for wallet save) 2021-02-27 22:50:14 -03:00
ghubstan
3bbefffb9c
Adjust mainnet bats test to default rate meter interceptors 2021-02-27 22:38:38 -03:00
ghubstan
3feacf4580
Remove unused import 2021-02-27 22:25:49 -03:00
ghubstan
724950926c
No need to wait, default+test call rate > 2x / second 2021-02-27 21:57:53 -03:00
ghubstan
675ce9813e
Make test call rate = default call rate 2021-02-27 21:56:19 -03:00
ghubstan
6b2c386a7c
Fix call rate metering interceptor bug
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.
2021-02-27 21:47:52 -03:00
ghubstan
e8d1f03792
Clean up call rate meter config file in test teardown 2021-02-27 18:10:06 -03:00
ghubstan
98ff6cf9ef
Fix test bug 2021-02-27 18:01:45 -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
6c0eac8942
Fix param order 2021-02-26 08:24:16 -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
b725f06514
Adjust api to new minimum fee per vbyte
The BaseCurrencyNetwork#getDefaultMinFeePerVbyte now returns
15 (sats/byte) since commit b341bb6e89.

This change adjusts the api to the new min tx fee rate by validating
the api's setTxFeeRatePreference param, and throwing an appropirate
exception if the param value is below the minimum.  Also adjusted a broken
test, and added a new test to check the appropriate exception is received
from the server.
2021-02-25 11:31:13 -03:00
ghubstan
4ac9fa5b8d
Add --help option to bot-script.json generator 2021-02-20 16:37:06 -03:00
ghubstan
9e48c32d40
Fix manual shutdown exception handling
Codacy is right.  Don't use instance of ex, add a catch clause.
Also removed an unnecessary fully qualified name 'String.format'.
2021-02-18 13:58:58 -03:00