How to Listen to Contract Events in Drizzle

2018-07-21 19:05:47

Let's take the example of the SimpleStorage contract that comes with the truffle box drizzle-box

How can we listen to the event StorageSet and console.log it to the JS console?

drizzleOptions.js

import SimpleStorage from './../build/contracts/SimpleStorage.json'

const drizzleOptions = {

web3: {

block: false,

fallback: {

type: 'ws',

url: 'ws://127.0.0.1:8545'

}

},

contracts: [

SimpleStorage

],

events: {

SimpleStorage: ['StorageSet'],

},

polls: {

accounts: 1500

}

}

export default drizzleOptions