Victor Lv
Victor Lv

Reputation: 81

How to create and deploy a contract with ether attached?

How to create and deploy a contract with ether attached in web3.js? In solidity, I know it can be writted like this:

D newD = (new D).value(amount)(arg);

But how to write it in web3.js for testing contract. Thanks sincerely

Upvotes: 4

Views: 318

Answers (1)

Victor Lv
Victor Lv

Reputation: 81

Just attach the attribute of "value: amount" when create contract like this: .new( { from: web3.eth.accounts[0], value: 5 wei }

Upvotes: 2

Related Questions