Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

returns null on new web3.eth.Contract(abi).deploy() #1147

Closed
rstormsf opened this issue Oct 27, 2017 · 5 comments
Closed

returns null on new web3.eth.Contract(abi).deploy() #1147

rstormsf opened this issue Oct 27, 2017 · 5 comments

Comments

@rstormsf
Copy link

"web3": "^1.0.0-beta.24"

let Web3 = require('web3')
let web3 = new Web3();
let abi = [{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"}];
let contract = new web3.eth.Contract(abi);
let deploy = contract.deploy(); // supposed to return estimateGas, send, encodeABI
//return null

why?

@rstormsf
Copy link
Author

rstormsf commented Oct 27, 2017

Looks like I had to do this:

contract.options.data = {}
let deploy = contract.deploy();

@rstormsf
Copy link
Author

so, without setting actual bytecode, I can't estimateGas/encodeABI which defeats the purpose.

@rstormsf
Copy link
Author

I was stupid, of course you have to supply data, what I was thinking?

@klivin
Copy link

klivin commented Nov 30, 2018

I was stupid and did the same thing, @rstormsf. Would be nice for missing bytecode to throw an exception rather than return null...

@x5engine
Copy link
Contributor

x5engine commented Mar 1, 2020

2020 I was dumb and did it without the bytecode but it seems the fault of the docs not telling you must add it!

also make you sure you add 0x before a bytecode string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants