diff --git a/cli-examples/TakeOffer.sh b/cli-examples/TakeOffer.sh index ff68e56..b53b300 100755 --- a/cli-examples/TakeOffer.sh +++ b/cli-examples/TakeOffer.sh @@ -2,11 +2,13 @@ source "env.sh" # Take a BSQ swap offer. -$BISQ_HOME/bisq-cli --password=xyz --port=9998 takeoffer --offer-id=8368b2e2-anb6-4ty9-ab09-3ebdk34f2aea +# The amount param is optional. +$BISQ_HOME/bisq-cli --password=xyz --port=9998 takeoffer --offer-id=8368b2e2-anb6-4ty9-ab09-3ebdk34f2aea --amount=0.1 # Take an offer that is not a BSQ swap offer. -# The payment-account-id param is required, the fee-currency param is optional. +# The payment-account-id param is required, the amount and fee-currency params are optional. $BISQ_HOME/bisq-cli --password=xyz --port=9998 takeoffer \ --offer-id=83e8b2e2-51b6-4f39-a748-3ebd29c22aea \ --payment-account-id=fe20cdbd-22be-4b8a-a4b6-d2608ff09d6e \ + --amount=0.08 \ --fee-currency=BTC diff --git a/java-examples/gradle/README.md b/java-examples/gradle/README.md new file mode 100644 index 0000000..765aa05 --- /dev/null +++ b/java-examples/gradle/README.md @@ -0,0 +1,27 @@ +# How to upgrade the Gradle version + +Visit the [Gradle website](https://gradle.org/releases) and decide the: + + - desired version + - desired distribution type + - what is the sha256 for the version and type chosen above + +Adjust the following command with tha arguments above and execute it twice: + +```asciidoc +$ ./gradlew wrapper --gradle-version 7.5 \ + --distribution-type bin \ + --gradle-distribution-sha256-sum cb87f222c5585bd46838ad4db78463a5c5f3d336e5e2b98dc7c0c586527351c2 +``` + +The first execution should automatically update: + +- `java-examples/gradle/wrapper/gradle-wrapper.properties` + +The second execution should then update: + +- `java-examples/gradle/wrapper/gradle-wrapper.jar` +- `java-examples/gradlew` +- `java-examples/gradlew.bat` + +The four updated files are ready to be committed. diff --git a/java-examples/gradle/wrapper/gradle-wrapper.properties b/java-examples/gradle/wrapper/gradle-wrapper.properties index 5925064..012d6d9 100644 --- a/java-examples/gradle/wrapper/gradle-wrapper.properties +++ b/java-examples/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=b586e04868a22fd817c8971330fec37e298f3242eb85c374181b12d637f80302 -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionSha256Sum=cb87f222c5585bd46838ad4db78463a5c5f3d336e5e2b98dc7c0c586527351c2 +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/java-examples/gradlew b/java-examples/gradlew index 1b6c787..a69d9cb 100755 --- a/java-examples/gradlew +++ b/java-examples/gradlew @@ -205,6 +205,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/java-examples/gradlew.bat b/java-examples/gradlew.bat index ac1b06f..53a6b23 100644 --- a/java-examples/gradlew.bat +++ b/java-examples/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/java-examples/src/main/java/bisq/rpccalls/TakeOffer.java b/java-examples/src/main/java/bisq/rpccalls/TakeOffer.java index bf1e17b..fc9692f 100644 --- a/java-examples/src/main/java/bisq/rpccalls/TakeOffer.java +++ b/java-examples/src/main/java/bisq/rpccalls/TakeOffer.java @@ -28,7 +28,8 @@ public class TakeOffer extends BaseJavaExample { var offerCategory = offersStub.getOfferCategory(getOfferCategoryRequest); // Create a takeoffer request builder with just the offerId parameter. var takeOfferRequestBuilder = TakeOfferRequest.newBuilder() - .setOfferId("83e8b2e2-51b6-4f39-a748-3ebd29c22aea"); + .setOfferId("83e8b2e2-51b6-4f39-a748-3ebd29c22aea") + .setAmount(1_000_000L); // 1 million satoshis = 0.01 BTC // If offer is not a BSQ swap offer, add the paymentAccountId and takerFeeCurrencyCode parameters. if (!offerCategory.equals(BSQ_SWAP)) takeOfferRequestBuilder diff --git a/python-examples/bisq/rpccalls/take_offer.py b/python-examples/bisq/rpccalls/take_offer.py index 4ad872c..b77c3a4 100644 --- a/python-examples/bisq/rpccalls/take_offer.py +++ b/python-examples/bisq/rpccalls/take_offer.py @@ -8,7 +8,7 @@ import bisq.api.grpc_pb2_grpc as bisq_service def main(): - grpc_channel = grpc.insecure_channel('localhost:9999') + grpc_channel = grpc.insecure_channel('localhost:9998') grpc_offers_service_stub = bisq_service.OffersStub(grpc_channel) grpc_trades_service_stub = bisq_service.TradesStub(grpc_channel) api_password: str = 'xyz' # getpass("Enter API password: ") @@ -16,13 +16,17 @@ def main(): # We need to send our payment account id and an (optional) taker fee currency code if offer # is not a BSQ swap offer. Find out by calling GetOfferCategory before taking the offer. get_offer_category_response = grpc_offers_service_stub.GetOfferCategory.with_call( - bisq_messages.GetOfferCategoryRequest(id='4940749-73a2e9c3-d5b9-440a-a05d-9feb8e8805f0-182'), + bisq_messages.GetOfferCategoryRequest(id='MGAQRIJJ-3aba77be-588c-4f98-839e-53fac183b823-194'), metadata=[('password', api_password)]) offer_category = get_offer_category_response[0].offer_category is_bsq_swap = offer_category == bisq_messages.GetOfferCategoryReply.BSQ_SWAP - take_offer_request = bisq_messages.TakeOfferRequest(offer_id='4940749-73a2e9c3-d5b9-440a-a05d-9feb8e8805f0-182') + take_offer_request = bisq_messages.TakeOfferRequest( + offer_id='MGAQRIJJ-3aba77be-588c-4f98-839e-53fac183b823-194', + # 10 million satoshis = 0.1 BTC + amount=10000000 + ) if not is_bsq_swap: - take_offer_request.payment_account_id = '44838060-ddb5-4fa4-8b34-c128a655316e' + take_offer_request.payment_account_id = '88892636-81a1-4864-a396-038297e112cf' take_offer_request.taker_fee_currency_code = 'BSQ' response = grpc_trades_service_stub.TakeOffer.with_call( take_offer_request, diff --git a/reference-doc-builder/gradle/README.md b/reference-doc-builder/gradle/README.md new file mode 100644 index 0000000..c051020 --- /dev/null +++ b/reference-doc-builder/gradle/README.md @@ -0,0 +1,27 @@ +# How to upgrade the Gradle version + +Visit the [Gradle website](https://gradle.org/releases) and decide the: + + - desired version + - desired distribution type + - what is the sha256 for the version and type chosen above + +Adjust the following command with tha arguments above and execute it twice: + +```asciidoc +$ ./gradlew wrapper --gradle-version 7.5 \ + --distribution-type bin \ + --gradle-distribution-sha256-sum cb87f222c5585bd46838ad4db78463a5c5f3d336e5e2b98dc7c0c586527351c2 +``` + +The first execution should automatically update: + +- `reference-doc-builder/gradle/wrapper/gradle-wrapper.properties` + +The second execution should then update: + +- `reference-doc-builder/gradle/wrapper/gradle-wrapper.jar` +- `reference-doc-builder/gradlew` +- `reference-doc-builder/gradlew.bat` + +The four updated files are ready to be committed. diff --git a/reference-doc-builder/gradle/wrapper/gradle-wrapper.properties b/reference-doc-builder/gradle/wrapper/gradle-wrapper.properties index 5925064..012d6d9 100644 --- a/reference-doc-builder/gradle/wrapper/gradle-wrapper.properties +++ b/reference-doc-builder/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=b586e04868a22fd817c8971330fec37e298f3242eb85c374181b12d637f80302 -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionSha256Sum=cb87f222c5585bd46838ad4db78463a5c5f3d336e5e2b98dc7c0c586527351c2 +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/reference-doc-builder/gradlew b/reference-doc-builder/gradlew index 1b6c787..a69d9cb 100755 --- a/reference-doc-builder/gradlew +++ b/reference-doc-builder/gradlew @@ -205,6 +205,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/reference-doc-builder/gradlew.bat b/reference-doc-builder/gradlew.bat index ac1b06f..53a6b23 100644 --- a/reference-doc-builder/gradlew.bat +++ b/reference-doc-builder/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal