I'm working on a dapp with the boilerplate created by running truffle unbox drizzle and need to call functions provided by the web3 instance.

Is there a way to access the web3 instance object? All we get from drizzle's store is the state.web3.status string.

Failed Attempt

There is /src/util/web3/web3Reducer.js and /src/util/web3/getWeb3.js but they both appear not to be in use. I tried adding web3Reducer to combineReducers but always get null for the web3Instance.

import { combineReducers } from 'redux'
import { routerReducer } from 'react-router-redux'
import { drizzleReducers } from 'drizzle'
import web3Reducer from './util/web3/web3Reducer'

const reducer = combineReducers({
  routing: routerReducer,
  web3Instance: web3Reducer,

export default reducer

web3 instance can be accessed via context in components. for more information please check https://github.com/trufflesuite/drizzle-react/issues/22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.