solidstate-solidity icon indicating copy to clipboard operation
solidstate-solidity copied to clipboard

Event parsing function

Open ItsNickBarry opened this issue 2 years ago • 1 comments

Draft provided by @Lumyo

import { ContractReceipt } from 'ethers';
import { Interface } from 'ethers/lib/utils';
import { LogDescription } from '@ethersproject/abi';

function getEvents(
  contractInterface: Interface,
  receipt: ContractReceipt,
) {
  const events: LogDescription[] = [];

  for (const log of receipt.logs) {
    try {
      events.push(contractInterface.parseLog(log));
    } catch (e) {}
  }

  return events;
}

ItsNickBarry avatar Dec 08 '21 04:12 ItsNickBarry

This would probably go well inside the lib package or it could be hardhat-plugin 🤔 . Was there anything that stopped this from being implemented?

0xCourtney avatar Oct 12 '22 14:10 0xCourtney

It should go in lib. It's blocked by the fact that lib is disorganized and lowest priority.

ItsNickBarry avatar Oct 12 '22 19:10 ItsNickBarry