-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9400a5
commit 93ecba9
Showing
12 changed files
with
411 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
hedera-base/src/main/java/com/openelements/hedera/base/protocol/FileContentsResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
package com.openelements.hedera.base.protocol; | ||
|
||
public record FileContentsResponse(byte[] contents) { | ||
import com.hedera.hashgraph.sdk.FileId; | ||
|
||
public record FileContentsResponse(FileId fileId, byte[] contents) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
hedera-base/src/main/java/com/openelements/hedera/base/protocol/FileInfoRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.openelements.hedera.base.protocol; | ||
|
||
import com.hedera.hashgraph.sdk.FileId; | ||
import com.hedera.hashgraph.sdk.Hbar; | ||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
import edu.umd.cs.findbugs.annotations.Nullable; | ||
import java.util.Objects; | ||
|
||
public record FileInfoRequest(@NonNull FileId fileId, @Nullable Hbar queryPayment, @Nullable Hbar maxQueryPayment) implements QueryRequest { | ||
|
||
public FileInfoRequest { | ||
Objects.requireNonNull(fileId, "fileId must not be null"); | ||
} | ||
|
||
@NonNull | ||
public static FileInfoRequest of(@NonNull String fileId) { | ||
Objects.requireNonNull(fileId, "fileId must not be null"); | ||
return of(FileId.fromString(fileId)); | ||
} | ||
|
||
@NonNull | ||
public static FileInfoRequest of(@NonNull FileId fileId) { | ||
return new FileInfoRequest(fileId, null, null); | ||
} | ||
|
||
@Override | ||
public Hbar queryPayment() { | ||
return queryPayment; | ||
} | ||
|
||
@Override | ||
public Hbar maxQueryPayment() { | ||
return maxQueryPayment; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
hedera-base/src/main/java/com/openelements/hedera/base/protocol/FileInfoResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.openelements.hedera.base.protocol; | ||
|
||
import com.hedera.hashgraph.sdk.FileId; | ||
import java.time.Instant; | ||
|
||
public record FileInfoResponse(FileId fileId, int size, boolean deleted, Instant expirationTime){ | ||
} |
39 changes: 39 additions & 0 deletions
39
hedera-base/src/main/java/com/openelements/hedera/base/protocol/FileUpdateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.openelements.hedera.base.protocol; | ||
|
||
import com.hedera.hashgraph.sdk.FileId; | ||
import com.hedera.hashgraph.sdk.Hbar; | ||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
import edu.umd.cs.findbugs.annotations.Nullable; | ||
import java.time.Duration; | ||
import java.time.Instant; | ||
import java.util.Objects; | ||
|
||
public record FileUpdateRequest(Hbar maxTransactionFee, | ||
|
||
Duration transactionValidDuration, | ||
|
||
FileId fileId, | ||
|
||
@Nullable byte[] contents, | ||
|
||
@Nullable Instant expirationTime, | ||
String fileMemo) implements TransactionRequest { | ||
|
||
private static final String DEFAULT_FILE_MEMO = ""; | ||
|
||
public static final int FILE_CREATE_MAX_BYTES = 2048; | ||
|
||
public FileUpdateRequest { | ||
if (contents != null && contents.length > FILE_CREATE_MAX_BYTES) { | ||
throw new IllegalArgumentException("File contents must be less than " + FILE_CREATE_MAX_BYTES + " bytes"); | ||
} | ||
} | ||
|
||
public static FileUpdateRequest of(@NonNull FileId fileId, @NonNull byte[] contents) { | ||
return new FileUpdateRequest(DEFAULT_MAX_TRANSACTION_FEE, DEFAULT_TRANSACTION_VALID_DURATION, fileId, contents, null, DEFAULT_FILE_MEMO); | ||
} | ||
|
||
public static FileUpdateRequest of(@NonNull FileId fileId, @NonNull Instant expirationTime) { | ||
return new FileUpdateRequest(DEFAULT_MAX_TRANSACTION_FEE, DEFAULT_TRANSACTION_VALID_DURATION, fileId, null, expirationTime, DEFAULT_FILE_MEMO); | ||
} | ||
} |
Oops, something went wrong.