From c524de6f231321ccf31c829c851ddd19a809e212 Mon Sep 17 00:00:00 2001 From: Iwueseiter Date: Thu, 31 Jul 2025 09:21:55 +0100 Subject: [PATCH] feat: implemented get pool creator --- src/app/hooks/useGetPoolCreator.ts | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/app/hooks/useGetPoolCreator.ts diff --git a/src/app/hooks/useGetPoolCreator.ts b/src/app/hooks/useGetPoolCreator.ts new file mode 100644 index 0000000..8668995 --- /dev/null +++ b/src/app/hooks/useGetPoolCreator.ts @@ -0,0 +1,39 @@ +import { useReadContract } from "@starknet-react/core"; +import { PREDIFI_ABI } from "../abi/predifi_abi"; +import { PREDIFI_CONTRACT_ADDRESS } from "@/static"; + +interface useGetPoolCreatorInterface { + enabled?: boolean; + watch?: boolean; + poolId?: string; + refetchInterval?: + | number + | false + | ((query: any) => number | false | undefined); +} + +function useGetPoolCreator({ + enabled = true, + watch = false, + poolId, + refetchInterval, +}: useGetPoolCreatorInterface) { + const { data, error, isLoading, status } = useReadContract({ + abi: PREDIFI_ABI, + functionName: "get_pool_creator", + address: PREDIFI_CONTRACT_ADDRESS, + args: [poolId], + enabled, + watch, + refetchInterval, + }); + + return { + data, + error, + isLoading, + status, + }; +} + +export default useGetPoolCreator; \ No newline at end of file