github web3/web3.js 0.8.0
Release 0.8.0

latest releases: v4.8.0, v4.7.0, v4.6.0...
8 years ago
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

Don't miss a new web3.js release

NewReleases is sending notifications on new releases.