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

contract.deploy().send() not resolving in beta.48 #2506

Closed
pstuermlinger opened this issue Mar 15, 2019 · 8 comments
Closed

contract.deploy().send() not resolving in beta.48 #2506

pstuermlinger opened this issue Mar 15, 2019 · 8 comments

Comments

@pstuermlinger
Copy link

Description

I've got a little contract deployment script, which stopped working after upgrading web3 from beta.37 to beta.48. Downgrading helped.
The issue is, that the promise returned by myContract.deploy(args).send(opts) is never resolved.

Issue may be related to #2500.

Expected behavior

The promise should either resolve or reject.

Actual behavior

Waiting for promise indefinitely.

Gists

https://gist.github.com/haggins/2213e5d1852c825869687672a9dff890

Versions

  • web3.js: beta.48
  • nodejs: 10.15
  • ethereum node: ganache-cli 6.2.3
@nivida
Copy link
Contributor

nivida commented Mar 15, 2019

Thanks for creating this issue!

I've tested it with the version beta.48 and it works. I think you forgot to return the response in the async method.

Code:

const contract = new web3.eth.Contract(abi);
contract.transactionConfirmationBlocks = 1;


const deploy = async () => {
  const gas = await contract.deploy({data: web3TokenBytecode}).estimateGas();
  const response = await contract.deploy({data: web3TokenBytecode}).send({
    from: '0xb414031Aa4838A69e27Cb2AE31E709Bcd674F0Cb',
    gas: gas + 1
  });

  console.log('Contract deployed to:', response.address);
  console.log('Contract deployed to:', response.options.address);

  return response;
};

deploy().then((contractClone) => {
  console.log('CLONED-CONTRACT: ', contractClone);

}).catch(console.log);

Response:

Contract deployed to: 0xF250bDB2bFE42e383C38F0CAafeD03545B24F5D6
Contract deployed to: 0xF250bDB2bFE42e383C38F0CAafeD03545B24F5D6
CLONED-CONTRACT: AbstractContract {...}

@nivida nivida added the support label Mar 15, 2019
@pstuermlinger
Copy link
Author

Hi Samuel,
thanks for your quick response. I've added the return (see gist) but it didn't change anything. Using beta.37 always works, though.

Did you run my gist? Against which ethereum node?

@pstuermlinger
Copy link
Author

pstuermlinger commented Mar 15, 2019

Oh wait - while I was writing my response it finally finished. It just takes a magnitude longer. Is there something new like "resolve after 24 confirmations" or so?
edit: yes - it resolves exactly after 24 confirmations

@pstuermlinger
Copy link
Author

Ok, we can close this issue.
When I use ganache UI instead of -cli it raises an exception with beta.37 but not with beta.48. This might cause beta.37 to resolve immediately (what I wanted).

TypeError: Cannot read property 'subscriptions' of undefined
    at /node_modules/ganache-core/lib/webSocketServer.js:102:47
    at process.nextTick (/node_modules/ganache-core/lib/provider.js:114:28)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

@amorriscode
Copy link

Glad I saw this issue; I was using the latest version beta.52 and I wasn't getting a promise resolved. Downgraded to beta.48 and I got my promise.

@Pedro-vk
Copy link

Pedro-vk commented May 9, 2019

I'm having this issue in beta.55 using ganache or ganache-cli. Is possible to resolve after just 1 confirmation?

@nivida
Copy link
Contributor

nivida commented May 9, 2019

Thanks for asking! @Pedro-vk
Yes, this is possible with the transactionConfirmationBlocks option of a Web3 module.

@Pedro-vk
Copy link

Pedro-vk commented May 9, 2019

Thank you 👍 Is gonna be really helpful for me!

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

4 participants