diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 51c36de7f..2144052f2 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -51,11 +51,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v7.0.1 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + uses: github/codeql-action/init@v4 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -66,7 +66,7 @@ jobs: # queries: security-extended,security-and-quality - name: Set up JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v6.1.0 with: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.JAVA_DISTRIBUTION }} @@ -85,6 +85,6 @@ jobs: # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + uses: github/codeql-action/analyze@v4 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/sbom.yml b/.github/workflows/sbom.yml index c3a0aa10f..edb10fd33 100644 --- a/.github/workflows/sbom.yml +++ b/.github/workflows/sbom.yml @@ -17,6 +17,6 @@ jobs: id-token: write steps: - name: Checkout repository - uses: actions/checkout@v6 + uses: actions/checkout@v7.0.1 - name: Fetch and submit SBOM uses: SCF-Public-Goods-Maintenance/pg-atlas-sbom-action@main \ No newline at end of file diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 1a24d4096..379f125e0 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -36,16 +36,16 @@ jobs: --health-retries 50 steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v7.0.1 - name: Set up JDK - uses: actions/setup-java@v4 + uses: actions/setup-java@v6.1.0 with: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.JAVA_DISTRIBUTION }} - name: Test run: ./gradlew check - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v7.1.1 with: token: ${{ secrets.CODECOV_TOKEN }} @@ -54,16 +54,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v7.0.1 - name: Set up JDK - uses: actions/setup-java@v4 + uses: actions/setup-java@v6.1.0 with: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.JAVA_DISTRIBUTION }} - name: Build run: ./gradlew build -x test -x jacocoTestReport - name: Persist JAR Artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.2 with: name: libs path: build/libs/*.jar @@ -73,16 +73,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v7.0.1 - name: Set up JDK - uses: actions/setup-java@v4 + uses: actions/setup-java@v6.1.0 with: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.JAVA_DISTRIBUTION }} - name: Generate Documentation run: ./gradlew javadoc - name: Persist Documentation - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7.0.2 with: name: javadoc path: javadoc @@ -101,9 +101,9 @@ jobs: ] steps: - name: checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7.0.1 - name: Download JAR Artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.2 with: name: libs path: android_test/app/libs/ @@ -112,12 +112,12 @@ jobs: echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules sudo udevadm control --reload-rules sudo udevadm trigger --name-match=kvm - - uses: actions/setup-java@v4 + - uses: actions/setup-java@v6.1.0 with: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.JAVA_DISTRIBUTION }} - name: run tests - uses: reactivecircus/android-emulator-runner@v2 + uses: reactivecircus/android-emulator-runner@v2.38.0 with: working-directory: ./android_test api-level: ${{ matrix.emulator.api-level }} @@ -134,27 +134,27 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v7.0.1 - name: Download JAR Artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.2 with: name: libs path: libs - name: Download Java Documentation - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8.0.2 with: name: javadoc path: javadoc - name: Archive Documentation run: tar -czf stellar-sdk-javadoc.tar.gz javadoc - name: Upload artifacts to GitHub Release - uses: softprops/action-gh-release@v2 + uses: softprops/action-gh-release@v3.0.3 with: files: | libs/*.jar stellar-sdk-javadoc.tar.gz - name: Upload Documentation to GitHub Pages - uses: JamesIves/github-pages-deploy-action@v4 + uses: JamesIves/github-pages-deploy-action@v4.9.0 with: folder: javadoc @@ -170,11 +170,11 @@ jobs: SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v7.0.1 - name: Set up JDK - uses: actions/setup-java@v4 + uses: actions/setup-java@v6.1.0 with: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.JAVA_DISTRIBUTION }} - name: Publish to Maven Central - run: ./gradlew publishAllPublicationsToCentralPortal + run: ./gradlew publishAggregationToCentralPortal diff --git a/.github/workflows/xdr-generator-snapshot-test.yml b/.github/workflows/xdr-generator-snapshot-test.yml index 918f8f466..eeb6965c8 100644 --- a/.github/workflows/xdr-generator-snapshot-test.yml +++ b/.github/workflows/xdr-generator-snapshot-test.yml @@ -17,6 +17,6 @@ jobs: snapshot-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7.0.1 - name: Run XDR generator snapshot tests run: make xdr-generator-test diff --git a/android_test/app/build.gradle.kts b/android_test/app/build.gradle.kts index 42aeda92d..d7a3cd7d8 100644 --- a/android_test/app/build.gradle.kts +++ b/android_test/app/build.gradle.kts @@ -69,12 +69,12 @@ dependencies { // Since we are adding local jar(libs/stellar-sdk.jar) as dependency, // gradle cannot automatically download the required third-party dependencies. implementation(files("libs/stellar-sdk-5.0.0.jar")) - implementation("com.squareup.okhttp3:okhttp:4.11.0") - implementation("com.squareup.okhttp3:okhttp-sse:4.11.0") + implementation("com.squareup.okhttp3:okhttp:4.12.1") + implementation("com.squareup.okhttp3:okhttp-sse:4.12.1") implementation("com.moandjiezana.toml:toml4j:0.7.2") - implementation("com.google.code.gson:gson:2.11.0") - implementation("org.bouncycastle:bcprov-jdk18on:1.78.1") - implementation("commons-codec:commons-codec:1.17.1") + implementation("com.google.code.gson:gson:2.15.0") + implementation("org.bouncycastle:bcprov-jdk18on:1.86") + implementation("commons-codec:commons-codec:1.23.0") testImplementation("junit:junit:4.13.2") androidTestImplementation("androidx.test.uiautomator:uiautomator:2.3.0-alpha03") androidTestImplementation("androidx.test.ext:junit:1.1.5") diff --git a/build.gradle.kts b/build.gradle.kts index fac45d80a..0dc9916c8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,11 +4,10 @@ plugins { id("signing") id("maven-publish") id("project-report") - id("com.diffplug.spotless") version "8.7.0" - id("com.github.ben-manes.versions") version "0.54.0" - id("io.freefair.lombok") version "9.5.0" - id("com.gradleup.nmcp").version("1.6.0") - kotlin("jvm") version "2.4.0" + id("com.diffplug.spotless") version "8.10.4" + id("io.github.ben-manes.versions") version "0.66.0" + id("io.freefair.lombok") version "9.8.2" + kotlin("jvm") version "2.4.21" } group = "network.lightsail" @@ -38,30 +37,30 @@ spotless { } kotlin { target("src/test/kotlin/**/*.kt") - ktfmt("0.56").googleStyle() + ktfmt("0.64").googleStyle() } } dependencies { - val okhttpVersion = "4.12.0" + val okhttpVersion = "4.12.1" implementation("com.squareup.okhttp3:okhttp:${okhttpVersion}") implementation("com.squareup.okhttp3:okhttp-sse:${okhttpVersion}") implementation("com.moandjiezana.toml:toml4j:0.7.2") - implementation("com.google.code.gson:gson:2.14.0") - implementation("org.bouncycastle:bcprov-jdk18on:1.84") - implementation("commons-codec:commons-codec:1.22.0") + implementation("com.google.code.gson:gson:2.15.0") + implementation("org.bouncycastle:bcprov-jdk18on:1.86") + implementation("commons-codec:commons-codec:1.23.0") testImplementation(kotlin("stdlib")) - testImplementation("org.mockito:mockito-core:5.23.0") + testImplementation("org.mockito:mockito-core:5.24.0") testImplementation("com.squareup.okhttp3:mockwebserver:${okhttpVersion}") testImplementation("junit:junit:4.13.2") - testImplementation("org.bouncycastle:bcpkix-jdk18on:1.84") // mock https - testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.11.3") + testImplementation("org.bouncycastle:bcpkix-jdk18on:1.86") // mock https + testRuntimeOnly("org.junit.vintage:junit-vintage-engine:6.1.3") testRuntimeOnly("org.junit.platform:junit-platform-launcher") - testImplementation("io.kotest:kotest-runner-junit5:6.1.11") - testImplementation("io.kotest:kotest-assertions-core:6.1.11") + testImplementation("io.kotest:kotest-runner-junit5:6.2.6") + testImplementation("io.kotest:kotest-assertions-core:6.2.6") } tasks { @@ -79,12 +78,12 @@ tasks { dependsOn(testClasses) } - val sourcesJar by registering(Jar::class) { + val sourcesJar = register("sourcesJar") { archiveClassifier = "sources" from(sourceSets.main.get().allSource) } - val uberJar by registering(Jar::class) { + val uberJar = register("uberJar") { // https://docs.gradle.org/current/userguide/working_with_files.html#sec:creating_uber_jar_exampl archiveClassifier = "uber" duplicatesStrategy = DuplicatesStrategy.EXCLUDE @@ -108,7 +107,7 @@ tasks { } } - val javadocJar by registering(Jar::class) { + val javadocJar = register("javadocJar") { archiveClassifier = "javadoc" dependsOn(javadoc) from(javadoc.get().destinationDir) // It needs to be placed after the javadoc task, otherwise it cannot read the path we set. @@ -196,7 +195,7 @@ publishing { signing { - val publishCommand = "publishAllPublicationsToCentralPortal" + val publishCommand = "publishAggregationToCentralPortal" isRequired = gradle.startParameter.taskNames.contains(publishCommand) println("Need to sign? $isRequired") // https://docs.gradle.org/current/userguide/signing_plugin.html#using_in_memory_ascii_armored_openpgp_subkeys @@ -211,14 +210,3 @@ signing { useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) sign(publishing.publications["mavenJava"]) } - -nmcp { - publishAllPublicationsToCentralPortal { - username = System.getenv("SONATYPE_USERNAME") - password = System.getenv("SONATYPE_PASSWORD") - // publish manually from the portal - publishingType = "USER_MANAGED" - // or if you want to publish automatically - // publishingType = "AUTOMATIC" - } -} diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index 71f29f116..6adefd484 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -1,6 +1,6 @@ plugins { id("java") - id("com.diffplug.spotless") version "6.24.0" + id("com.diffplug.spotless") version "8.10.4" } @@ -23,7 +23,7 @@ spotless { dependencies { // Use https://central.sonatype.com/artifact/network.lightsail/stellar-sdk in prod. implementation("network.lightsail:stellar-sdk:5.0.0") - testImplementation(platform("org.junit:junit-bom:5.10.0")) + testImplementation(platform("org.junit:junit-bom:6.1.3")) testImplementation("org.junit.jupiter:junit-jupiter") } diff --git a/examples/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/wrapper/gradle-wrapper.jar index 249e5832f..9fa7f2882 100644 Binary files a/examples/gradle/wrapper/gradle-wrapper.jar and b/examples/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/wrapper/gradle-wrapper.properties index b5c052432..91c4fc64a 100644 --- a/examples/gradle/wrapper/gradle-wrapper.properties +++ b/examples/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,9 @@ -#Wed Jul 03 20:45:55 CST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.2-bin.zip +networkTimeout=10000 +retries=0 +retryBackOffMs=500 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/examples/gradlew b/examples/gradlew index 1b6c78733..249efbb03 100755 --- a/examples/gradlew +++ b/examples/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,10 +15,12 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # -# Gradle start up script for POSIX generated by Gradle. +# gradlew start up script for POSIX generated by Gradle. # # Important for running: # @@ -27,7 +29,7 @@ # bash, then to run this script, type that shell name before the whole # command line, like: # -# ksh Gradle +# ksh gradlew # # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +82,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -133,22 +132,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -165,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -193,18 +198,27 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" +# 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/examples/gradlew.bat b/examples/gradlew.bat index 107acd32c..3185a43f7 100644 --- a/examples/gradlew.bat +++ b/examples/gradlew.bat @@ -13,19 +13,49 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem -@rem Gradle startup script for Windows +@rem gradlew startup script for Windows @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions + +@rem Catch executions from older scripts and ensure they exit cleanly. +@rem This can be removed once we can be reasonably confident that few people +@rem will be migrating directly to this new wrapper. +goto afterSafetyNet +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +goto exitWithErrorLevel +:afterSafetyNet set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,15 +70,16 @@ 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. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. -goto fail +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -56,34 +87,26 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. -goto fail +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="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 -:mainEnd -if "%OS%"=="Windows_NT" endlocal +@rem Execute gradlew +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel & goto exitWithErrorLevel -:omega +@rem This label must not be changed. We rely on old scripts being able to jump to this point. +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/examples/src/main/java/network/lightsail/CheckStellarAssetContract.java b/examples/src/main/java/network/lightsail/CheckStellarAssetContract.java index 918cb19c2..9265c07e4 100644 --- a/examples/src/main/java/network/lightsail/CheckStellarAssetContract.java +++ b/examples/src/main/java/network/lightsail/CheckStellarAssetContract.java @@ -6,7 +6,6 @@ import org.stellar.sdk.responses.sorobanrpc.GetLedgerEntriesResponse; import org.stellar.sdk.scval.Scv; import org.stellar.sdk.xdr.ContractDataDurability; -import org.stellar.sdk.xdr.LedgerEntry.LedgerEntryData; import org.stellar.sdk.xdr.LedgerEntryType; import org.stellar.sdk.xdr.LedgerKey; import org.stellar.sdk.xdr.LedgerKey.LedgerKeyContractData; diff --git a/examples/src/main/java/network/lightsail/SorobanCreateContract.java b/examples/src/main/java/network/lightsail/SorobanCreateContract.java index d7be45064..155515b0c 100644 --- a/examples/src/main/java/network/lightsail/SorobanCreateContract.java +++ b/examples/src/main/java/network/lightsail/SorobanCreateContract.java @@ -56,15 +56,8 @@ public static void main(String[] args) throws IOException { System.out.println("Transaction succeeded: " + getTransactionResponse); // parse the function return value TransactionMeta transactionMeta = getTransactionResponse.parseResultMetaXdr(); - byte[] hash = - transactionMeta - .getV3() - .getSorobanMeta() - .getReturnValue() - .getAddress() - .getContractId() - .getHash(); - String contractId = StrKey.encodeContract(hash); + String contractId = + Address.fromSCVal(transactionMeta.getV4().getSorobanMeta().getReturnValue()).toString(); System.out.println("Contract ID: " + contractId); } else { System.out.println("Transaction failed: " + getTransactionResponse); diff --git a/examples/src/main/java/network/lightsail/SorobanInvokeContractFunction.java b/examples/src/main/java/network/lightsail/SorobanInvokeContractFunction.java index 04d4c4753..7f13ab089 100644 --- a/examples/src/main/java/network/lightsail/SorobanInvokeContractFunction.java +++ b/examples/src/main/java/network/lightsail/SorobanInvokeContractFunction.java @@ -30,7 +30,7 @@ public static void main(String[] args) throws IOException { // The invoke host function operation // https://github.com/stellar/soroban-examples/tree/main/hello_world - String contractId = "CDZJVZWCY4NFGHCCZMX6QW5AK3ET5L3UUAYBVNDYOXDLQXW7PHXGYOBJ"; + String contractId = "CDSMG6PNJYIPIWFIDQVLCOXMQPZU73FSBCTMBDGBGFLF7WPLJMASODYX"; String functionName = "hello"; List parameters = List.of(Scv.toString("World!")); // Scv is a helper class to create SCVal objects @@ -98,7 +98,7 @@ public static void main(String[] args) throws IOException { System.out.println("Transaction succeeded: " + getTransactionResponse); // parse the function return value TransactionMeta transactionMeta = getTransactionResponse.parseResultMetaXdr(); - SCVal rawReturnValue = transactionMeta.getV3().getSorobanMeta().getReturnValue(); + SCVal rawReturnValue = transactionMeta.getV4().getSorobanMeta().getReturnValue(); System.out.println("Raw return value: " + rawReturnValue); List vec = Scv.fromVec(rawReturnValue).stream().toList(); String returnValue0 = new String(Scv.fromString(vec.get(0)), StandardCharsets.UTF_8); diff --git a/examples/src/main/java/network/lightsail/SorobanUploadWasm.java b/examples/src/main/java/network/lightsail/SorobanUploadWasm.java index 9008da0e3..8eaf38f16 100644 --- a/examples/src/main/java/network/lightsail/SorobanUploadWasm.java +++ b/examples/src/main/java/network/lightsail/SorobanUploadWasm.java @@ -61,7 +61,7 @@ public static void main(String[] args) throws IOException { // parse the function return value TransactionMeta transactionMeta = getTransactionResponse.parseResultMetaXdr(); byte[] wasmId = - transactionMeta.getV3().getSorobanMeta().getReturnValue().getBytes().getSCBytes(); + transactionMeta.getV4().getSorobanMeta().getReturnValue().getBytes().getSCBytes(); System.out.println("Wasm ID: " + Util.bytesToHex(wasmId).toLowerCase()); } else { System.out.println("Transaction failed: " + getTransactionResponse); diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index d997cfc60..9fa7f2882 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a351597e6..91c4fc64a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,9 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.2-bin.zip networkTimeout=10000 +retries=0 +retryBackOffMs=500 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 739907dfd..249efbb03 100755 --- a/gradlew +++ b/gradlew @@ -20,7 +20,7 @@ ############################################################################## # -# Gradle start up script for POSIX generated by Gradle. +# gradlew start up script for POSIX generated by Gradle. # # Important for running: # @@ -29,7 +29,7 @@ # bash, then to run this script, type that shell name before the whole # command line, like: # -# ksh Gradle +# ksh gradlew # # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: @@ -57,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/2d6327017519d23b96af35865dc997fcb544fb40/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. diff --git a/gradlew.bat b/gradlew.bat index e509b2dd8..03754c4c3 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -19,12 +19,39 @@ @if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem -@rem Gradle startup script for Windows +@rem gradlew startup script for Windows @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions + +@rem Catch executions from older scripts and ensure they exit cleanly. +@rem This can be removed once we can be reasonably confident that few people +@rem will be migrating directly to this new wrapper. +goto afterSafetyNet +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +goto exitWithErrorLevel +:afterSafetyNet set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @@ -45,13 +72,14 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. -goto fail +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -59,35 +87,26 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. -goto fail +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :execute @rem Setup the command line -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* +@rem Execute gradlew +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel & goto exitWithErrorLevel -:end -@rem End local scope for the variables with windows NT shell -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! -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 - -:omega +@rem This label must not be changed. We rely on old scripts being able to jump to this point. +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/settings.gradle.kts b/settings.gradle.kts index b06a2ed68..b0ba7064b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,2 +1,16 @@ +plugins { + id("com.gradleup.nmcp.settings").version("1.6.2") +} + rootProject.name = "stellar-sdk" +nmcpSettings { + centralPortal { + username = System.getenv("SONATYPE_USERNAME") + password = System.getenv("SONATYPE_PASSWORD") + // publish manually from the portal + publishingType = "USER_MANAGED" + // or if you want to publish automatically + // publishingType = "AUTOMATIC" + } +} diff --git a/src/test/kotlin/org/stellar/sdk/contract/SorobanServerContractIntrospectionTest.kt b/src/test/kotlin/org/stellar/sdk/contract/SorobanServerContractIntrospectionTest.kt index a87463d4e..e3804a902 100644 --- a/src/test/kotlin/org/stellar/sdk/contract/SorobanServerContractIntrospectionTest.kt +++ b/src/test/kotlin/org/stellar/sdk/contract/SorobanServerContractIntrospectionTest.kt @@ -133,14 +133,14 @@ private fun singleEntryJson(xdr: String): String = private fun emptyEntriesJson(): String = """ - { - "jsonrpc": "2.0", - "id": "id", - "result": { - "entries": [], - "latestLedger": "100" - } + { + "jsonrpc": "2.0", + "id": "id", + "result": { + "entries": [], + "latestLedger": "100" } + } """ .trimIndent()