Skip to content

Commit 205aaf0

Browse files
authored
Merge branch 'OpenElements:main' into master
2 parents 32f81ae + 9f631a1 commit 205aaf0

File tree

15 files changed

+199
-94
lines changed

15 files changed

+199
-94
lines changed

.github/workflows/maven.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,32 @@ jobs:
3030
distribution: 'temurin'
3131
cache: maven
3232

33-
- name: Prepare Hedera Solo
33+
- name: Prepare Hiero Solo
3434
id: solo
35-
uses: OpenElements/hedera-solo-action@v0.9
35+
uses: hiero-ledger/hiero-solo-action@a39acf8cfbaa2feb195a86530d0ab643a45aa541 # v0.10
3636
with:
3737
installMirrorNode: true
38+
hieroVersion: v0.63.7
39+
mirrorNodeVersion: v0.133.0
40+
mirrorNodePortRest: 5551
41+
mirrorNodePortGrpc: 5600
42+
mirrorNodePortWeb3Rest: 8545
43+
44+
- name: Wait for Mirror Node
45+
run: |
46+
echo "Waiting for Mirror Node REST API to be ready on http://localhost:5551..."
47+
until curl --output /dev/null --silent --head --fail http://localhost:5551/api/v1/network/supply; do
48+
echo "Mirror Node not ready, waiting..."
49+
kubectl get svc -n solo
50+
curl --silent http://localhost:5551/api/v1/network/supply || echo "No response from /api/v1/network/supply"
51+
sleep 5
52+
done
53+
echo "Mirror Node REST API is ready!"
3854
3955
- name: Build with Maven
4056
env:
41-
spring_profiles_active: solo
57+
SPRING_PROFILES_ACTIVE: solo
4258
HEDERA_ACCOUNT_ID: ${{ steps.solo.outputs.accountId }}
4359
HEDERA_PRIVATE_KEY: ${{ steps.solo.outputs.privateKey }}
4460
HEDERA_NETWORK: hiero-solo-action
4561
run: ./mvnw verify
46-

hiero-enterprise-base/pom.xml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>com.open-elements.hiero</groupId>
99
<artifactId>hiero-enterprise</artifactId>
10-
<version>0.19.0-SNAPSHOT</version>
10+
<version>0.20.0-SNAPSHOT</version>
1111
<relativePath>../pom.xml</relativePath>
1212
</parent>
1313

