From c6a40c5e273b927daea7d75d388520efc88239e8 Mon Sep 17 00:00:00 2001 From: AI Bot Date: Sat, 30 May 2026 03:53:44 +0100 Subject: [PATCH 1/4] refactor: extract duplicated duration units --- .../stream-creation/ScheduleStep.tsx | 32 ++++--------------- frontend/src/lib/soroban.ts | 4 +-- 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/frontend/src/components/stream-creation/ScheduleStep.tsx b/frontend/src/components/stream-creation/ScheduleStep.tsx index d1b0e90d..c3c5c189 100644 --- a/frontend/src/components/stream-creation/ScheduleStep.tsx +++ b/frontend/src/components/stream-creation/ScheduleStep.tsx @@ -1,12 +1,13 @@ "use client"; import React, { useMemo, useRef, useEffect } from "react"; import { hasValidPrecision } from "@/lib/amount"; +import { SECONDS_PER_UNIT, DurationUnit } from "@/lib/soroban"; interface ScheduleStepProps { duration: string; - durationUnit: "seconds" | "minutes" | "hours" | "days" | "weeks" | "months"; + durationUnit: DurationUnit; onDurationChange: (value: string) => void; - onUnitChange: (value: "seconds" | "minutes" | "hours" | "days" | "weeks" | "months") => void; + onUnitChange: (value: DurationUnit) => void; error?: string; amount?: string; token?: string; @@ -42,29 +43,10 @@ export const ScheduleStep: React.FC = ({ return null; } - let seconds = parseFloat(duration); - - switch (durationUnit) { - case "seconds": - break; - case "minutes": - seconds *= 60; - break; - case "hours": - seconds *= 3600; - break; - case "days": - seconds *= 86400; - break; - case "weeks": - seconds *= 604800; - break; - case "months": - seconds *= 2592000; // 30 days - break; - } + const seconds = parseFloat(duration); + const multiplier = Number(SECONDS_PER_UNIT[durationUnit]); - return seconds; + return seconds * multiplier; }, [duration, durationUnit]); const ratePerSecond = useMemo(() => { @@ -154,7 +136,7 @@ export const ScheduleStep: React.FC = ({ value={durationUnit} onChange={(e) => onUnitChange( - e.target.value as "seconds" | "minutes" | "hours" | "days" | "weeks" | "months" + e.target.value as DurationUnit ) } className="w-full px-4 py-3 rounded-lg bg-glass border border-glass-border focus:border-accent focus:ring-accent focus:outline-none focus:ring-2 focus:ring-opacity-50 transition-colors text-foreground" diff --git a/frontend/src/lib/soroban.ts b/frontend/src/lib/soroban.ts index a89bab71..81366846 100644 --- a/frontend/src/lib/soroban.ts +++ b/frontend/src/lib/soroban.ts @@ -65,9 +65,9 @@ export class SorobanCallError extends Error { } } -type DurationUnit = "seconds" | "minutes" | "hours" | "days" | "weeks" | "months"; +export type DurationUnit = "seconds" | "minutes" | "hours" | "days" | "weeks" | "months"; -const SECONDS_PER_UNIT: Record = { +export const SECONDS_PER_UNIT: Record = { seconds: BigInt(1), minutes: BigInt(60), hours: BigInt(3600), From 6148805e4b5e9f06925d6fa99844467de25c6cbe Mon Sep 17 00:00:00 2001 From: AI Bot Date: Sat, 30 May 2026 03:55:33 +0100 Subject: [PATCH 2/4] chore: remove commented-out dead code in WalletButton --- frontend/src/components/wallet/WalletButton.tsx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/wallet/WalletButton.tsx b/frontend/src/components/wallet/WalletButton.tsx index 63387560..16357719 100644 --- a/frontend/src/components/wallet/WalletButton.tsx +++ b/frontend/src/components/wallet/WalletButton.tsx @@ -78,7 +78,7 @@ export function WalletButton() { } if (status === "connected" && session) { - // const networkLabel = formatNetwork(session.network); + const networkOk = isExpectedNetwork(session.network); return ( @@ -91,14 +91,7 @@ export function WalletButton() { title={session.publicKey} onClick={() => setDropdownOpen((o) => !o)} > - {/* {session.walletName} */} - {/* - {networkLabel} - */} + {shortenPublicKey(session.publicKey)} From c998c77952bbeea94564adb3cd59b659f1c20e15 Mon Sep 17 00:00:00 2001 From: AI Bot Date: Sat, 30 May 2026 03:56:40 +0100 Subject: [PATCH 3/4] refactor: rename timeout state to timeoutError in StreamCreationWizard --- .../src/components/stream-creation/StreamCreationWizard.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/stream-creation/StreamCreationWizard.tsx b/frontend/src/components/stream-creation/StreamCreationWizard.tsx index edecd5a6..f869a902 100644 --- a/frontend/src/components/stream-creation/StreamCreationWizard.tsx +++ b/frontend/src/components/stream-creation/StreamCreationWizard.tsx @@ -112,7 +112,7 @@ export const StreamCreationWizard: React.FC = ({ // Tracking & Polling state (Issue #378) const [txHash, setTxHash] = useState(null); const [isPolling, setIsPolling] = useState(false); - const [timeout, setTimeoutError] = useState(false); + const [timeoutError, setTimeoutError] = useState(false); const router = useRouter(); @@ -492,10 +492,10 @@ export const StreamCreationWizard: React.FC = ({ {isPolling ? (

- {timeout ? "Confirmation Timeout" : "Waiting for confirmation..."} + {timeoutError ? "Confirmation Timeout" : "Waiting for confirmation..."}

- {!timeout ? ( + {!timeoutError ? ( <> Date: Sat, 30 May 2026 03:58:10 +0100 Subject: [PATCH 4/4] docs: fix Postgres port mismatch to 5433 in README and env defaults --- README.md | 2 +- backend/.env.example | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 93890dae..95751f3b 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ docker compose up --build This starts: -- **Postgres** database on port `5432` +- **Postgres** database on port `5433` - **Backend** API on port `3001` To run in detached mode: diff --git a/backend/.env.example b/backend/.env.example index 9d90cc90..64403de6 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -1,5 +1,5 @@ # Database -DATABASE_URL="postgresql://user:password@localhost:5432/flowfi?schema=public" +DATABASE_URL="postgresql://user:password@localhost:5433/flowfi?schema=public" # Server PORT=3001 @@ -17,7 +17,7 @@ SANDBOX_MODE_ENABLED=true # Optional: Use a separate database for sandbox # If not set, it will use {DATABASE_URL}_sandbox -SANDBOX_DATABASE_URL="postgresql://user:password@localhost:5432/flowfi_sandbox?schema=public" +SANDBOX_DATABASE_URL="postgresql://user:password@localhost:5433/flowfi_sandbox?schema=public" # ─── Soroban Event Indexer ──────────────────────────────────────────────────── # Soroban RPC endpoint (testnet default shown)