Currently TypeChain generates types similar to the following:
class ContractAbc extends Contract {
...
filters: {
TemplateCreated(
templateId: BytesLike | null,
airnodeId: null,
endpointId: null,
parameters: null
): TypedEventFilter<
[string, string, string, string],
{
templateId: string;
airnodeId: string;
endpointId: string;
parameters: string;
}
>;
...
The problem is that I can't use filters to query my event. Instead I want to pass tx.hash, and parse the logs myself. However at that point I would like to cast my event response to the Type generated by TypeChain.
For example, this code:
contractAbc.provider.once(tx.hash, (tx) => {
const parsedLog = airnodeRrp.interface.parseLog(tx.logs[0]);
resolve(parsedLog.args.templateId); // This is untyped (args is basically any)
})
Instead I would like to have a code like this:
contractAbc.provider.once(tx.hash, (tx) => {
const parsedLog = airnodeRrp.interface.parseLog(tx.logs[0]).args as TemplateCreatedEvent;
resolve(parsedLog.templateId); // parsedLog should be typed
})
Slightly related: #249
Currently TypeChain generates types similar to the following:
The problem is that I can't use filters to query my event. Instead I want to pass
tx.hash, and parse the logs myself. However at that point I would like to cast my event response to the Type generated by TypeChain.For example, this code:
Instead I would like to have a code like this:
Slightly related: #249