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

(Fix) Use web3 HttpProvider in dev environment #325

Merged
merged 4 commits into from
Nov 6, 2017

Conversation

fvictorio
Copy link
Contributor

Depends on #324.

If web3 is not injected and you are in the development environment (using npm start), try to connect directly to testrpc (localhost:8545).

I think this can be very useful during development, since the transactions are submitted automatically.

use-web3-http-provider branch sync with master branch
(Sync) use-web3-http-provider <- master
@@ -38,6 +38,10 @@ export function getWeb3(cb) {
if (typeof web3 === 'undefined') {
// no web3, use fallback
console.error("Please use a web3 browser");
if (process.env.NODE_ENV === 'development') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extract to variable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean the condition in the if? Something like:

const devEnvironment = process.env.NODE_ENV === 'development'
if (devEnvironment) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes exactly 👍

Copy link
Contributor

@mark-antony1 mark-antony1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please extract logic in 'if' statement.

@fvictorio
Copy link
Contributor Author

@15chrjef Change applied.

Copy link
Collaborator

@vbaranov vbaranov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Very helpful.

@vbaranov vbaranov merged commit 5ff68b4 into master Nov 6, 2017
@fvictorio fvictorio deleted the use-web3-http-provider branch November 29, 2017 14:51
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

Successfully merging this pull request may close these issues.

3 participants