Skip to content

Conversation

@Ndacyayisenga-droid
Copy link
Member

No description provided.

@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);
Copy link
Member

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);
Copy link
Member

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);
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null check is missing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants