-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Labels
Good first issueGood for newcomersGood for newcomers
Description
Description
When using envio init to auto-generate an indexer, the generated EventHandlers.ts file contains incorrect property casing for the StopRampA event handler, causing TypeScript compilation errors.
Error Details
Compilation Error:
src/EventHandlers.ts(123,21): error TS2551: Property 'a' does not exist on type 'Vyper_contract_StopRampA_eventArgs'. Did you mean 'A'?
Root Cause:
The auto-generated code incorrectly maps event parameters with inconsistent casing:
- Event parameter:
event.params.A(uppercase) - Entity field:
a(lowercase) - Generated code incorrectly uses:
a: event.params.a❌
Reproduction Steps
- Run
envio initto create a new indexer - Use the following contract configuration
- 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7
On eth mainnet
- Run
pnpm tsc --noEmitto see the compilation error
Expected Behavior
The auto-generated code should correctly map the uppercase event parameter A to the lowercase entity field a:
Vyper_contract.StopRampA.handler(async ({ event, context }) => {
const entity: Vyper_contract_StopRampA = {
id: `${event.chainId}_${event.block.number}_${event.logIndex}`,
a: event.params.A, // ✅ Correct: uppercase param -> lowercase field
t: event.params.t,
};
context.Vyper_contract_StopRampA.set(entity);
});Actual Behavior
The auto-generated code incorrectly uses lowercase for both:
Vyper_contract.StopRampA.handler(async ({ event, context }) => {
const entity: Vyper_contract_StopRampA = {
id: `${event.chainId}_${event.block.number}_${event.logIndex}`,
a: event.params.a, // ❌ Error: lowercase param doesn't exist
t: event.params.t,
};
context.Vyper_contract_StopRampA.set(entity);
});Environment
- Contract Address:
0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7(Curve 3pool) - Event:
StopRampA(uint256 A, uint256 t) - Generated Types:
- Event args:
{ readonly A: bigint; readonly t: bigint } - Entity:
{ readonly a: bigint; readonly id: id; readonly t: bigint }
- Event args:
Workaround
Manually fix the generated code by changing event.params.a to event.params.A in the StopRampA handler.
Impact
This prevents the indexer from compiling and running, requiring manual intervention to fix auto-generated code.
Metadata
Metadata
Assignees
Labels
Good first issueGood for newcomersGood for newcomers