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
1 change: 0 additions & 1 deletion src/app/(mobile-ui)/history/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ const HistoryPage = () => {
// Fallback: Use raw entry with proper amount formatting
let fallbackAmount = newEntry.amount.toString()

// For DEPOSIT entries, amount is in wei and needs formatting
if (newEntry.type === 'DEPOSIT' && newEntry.extraData?.blockNumber) {
try {
fallbackAmount = formatUnits(BigInt(newEntry.amount), PEANUT_WALLET_TOKEN_DECIMALS)
Expand Down
11 changes: 9 additions & 2 deletions src/components/Claim/Link/Initial.view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ export const InitialClaimLinkView = (props: IClaimScreenProps) => {
console.error('Error fetching route:', error)
if (!toToken && !toChain) {
setSelectedRoute(undefined)
setHasFetchedRoute(true) // Mark as fetched to show error and allow retry
}
setErrorState({
showError: true,
Expand Down Expand Up @@ -685,14 +686,18 @@ export const InitialClaimLinkView = (props: IClaimScreenProps) => {
)
}

if (selectedRoute || (isXChain && hasFetchedRoute)) {
if (selectedRoute) {
return 'Review'
}

if ((isLoading || isXchainLoading) && !inputChanging) {
return 'Receiving'
}

if (isXChain && hasFetchedRoute && !selectedRoute) {
return 'Retry'
}

return 'Receive now'
}

Expand All @@ -708,9 +713,11 @@ export const InitialClaimLinkView = (props: IClaimScreenProps) => {
} else if (recipientType === 'iban' || recipientType === 'us') {
handleIbanRecipient()
} else if (!isPeanutChain) {
if (selectedRoute || (isXChain && hasFetchedRoute)) {
if (selectedRoute) {
// Only proceed if we have a valid route
onNext()
} else if (isXChain) {
// No route yet or route fetch failed - trigger refetch
setRefetchXchainRoute(true)
}
} else {
Expand Down
6 changes: 4 additions & 2 deletions src/components/Payment/PaymentForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,9 @@ export const PaymentForm = ({
}, [dispatch, recipient])

useEffect(() => {
// Skip balance check if on CONFIRM or STATUS view (balance has been optimistically updated)
if (currentView === 'CONFIRM' || currentView === 'STATUS') {
// Skip balance check if on CONFIRM or STATUS view, or if transaction is being processed
// (balance has been optimistically updated in these states)
if (currentView === 'CONFIRM' || currentView === 'STATUS' || isProcessing) {
return
}

Expand Down Expand Up @@ -274,6 +275,7 @@ export const PaymentForm = ({
isExternalWalletConnected,
isExternalWalletFlow,
currentView,
isProcessing,
])

// fetch token price
Expand Down
5 changes: 4 additions & 1 deletion src/services/sendLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,12 @@ export const sendLinksApi = {
get: async (link: string): Promise<SendLink> => {
const params = getParamsFromLink(link)
const pubKey = generateKeysFromString(params.password).address
const url = `${PEANUT_API_URL}/send-links/${pubKey}?c=${params.chainId}&v=${params.contractVersion}&i=${params.depositIdx}`
// Add timestamp to prevent caching of 404s during DB replication lag
const cacheBuster = Date.now()
const url = `${PEANUT_API_URL}/send-links/${pubKey}?c=${params.chainId}&v=${params.contractVersion}&i=${params.depositIdx}&_=${cacheBuster}`
const response = await fetchWithSentry(url, {
method: 'GET',
cache: 'no-store', // Prevent browser from caching responses
})
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
Expand Down
10 changes: 8 additions & 2 deletions src/utils/history.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,10 @@ export async function completeHistoryEntry(entry: HistoryEntry): Promise<History
const price = await getCurrencyPrice(entry.currency.code)
usdAmount = (Number(entry.currency.amount) / price.buy).toString()
} catch (error) {
console.error(`[completeHistoryEntry] Failed to fetch currency price for ${entry.currency.code}:`, error)
console.error(
`[completeHistoryEntry] Failed to fetch currency price for ${entry.currency.code}:`,
error
)
// Fallback: use original amount (already set above)
}
}
Expand All @@ -274,7 +277,10 @@ export async function completeHistoryEntry(entry: HistoryEntry): Promise<History
const price = await getCurrencyPrice(entry.currency.code)
entry.currency.amount = (Number(entry.amount) / price.sell).toString()
} catch (error) {
console.error(`[completeHistoryEntry] Failed to fetch currency price for ${entry.currency.code}:`, error)
console.error(
`[completeHistoryEntry] Failed to fetch currency price for ${entry.currency.code}:`,
error
)
// Fallback: use original amount (already set above)
}
}
Expand Down
Loading