Skip to content

Commit

Permalink
Merge branch 'main' into implement-MirrorNodeContractQuery-
Browse files Browse the repository at this point in the history
  • Loading branch information
0xivanov committed Dec 2, 2024
2 parents d6bd034 + 18ac2a0 commit 442748c
Show file tree
Hide file tree
Showing 16 changed files with 175 additions and 163 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 2.45.0-beta.1
## 2.45.0

### Fixed
- Fixed a bug where optional fields for `NodeUpdateTransaction` were being set as default values.
- A bug where optional fields for `NodeUpdateTransaction` were being set as default values.
-
### Added
- New api for creating client with mirror network - `forMirrorNetwork`

## 2.44.0

Expand Down
2 changes: 1 addition & 1 deletion docs/android-app/android-app-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ To get started with an Android project, you'll need to add the following **two**

1. **Hedera™ Java SDK:**
```groovy
implementation 'com.hedera.hashgraph:sdk:2.45.0-beta.1'
implementation 'com.hedera.hashgraph:sdk:2.45.0'
```

2. **gRPC implementation:**
Expand Down
4 changes: 2 additions & 2 deletions docs/java-app/java-app-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ To get started with a Java project, you'll need to add the following **three** d

_Gradle:_
```groovy
implementation 'com.hedera.hashgraph:sdk:2.45.0-beta.1'
implementation 'com.hedera.hashgraph:sdk:2.45.0'
```

