strange that after much searching, i havent found even one piece of info out there which clearly elaborates on how the events are manipulated in drizzle. From what i understand, the event names (and options) are specified in the Drizzle Options object. But the event array that is received in the drizzleState is a collection of logs from all events. How can we properly filter only certain event types, collected starting from block 0 to 'latest', and select only logevents that satisfy custom conditions pertaining to log values, and inject them into components? any example code would be appreciated.

1 Answer 1


Here is a code snippet:

export class DrizzleService {
drizzle: Drizzle;

constructor(private web3Service: Web3Service) {

async init() {

    const options = {
      contracts: [], // Without providing an empty array, an error will be raised

    this.drizzle = new Drizzle(options);
async getPastEvents(contractName: string, event: string = 'allEvents', options: any) 
    await this.ensureDrizzleInitialization();

    const web3 = this.drizzle.web3;
    const contract = this.drizzle.contracts[contractName];
    const yourContractWeb3 = new web3.eth.Contract(contract.abi, contract.address);
    return await yourContractWeb3.getPastEvents(event, options);

Full code at: https://github.com/Muhammad-Altabba/ens-angular-truffle-drizzle/

Try it at: https://muhammad-altabba.github.io/ens-angular-truffle-drizzle/

  • This is not really answering the question: you show how to handle event using web3, but not how to do this using Drizzle
    – tomsoft
    Jun 7, 2019 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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