Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/(app)/rates/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
const [activePair, setActivePair] = useState("USDC/NGN");
const [rates, setRates] = useState<Record<string, RateData>>({});
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);

Check warning on line 26 in src/app/(app)/rates/page.tsx

View workflow job for this annotation

GitHub Actions / Lint, Test & Build (Next.js)

'error' is assigned a value but never used

// Fetch all rates on mount
useEffect(() => {
Expand Down Expand Up @@ -78,7 +78,7 @@
}, [rates]);

const activeRate = rates[activePair];
const activePairConfig = ASSET_PAIRS.find((p) => p.label === activePair);

Check warning on line 81 in src/app/(app)/rates/page.tsx

View workflow job for this annotation

GitHub Actions / Lint, Test & Build (Next.js)

'activePairConfig' is assigned a value but never used

return (
<main className="min-h-screen bg-gray-50/50">
Expand Down Expand Up @@ -483,7 +483,7 @@
<div>
<p className="text-xs font-bold">Alert Created</p>
<p className="text-[10px] opacity-80">
We'll notify you at the threshold
We will notify you at the threshold
</p>
</div>
<button
Expand Down
2 changes: 1 addition & 1 deletion src/app/(app)/review/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default function ReviewPage() {
<span className="material-symbols-outlined text-red-500 mt-0.5 shrink-0 text-sm">warning</span>
<div>
<p className="text-[10px] font-bold text-red-700 mb-0.5 uppercase">Security Verification</p>
<p className="text-[10px] text-gray-500">Double-check the recipient's wallet address. Assets sent on Stellar cannot be reversed.</p>
<p className="text-[10px] text-gray-500">Double-check the recipient{"'"}s wallet address. Assets sent on Stellar cannot be reversed.</p>
</div>
</div>
</div>
Expand Down
9 changes: 5 additions & 4 deletions src/app/api/stellar/send/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ export async function POST(request: NextRequest) {
toAmount,
recipientAddress,
}, 201);
} catch (err: any) {
} catch (err: unknown) {
console.error("Send error:", err);
if (err.message?.includes("Invalid recipient")) {
return errorResponse(err.message, 400);
const message = err instanceof Error ? err.message : "Unknown error";
if (message.includes("Invalid recipient")) {
return errorResponse(message, 400);
}
return errorResponse(err.message || "Failed to build transaction", 500);
return errorResponse(message || "Failed to build transaction", 500);
}
}
5 changes: 3 additions & 2 deletions src/app/api/stellar/submit/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ export async function POST(request: NextRequest) {
fromAmount: updated.fromAmount,
toAmount: updated.toAmount,
});
} catch (err: any) {
} catch (err: unknown) {
console.error("Submit error:", err);
return errorResponse(err.message || "Failed to submit transaction", 500);
const message = err instanceof Error ? err.message : "Unknown error";
return errorResponse(message, 500);
}
}
43 changes: 34 additions & 9 deletions src/lib/stellar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,41 @@ export async function createTestnetAccount(): Promise<{
publicKey: string;
secretKey: string;
}> {
// TODO(contributor): Generate a Keypair.random(), fund via Friendbot
// (https://friendbot.stellar.org?addr=<publicKey> for testnet),
// return the publicKey and secretKey. Do NOT store the secretKey server-side
// in production — return it to the client once so the user can save it.
console.warn("[STUB] createTestnetAccount returning mock keypair");
const keypair = Keypair.random();
return {
publicKey: keypair.publicKey(),
secretKey: keypair.secret(),
};
const publicKey = keypair.publicKey();
const secretKey = keypair.secret();

// Only attempt Friendbot funding on testnet
if (NETWORK === "testnet") {
const friendbotUrl = `https://friendbot.stellar.org?addr=${publicKey}`;
console.log(`[createTestnetAccount] Funding ${publicKey} via Friendbot...`);

try {
const response = await fetch(friendbotUrl, { method: "GET" });

if (!response.ok) {
// Friendbot returns 400+ when the account is already funded or on error.
// We treat this as non-fatal — the keypair is still valid.
const body = await response.text();
console.warn(
`[createTestnetAccount] Friendbot responded with ${response.status}: ${body}`
);
} else {
const result = await response.json();
console.log(
`[createTestnetAccount] Friendbot success: hash=${result.hash}`
);
}
} catch (err) {
// Network errors, timeouts, etc. — log and continue.
console.warn(
`[createTestnetAccount] Friendbot request failed:`,
err
);
}
}

return { publicKey, secretKey };
}

// TODO(contributor): implement Horizon polling or streaming to resolve
Expand Down
Loading