Skip to content

Commit 79c0de3

Browse files
author
Amine Afia
committed
Add support for tuple types in ABI event and function signatures
1 parent ad5aabc commit 79c0de3

File tree

1 file changed

+15
-2
lines changed
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils

1 file changed

+15
-2
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils/abiUtils.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ function isAbiInput(
2828
);
2929
}
3030

31+
// Helper to recursively get canonical type for ABI input (handles tuples)
32+
function getCanonicalType(input: any): string {
33+
if (input.type.startsWith("tuple")) {
34+
// Recursively build tuple type string
35+
const components = input.components || [];
36+
const tupleType = `(${components.map(getCanonicalType).join(",")})`;
37+
// Handle tuple arrays (tuple[], tuple[2], etc)
38+
const arraySuffix = input.type.slice("tuple".length);
39+
return tupleType + arraySuffix;
40+
}
41+
return input.type;
42+
}
43+
3144
/**
3245
* Extracts event signatures from ABI data
3346
* @param abiData Array of ABI data objects
@@ -80,7 +93,7 @@ export const extractEventSignatures = (
8093
const canonicalInputs = Array.isArray(event.inputs)
8194
? event.inputs
8295
.filter((input: unknown) => isAbiInput(input))
83-
.map((input: { type: string }) => input.type)
96+
.map((input: any) => getCanonicalType(input))
8497
.join(",")
8598
: "";
8699

@@ -162,7 +175,7 @@ export const extractFunctionSignatures = (
162175
const canonicalInputs = Array.isArray(func.inputs)
163176
? func.inputs
164177
.filter((input: unknown) => isAbiInput(input))
165-
.map((input: { type: string }) => input.type)
178+
.map((input: any) => getCanonicalType(input))
166179
.join(",")
167180
: "";
168181

0 commit comments

Comments
 (0)