Closed jordaniac89 closed 7 years ago
I believe I found what I'm looking for:
Transaction transaction = Transaction.createFunctionCallTransaction(
<credentials>,
<nonce>,
<gasPrice>,
<gasLimit>,
<contractAddress>,
<data> );
EthSendTransaction response =
web3j.ethSendTransaction( transaction ).send();
String hash = response.getTransactionHash()
Does this look like best practice?
That's certainly a way around it.
It makes sense to have a transaction manager that returns the transaction hash straight away. This helps with higher throughput scenarios. Your welcome to take a look at this if you fancy creating a PR.
I may do that. BTW, I'm also using the client on the new Rootstock smart contract platform for Bitcoin. Works like a charm :)
I've created a couple of classes to address this:
Just receive the transaction hash & nothing else: https://github.com/web3j/web3j/blob/master/core/src/main/java/org/web3j/tx/response/NoOpProcessor.java
Get the transactions to be processed in a worker thread that's continually running in the background: https://github.com/web3j/web3j/blob/master/core/src/main/java/org/web3j/tx/response/QueuingTransactionReceiptProcessor.java
See usage examples in the following integration test: https://github.com/web3j/web3j/blob/master/integration-tests/src/test/java/org/web3j/protocol/scenarios/FastRawTransactionManagerIT.java#L79
Just receive the transaction hash & nothing else: https://github.com/web3j/web3j/blob/master/core/src/main/java/org/web3j/tx/response/NoOpProcessor.java
Doesn't look like it does what you said it does...
Why is this closed? Is there a better way to do this instead of "Transaction.createFunctionCallTransaction" ?
If I make a call through something like Postman, I can immediately get back a transaction hash. Is there a way to do this with web3j? The only way I'm seeing to get the data back in the client is to return a future and wait for it. If not, is this a planned update?
Thanks, Jordan