-
Notifications
You must be signed in to change notification settings - Fork 5k
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
TypeScript and Web3 constructor #2275
Comments
It looks like this is something that was introduced recently, Just for confirmation, should I consider this pattern no longer possible? const web3 = new Web3()
web3.setProvider(someProvider)
|
Also encountered this issue when updating dependencies. I am worried about that If this breaking change is intentional, web3 instances cannot even be initialized in browsers without a injected web3 provider and requires much code for pre- For a quick workaround, pass a dummy (but invalid) URI that would be recognized as an HTTP RPC endpoint: |
@wnz99 |
sure, thank you. |
@wnz99 or @andy0130tw can you explain me the exact use case for initiating a Web3 object without a provider? |
I'm closing this issue because there was no answer from the creator. |
Expected behavior
Initialize Web3 instance without passing an initial provider.
Actual behavior
I am trying to initialize Web3 in a TS project as follows:
however the compiler outputs the following error:
An argument for 'provider' was not provided
Is this expected?
Steps to reproduce the behavior
Error Logs
An argument for 'provider' was not provided
Versions
Web3 1.0.0-beta.41
The text was updated successfully, but these errors were encountered: