diff --git a/components/input/input-parameter-tuple.tsx b/components/input/input-parameter-tuple.tsx
index b0a212d0..872f4340 100644
--- a/components/input/input-parameter-tuple.tsx
+++ b/components/input/input-parameter-tuple.tsx
@@ -45,7 +45,7 @@ export const InputParameterTuple = ({
};
const components: AbiParameter[] = (abi as any).components || [];
- const someMissingName = true || components.some((c) => !c.name);
+ const someMissingName = components.some((c) => !c.name);
return (
diff --git a/plugins/dualGovernance/hooks/useProposal.tsx b/plugins/dualGovernance/hooks/useProposal.tsx
index 0436642c..bc8418a6 100644
--- a/plugins/dualGovernance/hooks/useProposal.tsx
+++ b/plugins/dualGovernance/hooks/useProposal.tsx
@@ -81,7 +81,7 @@ export function useProposal(
setMetadata(log.args.metadata);
})
.catch((err) => {
- console.error("Could not fetch the proposal defailt", err);
+ console.error("Could not fetch the proposal details", err);
return null;
});
}, [proposalData?.vetoTally]);
diff --git a/plugins/tokenVoting/hooks/useProposal.tsx b/plugins/tokenVoting/hooks/useProposal.tsx
index a2ce0568..49f0cb41 100644
--- a/plugins/tokenVoting/hooks/useProposal.tsx
+++ b/plugins/tokenVoting/hooks/useProposal.tsx
@@ -77,7 +77,7 @@ export function useProposal(proposalId: string, autoRefresh = false) {
setMetadata(log.args.metadata);
})
.catch((err) => {
- console.error("Could not fetch the proposal defailt", err);
+ console.error("Could not fetch the proposal details", err);
});
}, [proposalData?.tally]);
diff --git a/utils/input-values.ts b/utils/input-values.ts
index a851cd8c..e211176e 100644
--- a/utils/input-values.ts
+++ b/utils/input-values.ts
@@ -1,4 +1,3 @@
-import { AbiParameter } from "viem";
import { decodeCamelCase } from "./case";
export type InputValue =
@@ -9,74 +8,6 @@ export type InputValue =
| Array
| { [k: string]: InputValue };
-export function isValidValue(
- value: InputValue,
- paramType: string,
- components?: AbiParameter[]
-): boolean {
- if (!value || !paramType) return false;
-
- // Recursize cases
-
- if (paramType === "tuple[]") {
- // struct array
- if (!Array.isArray(value)) return false;
- else if (!components)
- throw new Error("The components parameter is required for tuples");
-
- return !value.some((item, idx) => {
- const abi = (paramAbi as any)["components"][idx];
- return !isValidValue(item, abi);
- });
- } else if (paramType.endsWith("[]")) {
- // plain array
- if (!Array.isArray(value)) return false;
- const baseType = paramType.replace(/\[\]$/, "");
-
- return !value.some((item) => !isValidValue(item, baseType));
- } else if (paramType === "tuple[]") {
- // struct
- if (!Array.isArray(value)) return false;
- else if (!components)
- throw new Error("The components parameter is required for tuples");
-
- return !value.some((item, idx) => {
- const abi = (paramAbi as any)["components"][idx];
- return !isValidValue(item, abi);
- });
- }
-
- // Simple cases
-
- switch (paramType) {
- case "address":
- if (typeof value !== "string") return false;
- return /^0x[0-9a-fA-F]{40}$/.test(value);
- case "bytes":
- if (typeof value !== "string") return false;
- return value.length % 2 === 0 && /^0x[0-9a-fA-F]*$/.test(value);
- case "string":
- return typeof value === "string";
- case "bool":
- return typeof value === "boolean";
- }
-
- if (paramType.match(/^bytes[0-9]{1,2}$/)) {
- if (typeof value !== "string") return false;
- return value.length % 2 === 0 && /^0x[0-9a-fA-F]+$/.test(value);
- } else if (
- paramType.match(/^uint[0-9]+$/) ||
- paramType.match(/^int[0-9]+$/)
- ) {
- return typeof value === "bigint";
- }
-
- throw new Error(
- "Complex types need to be checked in a higher order function. Got: " +
- paramType
- );
-}
-
export function isValidStringValue(value: string, paramType: string): boolean {
if (!value || !paramType) return false;
@@ -102,7 +33,7 @@ export function isValidStringValue(value: string, paramType: string): boolean {
if (paramType.match(/^bytes[0-9]{1,2}$/)) {
const len = parseInt(paramType.replace(/^bytes/, ""));
- if (value.length !== len * 2) return false;
+ if (value.length !== 2 + len * 2) return false;
return /^0x[0-9a-fA-F]+$/.test(value);
} else if (paramType.match(/^uint[0-9]+$/)) {
return /^[0-9]*$/.test(value);