- added
web3.eth.getTransactionReceipt()
see: https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethgettransactionreceipt - contract creation transactions don't return the transaction hash anymore, you need to get them through receipts, or use our new way of using
contract.new()
:
var MyContract = web3.eth.contract(abiArray);
// Create the contract async
var myContract = MyContract.new(param1, param2, {
data: myContractCode,
gas: 300000,
from: mySenderAddress}, function(err, contract){
if(!err) {
// The callback will fire after the contract is mined
// Note that the returned "myContract" === "myContractInstance"
console.log(myContractInstance.address) // "0xc4abd0339eb8d57087278718986382264244252f"
console.log(myContractInstance.transactionHash) // The hash of the transaction, which created the contract
}
});
// Create contract sync: Then the address will be added as soon as the contract is mined.
// Additionally you can watch the transaction by using the "transactionHash" property
var myContractInstance = MyContract.new(param1, param2, {data: myContractCode, gas: 300000, from: mySenderAddress});
myContractInstance.transactionHash // The hash of the transaction, which created the contract
myContractInstance.address // undefined at start, but will be auto-filled later
See contracts for more: https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethcontract