-
Notifications
You must be signed in to change notification settings - Fork 215
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
Conversation
use-web3-http-provider branch sync with master branch
(Sync) use-web3-http-provider <- master
src/utils/blockchainHelpers.js
Outdated
@@ -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') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract to variable
There was a problem hiding this comment.
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) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes exactly 👍
There was a problem hiding this 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.
@15chrjef Change applied. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Very helpful.
Depends on #324.
If web3 is not injected and you are in the
development
environment (usingnpm start
), try to connect directly to testrpc (localhost:8545
).I think this can be very useful during development, since the transactions are submitted automatically.