The main index.js is run, calling functions from the imported Aragon class from the wrapper/src/index.js file in the @aragon/wrapper package.
With the currentEvents() function we achieve getting subscribed to the events currently happening within an Aragon DAO app.
Run npm run start after every change (I know, it is too much hassle xD)
Currently it is connecting with currentEvents() to the Voting App inside the dappwalltest0.aragonid.eth DAO.
For it to work you need to:
- Install modules:
npm i
- copy the
artifactsfolder inside thewrapperinto thedistfolder. Like this:
mkdir dist
cp -r node_modules/@aragon/wrapper/artifacts dist/artifacts
apps-abiscontent should go into the@aragon/ospackage like so:
cp apps-abis/* node_modules/@aragon/os/abi/
- replace the
node_modules/@aragon/wrapper/src/index.jsfile with thewrapper-index.jsone.
cp wrapper-index.js node_modules/@aragon/wrapper/src/index.js
- replace the
node_modules/@aragon/wrapper/interfaces.jsfile with theinterfaces.jsone.
cp interfaces.js node_modules/@aragon/wrapper/src/
npm run start
-
Change this line
const yourDAO = new Aragon('0xeeda0bD313b8042B360Ac6755e01D7970860c445'in theindex.jsfile and replace the address with the one of your organization. You can check easily it in the UI at 'Organization'. -
At line
265in thewrapper-indexfile, change this line:let votingAppAddress = '0x40923e3215243b4a51bf411f9873d02f5bacfd60'and replace it for the address of the app you wish to listen to. Also it is highly recommendable to change the variable's name to match the app's -
At line
270, change it all with your app's name and don't forget the second parameter, which identifies you app's ABI. These are all the ABIs I added: 'Finance, 'TokenManager', 'Vault', 'Agent', 'Survey','Payroll', 'DAppWall'.
this.votingProxy = makeProxy(votingAppAddress, 'Voting', this.web3, { initializationBlock: this.kernelProxy.initializationBlock })
-
At line
276const VOTING_CACHE_KEY = getCacheKey(votingAppAddress, 'voting')change it for the variable name you used in line270. The second parameter you don't need to change it. -
At line
313and298changevotingProxy, inside thecurrentEventsandpastEventsfunctions, for the variable name you used at line270.
First Goal: be able to subscribe to all the events occurring in a specific DAO.
---> Accomplished in the way that found out how to subscribe to the events occurring within an app with the currentEvents() function.
These instructions are only there if you plan to use the runApp() function. Not sure if this function is useful at all.
-
You will get a
ReferenceError: self is not definedat MessagePortMessage. You need to changeselftoglobal(this is because of NodeJS specifications) atnode_modules/@aragon/rpc-messenger/dist/providers/MessagePortMessage.js -
Another error at
node_modules/rxjs/internal/util/hostReportError.js:4. It readsTypeError: Invalid event target. You need to change thethrow errin:
setTimeout(function () { throw err; }, 0);
for return err.