@@ -68,16 +68,4 @@
6868
<scope>test</scope>
6969
</dependency>
7070
</dependencies>
71-
72-
<build>
73-
<plugins>
74-
<plugin>
75-
<groupId>org.jreleaser</groupId>
76-
<artifactId>jreleaser-maven-plugin</artifactId>
77-
<configuration>
78-
<skip>true</skip>
79-
</configuration>
80-
</plugin>
81-
</plugins>
82-
</build>
8371
</project>
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
package com.openelements.hiero.base.config.implementation;
2+
3+
import com.hedera.hashgraph.sdk.AccountId;
4+
import com.hedera.hashgraph.sdk.PrivateKey;
5+
import com.hedera.hashgraph.sdk.PublicKey;
6+
import com.openelements.hiero.base.config.ConsensusNode;
7+
import com.openelements.hiero.base.config.HieroConfig;
8+
import com.openelements.hiero.base.data.Account;
9+
import java.util.Optional;
10+
import java.util.Set;
11+
import org.jspecify.annotations.NonNull;
12+
13+
public class EnvBasedHieroConfig implements HieroConfig {
14+
15+
private final AccountId operatorAccountId;
16+
private final PublicKey operatorPublicKey;
17+
private final PrivateKey operatorPrivateKey;
18+
private final String mirrorNodeAddress;
19+
20+
private final String consensusNodeIp;
21+
private final String consensusNodePort;
22+
private final String consensusNodeAccount;
23+
24+
private final String relayUrl;
25+
26+
private final Long chainId;
27+
28+
public EnvBasedHieroConfig() {
29+
operatorAccountId = getEnv("HEDERA_OPERATOR_ACCOUNT_ID")
30+
.map(AccountId::fromString)
31+
.orElseThrow(() -> new IllegalStateException("HEDERA_OPERATOR_ACCOUNT_ID is not set"));
32+
operatorPublicKey = getEnv("HEDERA_OPERATOR_PUBLIC_KEY")
33+
.map(PublicKey::fromString)
34+
.orElseThrow(() -> new IllegalStateException("HEDERA_OPERATOR_PUBLIC_KEY is not set"));
35+
operatorPrivateKey = getEnv("HEDERA_OPERATOR_PRIVATE_KEY")
36+
.map(PrivateKey::fromString)
37+
.orElseThrow(() -> new IllegalStateException("HEDERA_OPERATOR_PRIVATE_KEY is not set"));
38+
mirrorNodeAddress = getEnv("HEDERA_MIRROR_NODE_ADDRESS")
39+
.orElse(null);
40+
consensusNodeIp = getEnv("HEDERA_CONSENSUS_NODE_IP")
41+
.orElseThrow(() -> new IllegalStateException("HEDERA_CONSENSUS_NODE_IP is not set"));
42+
consensusNodePort = getEnv("HEDERA_CONSENSUS_NODE_PORT")
43+
.orElseThrow(() -> new IllegalStateException("HEDERA_CONSENSUS_NODE_PORT is not set"));
44+
consensusNodeAccount = getEnv("HEDERA_CONSENSUS_NODE_ACCOUNT")
45+
.orElseThrow(() -> new IllegalStateException("HEDERA_CONSENSUS_NODE_ACCOUNT is not set"));
46+
relayUrl = getEnv("HEDERA_RELAY_URL").orElse(null);
47+
chainId = getEnv("HEDERA_CHAIN_ID")
48+
.map(Long::valueOf)
49+
.orElse(null);
50+
}
51+
52+
private Optional<String> getEnv(String key) {
53+
return Optional.ofNullable(System.getenv(key));
54+
}
55+
56+
@Override
57+
public @NonNull Account getOperatorAccount() {
58+
return new Account(operatorAccountId, operatorPublicKey, operatorPrivateKey);
59+
}
60+
61+
@Override
62+
public @NonNull Optional<String> getNetworkName() {
63+
return Optional.empty();
64+
}
65+
66+
@Override
67+
public @NonNull Set<String> getMirrorNodeAddresses() {
68+
if (mirrorNodeAddress == null) {
69+
return Set.of();
70+
}
71+
return Set.of(mirrorNodeAddress);
72+
}
73+
74+
@Override
75+
public @NonNull Set<ConsensusNode> getConsensusNodes() {
76+
ConsensusNode node = new ConsensusNode(
77+
consensusNodeIp,
78+
consensusNodePort,
79+
consensusNodeAccount
80+
);
81+
return Set.of(node);
82+
}
83+
84+
@Override
85+
public @NonNull Optional<Long> chainId() {
86+
return Optional.ofNullable(chainId);
87+
}
88+
89+
@Override
90+
public @NonNull Optional<String> relayUrl() {
91+
return Optional.ofNullable(relayUrl);
92+
}
93+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package com.openelements.hiero.base.config.implementation;
2+
3+
import com.openelements.hiero.base.config.ConsensusNode;
4+
import com.openelements.hiero.base.config.HieroConfig;
5+
import com.openelements.hiero.base.config.NetworkSettings;
6+
import com.openelements.hiero.base.data.Account;
7+
import java.util.Objects;
8+
import java.util.Optional;
9+
import java.util.Set;
10+
import org.jspecify.annotations.NonNull;
11+
12+
public class NetworkSettingsBasedHieroConfig implements HieroConfig {
13+
14+
private final Account operatorAccount;
15+
16+
private final NetworkSettings networkSetting;
17+
18+
public NetworkSettingsBasedHieroConfig(@NonNull final Account operatorAccount, @NonNull final String networkName) {
19+
this.operatorAccount = Objects.requireNonNull(operatorAccount, "operatorAccount must not be null");
20+
Objects.requireNonNull(networkName, "networkName must not be null");
21+
this.networkSetting = NetworkSettings.forIdentifier(networkName)
22+
.orElseThrow(() -> new IllegalStateException("Network settings for '" + networkName + "' not found"));
23+
}
24+
25+
@Override
26+
public @NonNull Account getOperatorAccount() {
27+
return operatorAccount;
28+
}
29+
30+
@Override
31+
public @NonNull Optional<String> getNetworkName() {
32+
return networkSetting.getNetworkName();
33+
}
34+
35+
@Override
36+
public @NonNull Set<String> getMirrorNodeAddresses() {
37+
return networkSetting.getMirrorNodeAddresses();
38+
}
39+
40+
@Override
41+
public @NonNull Set<ConsensusNode> getConsensusNodes() {
42+
return networkSetting.getConsensusNodes();
43+
}
44+
45+
@Override
46+
public @NonNull Optional<Long> chainId() {
47+
return networkSetting.chainId();
48+
}
49+
50+
@Override
51+
public @NonNull Optional<String> relayUrl() {
52+
return networkSetting.relayUrl();
53+
}
54+
}

hiero-enterprise-base/src/main/java/com/openelements/hiero/base/implementation/ProtocolLayerClientImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public class ProtocolLayerClientImpl implements ProtocolLayerClient {
105105

106106
private static final Logger log = LoggerFactory.getLogger(ProtocolLayerClientImpl.class);
107107

108-
public static final int DEFAULT_GAS = 1_000_000;
108+
public static final int DEFAULT_GAS = 5_000_000;
109109

110110
private final List<TransactionListener> listeners;
111111

hiero-enterprise-base/src/test/java/com/openelements/hiero/base/test/AccountClientImplTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void setUp() {
3030
}
3131

3232
@Test
33-
public void testGetAccountBalance_ValidPositiveBalance() throws HieroException {
33+
public void testGetAccountBalanceValidPositiveBalance() throws HieroException {
3434
AccountId accountId = AccountId.fromString("0.0.12345");
3535
Hbar expectedBalance = new Hbar(10);
3636

@@ -48,7 +48,7 @@ public void testGetAccountBalance_ValidPositiveBalance() throws HieroException {
4848
}
4949

5050
@Test
51-
public void testGetAccountBalance_ZeroBalance() throws HieroException {
51+
public void testGetAccountBalanceZeroBalance() throws HieroException {
5252
AccountId accountId = AccountId.fromString("0.0.67890");
5353
Hbar expectedBalance = new Hbar(0);
5454

@@ -65,7 +65,7 @@ public void testGetAccountBalance_ZeroBalance() throws HieroException {
6565
}
6666

6767
@Test
68-
public void testGetAccountBalance_InvalidAccount_ThrowsException() throws HieroException {
68+
public void testGetAccountBalanceInvalidAccountThrowsException() throws HieroException {
6969
AccountId invalidAccountId = AccountId.fromString("0.0.9999999");
7070

7171
when(mockProtocolLayerClient.executeAccountBalanceQuery(
@@ -78,14 +78,14 @@ public void testGetAccountBalance_InvalidAccount_ThrowsException() throws HieroE
7878
}
7979

8080
@Test
81-
public void testGetAccountBalance_NullThrowsException() {
81+
public void testGetAccountBalanceNullThrowsException() {
8282
assertThrows(NullPointerException.class, () -> {
8383
accountClientImpl.getAccountBalance((AccountId) null);
8484
});
8585
}
8686

8787
@Test
88-
public void testGetAccountBalance_ProtocolLayerClientFails() throws HieroException {
88+
public void testGetAccountBalanceProtocolLayerClientFails() throws HieroException {
8989
AccountId accountId = AccountId.fromString("0.0.12345");
9090

9191
when(mockProtocolLayerClient.executeAccountBalanceQuery(
@@ -99,7 +99,7 @@ public void testGetAccountBalance_ProtocolLayerClientFails() throws HieroExcepti
9999

100100
//tests for createAccount method
101101
@Test
102-
void testCreateAccount_successful() throws HieroException {
102+
void testCreateAccountSuccessful() throws HieroException {
103103
Hbar initialBalance = Hbar.from(100);
104104

105105
AccountCreateResult mockResult = mock(AccountCreateResult.class);
@@ -119,7 +119,7 @@ void testCreateAccount_successful() throws HieroException {
119119
}
120120

121121
@Test
122-
void testCreateAccount_invalidInitialBalance_null() {
122+
void testCreateAccountInvalidInitialBalanceNull() {
123123
Hbar initialBalance = null;
124124

125125
assertThrows(NullPointerException.class, () -> accountClientImpl.createAccount(initialBalance));
@@ -136,7 +136,7 @@ void testCreateAccount_invalidInitialBalance_negative() {
136136

137137

138138
@Test
139-
void testCreateAccount_hieroExceptionThrown() throws HieroException {
139+
void testCreateAccountHieroExceptionThrown() throws HieroException {
140140
Hbar initialBalance = Hbar.from(100);
141141

142142
when(mockProtocolLayerClient.executeAccountCreateTransaction(any(AccountCreateRequest.class)))

hiero-enterprise-microprofile-sample/pom.xml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>com.open-elements.hiero</groupId>
99
<artifactId>hiero-enterprise</artifactId>
10-
<version>0.19.0-SNAPSHOT</version>
10+
<version>0.20.0-SNAPSHOT</version>
1111
<relativePath>../pom.xml</relativePath>
1212
</parent>
1313

@@ -49,13 +49,6 @@
4949
<skip>true</skip>
5050
</configuration>
5151
</plugin>
52-
<plugin>
53-
<groupId>org.jreleaser</groupId>
54-
<artifactId>jreleaser-maven-plugin</artifactId>
55-
<configuration>
56-
<skip>true</skip>
57-
</configuration>
58-
</plugin>
5952
<plugin>
6053
<groupId>io.quarkus</groupId>
6154
<artifactId>quarkus-maven-plugin</artifactId>

hiero-enterprise-microprofile/pom.xml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>com.open-elements.hiero</groupId>
99
<artifactId>hiero-enterprise</artifactId>
10-
<version>0.19.0-SNAPSHOT</version>
10+
<version>0.20.0-SNAPSHOT</version>
1111
<relativePath>../pom.xml</relativePath>
1212
</parent>
1313

@@ -83,16 +83,4 @@
8383
<scope>test</scope>
8484
</dependency>
8585
</dependencies>
86-
87-
<build>
88-
<plugins>
89-
<plugin>
90-
<groupId>org.jreleaser</groupId>
91-
<artifactId>jreleaser-maven-plugin</artifactId>
92-
<configuration>
93-
<skip>true</skip>
94-
</configuration>
95-
</plugin>
96-
</plugins>
97-
</build>
9886
</project>

hiero-enterprise-spring-sample/pom.xml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>com.open-elements.hiero</groupId>
99
<artifactId>hiero-enterprise</artifactId>
10-
<version>0.19.0-SNAPSHOT</version>
10+
<version>0.20.0-SNAPSHOT</version>
1111
<relativePath>../pom.xml</relativePath>
1212
</parent>
1313

@@ -53,13 +53,6 @@
5353
<skip>true</skip>
5454
</configuration>
5555
</plugin>
56-
<plugin>
57-
<groupId>org.jreleaser</groupId>
58-
<artifactId>jreleaser-maven-plugin</artifactId>
59-
<configuration>
60-
<skip>true</skip>
61-
</configuration>
62-
</plugin>
6356
</plugins>
6457
</build>
6558
</project>

hiero-enterprise-spring/pom.xml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>com.open-elements.hiero</groupId>
99
<artifactId>hiero-enterprise</artifactId>
10-
<version>0.19.0-SNAPSHOT</version>
10+
<version>0.20.0-SNAPSHOT</version>
1111
<relativePath>../pom.xml</relativePath>
1212
</parent>
1313

@@ -75,15 +75,4 @@
7575
</dependency>
7676
</dependencies>
7777

78-
<build>
79-
<plugins>
80-
<plugin>
81-
<groupId>org.jreleaser</groupId>
82-
<artifactId>jreleaser-maven-plugin</artifactId>
83-
<configuration>
84-
<skip>true</skip>
85-
</configuration>
86-
</plugin>
87-
</plugins>
88-
</build>
8978
</project>

0 commit comments

Comments
 (0)