Skip to content

Commit e03da96

Browse files
committed
lint fix
1 parent ce6615d commit e03da96

File tree

5 files changed

+57
-25
lines changed

5 files changed

+57
-25
lines changed

apps/dashboard/src/@/components/blocks/SignatureSelector.tsx

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ export function SignatureSelector({
4848
const currentValues = useMemo((): string[] => {
4949
if (multiSelect) {
5050
if (Array.isArray(value)) {
51-
return value.filter((val): val is string => val !== undefined && val !== null);
51+
return value.filter(
52+
(val): val is string => val !== undefined && val !== null,
53+
);
5254
} else {
5355
return value ? [value] : [];
5456
}
@@ -63,14 +65,19 @@ export function SignatureSelector({
6365

6466
// Check if the current values include custom values (not in options)
6567
const customValues = useMemo(() => {
66-
return currentValues.filter((val): val is string => val !== undefined && val !== null && !options.some((opt) => opt.value === val));
68+
return currentValues.filter(
69+
(val): val is string =>
70+
val !== undefined &&
71+
val !== null &&
72+
!options.some((opt) => opt.value === val),
73+
);
6774
}, [currentValues, options]);
6875

6976
// Add the custom values as options if needed
7077
const allOptions = useMemo(() => {
7178
const customOptions = customValues
72-
.filter(val => val) // Filter out undefined/null values
73-
.map(val => ({ label: val!, value: val! }));
79+
.filter((val) => val) // Filter out undefined/null values
80+
.map((val) => ({ label: val!, value: val! }));
7481
return [...formattedOptions, ...customOptions];
7582
}, [formattedOptions, customValues]);
7683

@@ -81,7 +88,7 @@ export function SignatureSelector({
8188
// Multi-select behavior
8289
onChange(selected);
8390
// For multi-select, we'll use the ABI from the first selected option that has one
84-
const firstOptionWithAbi = selected.find(selectedValue => {
91+
const firstOptionWithAbi = selected.find((selectedValue) => {
8592
const found = options.find((opt) => opt.value === selectedValue);
8693
return found?.abi;
8794
});
@@ -91,7 +98,8 @@ export function SignatureSelector({
9198
}
9299
} else {
93100
// Single-select behavior (maintain backward compatibility)
94-
const selectedValue = selected.length > 0 ? (selected[selected.length - 1] ?? "") : "";
101+
const selectedValue =
102+
selected.length > 0 ? (selected[selected.length - 1] ?? "") : "";
95103
onChange(selectedValue);
96104
const found = options.find((opt) => opt.value === selectedValue);
97105
if (setAbi) {
@@ -109,8 +117,14 @@ export function SignatureSelector({
109117
if (!options.some((opt) => opt.value === searchValue.trim())) {
110118
if (multiSelect) {
111119
// Add to existing values for multi-select
112-
const currentArray = Array.isArray(value) ? value : (value ? [value] : []);
113-
const filteredArray = currentArray.filter((val): val is string => val !== undefined && val !== null);
120+
const currentArray = Array.isArray(value)
121+
? value
122+
: value
123+
? [value]
124+
: [];
125+
const filteredArray = currentArray.filter(
126+
(val): val is string => val !== undefined && val !== null,
127+
);
114128
const newValues = [...filteredArray, searchValue.trim()];
115129
onChange(newValues);
116130
} else {
@@ -163,10 +177,9 @@ export function SignatureSelector({
163177
/>
164178
{customValues.length > 0 && (
165179
<div className="mt-2 rounded border border-warning-200 bg-warning-50 px-2 py-1 text-warning-700 text-xs">
166-
{multiSelect
167-
? `You entered ${customValues.length} custom signature${customValues.length > 1 ? 's' : ''}. Please provide the ABI below.`
168-
: "You entered a custom signature. Please provide the ABI below."
169-
}
180+
{multiSelect
181+
? `You entered ${customValues.length} custom signature${customValues.length > 1 ? "s" : ""}. Please provide the ABI below.`
182+
: "You entered a custom signature. Please provide the ABI below."}
170183
</div>
171184
)}
172185
</div>

apps/dashboard/src/@/components/blocks/multi-select.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export const MultiSelect = forwardRef<HTMLButtonElement, MultiSelectProps>(
147147

148148
// Filter out customTrigger from props to avoid passing it to Button
149149
const buttonProps = Object.fromEntries(
150-
Object.entries(props).filter(([key]) => key !== 'customTrigger')
150+
Object.entries(props).filter(([key]) => key !== "customTrigger"),
151151
) as React.ButtonHTMLAttributes<HTMLButtonElement>;
152152

153153
return (

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

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,16 @@ export function FilterDetailsStep({
7474
const knownFunctionSignatures = functionSignatures.map(
7575
(sig) => sig.signature,
7676
);
77-
77+
7878
// Handle both single and multiple signatures for custom signature detection
79-
const sigHashes = Array.isArray(sigHash) ? sigHash : (sigHash ? [sigHash] : []);
79+
const sigHashes = Array.isArray(sigHash) ? sigHash : sigHash ? [sigHash] : [];
8080
const isCustomSignature =
8181
(watchFilterType === "event" &&
82-
sigHashes.some(hash => hash && !knownEventSignatures.includes(hash))) ||
82+
sigHashes.some((hash) => hash && !knownEventSignatures.includes(hash))) ||
8383
(watchFilterType === "transaction" &&
84-
sigHashes.some(hash => hash && !knownFunctionSignatures.includes(hash)));
84+
sigHashes.some(
85+
(hash) => hash && !knownFunctionSignatures.includes(hash),
86+
));
8587

8688
return (
8789
<>
@@ -322,7 +324,9 @@ export function FilterDetailsStep({
322324
// If custom signature, clear ABI field
323325
const known = eventSignatures.map((sig) => sig.signature);
324326
const values = Array.isArray(val) ? val : [val];
325-
const hasCustomSignature = values.some(v => v && !known.includes(v));
327+
const hasCustomSignature = values.some(
328+
(v) => v && !known.includes(v),
329+
);
326330
if (hasCustomSignature) {
327331
form.setValue("abi", "");
328332
}
@@ -348,7 +352,9 @@ export function FilterDetailsStep({
348352
(sig) => sig.signature,
349353
);
350354
const values = Array.isArray(val) ? val : [val];
351-
const hasCustomSignature = values.some(v => v && !known.includes(v));
355+
const hasCustomSignature = values.some(
356+
(v) => v && !known.includes(v),
357+
);
352358
if (hasCustomSignature) {
353359
form.setValue("abi", "");
354360
}
@@ -374,7 +380,11 @@ export function FilterDetailsStep({
374380
? "Fetching event signatures..."
375381
: "Fetching function signatures..."
376382
}
377-
value={Array.isArray(field.value) ? field.value.join(", ") : field.value || ""}
383+
value={
384+
Array.isArray(field.value)
385+
? field.value.join(", ")
386+
: field.value || ""
387+
}
378388
/>
379389
)}
380390
</FormControl>

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,19 +194,24 @@ export default function ReviewStep({
194194

195195
<li className="flex justify-between">
196196
<span className="text-muted-foreground text-sm">
197-
Signature Hash{Array.isArray(form.watch("sigHash")) && form.watch("sigHash")?.length > 1 ? "es" : ""}:
197+
Signature Hash
198+
{Array.isArray(form.watch("sigHash")) &&
199+
form.watch("sigHash")?.length > 1
200+
? "es"
201+
: ""}
202+
:
198203
</span>
199204
<span className="font-medium text-sm">
200205
{(() => {
201206
const sigHash = form.watch("sigHash");
202207
if (!sigHash) return "None";
203-
208+
204209
if (Array.isArray(sigHash)) {
205210
if (sigHash.length === 0) return "None";
206211
if (sigHash.length === 1) {
207212
return truncateMiddle(sigHash[0], 10, 6);
208213
}
209-
return `${sigHash.length} signature${sigHash.length > 1 ? 's' : ''} selected`;
214+
return `${sigHash.length} signature${sigHash.length > 1 ? "s" : ""} selected`;
210215
} else {
211216
return truncateMiddle(sigHash, 10, 6);
212217
}

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ export function buildEventWebhookPayload(
3333
): WebhookPayload {
3434
const eventSignatures = [];
3535
if (data.sigHash) {
36-
const sigHashes = Array.isArray(data.sigHash) ? data.sigHash : [data.sigHash];
36+
const sigHashes = Array.isArray(data.sigHash)
37+
? data.sigHash
38+
: [data.sigHash];
3739
for (const sigHash of sigHashes) {
3840
if (sigHash) {
3941
eventSignatures.push({
@@ -64,7 +66,9 @@ export function buildTransactionWebhookPayload(
6466
): WebhookPayload {
6567
const txSignatures = [];
6668
if (data.sigHash) {
67-
const sigHashes = Array.isArray(data.sigHash) ? data.sigHash : [data.sigHash];
69+
const sigHashes = Array.isArray(data.sigHash)
70+
? data.sigHash
71+
: [data.sigHash];
6872
for (const sigHash of sigHashes) {
6973
if (sigHash) {
7074
txSignatures.push({

0 commit comments

Comments
 (0)