Skip to content

Commit

Permalink
feat(apps/web): Parse abi params as part of their validation
Browse files Browse the repository at this point in the history
  • Loading branch information
nevendyulgerov committed Jan 28, 2025
1 parent a83d364 commit a2a0dc3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apps/web/src/components/specification/form/validations.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { includes } from "ramda";
import { isBlank, isNilOrEmpty, isNotNilOrEmpty } from "ramda-adjunct";
import { Abi, Hex, isHex } from "viem";
import { Abi, Hex, isHex, parseAbiParameters } from "viem";
import { Modes, Predicate, SliceInstruction } from "../types";
import { SpecFormValues } from "./context";

Expand Down Expand Up @@ -38,6 +38,12 @@ const specAbiParamValidation = (value: string[], values: SpecFormValues) => {
isNilOrEmpty(value)
)
return `A slice name ${values.sliceTarget} was selected, making ABI parameter required!`;

try {
parseAbiParameters(value);
} catch (error: any) {
return error.message;
}
}

return null;
Expand Down

0 comments on commit a2a0dc3

Please sign in to comment.