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

[4.x] Transaction sending does not work with Ganache's EthereumProvider #5591

Closed
1 task done
mpetrunic opened this issue Nov 4, 2022 · 2 comments
Closed
1 task done
Labels
4.x 4.0 related Bug Addressing a bug

Comments

@mpetrunic
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Runtime error about missing method

/home/mpetrunic/Projects/ChainSafe/@web3.js/repro/ganache-provider/node_modules/web3-eth/dist/utils/reject_if_block_timeout.js:5
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
                                                         ^
TypeError: provider.supportsSubscriptions is not a function
    at /home/mpetrunic/Projects/ChainSafe/@web3.js/repro/ganache-provider/node_modules/web3-eth/src/utils/reject_if_block_timeout.ts:169:12
    at Generator.next (<anonymous>)
    at fulfilled (/home/mpetrunic/Projects/ChainSafe/@web3.js/repro/ganache-provider/node_modules/web3-eth/dist/utils/reject_if_block_timeout.js:5:58)

Expected Behavior

Should work.
Probably this: https://github.com/web3/web3.js/blob/4.x/packages/web3-eth/src/utils/reject_if_block_timeout.ts#L169
should not expect every provider to have this method.

Steps to Reproduce

import Web3 from "web3"
import {LegacySendProvider} from "web3-types"
import ganache from "ganache";

(async function() {
    const LOCAL_PREFUNDED_MNEMONIC =
  "pioneer casual canoe gorilla embrace width fiction bounce spy exhibit another dog";
    
    const server = ganache.server({
        wallet: {
            mnemonic: LOCAL_PREFUNDED_MNEMONIC,
            defaultBalance: 100,
        },
    });
    const provider = server.provider;

    const web3 = new Web3(provider as LegacySendProvider)

    const accounts = await web3.eth.getAccounts();

    await web3.eth.sendTransaction({to: accounts[1], from: accounts[0], value: "100000"})
})()

Web3.js Version

4.0.1-alpha.1

Environment

  • Operating System:
  • Browser:
  • Node.js Version:
  • NPM Version:

Anything Else?

#5309 would detect those things.

@mpetrunic mpetrunic added the Bug Addressing a bug label Nov 4, 2022
@jdevcs jdevcs added the 4.x 4.0 related label Nov 4, 2022
@jdevcs
Copy link
Contributor

jdevcs commented Dec 13, 2022

@mpetrunic
Copy link
Contributor Author

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x 4.0 related Bug Addressing a bug
Projects
None yet
Development

No branches or pull requests

2 participants