_Maven:_
```xml
<dependency>
<groupId>com.hedera.hashgraph</groupId>
<artifactId>sdk</artifactId>
<version>2.45.0-beta.1</version>
<version>2.45.0</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion example-android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ dependencies {
implementation(platform("com.hedera.hashgraph:sdk-dependency-versions"))
// ---------------------------------------------

implementation("com.hedera.hashgraph:sdk:2.45.0-beta.1")
implementation("com.hedera.hashgraph:sdk:2.45.0")

implementation("com.google.android.material:material:1.11.0")

Expand Down
4 changes: 2 additions & 2 deletions examples/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ mainModuleInfo {
}

dependencies.constraints {
implementation("com.hedera.hashgraph:sdk:2.45.0-beta.1")
implementation("com.hedera.hashgraph:sdk-full:2.45.0-beta.1")
implementation("com.hedera.hashgraph:sdk:2.45.0")
implementation("com.hedera.hashgraph:sdk-full:2.45.0")
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.hedera.hashgraph.sdk.logger.Logger;
import io.github.cdimascio.dotenv.Dotenv;

import java.io.ByteArrayInputStream;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.util.Objects;
Expand Down Expand Up @@ -87,6 +88,9 @@ public static void main(String[] args) throws Exception {
Files.deleteIfExists(FileSystems.getDefault().getPath("address-book.proto.bin"));
client.close();

Files.copy(new ByteArrayInputStream(addressBook.toBytes().toByteArray()),
FileSystems.getDefault().getPath("address-book.proto.bin"));

System.out.println("Get Address Book Example Complete!");
}
}
2 changes: 1 addition & 1 deletion gradle/plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ plugins {
repositories.gradlePluginPortal()

dependencies {
implementation("com.autonomousapps:dependency-analysis-gradle-plugin:2.4.2")
implementation("com.autonomousapps:dependency-analysis-gradle-plugin:2.5.0")
implementation("com.google.protobuf:protobuf-gradle-plugin:0.9.4")
implementation("io.github.gradle-nexus:publish-plugin:1.3.0")
implementation("org.gradlex:extra-java-module-info:1.9")
Expand Down
14 changes: 7 additions & 7 deletions sdk-dependency-versions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@ dependencies.constraints {
api("com.google.code.gson:gson:2.10.1") {
because("com.google.gson")
}
api("com.google.protobuf:protobuf-java:4.28.3") {
api("com.google.protobuf:protobuf-java:4.29.0") {
// shouldn't be updated for now (breaking changes after 4.x.x)
because("com.google.protobuf")
}
api("com.google.protobuf:protobuf-javalite:4.28.3") {
api("com.google.protobuf:protobuf-javalite:4.29.0") {
// shouldn't be updated for now (breaking changes after 4.x.x)
because("com.google.protobuf")
}
api("io.grpc:grpc-api:1.68.1") {
api("io.grpc:grpc-api:1.68.2") {
because("io.grpc")
}
api("io.grpc:grpc-inprocess:1.67.1") {
because("io.grpc.protobuf")
}
api("io.grpc:grpc-protobuf:1.68.1") {
api("io.grpc:grpc-protobuf:1.68.2") {
because("io.grpc.protobuf")
}
api("io.grpc:grpc-protobuf-lite:1.68.1") {
api("io.grpc:grpc-protobuf-lite:1.68.2") {
because("io.grpc.protobuf")
}
api("io.grpc:grpc-stub:1.68.1") {
api("io.grpc:grpc-stub:1.68.2") {
because("io.grpc.stub")
}
api("com.google.code.findbugs:jsr305:3.0.2") {
Expand All @@ -69,7 +69,7 @@ dependencies.constraints {
}

// Testing
api("com.fasterxml.jackson.core:jackson-core:2.18.1") {
api("com.fasterxml.jackson.core:jackson-core:2.18.2") {
because("com.fasterxml.jackson.core")
}
api("io.github.cdimascio:java-dotenv:5.3.1") {
Expand Down
12 changes: 1 addition & 11 deletions sdk/src/main/java/com/hedera/hashgraph/sdk/BaseNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -363,18 +363,8 @@ synchronized void close(Duration timeout) throws InterruptedException {
* @return the user agent string
*/
private String getUserAgent() {
var theModule = getClass().getModule();
var thePackage = getClass().getPackage();
String implementationVersion;
if (theModule.getName() == null) {
// running on classpath
implementationVersion =
thePackage != null ? thePackage.getImplementationVersion() : null;
} else {
// running on module path
implementationVersion =
theModule.getDescriptor().version().map(ModuleDescriptor.Version::toString).orElse(null);
}
var implementationVersion = thePackage != null ? thePackage.getImplementationVersion() : null;
return "hedera-sdk-java/" + ((implementationVersion != null) ? ("v" + implementationVersion) : "DEV");
}
}
4 changes: 0 additions & 4 deletions sdk/src/main/java/com/hedera/hashgraph/sdk/Endpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ public Endpoint() {
static Endpoint fromProtobuf(ServiceEndpoint serviceEndpoint) {
var port = (int) (serviceEndpoint.getPort() & 0x00000000ffffffffL);

if (port == 0 || port == 50111) {
port = 50211;
}

return new Endpoint()
.setAddress(serviceEndpoint.getIpAddressV4().toByteArray())
.setPort(port)
Expand Down
5 changes: 3 additions & 2 deletions sdk/src/main/java/com/hedera/hashgraph/sdk/TransactionId.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.Objects;
import java.util.Random;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.BiConsumer;
Expand Down Expand Up @@ -69,7 +70,6 @@ public final class TransactionId implements Comparable<TransactionId> {

private static final long NANOSECONDS_TO_REMOVE = 10000000000L;

private static final Random randomNanosecs = new Random();
private static final AtomicLong monotonicTime = new AtomicLong();


Expand Down Expand Up @@ -128,7 +128,8 @@ public static TransactionId generate(AccountId accountId) {
}
} while (!monotonicTime.compareAndSet(lastTime, currentTime));

return new TransactionId(accountId, Instant.ofEpochSecond(0, currentTime + randomNanosecs.nextLong(1_000)));
// NOTE: using ThreadLocalRandom because it's compatible with Android SDK version 26
return new TransactionId(accountId, Instant.ofEpochSecond(0, currentTime + ThreadLocalRandom.current().nextLong(1_000)));
}

/**
Expand Down
Loading

0 comments on commit 442748c

Please sign in to comment.