diff --git a/src/app/hooks/useGetCreatorFeePercentage.ts b/src/app/hooks/useGetCreatorFeePercentage.ts new file mode 100644 index 0000000..a077751 --- /dev/null +++ b/src/app/hooks/useGetCreatorFeePercentage.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 useGetCreatorFeePercentageInterface { + enabled?: boolean; + watch?: boolean; + poolId?: string; + refetchInterval?: + | number + | false + | ((query: any) => number | false | undefined); +} + +function useGetCreatorFeePercentage({ + enabled = true, + watch = false, + poolId, + refetchInterval, +}: useGetCreatorFeePercentageInterface) { + const { data, error, isLoading, status } = useReadContract({ + abi: PREDIFI_ABI, + functionName: "get_creator_fee_percentage", + address: PREDIFI_CONTRACT_ADDRESS, + args: [poolId], + enabled, + watch, + refetchInterval, + }); + + return { + data, + error, + isLoading, + status, + }; +} + +export default useGetCreatorFeePercentage;