Skip to content

Adding event type for ethers #249

Description

@Nekonaughey

Hello!

Thanks for the great project!

It seems that typechain does not output the event type when it is generated by specifying ethers-v4 as the target.
This is inconvenient because I don't know the type when implementing the event handler.

Sample Code

pragma solidity ^0.6.4;
pragma experimental ABIEncoderV2;
contract Test {
  event TestEvent(address sender, string message);
  function test() public {
    emit TestEvent(msg.sender, 'test Message!');
  }
}

Output Result

interface TestInterface extends Interface {
  events: {
    TestEvent: TypedEventDescription<{
      encodeTopics([sender, message]: [null, null]): string[];  **// type is null**
    }>;
  };
}

export class Test extends Contract {
  filters: {
    TestEvent(sender: null, message: null): EventFilter;  **// type is null**
  };
}

Expected Behavior
It would be helpful if you could output something like the following
export type TestEvent = [string, string]

If struct type is used...
export type TestEvent = [string, { id: string, name: string }]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions