-
Notifications
You must be signed in to change notification settings - Fork 24
feat: create ContractRepository interface, implementation #204
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Ndacyayisenga-droid <[email protected]>
| @NonNull | ||
| default JSON queryContractsByFileId(@NonNull final String fileId) throws HieroException { | ||
| Objects.requireNonNull(fileId, "fileId must not be null"); | ||
| return doGetCall("/api/v1/contracts?file.id=" + fileId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you ever tried that endpoints? I can not find a definition for it at https://testnet.mirrornode.hedera.com/api/v1/docs/#/
| @NonNull | ||
| default JSON queryContractsByEvmAddress(@NonNull final String evmAddress) throws HieroException { | ||
| Objects.requireNonNull(evmAddress, "evmAddress must not be null"); | ||
| return doGetCall("/api/v1/contracts?evm.address=" + evmAddress); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you ever tried that endpoints? I can not find a definition for it at https://testnet.mirrornode.hedera.com/api/v1/docs/#/
| @NonNull | ||
| default JSON queryContractsByProxyAccountId(@NonNull final String proxyAccountId) throws HieroException { | ||
| Objects.requireNonNull(proxyAccountId, "proxyAccountId must not be null"); | ||
| return doGetCall("/api/v1/contracts?proxy.account.id=" + proxyAccountId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you ever tried that endpoints? I can not find a definition for it at https://testnet.mirrornode.hedera.com/api/v1/docs/#/
| } | ||
| final JsonArray contractsArray = jsonObject.getJsonArray("contracts"); | ||
| if (contractsArray == null) { | ||
| throw new IllegalArgumentException("Contracts array is not an array: " + contractsArray); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| throw new IllegalArgumentException("Contracts array is not an array: " + contractsArray); | |
| throw new IllegalArgumentException("No contracts array in JSON"); |
| if (contractsArray == null) { | ||
| throw new IllegalArgumentException("Contracts array is not an array: " + contractsArray); | ||
| } | ||
| Spliterator<JsonValue> spliterator = Spliterators.spliteratorUnknownSize(contractsArray.iterator(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Spliterator<JsonValue> spliterator = Spliterators.spliteratorUnknownSize(contractsArray.iterator(), | |
| final Spliterator<JsonValue> spliterator = Spliterators.spliteratorUnknownSize(contractsArray.iterator(), |
| } | ||
|
|
||
| // Simple Page implementation for converter methods | ||
| private static class SimplePage<T> implements Page<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| private static class SimplePage<T> implements Page<T> { | |
| private static class SinglePage<T> implements Page<T> { |
We should extract that class to an extra file since others might want to use it as well
| private static class SimplePage<T> implements Page<T> { | ||
| private final List<T> data; | ||
|
|
||
| public SimplePage(List<T> data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null check is missing
No description provided.