diff --git a/packages/nextjs/app/page.tsx b/packages/nextjs/app/page.tsx index cfe6f6f0..602daf9f 100644 --- a/packages/nextjs/app/page.tsx +++ b/packages/nextjs/app/page.tsx @@ -19,11 +19,11 @@ const Home: NextPage = () => { // console.log(data); - const { writeAsync } = useScaffoldContractWrite({ - contractName: "HelloStarknet", - functionName: "increase_balance", - args: [1], - }); + // const { writeAsync } = useScaffoldContractWrite({ + // contractName: "HelloStarknet", + // functionName: "increase_balance", + // args: [1], + // }); // console.log(data, isLoading); return ( diff --git a/packages/nextjs/hooks/scaffold-stark/useScaffoldContractWrite.ts b/packages/nextjs/hooks/scaffold-stark/useScaffoldContractWrite.ts index 58e17778..35e0222f 100644 --- a/packages/nextjs/hooks/scaffold-stark/useScaffoldContractWrite.ts +++ b/packages/nextjs/hooks/scaffold-stark/useScaffoldContractWrite.ts @@ -38,7 +38,7 @@ export const useScaffoldContractWrite = < calls: deployedContractData ? [ { - contractAddress: deployedContractData.address, + contractAddress: deployedContractData?.address, entrypoint: functionName, calldata: args as any[], }, diff --git a/packages/nextjs/utils/scaffold-stark/contract.ts b/packages/nextjs/utils/scaffold-stark/contract.ts index a3d091d6..0e794cd6 100644 --- a/packages/nextjs/utils/scaffold-stark/contract.ts +++ b/packages/nextjs/utils/scaffold-stark/contract.ts @@ -12,6 +12,7 @@ import { UseContractReadProps, UseContractWriteProps, } from "@starknet-react/core"; +import { Address } from "@starknet-react/chains"; type ConfiguredChainId = (typeof scaffoldConfig)["targetNetworks"][0]["network"]; @@ -35,7 +36,7 @@ export enum ContractCodeStatus { } export type GenericContract = { - address: string; + address: Address; abi: Abi; }; export type GenericContractsDeclaration = { @@ -134,10 +135,11 @@ export type UseScaffoldWriteConfig< > > = { contractName: TContractName; - // onBlockConfirmation?: (txnReceipt: TransactionReceipt) => void; TODO check this lines - // blockConfirmations?: number; } & IsContractDeclarationMissing< - Partial, + Partial & { + functionName: string; + args: any[]; + }, { functionName: TFunctionName; } & Omit<