diff --git a/ui/app/src/CreatePage.tsx b/ui/app/src/CreatePage.tsx index 3ef2bad..d88d0a3 100644 --- a/ui/app/src/CreatePage.tsx +++ b/ui/app/src/CreatePage.tsx @@ -72,7 +72,7 @@ const StreamPage = () => {
{ abi: erc20ABI, args: [address, props.streamManagerAddress], watch: true, + onError(error) { + console.log("Error fetching allowance", error); + }, + onSettled(data, error) { + console.log("Allowance settled", { data, error }); + }, }); useEffect(() => { - if (allowanceData) { + // Check if allowance data is available and update allowance state + if (allowanceData !== null && allowanceData !== undefined) { const fetchedAllowance = Number(allowanceData.toString()); setAllowance(fetchedAllowance); - } - }, [allowanceData]); - // Effect hook to check if the allowance is sufficient - useEffect(() => { - if (allowance !== null && txCost !== undefined) { - setIsAllowanceSufficient(allowance >= txCost); + // Check if the fetched allowance is sufficient for the transaction cost + if (txCost !== undefined) { + setIsAllowanceSufficient(fetchedAllowance >= txCost); + } } - }, [allowance, txCost]); - - console.log("allowance", allowance); - console.log("cost", txCost); + }, [allowanceData, txCost]); // Select the payment token among tokens with the same chainID const Step1 = () => { @@ -436,6 +438,9 @@ const CreateStream = (props: CreateStreamProps) => {
{props.cart && props.cart}
+
+ Select the number of days you want to run your stream +
{ } disabled={isSuccess} /> - - {isAllowanceSufficient && ( - <> - - - )} - {!isAllowanceSufficient && ( - <> - - + {isAllowanceSufficient ? ( + + ) : ( + )} {isLoading && (