Skip to content

Commit

Permalink
fix(core): fix the problem that the contract method without ABI canno…
Browse files Browse the repository at this point in the history
…t be called
  • Loading branch information
Cletitia committed Aug 13, 2021
1 parent 92d68ce commit 39535f2
Showing 1 changed file with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1431,15 +1431,13 @@ private TransactionExtention callWithoutBroadcast(String ownerAddr, Contract cnt
* @param contractAddr smart contract address.
* @param function contract function.
* @return TransactionExtention.
* @throws RuntimeException if function cannot be found in the contract.
*/
public TransactionExtention constantCall(String ownerAddr, String contractAddr, Function function) {
Contract cntr = getContract(contractAddr);
if (isFuncInContract(cntr, function)) {
return callWithoutBroadcast(ownerAddr, cntr, function);
} else {
throw new RuntimeException("Function not found in the contract");
}

TransactionExtention txnExt = callWithoutBroadcast(ownerAddr, cntr, function);

return txnExt;
}

/**
Expand All @@ -1448,16 +1446,13 @@ public TransactionExtention constantCall(String ownerAddr, String contractAddr,
* @param contractAddr smart contract address
* @param function contract function
* @return transaction builder. Users may set other fields, e.g. feeLimit
* @throws RuntimeException if function cannot be found in the contract
*/
public TransactionBuilder triggerCall(String ownerAddr, String contractAddr, Function function) {
Contract cntr = getContract(contractAddr);
if (isFuncInContract(cntr, function)) {
TransactionExtention txnExt = callWithoutBroadcast(ownerAddr, cntr, function);
return new TransactionBuilder(txnExt.getTransaction());
} else {
throw new RuntimeException("Function not found in the contract");
}

TransactionExtention txnExt = callWithoutBroadcast(ownerAddr, cntr, function);

return new TransactionBuilder(txnExt.getTransaction());
}

}

0 comments on commit 39535f2

Please sign in to comment.