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
getNextNonce should return BigInteger.ONE
if account doesn't exist
#66
Comments
would be good to have this fixed quickly because I want to add a new example to the showcase repo which requires this as it runs against mainnet (TokenMigration contract) |
@mitch-lbw I think we can close this. just tried the workaround and I am getting an error for the dry-run call:
so it probably doesn't matter. maybe it's possible to provide an option to the dry-run endpoint to ignore insufficient funds |
seems like it is possible to provide an amount for dry-run calls, see discussion here aeternity/aeternity#3677 |
so the bug here is still valid as we need to cover @mitch-lbw we need to think about how and where we want to provide this. it probably makes sense to additionally introduce a new config-param for the |
amount should also be quite easy to add: private DryRunTransactionResult dryRunCall(ContractCallTransactionModel contractCallModel,
String functionName) {
DryRunTransactionResults dryRunResults = aeternityService.transactions.blockingDryRunTransactions(DryRunRequest.builder().build().transactionInputItem(contractCallModel).account(DryRunAccountModel.builder().amount(new BigInteger("100000000000000000000000000000000000").publicKey(this.config.getKeyPair().getAddress()).build()));
if(dryRunResults.getResults() != null && dryRunResults.getResults().size()>0) {
return dryRunResults.getResults().get(0);
}
Object dryRunErrorMessage = dryRunResults.getResults().get(0).getContractCallObject().getReturnValue();
try{dryRunErrorMessage=this.aeternityService.compiler.blockingDecodeCallResult(aesSourcecode,functionName,dryRunResults.getResults().get(0).getContractCallObject().getReturnType(),dryRunResults.getResults().get(0).getContractCallObject().getReturnValue(),aesIncludes).getResult();} catch(Exception e){}throw new RuntimeException(String.format("\n"
+ "Dry run call of function %s failed: %s\n"
+ "Causing Exception: %s%nException Details: %s\n"
+ "Exception Hint : %s",functionName,dryRunErrorMessage,dryRunResults.getAeAPIErrorMessage(),dryRunResults.getRootErrorMessage(),"Please validate your input data"));
} in the snippet above (generated by the plugin) I added note
|
the javascript sdk e.g. always uses the zero address with a pre-defined amount for every dry-run call. see:
doing it that way would allow us to skip the requirement of having a configured keypair and we could use this for every static call. the |
Will be fixed with kryptokrauts/aepp-sdk-java#173 |
@mitch-lbw can/should we close this then? |
Yes we can close this issue |
fixed with kryptokrauts/aepp-sdk-java#173 |
I tried to perform
dry-run
calls and those always failed becausegetNextNonce()
doesn't handleAccount not found
properlywe should return
BigInteger.ONE
if the account does not exist yet which should allow us to perform the dry-run callThe text was updated successfully, but these errors were encountered: