Skip to content

Commit

Permalink
check for custom network
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikebbers committed Jul 14, 2024
1 parent 7936ab3 commit c373f0b
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ public ContractVerificationClientImplementation(@NonNull HederaNetwork hederaNet
restClient = RestClient.create();
}

private void checkSupportedNetwork() {
private String getChainId() {
if(hederaNetwork == HederaNetwork.CUSTOM) {
throw new IllegalArgumentException("Custom network is not supported");
}
return hederaNetwork.getChainId() + "";
}

private void handleError(HttpRequest request, ClientHttpResponse response) throws IOException {
Expand Down Expand Up @@ -80,7 +81,7 @@ public ContractVerificationState verify(ContractId contractId, String contractNa

final VerifyRequest verifyRequest = new VerifyRequest(
contractId.toSolidityAddress(),
hederaNetwork.getChainId(),
getChainId(),
"",
"",
files
Expand Down Expand Up @@ -140,7 +141,7 @@ public ContractVerificationState verify(ContractId contractId, String contractNa
public ContractVerificationState checkVerification(ContractId contractId) {
checkSupportedNetwork();

final String uri = CONTRACT_VERIFICATION_URL + "/check-by-addresses" + "?addresses=" + contractId.toSolidityAddress() + "&chainIds=" + hederaNetwork.getChainId();
final String uri = CONTRACT_VERIFICATION_URL + "/check-by-addresses" + "?addresses=" + contractId.toSolidityAddress() + "&chainIds=" + getChainId();

final String resultBody = restClient.get()
.uri(uri)
Expand Down Expand Up @@ -188,7 +189,7 @@ public boolean checkVerification(ContractId contractId, String fileName, String
throw new IllegalStateException("Contract is not verified");
}

final String uri = CONTRACT_VERIFICATION_URL + "/files/" + hederaNetwork.getChainId() + "/" + contractId.toSolidityAddress();
final String uri = CONTRACT_VERIFICATION_URL + "/files/" + getChainId() + "/" + contractId.toSolidityAddress();

final String resultBody = restClient.get()
.uri(uri)
Expand Down

0 comments on commit c373f0b

Please sign in to comment.