0

Problem: org.web3j.tx.exceptions.ContractCallException: Empty value (0x) returned from contract

The code is as follows....

My java:

String owner = managedWalletLookup.getOwner(contractAddress).send();

This ^ line of code calls this auto-generated Java wrapper:

public RemoteCall<String> getOwner(String wallet) {
    final Function function = new Function(FUNC_GETOWNER,
            Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(wallet)),
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}));
    return executeRemoteCallSingleValueReturn(function, String.class);
}

This is the original solidity, from which the Java wrapper gets generated:

mapping(address => address) public _managedWallets;


function updateManagedWallets(address wallet, address owner) public isOwner {
    _managedWallets[wallet] = owner;
}

function getOwner(address wallet) public view returns (address owner) {
    owner = _managedWallets[wallet];
    return owner;
}

Every time I call updateManagedWallets, I get a successful TransactionReciept, but the getOwner function always generates an error.

Any thoughts?

0

I have the exact same problem and I managed to make it work just one time using the following call. Now I cannot obtain the value again.

You could also try, or read more about this

String owner = managedWalletLookup.getOwner(contractAddress).sendAsync().get();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.