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
13 changes: 11 additions & 2 deletions frontend/app/job/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
type FiatCurrency,
type XlmFiatRateCache,
} from "@/lib/format";
import { getExplorerTxUrl } from "@/lib/stellar";
import { getExplorerTxUrl, parseContractError, getNativeBalance } from "@/lib/stellar";
import { isConfirmSuppressed, CONFIRM_KEYS } from "@/lib/confirm-prefs";
import type { Job } from "@/lib/types";
import { useWallet } from "@/lib/wallet-context";
Expand Down Expand Up @@ -275,7 +275,16 @@ function JobDetailPageContent() {
showSuccess(successMessage);
setStatusAnnouncement(successMessage);
} catch (e) {
const message = e instanceof Error ? e.message : "Transaction failed.";
// Fetch current balance to include in insufficient-balance messages (#620)
let balance: string | undefined;
if (wallet) {
try {
balance = await getNativeBalance(wallet);
} catch {
// Balance fetch failed — parseContractError will omit the balance detail
}
}
const message = parseContractError(e, balance);
setError(message);
showError(message);
} finally {
Expand Down
13 changes: 11 additions & 2 deletions frontend/app/post-job/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getDescPayloadMax, postJob, storeDescriptionCid } from "@/lib/contract"
import { uploadToIpfs } from "@/lib/ipfs-service";
import ErrorBanner from "@/components/ErrorBanner";
import RichTextEditor, { htmlToPlainText } from "@/components/RichTextEditor";
import { getExplorerTxUrl, isValidStellarAddress } from "@/lib/stellar";
import { getExplorerTxUrl, isValidStellarAddress, parseContractError, getNativeBalance } from "@/lib/stellar";
import { useWallet } from "@/lib/wallet-context";
import { useEffect, useId, useRef, useState } from "react";
import {
Expand Down Expand Up @@ -415,7 +415,16 @@ export default function PostJobPage() {
setDraftSavedAt(null);
setHasDraft(false);
} catch (e) {
setError(e instanceof Error ? e.message : "Failed to post job. Please try again.");
// Fetch current balance to include in insufficient-balance messages (#620)
let balance: string | undefined;
if (wallet) {
try {
balance = await getNativeBalance(wallet);
} catch {
// Balance fetch failed — parseContractError will omit the balance detail
}
}
setError(parseContractError(e, balance));
} finally {
setSubmitting(false);
}
Expand Down
Loading