New answers tagged

1

Web3j web3j = Web3j.build(new HttpService("")); Credentials credentials = Credentials.create("privateKey"); BigInteger nonce = web3j.ethGetTransactionCount(credentials.getAddress(), DefaultBlockParameterName.PENDING).sendAsync().get().getTransactionCount(); BigInteger gasPrice = web3j.ethGasPrice().sendAsync().get()....


0

You cannot call approve in a contract on behalf of a user. The first parameter of approve is the spender: the address of who or what is allowed to transfer funds for msg.sender. Specifying msg.sender as spender does not let your contract send tokens for msg.sender. What you want to do instead is have the user send two transactions: First, an approve ...


Top 50 recent answers are included