I'm using truffle.
How can I get transaction id before it is mined? For example:
contract.purchase(price).then(function(tx) {
console.log("Success");
}).catch(function(e){
console.log(e);
});
In that case I only get the tx after the transaction is mined. But I want to have the ability to print the transaction id as soon as it has been created.
I tried using callback function, like:
contract.purchase(price, function(error, tx) {
if(error != null)
return;
console.log(tx);
})
but I get error "invalid address"
I have tried using web3.eth.filter('pending')
and web3.eth.filter('latest')
but I only get the id after it is mined. I'm testing it in TestRpc.
contract.purchase.sendTransaction(price).then(function (tx) { console.log(tx); });
. It should not wait but return immediately.