Skip to content

Commit 5d97e9e

Browse files
Merge pull request #114 from OpenElements/hiero-setup
Hedera renamed to Hiero
2 parents 8110787 + e4b52be commit 5d97e9e

File tree

59 files changed

+626
-678
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+626
-678
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
This project provides Java modules to integrate [Hedera network](https://hedera.com) smoothless in a Spring Boot or Eclipse Microprofile (like Quarkus) application.
33
This module is based on the [Hedera Java SDK](https://github.com/hashgraph/hedera-sdk-java).
44

5+
> [!NOTE]
6+
> The repo is currently transformed to be compatible with the vendor neutral [Hiero](hiero.org) project.
7+
> Hedera is 100% compatible with Hiero and the transformation is just a renaming of the packages, classes, documentation, and so on.
8+
> The transformation is still in progress and not all is renamed yet.
9+
510
## Spring Boot support
611

712
To use this module, you need to add the following dependency to your project:

hiero-base/src/main/java/com/openelements/hiero/base/Account.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import org.jspecify.annotations.NonNull;
88

99
/**
10-
* Represents a Hedera account.
10+
* Represents an account of a Hiero network.
1111
*
1212
* @param accountId the ID of the account
1313
* @param publicKey the public key of the account

hiero-base/src/main/java/com/openelements/hiero/base/AccountClient.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,45 @@
66
import org.jspecify.annotations.NonNull;
77

88
/**
9-
* Interface for interacting with a Hedera network. This interface provides methods for interacting with Hedera
9+
* Interface for interacting with a Hiero network. This interface provides methods for interacting with Hedera
1010
* accounts, like creating and deleting accounts. An implementation of this interface is using an internal account to
11-
* interact with the Hedera network. That account is the account that is used to pay for the transactions that are sent
12-
* to the Hedera network and called 'operator account'.
11+
* interact with a Hiero network. That account is the account that is used to pay for the transactions that are sent
12+
* to the network and called 'operator account'.
1313
*/
1414
public interface AccountClient {
1515

1616
/**
17-
* Creates a new Hedera account. The account is created with an initial balance of 0 hbar. The account is created by
17+
* Creates a new account. The account is created with an initial balance of 0 hbar. The account is created by
1818
* the operator account.
1919
*
2020
* @return the created account
21-
* @throws HederaException if the account could not be created
21+
* @throws HieroException if the account could not be created
2222
*/
2323
@NonNull
24-
default Account createAccount() throws HederaException {
24+
default Account createAccount() throws HieroException {
2525
return createAccount(Hbar.ZERO);
2626
}
2727

2828
/**
29-
* Creates a new Hedera account with the given initial balance. The account is created by the operator account.
29+
* Creates a new account with the given initial balance. The account is created by the operator account.
3030
*
3131
* @param initialBalance the initial balance of the account
3232
* @return the created account
33-
* @throws HederaException if the account could not be created
33+
* @throws HieroException if the account could not be created
3434
*/
3535
@NonNull
36-
Account createAccount(@NonNull Hbar initialBalance) throws HederaException;
36+
Account createAccount(@NonNull Hbar initialBalance) throws HieroException;
3737

3838
/**
39-
* Creates a new Hedera account with the given initial balance (in HBAR). The account is created by the operator
39+
* Creates a new account with the given initial balance (in HBAR). The account is created by the operator
4040
* account.
4141
*
4242
* @param initialBalanceInHbar the initial balance of the account in HBAR
4343
* @return the created account
44-
* @throws HederaException if the account could not be created
44+
* @throws HieroException if the account could not be created
4545
*/
4646
@NonNull
47-
default Account createAccount(long initialBalanceInHbar) throws HederaException {
47+
default Account createAccount(long initialBalanceInHbar) throws HieroException {
4848
if (initialBalanceInHbar < 0) {
4949
throw new IllegalArgumentException("initialBalanceInHbar must be non-negative");
5050
}
@@ -55,38 +55,38 @@ default Account createAccount(long initialBalanceInHbar) throws HederaException
5555
* Deletes the account with the given ID. All fees of that account are transferred to the operator account.
5656
*
5757
* @param account the account to delete
58-
* @throws HederaException if the account could not be deleted
58+
* @throws HieroException if the account could not be deleted
5959
*/
60-
void deleteAccount(@NonNull Account account) throws HederaException;
60+
void deleteAccount(@NonNull Account account) throws HieroException;
6161

6262
/**
6363
* Deletes the account with the given ID. All fees of that account are transferred to the given toAccount.
6464
*
6565
* @param account the account to delete
6666
* @param toAccount the account to transfer the fees to
67-
* @throws HederaException if the account could not be deleted
67+
* @throws HieroException if the account could not be deleted
6868
*/
69-
void deleteAccount(@NonNull Account account, @NonNull Account toAccount) throws HederaException;
69+
void deleteAccount(@NonNull Account account, @NonNull Account toAccount) throws HieroException;
7070

7171
/**
7272
* Returns the balance of the given account.
7373
*
7474
* @param accountId the ID of the account
7575
* @return the balance of the account
76-
* @throws HederaException if the balance could not be retrieved
76+
* @throws HieroException if the balance could not be retrieved
7777
*/
7878
@NonNull
79-
Hbar getAccountBalance(@NonNull AccountId accountId) throws HederaException;
79+
Hbar getAccountBalance(@NonNull AccountId accountId) throws HieroException;
8080

8181
/**
8282
* Returns the balance of the given account.
8383
*
8484
* @param accountId the ID of the account
8585
* @return the balance of the account
86-
* @throws HederaException if the balance could not be retrieved
86+
* @throws HieroException if the balance could not be retrieved
8787
*/
8888
@NonNull
89-
default Hbar getAccountBalance(@NonNull String accountId) throws HederaException {
89+
default Hbar getAccountBalance(@NonNull String accountId) throws HieroException {
9090
Objects.requireNonNull(accountId, "newAccountId must not be null");
9191
return getAccountBalance(AccountId.fromString(accountId));
9292
}

hiero-base/src/main/java/com/openelements/hiero/base/AccountRepository.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,26 @@
77
import org.jspecify.annotations.NonNull;
88

99
/**
10-
* Interface for interacting with a Hedera network. This interface provides methods for searching for Accounts.
10+
* Interface for interacting with a Hiero network. This interface provides methods for searching for Accounts.
1111
*/
1212
public interface AccountRepository {
1313
/**
1414
* Return the AccountInfo of a given accountId.
1515
*
1616
* @param accountId id of the account
1717
* @return {@link Optional} containing the found AccountInfo or null
18-
* @throws HederaException if the search fails
18+
* @throws HieroException if the search fails
1919
*/
20-
Optional<AccountInfo> findById(@NonNull AccountId accountId) throws HederaException;
20+
Optional<AccountInfo> findById(@NonNull AccountId accountId) throws HieroException;
2121

2222
/**
2323
* Return the AccountInfo of a given accountId.
2424
*
2525
* @param accountId id of the account
2626
* @return {@link Optional} containing the found AccountInfo or null
27-
* @throws HederaException if the search fails
27+
* @throws HieroException if the search fails
2828
*/
29-
default Optional<AccountInfo> findById(@NonNull String accountId) throws HederaException {
29+
default Optional<AccountInfo> findById(@NonNull String accountId) throws HieroException {
3030
Objects.requireNonNull(accountId, "accountId must not be null");
3131
return findById(AccountId.fromString(accountId));
3232
}

hiero-base/src/main/java/com/openelements/hiero/base/ContractVerificationClient.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import org.jspecify.annotations.NonNull;
66

77
/**
8-
* Client for verifying contracts on the Hedera network. This client is used to check the verification state of a smart
8+
* Client for verifying contracts on a Hiero network. This client is used to check the verification state of a smart
99
* contract and to verify a smart contract. Currently only the Hedera mainnet, testnet and previewnet is supported.
1010
*/
1111
public interface ContractVerificationClient {
@@ -15,10 +15,10 @@ public interface ContractVerificationClient {
1515
*
1616
* @param contractId contract to check
1717
* @return verification state
18-
* @throws HederaException if an error happens in communication with the Hedera network
18+
* @throws HieroException if an error happens in communication with a Hiero network
1919
*/
2020
@NonNull
21-
ContractVerificationState checkVerification(@NonNull ContractId contractId) throws HederaException;
21+
ContractVerificationState checkVerification(@NonNull ContractId contractId) throws HieroException;
2222

2323
/**
2424
* Check the verification state of a file that is part of a contract.
@@ -28,10 +28,10 @@ public interface ContractVerificationClient {
2828
* @param fileContent file content
2929
* @return true if the contract contains is verified and contains a file with the given name and content
3030
* @throws IllegalStateException if contract is not verified
31-
* @throws HederaException if an error happens in communication with the Hedera network
31+
* @throws HieroException if an error happens in communication with a Hiero network
3232
*/
3333
boolean checkVerification(@NonNull ContractId contractId, @NonNull String fileName, @NonNull String fileContent)
34-
throws HederaException;
34+
throws HieroException;
3535

3636
/**
3737
* Try to verify a contract.
@@ -42,11 +42,11 @@ boolean checkVerification(@NonNull ContractId contractId, @NonNull String fileNa
4242
* @param contractMetadata contract metadata
4343
* @return verification state
4444
* @throws IllegalStateException if contract is already verified
45-
* @throws HederaException if an error happens in communication with the Hedera network
45+
* @throws HieroException if an error happens in communication with a Hiero network
4646
*/
4747
@NonNull
4848
default ContractVerificationState verify(@NonNull final ContractId contractId, @NonNull final String contractName,
49-
@NonNull final String contractSource, final String contractMetadata) throws HederaException {
49+
@NonNull final String contractSource, final String contractMetadata) throws HieroException {
5050
return verify(contractId, contractName,
5151
Map.of(contractName + ".sol", contractSource, "metadata.json", contractMetadata));
5252
}
@@ -59,9 +59,9 @@ default ContractVerificationState verify(@NonNull final ContractId contractId, @
5959
* @param files contract files
6060
* @return verification state
6161
* @throws IllegalStateException if contract is already verified
62-
* @throws HederaException if an error happens in communication with the Hedera network
62+
* @throws HieroException if an error happens in communication with a Hiero network
6363
*/
6464
@NonNull
6565
ContractVerificationState verify(@NonNull ContractId contractId, @NonNull String contractName,
66-
@NonNull Map<String, String> files) throws HederaException;
66+
@NonNull Map<String, String> files) throws HieroException;
6767
}

hiero-base/src/main/java/com/openelements/hiero/base/FileClient.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import org.jspecify.annotations.NonNull;
77

88
/**
9-
* A client for interacting with the file service on the Hedera network. An implementation of this interface is using an
10-
* internal account to interact with the Hedera network. That account is the account that is used to pay for the
11-
* transactions that are sent to the Hedera network and called 'operator account'.
9+
* A client for interacting with the file service on a Hiero network. An implementation of this interface is using an
10+
* internal account to interact with a Hiero network. That account is the account that is used to pay for the
11+
* transactions that are sent to a Hiero network and called 'operator account'.
1212
*/
1313
public interface FileClient {
1414

@@ -17,22 +17,22 @@ public interface FileClient {
1717
*
1818
* @param contents the contents of the file
1919
* @return the ID of the new file
20-
* @throws HederaException if the file could not be created
20+
* @throws HieroException if the file could not be created
2121
*/
2222
@NonNull
23-
FileId createFile(@NonNull byte[] contents) throws HederaException;
23+
FileId createFile(@NonNull byte[] contents) throws HieroException;
2424

25-
FileId createFile(@NonNull byte[] contents, @NonNull Instant expirationTime) throws HederaException;
25+
FileId createFile(@NonNull byte[] contents, @NonNull Instant expirationTime) throws HieroException;
2626

2727
/**
2828
* Create a new file with the given contents.
2929
*
3030
* @param fileId the ID of the file to update
3131
* @return the ID of the new file
32-
* @throws HederaException if the file could not be created
32+
* @throws HieroException if the file could not be created
3333
*/
3434
@NonNull
35-
default byte[] readFile(@NonNull String fileId) throws HederaException {
35+
default byte[] readFile(@NonNull String fileId) throws HieroException {
3636
Objects.requireNonNull(fileId, "fileId must not be null");
3737
return readFile(FileId.fromString(fileId));
3838
}
@@ -42,71 +42,71 @@ default byte[] readFile(@NonNull String fileId) throws HederaException {
4242
*
4343
* @param fileId the ID of the file to read
4444
* @return the contents of the file
45-
* @throws HederaException if the file could not be read
45+
* @throws HieroException if the file could not be read
4646
*/
4747
@NonNull
48-
byte[] readFile(@NonNull FileId fileId) throws HederaException;
48+
byte[] readFile(@NonNull FileId fileId) throws HieroException;
4949

5050
/**
5151
* Delete a file.
5252
*
5353
* @param fileId the ID of the file to delete
54-
* @throws HederaException if the file could not be deleted
54+
* @throws HieroException if the file could not be deleted
5555
*/
56-
default void deleteFile(@NonNull String fileId) throws HederaException {
56+
default void deleteFile(@NonNull String fileId) throws HieroException {
5757
deleteFile(FileId.fromString(fileId));
5858
}
5959

6060
/**
6161
* Delete a file.
6262
*
6363
* @param fileId the ID of the file to delete
64-
* @throws HederaException if the file could not be deleted
64+
* @throws HieroException if the file could not be deleted
6565
*/
66-
void deleteFile(@NonNull FileId fileId) throws HederaException;
66+
void deleteFile(@NonNull FileId fileId) throws HieroException;
6767

6868
/**
6969
* Update the contents of a file.
7070
*
7171
* @param fileId the ID of the file to update
7272
* @param content the new contents of the file
73-
* @throws HederaException if the file could not be updated
73+
* @throws HieroException if the file could not be updated
7474
*/
75-
void updateFile(@NonNull FileId fileId, byte[] content) throws HederaException;
75+
void updateFile(@NonNull FileId fileId, byte[] content) throws HieroException;
7676

7777
/**
7878
* Update the expiration time of a file.
7979
*
8080
* @param fileId the ID of the file to update
8181
* @param expirationTime the new expiration time of the file
82-
* @throws HederaException if the file could not be updated
82+
* @throws HieroException if the file could not be updated
8383
*/
84-
void updateExpirationTime(@NonNull FileId fileId, @NonNull Instant expirationTime) throws HederaException;
84+
void updateExpirationTime(@NonNull FileId fileId, @NonNull Instant expirationTime) throws HieroException;
8585

8686
/**
8787
* Check if a file is deleted.
8888
*
8989
* @param fileId the ID of the file to check
9090
* @return true if the file is deleted, false otherwise
91-
* @throws HederaException if the file could not be checked
91+
* @throws HieroException if the file could not be checked
9292
*/
93-
boolean isDeleted(@NonNull FileId fileId) throws HederaException;
93+
boolean isDeleted(@NonNull FileId fileId) throws HieroException;
9494

9595
/**
9696
* Get the size of a file.
9797
*
9898
* @param fileId the ID of the file to check
9999
* @return the size of the file
100-
* @throws HederaException if the file could not be checked
100+
* @throws HieroException if the file could not be checked
101101
*/
102-
int getSize(@NonNull FileId fileId) throws HederaException;
102+
int getSize(@NonNull FileId fileId) throws HieroException;
103103

104104
/**
105105
* Get the expiration time of a file.
106106
*
107107
* @param fileId the ID of the file to check
108108
* @return the expiration time of the file
109-
* @throws HederaException if the file could not be checked
109+
* @throws HieroException if the file could not be checked
110110
*/
111-
Instant getExpirationTime(@NonNull FileId fileId) throws HederaException;
111+
Instant getExpirationTime(@NonNull FileId fileId) throws HieroException;
112112
}

hiero-base/src/main/java/com/openelements/hiero/base/HederaContext.java renamed to hiero-base/src/main/java/com/openelements/hiero/base/HieroContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import java.time.Duration;
77
import org.jspecify.annotations.NonNull;
88

9-
public interface HederaContext {
9+
public interface HieroContext {
1010

1111
@NonNull
1212
Account getOperatorAccount();

hiero-base/src/main/java/com/openelements/hiero/base/HederaException.java renamed to hiero-base/src/main/java/com/openelements/hiero/base/HieroException.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@
33
import org.jspecify.annotations.NonNull;
44

55
/**
6-
* Represents an exception that occurred while interacting with the Hedera network.
6+
* Represents an exception that occurred while interacting with a Hiero network.
77
*/
8-
public class HederaException extends Exception {
8+
public class HieroException extends Exception {
99

1010
/**
11-
* Constructs a new HederaException with the specified detail message.
11+
* Constructs a new Exception with the specified detail message.
1212
*
1313
* @param message The detail message.
1414
*/
15-
public HederaException(@NonNull String message) {
15+
public HieroException(@NonNull String message) {
1616
super(message);
1717
}
1818

1919
/**
20-
* Constructs a new HederaException with the specified detail message and cause.
20+
* Constructs a new Exception with the specified detail message and cause.
2121
*
2222
* @param message The detail message.
2323
* @param cause The cause.
2424
*/
25-
public HederaException(@NonNull String message, @NonNull Throwable cause) {
25+
public HieroException(@NonNull String message, @NonNull Throwable cause) {
2626
super(message, cause);
2727
}
2828
}

0 commit comments

Comments
 (0)