Skip to content

Commit ff6eed3

Browse files
authored
Merge pull request #590 from SharifIbrahimDev/main
2 parents 4f629a3 + 5487d76 commit ff6eed3

6 files changed

Lines changed: 17 additions & 42 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ docker compose up --build
6262

6363
This starts:
6464

65-
- **Postgres** database on port `5432`
65+
- **Postgres** database on port `5433`
6666
- **Backend** API on port `3001`
6767

6868
To run in detached mode:

backend/.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Database
2-
DATABASE_URL="postgresql://user:password@localhost:5432/flowfi?schema=public"
2+
DATABASE_URL="postgresql://user:password@localhost:5433/flowfi?schema=public"
33

44
# Server
55
PORT=3001
@@ -17,7 +17,7 @@ SANDBOX_MODE_ENABLED=true
1717

1818
# Optional: Use a separate database for sandbox
1919
# If not set, it will use {DATABASE_URL}_sandbox
20-
SANDBOX_DATABASE_URL="postgresql://user:password@localhost:5432/flowfi_sandbox?schema=public"
20+
SANDBOX_DATABASE_URL="postgresql://user:password@localhost:5433/flowfi_sandbox?schema=public"
2121

2222
# ─── Soroban Event Indexer ────────────────────────────────────────────────────
2323
# Soroban RPC endpoint (testnet default shown)

frontend/src/components/stream-creation/ScheduleStep.tsx

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
"use client";
22
import React, { useMemo, useRef, useEffect } from "react";
33
import { hasValidPrecision } from "@/lib/amount";
4+
import { SECONDS_PER_UNIT, DurationUnit } from "@/lib/soroban";
45

56
interface ScheduleStepProps {
67
duration: string;
7-
durationUnit: "seconds" | "minutes" | "hours" | "days" | "weeks" | "months";
8+
durationUnit: DurationUnit;
89
onDurationChange: (value: string) => void;
9-
onUnitChange: (value: "seconds" | "minutes" | "hours" | "days" | "weeks" | "months") => void;
10+
onUnitChange: (value: DurationUnit) => void;
1011
error?: string;
1112
amount?: string;
1213
token?: string;
@@ -42,29 +43,10 @@ export const ScheduleStep: React.FC<ScheduleStepProps> = ({
4243
return null;
4344
}
4445

45-
let seconds = parseFloat(duration);
46-
47-
switch (durationUnit) {
48-
case "seconds":
49-
break;
50-
case "minutes":
51-
seconds *= 60;
52-
break;
53-
case "hours":
54-
seconds *= 3600;
55-
break;
56-
case "days":
57-
seconds *= 86400;
58-
break;
59-
case "weeks":
60-
seconds *= 604800;
61-
break;
62-
case "months":
63-
seconds *= 2592000; // 30 days
64-
break;
65-
}
46+
const seconds = parseFloat(duration);
47+
const multiplier = Number(SECONDS_PER_UNIT[durationUnit]);
6648

67-
return seconds;
49+
return seconds * multiplier;
6850
}, [duration, durationUnit]);
6951

7052
const ratePerSecond = useMemo(() => {
@@ -154,7 +136,7 @@ export const ScheduleStep: React.FC<ScheduleStepProps> = ({
154136
value={durationUnit}
155137
onChange={(e) =>
156138
onUnitChange(
157-
e.target.value as "seconds" | "minutes" | "hours" | "days" | "weeks" | "months"
139+
e.target.value as DurationUnit
158140
)
159141
}
160142
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"

frontend/src/components/stream-creation/StreamCreationWizard.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export const StreamCreationWizard: React.FC<StreamCreationWizardProps> = ({
112112
// Tracking & Polling state (Issue #378)
113113
const [txHash, setTxHash] = useState<string | null>(null);
114114
const [isPolling, setIsPolling] = useState(false);
115-
const [timeout, setTimeoutError] = useState(false);
115+
const [timeoutError, setTimeoutError] = useState(false);
116116

117117
const router = useRouter();
118118

@@ -492,10 +492,10 @@ export const StreamCreationWizard: React.FC<StreamCreationWizardProps> = ({
492492
{isPolling ? (
493493
<div className="flex flex-col items-center justify-center py-10">
494494
<h3 className="text-xl font-bold mb-8">
495-
{timeout ? "Confirmation Timeout" : "Waiting for confirmation..."}
495+
{timeoutError ? "Confirmation Timeout" : "Waiting for confirmation..."}
496496
</h3>
497497

498-
{!timeout ? (
498+
{!timeoutError ? (
499499
<>
500500
<TransactionTracker
501501
steps={[

frontend/src/components/wallet/WalletButton.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function WalletButton() {
7878
}
7979

8080
if (status === "connected" && session) {
81-
// const networkLabel = formatNetwork(session.network);
81+
8282
const networkOk = isExpectedNetwork(session.network);
8383

8484
return (
@@ -91,14 +91,7 @@ export function WalletButton() {
9191
title={session.publicKey}
9292
onClick={() => setDropdownOpen((o) => !o)}
9393
>
94-
{/* <span className="wallet-chip__name">{session.walletName}</span> */}
95-
{/* <span
96-
className="wallet-chip__network"
97-
data-mainnet={networkLabel === "Mainnet" ? "true" : undefined}
98-
data-mismatch={!networkOk ? "true" : undefined}
99-
>
100-
{networkLabel}
101-
</span> */}
94+
10295
<strong className="wallet-chip__key">
10396
{shortenPublicKey(session.publicKey)}
10497
</strong>

frontend/src/lib/soroban.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ export class SorobanCallError extends Error {
6565
}
6666
}
6767

68-
type DurationUnit = "seconds" | "minutes" | "hours" | "days" | "weeks" | "months";
68+
export type DurationUnit = "seconds" | "minutes" | "hours" | "days" | "weeks" | "months";
6969

70-
const SECONDS_PER_UNIT: Record<DurationUnit, bigint> = {
70+
export const SECONDS_PER_UNIT: Record<DurationUnit, bigint> = {
7171
seconds: BigInt(1),
7272
minutes: BigInt(60),
7373
hours: BigInt(3600),

0 commit comments

Comments
 (0)