diff --git a/packages/nextjs/app/token-vendor/page.tsx b/packages/nextjs/app/token-vendor/page.tsx index 61f46c9e..c5de52b5 100644 --- a/packages/nextjs/app/token-vendor/page.tsx +++ b/packages/nextjs/app/token-vendor/page.tsx @@ -47,7 +47,6 @@ const TokenVendor: NextPage = () => { const { data: tokensPerEth } = useScaffoldReadContract({ contractName: "Vendor", functionName: "tokens_per_eth", - args: [], }); const { sendAsync: transferTokens } = useScaffoldWriteContract({ diff --git a/packages/nextjs/hooks/scaffold-stark/useScaffoldReadContract.ts b/packages/nextjs/hooks/scaffold-stark/useScaffoldReadContract.ts index 511b2c94..fae3d663 100644 --- a/packages/nextjs/hooks/scaffold-stark/useScaffoldReadContract.ts +++ b/packages/nextjs/hooks/scaffold-stark/useScaffoldReadContract.ts @@ -29,7 +29,7 @@ export const useScaffoldReadContract = < address: deployedContract?.address, abi: deployedContract?.abi, watch: true, - args, + args: args || [], enabled: args && (!Array.isArray(args) || !args.some((arg) => arg === undefined)), blockIdentifier: "pending" as BlockNumber, diff --git a/packages/nextjs/hooks/scaffold-stark/useScaffoldWriteContract.ts b/packages/nextjs/hooks/scaffold-stark/useScaffoldWriteContract.ts index 1c082912..9fce2ee5 100644 --- a/packages/nextjs/hooks/scaffold-stark/useScaffoldWriteContract.ts +++ b/packages/nextjs/hooks/scaffold-stark/useScaffoldWriteContract.ts @@ -76,7 +76,7 @@ export const useScaffoldWriteContract = < }) => { // if no args supplied, use the one supplied from hook let newArgs = params?.args; - if (!newArgs) { + if (Object.keys(newArgs || {}).length <= 0) { newArgs = args; } @@ -100,7 +100,7 @@ export const useScaffoldWriteContract = < ? parseFunctionParams({ abiFunction, abi: deployedContractData.abi, - inputs: args as any[], + inputs: newArgs as any[], isRead: false, isReadArgsParsing: false, }).flat(Infinity)