- {/* Network */}
-
-
-
- {({ account, chain, openAccountModal, openChainModal, openConnectModal, authenticationStatus, mounted }) => {
- const ready = mounted && authenticationStatus !== "loading"
- const connected =
- ready && account && chain && (!authenticationStatus || authenticationStatus === "authenticated")
-
- if (!connected) {
- return (
-
- )
- }
-
- if (chain?.unsupported) {
- return (
-
- )
- }
-
- return (
-
- )
- }}
-
- {formErrors.network ? (
-
- {formErrors.network}
-
- ) : (
-
Your jar will be deployed on the selected network
- )}
-
-
-
-
- {/* Jar Owner */}
-
-
-
{
- const value = e.target.value
- if (value === "") {
- setJarOwnerAddress(address as `0x${string}`)
- } else {
- setJarOwnerAddress(value as `0x${string}`)
- }
- }}
- />
- {formErrors.jarOwnerAddress ? (
-
- {formErrors.jarOwnerAddress}
-
- ) : (
-
- The address that will have owner/admin rights for this cookie jar. Leave empty to use your wallet
- address.
-
- )}
-
-
- {/* Currency Type */}
-
-
-
-
- {currencyType === "eth"
- ? `Use native ${tokenSymbol} as the currency for this jar`
- : "Use an ERC20 token as the currency for this jar"}
-
-
-
- {currencyType === "token" && (
-
-
-
{
- const value = e.target.value
- setSupportedCurrency(value as `0x${string}`)
- }}
- />
- {isERC20 && !tokenError && tokenSymbol && (
-
Token recognized: {tokenSymbol} (decimals: {tokenDecimals})
- )}
- {(formErrors.supportedCurrency || (tokenError && supportedCurrency && supportedCurrency !== '0x')) ? (
-
- {formErrors.supportedCurrency || tokenErrorMessage}
-
- ) : !isERC20 && (
-
Address of the ERC20 token contract
- )}
-
- )}
-
- {/* Jar Name */}
-
-
-
{
- const value = e.target.value;
- setJarName(value);
-
- // Validate name length in real-time
- if (value.length > 0 && value.length < 3) {
- setFormErrors(prev => ({
- ...prev,
- jarName: `Jar name must be at least 3 characters (${value.length}/3)`
- }));
- } else {
- // Clear error when valid or empty
- setFormErrors(prev => ({
- ...prev,
- jarName: undefined
- }));
- }
- }}
- />
- {formErrors.jarName ? (
-
- {formErrors.jarName}
-
- ) : (
-
A descriptive name for your cookie jar
- )}
-
-
- {/* Image URL */}
-
-
-
{
- const value = e.target.value;
- setImageUrl(value);
-
- // Validate URL format in real-time
- if (value && !isValidUrl(value)) {
- setFormErrors(prev => ({
- ...prev,
- imageUrl: "Please enter a valid URL"
- }));
- } else {
- // Clear error when valid or empty
- setFormErrors(prev => ({
- ...prev,
- imageUrl: undefined
- }));
- }
- }}
- />
- {formErrors.imageUrl ? (
-
- {formErrors.imageUrl}
-
- ) : (
-
An image to represent your cookie jar
- )}
-
-
- {/* External Link */}
-
-
-
{
- const value = e.target.value;
- setExternalLink(value);
-
- // Validate URL format in real-time
- if (value && !isValidUrl(value)) {
- setFormErrors(prev => ({
- ...prev,
- externalLink: "Please enter a valid URL"
- }));
- } else {
- // Clear error when valid or empty
- setFormErrors(prev => ({
- ...prev,
- externalLink: undefined
- }));
- }
- }}
- />
- {formErrors.externalLink ? (
-
- {formErrors.externalLink}
-
- ) : (
-
A link to more information about your project
- )}
-
-
- {/* Custom Donation Fee */}
-
-
- {
- setEnableCustomFee(checked as boolean);
- if (!checked) {
- setCustomFee("");
- setFormErrors(prev => ({ ...prev, customFee: undefined }));
- }
- }}
- className="border-[#3c2a14] data-[state=checked]:bg-[#ff5e14] data-[state=checked]:border-[#ff5e14]"
- />
-
-
-
- {enableCustomFee && (
-
-
{
- const value = e.target.value;
- setCustomFee(value);
+ };
- // Validate fee percentage in real-time
- if (value) {
- const feeValue = parseFloat(value);
- if (isNaN(feeValue) || feeValue < 0 || feeValue > 100) {
- setFormErrors(prev => ({
- ...prev,
- customFee: "Fee percentage must be between 0 and 100"
- }));
- } else {
- setFormErrors(prev => ({
- ...prev,
- customFee: undefined
- }));
- }
- }
- }}
- />
- {formErrors.customFee ? (
-
- {formErrors.customFee}
-
- ) : (
-
Percentage of deposits to donate (0-100%). Leave unchecked to use default platform fee.
- )}
-
- )}
-
- {!enableCustomFee && (
-
Your jar will use the default platform donation fee. Check the box above to customize.
- )}
-
+ // Auto-retry jar creation when wallet connects
+ useEffect(() => {
+ if (isConnected && address && pendingSubmission && showWalletModal) {
+ setShowWalletModal(false);
+ setPendingSubmission(false);
+ // Retry the submission
+ setTimeout(() => {
+ formData.confirmSubmit();
+ }, 100); // Small delay to ensure modal closes first
+ }
+ }, [isConnected, address, pendingSubmission, showWalletModal, formData]);
- {/* Metadata */}
-
-
-