Skip to content

Commit 70d3e97

Browse files
Refactor and add javadocs
1 parent 7a7f1f7 commit 70d3e97

File tree

2 files changed

+110
-1
lines changed

2 files changed

+110
-1
lines changed

hedera-base/src/main/java/com/openelements/hedera/base/protocol/ProtocolLayerClient.java

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,22 @@ public interface ProtocolLayerClient {
5858
@NonNull
5959
FileCreateResult executeFileCreateTransaction(@NonNull FileCreateRequest request) throws HederaException;
6060

61+
/**
62+
* Execute a file update transaction.
63+
*
64+
* @param request the request containing the details of the file update
65+
* @return the result of the file update transaction
66+
* @throws HederaException if the transaction could not be executed
67+
*/
6168
FileUpdateResult executeFileUpdateRequestTransaction(FileUpdateRequest request) throws HederaException;
6269

70+
/**
71+
* Execute a file info query.
72+
*
73+
* @param request the request containing the details of the file info query
74+
* @return the response containing the information about the file
75+
* @throws HederaException if the query could not be executed
76+
*/
6377
@NonNull
6478
FileInfoResponse executeFileInfoQuery(@NonNull FileInfoRequest request) throws HederaException;
6579

@@ -84,34 +98,128 @@ ContractCreateResult executeContractCreateTransaction(@NonNull ContractCreateReq
8498
@NonNull
8599
ContractCallResult executeContractCallTransaction(@NonNull ContractCallRequest request) throws HederaException;
86100

101+
/**
102+
* Executes a contract delete transaction.
103+
*
104+
* @param request the request containing the details of the contract delete transaction
105+
* @return the result of the contract delete transaction
106+
* @throws HederaException if the transaction could not be executed
107+
*/
87108
@NonNull
88109
ContractDeleteResult executeContractDeleteTransaction(@NonNull final ContractDeleteRequest request)
89110
throws HederaException;
90111

112+
/**
113+
* Executes an account create transaction.
114+
*
115+
* @param request the request containing the details of the account create transaction
116+
* @return the result of the account create transaction
117+
* @throws HederaException if the transaction could not be executed
118+
*/
91119
@NonNull
92120
AccountCreateResult executeAccountCreateTransaction(@NonNull final AccountCreateRequest request)
93121
throws HederaException;
94122

123+
/**
124+
* Executes an account delete transaction.
125+
*
126+
* @param request the request containing the details of the account delete transaction
127+
* @return the result of the account delete transaction
128+
* @throws HederaException if the transaction could not be executed
129+
*/
95130
@NonNull
96131
AccountDeleteResult executeAccountDeleteTransaction(@NonNull AccountDeleteRequest request) throws HederaException;
97132

133+
/**
134+
* Executes a token create transaction.
135+
*
136+
* @param request the request containing the details of the token create transaction
137+
* @return the result of the token create transaction
138+
* @throws HederaException if the transaction could not be executed
139+
*/
98140
@NonNull
99141
TokenCreateResult executeTokenCreateTransaction(@NonNull final TokenCreateRequest request) throws HederaException;
100142

143+
/**
144+
* Executes a token associate transaction.
145+
*
146+
* @param request the request containing the details of the token associate transaction
147+
* @return the result of the token associate transaction
148+
* @throws HederaException if the transaction could not be executed
149+
*/
101150
@NonNull
102151
TokenAssociateResult executeTokenAssociateTransaction(@NonNull final TokenAssociateRequest request)
103152
throws HederaException;
104153

154+
/**
155+
* Executes a token mint transaction.
156+
*
157+
* @param request the request containing the details of the token mint transaction
158+
* @return the result of the token mint transaction
159+
* @throws HederaException if the transaction could not be executed
160+
*/
105161
@NonNull
106162
TokenMintResult executeMintTokenTransaction(@NonNull final TokenMintRequest request) throws HederaException;
107163

164+
/**
165+
* Executes a token burn transaction.
166+
*
167+
* @param request the request containing the details of the token burn transaction
168+
* @return the result of the token burn transaction
169+
* @throws HederaException if the transaction could not be executed
170+
*/
108171
@NonNull
109172
TokenBurnResult executeBurnTokenTransaction(@NonNull final TokenBurnRequest request) throws HederaException;
110173

174+
/**
175+
* Executes a transfer transaction for an NFT.
176+
*
177+
* @param request the request containing the details of the token transfer transaction
178+
* @return the result of the token transfer transaction
179+
* @throws HederaException if the transaction could not be executed
180+
*/
111181
@NonNull
112182
TokenTransferResult executeTransferTransactionForNft(@NonNull final TokenTransferRequest request)
113183
throws HederaException;
114184

185+
/**
186+
* Executes a topic create transaction.
187+
*
188+
* @param request the request containing the details of the topic create transaction
189+
* @return the result of the topic create transaction
190+
* @throws HederaException if the transaction could not be executed
191+
*/
192+
@NonNull
193+
TopicCreateResult executeTopicCreateTransaction(@NonNull TopicCreateRequest request) throws HederaException;
194+
195+
/**
196+
* Executes a topic delete transaction.
197+
*
198+
* @param request the request containing the details of the topic delete transaction
199+
* @return the result of the topic delete transaction
200+
* @throws HederaException if the transaction could not be executed
201+
*/
202+
@NonNull
203+
TopicDeleteResult executeTopicDeleteTransaction(@NonNull TopicDeleteRequest request) throws HederaException;
204+
205+
/**
206+
* Executes a topic message submit transaction.
207+
*
208+
* @param request the request containing the details of the topic message submit transaction
209+
* @return the result of the topic message submit transaction
210+
* @throws HederaException if the transaction could not be executed
211+
*/
212+
@NonNull
213+
TopicSubmitMessageResult executeTopicMessageSubmitTransaction(@NonNull TopicSubmitMessageRequest request)
214+
throws HederaException;
215+
216+
/**
217+
* Adds a transaction listener to the protocol layer client. The listener will be notified when a transaction
218+
* is executed.
219+
*
220+
* @param listener the transaction listener to be added
221+
* @return a Runnable object that can be used to remove the listener
222+
*/
115223
@NonNull
116224
Runnable addTransactionListener(@NonNull TransactionListener listener);
117225
}

hedera-base/src/test/java/com/openelements/hedera/base/test/ProtocolLayerClientTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.openelements.hedera.base.test;
22

3+
import com.openelements.hedera.base.protocol.ProtocolLayerClient;
34
import org.junit.jupiter.api.Assertions;
45
import org.junit.jupiter.api.Test;
56

@@ -27,7 +28,7 @@ void testNullConstructorParam() {
2728
void testNullParams() {
2829
//given
2930
final Account account = new Account(AccountId.fromString("0.0.12345"), PrivateKey.generateED25519().getPublicKey(), PrivateKey.generateED25519());
30-
final ProtocolLayerClientImpl client = new ProtocolLayerClientImpl(Client.forTestnet(), account);
31+
final ProtocolLayerClient client = new ProtocolLayerClientImpl(Client.forTestnet(), account);
3132

3233
//then
3334
Assertions.assertThrows(NullPointerException.class, () -> client.executeAccountBalanceQuery(null));

0 commit comments

Comments
 (0)