Skip to content

Commit

Permalink
fix type when no contract data
Browse files Browse the repository at this point in the history
  • Loading branch information
jrcarlos2000 committed Apr 3, 2024
1 parent e4e3b75 commit 8659401
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
10 changes: 5 additions & 5 deletions packages/nextjs/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const useScaffoldContractWrite = <
calls: deployedContractData
? [
{
contractAddress: deployedContractData.address,
contractAddress: deployedContractData?.address,
entrypoint: functionName,
calldata: args as any[],
},
Expand Down
10 changes: 6 additions & 4 deletions packages/nextjs/utils/scaffold-stark/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
UseContractReadProps,
UseContractWriteProps,
} from "@starknet-react/core";
import { Address } from "@starknet-react/chains";

type ConfiguredChainId =
(typeof scaffoldConfig)["targetNetworks"][0]["network"];
Expand All @@ -35,7 +36,7 @@ export enum ContractCodeStatus {
}

export type GenericContract = {
address: string;
address: Address;
abi: Abi;
};
export type GenericContractsDeclaration = {
Expand Down Expand Up @@ -134,10 +135,11 @@ export type UseScaffoldWriteConfig<
>
> = {
contractName: TContractName;
// onBlockConfirmation?: (txnReceipt: TransactionReceipt) => void; TODO check this lines
// blockConfirmations?: number;
} & IsContractDeclarationMissing<
Partial<UseContractWriteProps>,
Partial<UseContractWriteProps> & {
functionName: string;
args: any[];
},
{
functionName: TFunctionName;
} & Omit<
Expand Down

0 comments on commit 8659401

Please sign in to comment.