Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remaining renaming to Hiero #2150

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,4 @@ jobs:
env:
NEXUS_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: ./gradlew releaseMavenCentral -PpublishingPackageGroup=org.hiero -PpublishSigningEnabled=true --scan --no-configuration-cache
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be done bore the SDK is transfered to Hiero

run: ./gradlew releaseMavenCentral -PpublishingPackageGroup=org.hiero.sdk -PpublishSigningEnabled=true --scan --no-configuration-cache
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ bin/
gradle.properties
.DS_Store
/examples/address-book.proto.bin
local.properties
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2020 Hedera Hashgraph LLC
Copyright 2024 Hiero LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,57 @@
# Hedera™ Hashgraph Java SDK
# Hiero Java SDK

![](https://img.shields.io/badge/java-17%2B-blue?style=flat-square)
![](https://img.shields.io/badge/android-26%2B-blue?style=flat-square)
[![](https://img.shields.io/github/actions/workflow/status/hashgraph/hedera-sdk-java/build.yml?style=flat-square)](https://github.com/hashgraph/hedera-sdk-java/actions)
[![](https://img.shields.io/maven-central/v/com.hedera.hashgraph/sdk/2?label=maven&style=flat-square)](https://search.maven.org/artifact/com.hedera.hashgraph/sdk)

> The Java SDK for interacting with Hedera Hashgraph: the official distributed
> The Java SDK for interacting with Hiero: the official distributed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> The Java SDK for interacting with Hiero: the official distributed
> The Java SDK for interacting with a Hiero based network: the official distributed

> consensus platform built using the hashgraph consensus algorithm for fast,
> fair and secure transactions. Hedera enables and empowers developers to
> fair and secure transactions. Hiero enables and empowers developers to
> build an entirely new class of decentralized applications.

**NOTE**: v1 of the SDK is deprecated and support was discontinued after October 2021.
Please install the latest version 2.x.x or migrate from v1 to the latest 2.x.x version.
You can reference the [migration documentation](docs/sdk/MIGRATING_V1.md).

## Java app quickstart

[The Java application quickstart guide](docs/java-app/java-app-quickstart.md) covers how to properly set up the dependencies
needed to start developing your Java project using the Hedera™ Java SDK.
needed to start developing your Java project using the Hiero Java SDK.

## Android app quickstart

[The Android application quickstart guide](docs/android-app/android-app-quickstart.md) covers how to properly set up the dependencies
needed to start developing your Android project using the Hedera™ Java SDK.
needed to start developing your Android project using the Hiero Java SDK.

## Examples

This repository includes [Java examples](examples/README.md) and [an Android example](example-android/README.md)
that showcase different use cases and workflows.

## Developer quickstart

The [developer quickstart guide](docs/sdk/developer-guide.md) provides instructions on how to set up the environment,
run unit and integration tests, and configure the project to work with different networks
such as the Hedera test network, preview network, etc.
such as the Hiero test network, preview network, etc.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to be reverted


## Support

If you have a question on how to use the product, please see our
[support guide](https://github.com/hashgraph/.github/blob/main/SUPPORT.md).

## Contributing

We welcome participation from all developers!\
For instructions on how to contribute to this repo, please
review the [Contributing Guide](docs/sdk/CONTRIBUTING.md).\
More instructions for contribution can be found in the [Global Contributing Guide](https://github.com/hashgraph/.github/blob/main/CONTRIBUTING.md).

## Code of Conduct

This project is governed by the [Contributor Covenant Code of Conduct](https://github.com/hashgraph/.github/blob/main/CODE_OF_CONDUCT.md). By participating, you are
expected to uphold this code of conduct.

## License

[Apache License 2.0](LICENSE)
2 changes: 1 addition & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ tasks:

"update:snapshots":
cmds:
- rm sdk/src/test/java/com/hedera/hashgraph/sdk/*.snap
- rm sdk/src/test/java/org/hiero/sdk/*.snap
- ./gradlew clean test

"update:proto":
Expand Down
77 changes: 12 additions & 65 deletions docs/sdk/SDK_ANATOMY.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,13 @@ Augments the Java compiler to output more comprehensive errors and warnings.

Library to assist in code generation (see **FunctionalExecutableProcessor**).





## Classes:





### `LockableList`:

An internal utility class that represents a list of things, and which has these capabilities:
* It can be locked, which prevents the list from being mutated.
* It has an index which can be incremented with the `advance()` method, and the index will loop back around to 0 on reaching the end of the list.




* It can be locked, which prevents the list from being mutated.
* It has an index which can be incremented with the `advance()` method, and the index will loop back around to 0 on reaching the end of the list.

### `Client`:

Expand All @@ -62,10 +50,6 @@ A `Client` can be initialized from a config file (json). A `Client` can be init

`executor` will be used to initialize the gRPC `BaseChannel`, and in the event that an RPC fails and needs to be retried after a delay, `executor` will be used to schedule that delayed retry.





### `BaseNode`:

Has an `address`, a `channel`, an `executor` (ultimately from `Client`), `lastUsed` and `useCount`.
Expand All @@ -78,11 +62,7 @@ Has an `address`, a `channel`, an `executor` (ultimately from `Client`), `lastUs

`BaseNode` has the methods `inUse()`, which causes the `BaseNode` to record that it is being used, `getChannel()`, `close()`, and `getUserAgent()`.

The user agent is a string that is used to identify the client to the server. In this case, it's `"hedera-sdk-java/v{NUMBER}"`.




The user agent is a string that is used to identify the client to the server. In this case, it's `"hiero-sdk-java/v{NUMBER}"`.

### `BaseNetwork`:

Expand All @@ -96,28 +76,16 @@ Has these critical fields:

`setNetwork()` will update this `Network` to the given list. It will close a `Node` and remove it from this network if it is not in the given list, and then it will then add nodes from the list.





### `Network`:

This represents a network of Hedera nodes, a `Client` connects to a `Network`.

`getNodeAccountIdsForExecute()` gets a list of N randomly selected `AccountId`s where N is 1/3rd (rounded up) of healthy nodes in this `Network`. This is used by `Query` and `Transaction` to populate their `nodeAccountId`s, lists containing the `AccountId`s of `Node`s that the `Query` or `Transaction` will be attempted with.





### `Node`:

This is a connection to one node in the network. Inherits from `BaseNode` (which is where much of the meat is).





### `Executable`:

An `Executable` object represents a request to the server.
Expand Down Expand Up @@ -156,10 +124,6 @@ It should also be noted that the future returned by `grpc.ClientCalls.futureUnar

`execute()` is simpler by virtue of not being async, but it does approximately the same thing, just without the future mumbo jumbo.





### `Query`:

The `Query` class extends `Executable`.
Expand All @@ -180,23 +144,19 @@ Query also adds some abstract methods of its own:

`onExecute[async]()` seems to be where most of the action is in `Query`. It first makes sure that `nodeAccountIds` is filled, then it fetches the `queryPayment` amount (via `QueryCostQuery`) if one hasn't been set, then it generates the payment transactions for paying the query fee. The `paymentTransactions` list is a parallel array to `nodeAccountIds`. The `Query` proto message includes a `Transaction` proto message inside of it for paying the query fee, and `onExecuteAsync()` just goes ahead and builds a parallel array of `Transaction` messages which are to be used in the event that we attempt to send our query to that node.





### `Transaction`:

The `Transaction` class extends `Executable`.

A transaction is used like this:
- Instantiate a subclass of `Transaction`.
- Call methods to configure it.
- OPTIONAL:
- Freeze the transaction.
- Add more signatures.
- Execute the transaction (it will be frozen if not already frozen, and will be signed with client operator).
- `execute()` returns (or in the case of `executeAsync()`, returns in future) a `TransactionResponse`.
- OPTIONAL: use the resulting `TransactionResponse` to get the `TransactionReceipt` for free, or pay a fee to get the `TransactionRecord`. Fetching either of these is itself a query.
- Instantiate a subclass of `Transaction`.
- Call methods to configure it.
- OPTIONAL:
- Freeze the transaction.
- Add more signatures.
- Execute the transaction (it will be frozen if not already frozen, and will be signed with client operator).
- `execute()` returns (or in the case of `executeAsync()`, returns in future) a `TransactionResponse`.
- OPTIONAL: use the resulting `TransactionResponse` to get the `TransactionReceipt` for free, or pay a fee to get the `TransactionRecord`. Fetching either of these is itself a query.

The `Transaction` class is greatly complicated by three factors:

Expand Down Expand Up @@ -309,10 +269,6 @@ The `Transaction` is not immediately sent after freezing. Instead, the user of

`validateChecksums()` has the same function as in `Query`





### `TopicMessageQuery`

Unlike most classes in the Hedera SDK, this is _not_ a query to a Hedera Hashgraph network, it is a query to a _mirror_ network. As such, it is _not_ a subclass of `Query`, despite its name.
Expand All @@ -325,10 +281,6 @@ The responses may be chunked. If they are, `TopicMessageQuery` will collect all

In addition to the `onNext()` handler, there are several optional handlers which can be set with `setCompletionHandler()`, `setErrorhandler()`, and `setRetryHandler()`. The retry handler returns a boolean to indicate whether the query should be retried.





### `FunctionalExecutable` and `FunctionalExecutableProcessor`

These classes aren't themselves components of the SDK, they are components in the SDK's build process. `FunctionalExecutable` is a custom annotation defined in the `executable-annotation` directory, and we use this annotation is in the SDK source code to mark methods that require additional processing during the build process. This additional processing is performed by the `FunctionalExecutableProcessor`, which is defined in the `executable-processor` directory.
Expand All @@ -348,11 +300,6 @@ Note that the last two are synchronous versions, and in `Executable`, the synchr

The `FunctionalAnnotationProcessor` can't add these methods to `Bar` directly. Instead, it will generate a new interface called `WithFoo`. The `WithFoo` interface will have an abstract `CompletableFuture<Integer> fooAsync(Client client)` method, and it will have all of the variations of the `fooAsync()` and `foo()` methods which are listed above, which will use and build on the abstract `fooAsync()` method. You are expected to declare `Bar` as an implementation of this generated `WithFoo` interface. You should use the `@Override` annotation on your `fooAsync()` method in `Bar` to make sure that it overrides the abstract `fooAsync()` method from `WithFoo`.

If you want to get a better grasp on what the `FunctionalExecutableProcessor` actually does, I suggest that after building the SDK, you should look at the files in `sdk/build/generated/sources/annotationProcessor/java/main/com/hedera/hashgraph/sdk/`. These are the `With*.java` files that are generated by the `FunctionalExecutableProcessor` during the build process. For example, the `WithExecute.java` file was generated because of the `@FunctionalExecutable` annotation on the `Executable.executeAsync()` method, and if you look at `WithExecute.java` side-by-side with the `FunctionalExecutableProcessor.process()` method body, you should be able to see how each of the default methods in the `WithExecute` interface were generated by the processor




If you want to get a better grasp on what the `FunctionalExecutableProcessor` actually does, I suggest that after building the SDK, you should look at the files in `sdk/build/generated/sources/annotationProcessor/java/main/org/hiero/sdk/`. These are the `With*.java` files that are generated by the `FunctionalExecutableProcessor` during the build process. For example, the `WithExecute.java` file was generated because of the `@FunctionalExecutable` annotation on the `Executable.executeAsync()` method, and if you look at `WithExecute.java` side-by-side with the `FunctionalExecutableProcessor.process()` method body, you should be able to see how each of the default methods in the `WithExecute` interface were generated by the processor

**This document is not comprehensive. There are classes I have not yet documented, or which I have only documented in passing, like `ChunkedTransaction`.**

8 changes: 4 additions & 4 deletions example-android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ repositories {

android {
compileSdk = 34
namespace = "com.hedera.android_example"
namespace = "org.hiero.android_example"

defaultConfig {
applicationId = "com.hedera.android_example"
applicationId = "org.hiero.android_example"
minSdk = 26
targetSdk = 34
versionCode = 1
Expand Down Expand Up @@ -47,10 +47,10 @@ android {

dependencies {
// --- Remove to use a published SDK version ---
implementation(platform("com.hedera.hashgraph:hiero-dependency-versions"))
implementation(platform("org.hiero:hiero-dependency-versions"))
// ---------------------------------------------

implementation("com.hedera.hashgraph:sdk:2.46.0")
implementation("org.hiero.sdk:sdk:2.46.0")

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

Expand Down
2 changes: 1 addition & 1 deletion example-android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:name="org.hiero.android_example.MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
android:exported="true">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.android_example
package org.hiero.android_example

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.hedera.android_example.ui.main.SectionsPagerAdapter
import org.hiero.android_example.ui.main.SectionsPagerAdapter
import androidx.viewpager2.widget.ViewPager2
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.android_example.ui.main
package org.hiero.android_example.ui.main

import android.os.Bundle
import android.view.LayoutInflater
Expand All @@ -11,11 +11,11 @@ import android.widget.ProgressBar
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import com.hedera.android_example.R
import com.hedera.hashgraph.sdk.AccountBalanceQuery
import com.hedera.hashgraph.sdk.AccountId
import com.hedera.hashgraph.sdk.Client
import com.hedera.hashgraph.sdk.PrecheckStatusException
import org.hiero.android_example.R
import org.hiero.sdk.AccountBalanceQuery
import org.hiero.sdk.AccountId
import org.hiero.sdk.Client
import org.hiero.sdk.PrecheckStatusException
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.android_example.ui.main
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should do this in multiple steps. This PR is too big to not oversee any issue ;)

package org.hiero.android_example.ui.main

import android.os.Bundle
import android.view.LayoutInflater
Expand All @@ -11,8 +11,8 @@ import android.widget.ProgressBar
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import com.hedera.android_example.R
import com.hedera.hashgraph.sdk.*
import org.hiero.android_example.R
import org.hiero.sdk.*
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.android_example.ui.main
package org.hiero.android_example.ui.main

import android.widget.TextView
import android.view.LayoutInflater
import android.view.ViewGroup
import android.os.Bundle
import android.view.View
import com.hedera.android_example.R
import org.hiero.android_example.R
import androidx.fragment.app.Fragment
import com.hedera.hashgraph.sdk.PrivateKey
import org.hiero.sdk.PrivateKey

class PrivateKeyFragment : Fragment() {
private lateinit var privateKey: TextView
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
package com.hedera.android_example.ui.main
package org.hiero.android_example.ui.main

import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
Expand Down
2 changes: 2 additions & 0 deletions example-android/gradle/module.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
org.hiero.sdk=org.hiero.sdk:sdk
org.hiero.sdk.full=org.hiero.sdk:sdk-full
Loading