Skip to content

Commit 71c8e84

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

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/FilterDetailsStep.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ export function FilterDetailsStep({
344344
}}
345345
options={functionSignatures.map((sig) => ({
346346
abi: sig.abi,
347-
label: sig.name,
347+
label: truncateMiddle(sig.name, 30, 15),
348348
value: sig.signature,
349349
}))}
350350
placeholder="Select or enter a function signature"

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)