I've started working from the drizzle box and can access functions within contracts, but if I want to give an allowance to a contract address so it can use users tokens how can I give the correct address? drizzleOptions contains contracts which have addresses per network but I don't think I can figure out which network is current without a web3 instance, there must be a simple way though to get the address of a contract on the current network?
Drizzle Dapp – How to Access Contract Address in Drizzle Dapp
dapp-developmentdrizzlereacttruffle
Best Answer
you will need to access the drizzle context object, in the react component. I assume you are working on the 'Home.js' component.
For example:
this.drizzle = context.drizzle
in the constructor of the component and see https://github.com/trufflesuite/drizzle-react/issues/22,
Once you have that working then,
this.drizzle.contracts.TutorialToken.address
or equivalentlycontext.drizzle.contracts.TutorialToken.address
should return the address of the network, however, since I am no expert in react, there may be a better approach.