Skip to content

Commit

Permalink
minor fix for overloaded function the complete fix would need adridad…
Browse files Browse the repository at this point in the history
  • Loading branch information
UrsZeidler committed Mar 23, 2017
1 parent f6c20f3 commit 0aa380a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/main/java/org/adridadou/ethereum/SmartContract.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -55,7 +54,7 @@ public CompletableFuture<Object[]> callFunction(String functionName, EthValue va
}

public CompletableFuture<Object[]> callFunction(EthValue value, String functionName, Object... args) {
return Optional.ofNullable(contract.getByName(functionName)).map((func) -> {
return Arrays.stream(contract.functions).filter(f-> f.name.equals(functionName) && f.inputs.length == args.length).findFirst().map((func) -> {
EthData functionCallBytes = EthData.of(func.encode(args));
return proxy.sendTx(value, functionCallBytes, account, address)
.thenApply(receipt -> contract.getByName(functionName).decodeResult(receipt.getResult().data));
Expand Down

0 comments on commit 0aa380a

Please sign in to comment.