feat: enhance Starknet integration and UI components#480
Conversation
- Added support for internal API origin configuration in the aggregator API to handle deployments with separate SPA and API origins. - Updated the networks list in mocks to reflect explicit ranking based on aggregator volume, improving user experience. - Introduced a new context for managing transaction form swap state, allowing global UI updates without prop drilling. - Enhanced dropdown components to support a disabled state, preventing user interaction when necessary. - Implemented validation for Starknet-specific on-ramp functionality, including UI adjustments to indicate unsupported features. - Refactored transaction handling to ensure correct wallet address usage for Starknet, improving API interaction and error handling. - Improved error handling in transaction fetching to gracefully manage 404 responses, enhancing user feedback.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds an optional example env var for internal API origin and a URL helper for resolving Next.js Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 3/5 reviews remaining, refill in 16 minutes and 24 seconds. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/mocks.ts (1)
13-34:⚠️ Potential issue | 🟠 MajorDon't fall back to an empty Starknet RPC URL.
If
NEXT_PUBLIC_STARKNET_RPC_URLis missing, bothrpcUrlsentries become[""], which is not a valid endpoint and will fail later at runtime. Please fail fast here or omit Starknet from the chain list until a real URL is configured.Suggested fix
+const starknetRpcUrl = process.env.NEXT_PUBLIC_STARKNET_RPC_URL; + +if (!starknetRpcUrl) { + throw new Error("NEXT_PUBLIC_STARKNET_RPC_URL is required for Starknet support"); +} + export const starknetMainnet = { id: BigInt(toHex('SN_MAIN')).toString(), // Starknet Mainnet chain ID (SN_MAIN encoded) name: "Starknet", @@ default: { - http: [process.env.NEXT_PUBLIC_STARKNET_RPC_URL || ""], + http: [starknetRpcUrl], }, public: { - http: [process.env.NEXT_PUBLIC_STARKNET_RPC_URL || ""], + http: [starknetRpcUrl], }, },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/mocks.ts` around lines 13 - 34, starknetMainnet currently falls back to an empty string for rpcUrls when NEXT_PUBLIC_STARKNET_RPC_URL is unset, producing invalid endpoints; change the behavior in the starknetMainnet object so it does not include rpcUrls (or remove/omit the whole starknetMainnet export) unless process.env.NEXT_PUBLIC_STARKNET_RPC_URL is a non-empty string, or alternatively throw an explicit error at module load if NEXT_PUBLIC_STARKNET_RPC_URL is missing; update the rpcUrls field handling (referencing starknetMainnet and the NEXT_PUBLIC_STARKNET_RPC_URL env var) to only set valid http array entries when the env var is present.
🧹 Nitpick comments (1)
app/mocks.ts (1)
75-128: Make the ordering contract explicit.This array now drives defaults in
NetworksContextand the visual order inNetworkSelectionModal, so its position semantics are part of the app contract. Consider exporting a nameddefaultNetwork/rankfield or a dedicated ordering helper to avoid silent behavior changes when the ranking shifts later.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/mocks.ts` around lines 75 - 128, The networks array currently encodes ordering semantics used by NetworksContext and NetworkSelectionModal; make that contract explicit by adding an exported selector or metadata: either export a named defaultNetwork (e.g., export const defaultNetwork = networks[0]) and/or add a stable rank property on each network object (e.g., rank: 1,2,3...) or create and export a small ordering helper (e.g., export function getOrderedNetworks() that returns networks sorted by rank) so callers use the explicit identifier (defaultNetwork, networks[i].rank, or getOrderedNetworks) instead of relying on array position; update NetworksContext and NetworkSelectionModal to consume the new symbol instead of indexing the raw networks array.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/context/TransactionsContext.tsx`:
- Around line 284-296: The 404 branch clears local React state (via
setTransactions, setTotal, setError) but doesn't update the cached response,
allowing stale data to reappear; after handling the 404 you must also update or
invalidate the transactions cache entry for the same wallet/page/limit key
(e.g., call the project’s cache update API such as mutate,
queryClient.setQueryData or invalidateQueries for the transactions query key) so
the cached value becomes an empty list/total 0 (or is invalidated) and won't
resurrect stale rows.
In `@app/hooks/useSwapButton.ts`:
- Around line 17-18: The isStarknetOnramp flag currently only affects the label
but must short-circuit the swap state: inside useSwapButton (before the
migration/normal swap state-machine logic) check isStarknetOnramp and
immediately set isEnabled = false and buttonAction to the “Coming soon” /
blocked action (or a noop) so no later branch can enable the Swap; ensure this
guard executes before any migration/state computation (the code paths that
compute isEnabled and buttonAction) so the Starknet on‑ramp flow is always
locked down.
In `@app/pages/TransactionForm.tsx`:
- Around line 565-577: The Starknet on-ramp flag is only changing buttonText via
useSwapButton but not preventing submission; update the guard so unsupported
Starknet on-ramp orders cannot proceed by either adding isStarknetOnramp to the
isEnabled calculation inside useSwapButton (so isEnabled becomes false when
isStarknetOnramp is true) and/or short-circuiting buttonAction to a no-op when
isStarknetOnramp is true, and additionally add a defensive check in
MainPageContent.tsx handleFormSubmit to return early if isStarknetOnramp is true
(use the same prop/flag) to ensure preview/payment cannot be reached.
In `@app/pages/TransactionPreview.tsx`:
- Around line 232-240: The persisted wallet address must come from Privy's
embedded wallet (the same source the middleware sets in x-wallet-address) rather
than mixing in activeWallet; update walletAddressForTransactionApi to use
embeddedWallet?.address for all networks (i.e., remove the fallback to
activeWallet?.address) and add a fail-fast path that throws or returns an
explicit error when embeddedWallet?.address is missing; apply the same change to
the other occurrence of walletAddressForTransactionApi/related logic referenced
in the review so both places consistently resolve the address from
embeddedWallet.
---
Outside diff comments:
In `@app/mocks.ts`:
- Around line 13-34: starknetMainnet currently falls back to an empty string for
rpcUrls when NEXT_PUBLIC_STARKNET_RPC_URL is unset, producing invalid endpoints;
change the behavior in the starknetMainnet object so it does not include rpcUrls
(or remove/omit the whole starknetMainnet export) unless
process.env.NEXT_PUBLIC_STARKNET_RPC_URL is a non-empty string, or alternatively
throw an explicit error at module load if NEXT_PUBLIC_STARKNET_RPC_URL is
missing; update the rpcUrls field handling (referencing starknetMainnet and the
NEXT_PUBLIC_STARKNET_RPC_URL env var) to only set valid http array entries when
the env var is present.
---
Nitpick comments:
In `@app/mocks.ts`:
- Around line 75-128: The networks array currently encodes ordering semantics
used by NetworksContext and NetworkSelectionModal; make that contract explicit
by adding an exported selector or metadata: either export a named defaultNetwork
(e.g., export const defaultNetwork = networks[0]) and/or add a stable rank
property on each network object (e.g., rank: 1,2,3...) or create and export a
small ordering helper (e.g., export function getOrderedNetworks() that returns
networks sorted by rank) so callers use the explicit identifier (defaultNetwork,
networks[i].rank, or getOrderedNetworks) instead of relying on array position;
update NetworksContext and NetworkSelectionModal to consume the new symbol
instead of indexing the raw networks array.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6b3de0d0-260a-4a5f-a8d5-49136b91c925
📒 Files selected for processing (17)
.env.exampleapp/api/aggregator.tsapp/api/v1/recipients/route.tsapp/components/FlexibleDropdown.tsxapp/components/FormDropdown.tsxapp/components/MainPageContent.tsxapp/components/MobileDropdown.tsxapp/components/blog/home-client.tsxapp/context/HomeTransactionFormModeContext.tsxapp/context/TransactionsContext.tsxapp/context/index.tsapp/hooks/useSwapButton.tsapp/mocks.tsapp/pages/TransactionForm.tsxapp/pages/TransactionPreview.tsxapp/providers.tsxapp/utils.ts
- Added validation to block form submission when the Starknet on-ramp is active and a swap is indicated, enhancing user experience. - Updated transaction context to align cache state with API responses, preventing stale data from being used in future fetches. - Enhanced swap button logic to disable interactions when the Starknet on-ramp is active, ensuring clarity for users. - Refined wallet address handling in the TransactionPreview component to ensure proper API interactions and error handling, improving transaction persistence reliability.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/context/TransactionsContext.tsx`:
- Around line 284-305: The code in TransactionsContext.tsx currently treats
axios 404 responses as an empty transaction history and writes an empty entry
into the cache (the block around axios.isAxiosError(error) &&
error.response?.status === 404), which hides routing/origin/config problems;
remove that 404 special-case handling so 404s fall through to the error branch
instead — stop calling setTransactions([]), setTotal(0), setError(null), and
setCache(...) for status 404, and instead call setError(error) and console.error
as in the else path (ensure the axios.isAxiosError check is still used to detect
HTTP errors but do not swallow 404).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 339c01e6-871e-4ab4-a3a4-d1171b874647
📒 Files selected for processing (4)
app/components/MainPageContent.tsxapp/context/TransactionsContext.tsxapp/hooks/useSwapButton.tsapp/pages/TransactionPreview.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
- app/pages/TransactionPreview.tsx
- app/hooks/useSwapButton.ts
- app/components/MainPageContent.tsx
…tching - Enhanced error handling in the TransactionsContext to log detailed error messages when fetching transactions fails. - Simplified the handling of 404 errors by removing redundant state updates, ensuring clearer error reporting and user feedback.
* remove celo & scroll from migration path (#451) * remove celo from migration path * exclude scroll --------- Co-authored-by: Prosper <40717516+onahprosper@users.noreply.github.com> * feat(rates): fetch quotes via aggregator v2 with buy/sell side (#453) * feat(rates): fetch quotes via aggregator v2 with buy/sell side Made-with: Cursor * feat(aggregator): enhance URL validation and parsing in aggregatorOriginForV2 function Updated the aggregatorOriginForV2 function to include error handling for the NEXT_PUBLIC_AGGREGATOR_URL. It now checks for valid absolute URLs and ensures the protocol is either HTTP or HTTPS before returning the base path. * Feat/onramp implementation (#333) * feat: enhance swap functionality in TransactionForm - Simplified the stateProps object in MainPageContent for better readability. - Introduced isSwapped state in TransactionForm to manage swap mode between token and currency. - Updated calculations for amount sent and received based on swap mode. - Enhanced dropdowns and button for swapping fields, improving user experience. * feat: implement `onramp` support and enhance transaction flow - Added support for wallet recipients in the transaction process, allowing users to send tokens directly to wallet addresses. - Introduced new state management for onramp mode, differentiating between wallet and bank/mobile money transactions. - Updated API interactions to handle wallet recipient data, including saving and migrating wallet recipients. - Enhanced UI components to accommodate wallet-specific fields and improve user experience during recipient selection. - Implemented ENS name resolution for wallet addresses to provide better visibility for users. - Updated database schema to include a new table for saved wallet recipients, ensuring proper data handling and security. * feat: enhance recipient management and transaction flow - Added a `name` field to wallet recipient details for better identification. - Implemented `getCurrencySymbol` utility to standardize currency symbol retrieval across components. - Updated transaction handling to validate and include recipient names in API interactions. - Enhanced UI components to display recipient names and improve user experience during transactions. - Modified database schema to ensure recipient names are stored and managed correctly. * feat: enhance recipient validation and UI components - Introduced type predicates for recipient details to improve type safety in filtering bank/mobile money and wallet recipients. - Added validation for wallet address format in the API, ensuring correct input before processing. - Updated UI components to utilize new type predicates for better handling of recipient data. - Enhanced error handling for missing required fields in recipient data during local storage migration. - Improved styling in the AddBeneficiaryModal for better user experience. * feat: enhance TransactionForm with onramp/offramp buttons - Added Onramp and Offramp buttons to the TransactionForm for improved user interaction. - Updated layout to better accommodate new buttons while maintaining UI consistency. - Ensured walletAddress is cleared when switching to onramp mode for better state management. * feat: add refund account management and payment order endpoints - Introduced refund account API endpoints for fetching and saving refund account details. - Added support for creating and retrieving v2 payment orders. - Updated types to include new refund account and payment order structures. - Enhanced middleware to include new API routes for refund accounts and payment orders. - Updated configuration to include aggregator sender API key. - Modified components and pages to integrate new refund account functionality and payment order handling. * chore: remove referral feature files from onramp branch Referral feature belongs to its own branch and has not been merged. Removing all referral-specific files to keep this branch focused on the onramp implementation. Made-with: Cursor * feat: enhance transaction handling and add mobile sheet view type - Introduced a new MobileSheetView type for better management of mobile sheet states. - Updated TransactionPreview to reset the refund account on currency changes. - Improved error handling in TransactionStatus for expired sessions during transaction tracking. * feat: enhance onramp functionality and transaction status handling - Added support for connected wallet address in RecipientDetailsForm. - Updated transaction status types to include "expired". - Implemented mapping of aggregator order status to database status for onramp transactions. - Enhanced error handling and status resolution for onramp payment orders. - Improved transaction details display for onramp transactions in TransactionDetails and TransactionPreview components. - Refactored payment instruction mapping for better clarity and functionality. * feat: introduce OnrampPaymentInstructions type and refactor mapping logic - Added OnrampPaymentInstructions type to define the structure for virtual account/bank transfer instructions. - Implemented mapProviderAccountToInstructions function to convert V2FiatProviderAccountDTO to OnrampPaymentInstructions. - Removed redundant onrampPaymentInstructions module and updated imports in relevant components. - Enhanced transaction handling in MakePayment and TransactionDetails components to utilize the new mapping function. * refactor: improve addBeneficiary function and transaction status handling - Enhanced the addBeneficiary function to return a boolean indicating success or failure, improving error handling and user feedback. - Cleaned up transaction status type definitions for better readability. - Updated UI elements to reflect changes in transaction status and actions based on the current state. * feat: add isSwapped state to transaction forms and update related logic - Introduced isSwapped boolean to FormData type for tracking swap mode. - Updated MainPageContent and TransactionForm components to manage isSwapped state. - Adjusted rate fetching logic based on isSwapped to differentiate between buy and sell sides. - Enhanced wallet address handling to conditionally set isSwapped based on user input. * fix: conditionally render receipt button based on onramp status * feat: enhance transaction status handling for onramp flows - Updated transaction completion logic to differentiate between onramp and off-ramp flows. - Introduced processingStartedAt state to track the start time of onramp processing. - Adjusted success visuals and button visibility based on transaction status for onramp transactions. - Improved time spent calculations to reflect onramp processing duration accurately. * feat: implement onramp client payment session management - Added functionality to track and manage the onramp client payment session expiration. - Introduced `isOnrampClientPaymentSessionExpired` utility to determine session validity based on transaction details. - Updated `TransactionDetails`, `TransactionList`, and `MakePayment` components to reflect session expiration in UI. - Enhanced transaction status handling to display "expired" when applicable, improving user feedback during onramp transactions. * fix: correct base URL configuration for payment orders API - Updated the base URL for the payment orders API to use the configured aggregator URL instead of a hardcoded value, ensuring proper integration with the aggregator service. * fix: ensure contentClassName is safely handled in AnimatedModal component - Updated the AnimatedModal component to use a fallback for contentClassName, preventing potential undefined values from causing issues in the className concatenation. --------- Co-authored-by: Prosper <40717516+onahprosper@users.noreply.github.com> * Update HomePage.tsx Homepage copy * feat/UI swap refund pending indicators (#459) * fix: update TransactionForm and TransactionPreview styles and structure - Adjusted text color for dark mode in TransactionForm to improve visibility. - Refactored refund account button in TransactionPreview for better accessibility and user interaction, including hover effects and aria-labels for improved screen reader support. * feat: enhance onramp transaction handling and UI notifications - Added utility functions to determine if an onramp order is awaiting user bank transfer. - Integrated onramp pending notification dot in WalletDetails component to indicate pending bank transfers. - Updated transaction fetching logic to ensure timely updates and re-evaluation of onramp status. - Improved transaction context to handle reindexing of pending transactions and update backend accordingly. * refactor: consolidate OnrampPendingNotificationDot into utils and enhance transaction context - Moved OnrampPendingNotificationDot component logic to utils for better organization. - Updated WalletDetails and TransactionPreview components to utilize the new OnrampPendingNotificationDot from utils. - Enhanced StepContext to manage onramp provider details visibility, improving user experience during transactions. - Refined isOnrampAwaitingUserBankTransfer function to simplify status checks for pending transactions. * feat: enhance onramp provider details management and transaction context. * feat(payment-orders): on-ramp-only proxy, messageHash apiKey, single env var (#464) * feat(payment-orders): on-ramp-only proxy, messageHash apiKey, single env var Restrict POST /api/v1/payment-orders to fiat on-ramp (v2); reject off-ramp. Embed sender API key UUID in encrypted createOrder recipient metadata for indexer parity. Use NEXT_PUBLIC_AGGREGATOR_SENDER_API_KEY_ID as the single config key for server and client. * feat(onramp): explicit receive selection, NGN on-ramp rules, tx amount labels Gate swap CTA and recipient flow on receiveDestinationExplicitlySelected. On-ramp: NGN send side, min fiat vs rate, rate fetch after token chosen; hero copy. Centralize transaction history amount/type display helpers; remove unused import. * fix(form): clear fiat when toggling off-ramp after on-ramp Reset currency to empty so off-ramp matches initial no-selection state. Adjust on-ramp hero: first line "Change cash to", second "stablecoins in seconds". * fix(form): reset partial amounts on ramp toggle; persist when flow complete Complete flow = receive destination + token + currency + both amounts > 0: swap amounts/formatting and keep assets. Otherwise clear amounts and apply defaults. On-ramp: normalize currency to NGN when switching from other fiat. Also: onrampFiatMin and Select token CTA only after token; useSwapButton aligns. * fix(home): align off-ramp hero line break with on-ramp (stablecoins to / cash in seconds) * fix(ui): on-ramp receipt explorer + transfer modal token label TransactionDetails: on-ramp headline uses fiat amount; hide duplicate onchain row; completed on-ramp opens explorer via View receipt (no PDF). Transfer funds: Select token dropdown title and selected value. * docs(faq): on-ramp copy and home tagline Expand FAQs for stablecoin↔fiat both ways; add bank/mobile money on-ramp FAQ. Home: move between stablecoins and cash line + 30s. * chore: refactor clipboard functionality to improve reliability (#463) * chore: refactor clipboard functionality to improve reliability and user feedback - Updated `copyToClipboard` function to use `navigator.clipboard` in secure contexts and fall back to `execCommand` for non-secure contexts. - Changed return type of `copyToClipboard` to boolean to indicate success or failure. - Refactored multiple components to utilize the updated `copyToClipboard` function, enhancing clipboard copy operations with toast notifications for user feedback. - Ensured consistent handling of clipboard actions across various components, including `CopyAddressWarningModal`, `MobileDropdown`, and `TransactionDetails`. * refactor: enhance clipboard copy functionality for improved reliability --------- Co-authored-by: Prosper <40717516+onahprosper@users.noreply.github.com> * Feat/starknet clean (#474) * feat(starknet): Starknet wallet, APIs, and app integration on latest main - Restore Starknet routes (create-wallet, get-public-key, transfer, create-order), context, lib, and STRK logo - Wire balance, transfer, transaction flows, network UI, and Privy wallet API helpers - Cast EVM viem Chain where migration/network lists still union with custom Starknet chain id type Made-with: Cursor * feat(aggregator): enhance fetchTokens function with URL validation and improved error handling - Added validation for the AGGREGATOR_URL to ensure it is set and properly formatted. - Improved error logging to provide more context on network issues when fetching tokens from the API. - Updated the API request to use a constructed URL for better clarity and maintainability. * feat(starknet): enhance create-order route with wallet address validation and error handling - Added validation for the wallet address format in the create-order API, ensuring it is a valid string. - Implemented error responses for missing or invalid wallet addresses to improve user feedback. - Refactored the logic to check if the wallet is deployed using the normalized wallet address. - Removed redundant code related to wallet deployment checks, streamlining the function. * feat(starknet): improve wallet address handling and state management in Starknet context - Added validation for wallet address format in the Starknet API, ensuring it is a valid string before processing. - Implemented error responses for missing or invalid wallet addresses to enhance user feedback. - Refactored state management in StarknetProvider to handle null values for wallet ID, address, and public key more effectively. - Streamlined the logic for checking if a wallet is deployed using the normalized wallet address, improving code clarity. * feat(starknet): enhance balance fetching and network handling for Starknet integration - Introduced unified balance fetching for both EVM and Starknet networks, improving consistency in balance management. - Added support for displaying balances in the WalletDetails component specifically for Starknet. - Implemented user notifications for unsupported on-ramp functionality on Starknet, guiding users to switch to an EVM network. - Refactored state management in BalanceContext to handle Starknet balances more effectively, ensuring accurate cross-chain balance representation. * refactor(utils): remove temporary USDT addition for Base network and streamline fallback token handling - Eliminated the temporary addition of USDT for the Base network during token fetching. - Simplified the logic for merging fallback tokens, ensuring only relevant networks are processed. * feat(starknet): enhance address validation and balance context management - Added validation for Starknet addresses to ensure they are not empty or the zero address, improving error handling. - Updated BalanceContext to reset smart wallet totals and cross-chain balances upon error, ensuring consistent state management during balance fetching. * feat(starknet): add new API routes and enhance wallet management - Introduced new API routes for Starknet: `/api/starknet/transfer` and `/api/starknet/create-order`, expanding functionality for wallet operations. - Implemented comprehensive error handling and validation for wallet addresses across Starknet APIs, improving user feedback and security. - Enhanced state management in the Starknet context to support new wallet-related features, including tracking wallet creation and transfer processes. - Updated middleware to include wallet address extraction for improved request handling. --------- Co-authored-by: sundayonah <sundayonah94@gmail.com> * refactor: centralize Starknet ready account class hash and paymaster configuration (#476) - Moved the Starknet ready account class hash and paymaster configuration from environment variables to the config module for better maintainability and clarity. - Updated relevant API routes and hooks to utilize the new centralized configuration, improving consistency across the application. - Removed redundant error handling for missing environment variables related to the paymaster setup, streamlining the codebase. * feat: enhance CopyAddressWarningModal for Starknet support (#477) - Updated the CopyAddressWarningModal to display specific warnings and information for Starknet addresses, ensuring users are aware of the differences in address formats and supported networks. - Centralized modal title, deposit description, and footer warning for improved readability and maintainability. - Adjusted the list of supported networks displayed based on the selected network, enhancing user experience and clarity regarding supported stablecoins and networks. * feat: enhance Starknet integration and UI components (#480) * feat: enhance Starknet integration and UI components - Added support for internal API origin configuration in the aggregator API to handle deployments with separate SPA and API origins. - Updated the networks list in mocks to reflect explicit ranking based on aggregator volume, improving user experience. - Introduced a new context for managing transaction form swap state, allowing global UI updates without prop drilling. - Enhanced dropdown components to support a disabled state, preventing user interaction when necessary. - Implemented validation for Starknet-specific on-ramp functionality, including UI adjustments to indicate unsupported features. - Refactored transaction handling to ensure correct wallet address usage for Starknet, improving API interaction and error handling. - Improved error handling in transaction fetching to gracefully manage 404 responses, enhancing user feedback. * feat: improve Starknet on-ramp handling and transaction management - Added validation to block form submission when the Starknet on-ramp is active and a swap is indicated, enhancing user experience. - Updated transaction context to align cache state with API responses, preventing stale data from being used in future fetches. - Enhanced swap button logic to disable interactions when the Starknet on-ramp is active, ensuring clarity for users. - Refined wallet address handling in the TransactionPreview component to ensure proper API interactions and error handling, improving transaction persistence reliability. * fix: improve error handling in TransactionsContext for transaction fetching - Enhanced error handling in the TransactionsContext to log detailed error messages when fetching transactions fails. - Simplified the handling of 404 errors by removing redundant state updates, ensuring clearer error reporting and user feedback. * feat: enhance TransferForm with improved address validation for Starknet and EVM networks (#481) - Added comprehensive validation for recipient addresses based on the selected network, ensuring correct formats for both Starknet and EVM addresses. - Integrated a trigger to validate the recipient address whenever the recipient network changes, improving user feedback and error handling. - Refactored existing validation logic to streamline address checks and provide clearer error messages for invalid formats. * feat: introduce swap mode functionality across transaction components - Added a new type to manage on-ramp and off-ramp states consistently. - Updated and various components to replace the boolean with , enhancing clarity and maintainability. - Implemented utility functions to derive swap mode from URL parameters and set initial values based on network conditions. - Refactored transaction handling and UI components to utilize the new swap mode logic, improving user experience and error handling during transactions. * feat(balances): parallelize rate+RPC, multicall per chain, SWR cache, CNGN UX (#482) * feat(balances): parallelize rate+RPC, multicall per chain, SWR cache, CNGN UX Speeds up wallet balance loads and removes the misleading "$0 red" CNGN display when the NGN-USD rate is unavailable. Highlights: - Run getCNGNRateForNetwork in parallel with cross-chain balance fetches so wall time is max(rate, RPC) instead of sum. - Replace per-token readContract loop with a single viem multicall per chain (allowFailure, sequential fallback when multicall3 is missing). - Add client-only TTL+single-flight cache (walletBalanceCache) keyed by chainId+address; expose softRefresh (cache-respecting) and refreshBalance (bypass-cache) on BalanceContext. - Treat missing CNGN rate as "USD valuation unknown" instead of \$0: introduce cngnUsdUnknown, render "—" with NGN-pegged copy in WalletDetails / WalletView, keep raw token amount visible. - Re-apply CNGN correction when the rate later resolves without re-fetching balances; quote NGN<->USD on a fixed corridor (CNGN_CROSS_CHAIN_QUOTE_NETWORK) for cross-chain consistency. - Identity-aware isRefreshing avoids showing another wallet's cached balances during account switches. - Add lightweight balanceTelemetry (opt-in via localStorage.balance_debug in dev, 2% sample in prod) and tokenBalanceRowVisible helper. Tests: extend coverage with tokenBalanceRowVisible.test.ts. * fix(balances): honor bypass on rate fallback, safe cache invalidation, sequential read fallback Pass bypassCache into getCNGNRateForNetwork when resolving CNGN rate in BalanceContext so manual refresh can skip the local quote cache. Prevent stale in-flight balance fetches from repopulating walletBalanceCache after invalidation, and clear inflight keys on invalidate. Use a true sequential ERC-20 readContract loop when multicall fails. * perf(balances): run native getBalance in parallel with ERC-20 multicall * fix(balances): bypass inflight dedupe on refresh, lazy-load cache on client When bypassCache is set, start a fresh fetch instead of joining an older in-flight request. Load walletBalanceCache via dynamic import in fetchEvmBalancesForAddress and skip cache entirely on the server so shared utils imports do not execute client-only Maps in Node. * perf(build): drop unused deps, lazy-load @react-pdf/renderer, enable Turbopack (#483) The production build was taking 10–12 minutes. This commit applies three independent changes that together remove the largest sources of build cost: 1. Removed dependencies that nothing in the app actually imports: - thirdweb (5.102.6 + duplicate 5.29.6) - @thirdweb-dev/auth, @thirdweb-dev/wallets - @vidstack/react - net, tls (already polyfilled-out via the package.json `browser` map and Next webpack `resolve.fallback`) These pulled in ~400 MB of transitive code (multiple viem versions, @WalletConnect copies, three.js, lucide-react, @thirdweb-dev/contracts-js, etc.). After re-locking, pnpm reports `+76 -693` packages and node_modules shrinks from 2.6 GB to 1.6 GB, which speeds up dep resolution, SWC transforms, and CI cache restore. 2. Lazy-load @react-pdf/renderer in TransactionDetails and TransactionStatus. PDFKit + fontkit + image decoders are only needed when the user clicks "Get receipt", so they no longer enter the first-load JS bundle. 3. Switch `next build` to use Turbopack (stable in Next 15.5+). Combined with the smaller dep tree, this should cut production build time by several minutes on its own. No app code or runtime behavior changes; the PDF receipt feature still works identically (just dynamically imported on click). * fix(build): disable Turbopack scope hoisting to avoid BytePos panic Workaround for the "high bits of the position ... are not all 0s or 1s" panic that crashes `next build --turbopack` on large module graphs (e.g. via Sanity). Fixed upstream in Next.js 16 (vercel/next.js#83399) but not in 15.5.x. Remove once we upgrade to a version that includes the fix. * fix(deps): patch 90+ Dependabot security vulnerabilities (#484) * fix(deps): patch 90+ Dependabot security vulnerabilities Update direct deps and add pnpm overrides to address all reachable CVEs. Skipped uuid@14 (major API break), undici@6 (5→6 major), and @tootallnate/once@3 (2→3 major) as they require breaking changes. Direct upgrades: - next ^15.5.7 → ^15.5.15 (DoS, high) - axios ^1.9.0 → ^1.15.0 (SSRF/header injection, medium) - postcss ^8.5.5 → ^8.5.10 (XSS, medium) - @sanity/cli ^3.99.0 → ^4.4.1 (removes vite@7.1.x from tree) New pnpm overrides (transitive): - @hpke/core 1.7.2→1.9.0 (critical) - jws 3.2.2→3.2.3, h3 1.15.3→1.15.11, valibot 1.1.0→1.3.1, preact 10.26.9→10.29.1 (high, production) - dompurify →3.4.2, follow-redirects →1.16.0, defu →6.1.7 (medium) - vite@7 7.1.2→7.3.2 (high, arbitrary file read) - rollup 4.46.2→4.60.2, tar 7.4.3→7.5.13, tar-fs 2.1.3→2.1.4, systeminformation 5.27.7→5.31.5 (high) - glob@10 →10.5.0, glob@11 →11.1.0 (high) - minimatch@3/5/9/10, picomatch@2/4, yaml@1/2, js-yaml@3/4 all patched - lodash/lodash-es →4.18.1, bn.js →5.2.3, qs →6.15.1, brace-expansion@2 →2.1.0, flatted →3.4.2, min-document →2.19.2 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(deps): drop noop @isaacs/brace-expansion override The package was no longer in the dep tree after the related minimatch/glob upgrades resolved upstream forks, making the override an unused defensive guard. Removing reduces noise in the overrides config. Verified: pnpm install --frozen-lockfile passes; next build compiles successfully (15.5.15, Turbopack, 95s). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(deps): patch undici CVE via @actions/http-client and @actions/github overrides (#485) Forces @actions/http-client to ^3.0.2 and @actions/github to ^9.1.1 via pnpm.overrides. Both v3+ of http-client ship with undici@^6.23.0, eliminating the vulnerable undici@5.29.0 that was pulled in via the @sanity/cli → @sanity/template-validator@2.4.3 → @actions/github@6 chain. Sanity's own latest releases (template-validator@3.x) already depend on @actions/github@^9, so these versions are validated by the Sanity team. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(deps): resolve Dependabot/npm audit vulnerabilities via pnpm overrides (#487) * fix(wallet): parse CNGN rate when fetchRate returns numeric data --------- Co-authored-by: Isaac Onyemaechi Ugwu <Amaechiisaac450@gmail.com> Co-authored-by: Prosper <40717516+onahprosper@users.noreply.github.com> Co-authored-by: Onah Sunday. <sundayonah94@gmail.com> Co-authored-by: Agom Michael Junior <agomichaeljnr@gmail.com> Co-authored-by: Francis Ocholi <5raan6@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Description
References
Testing
Checklist
mainBy submitting a PR, I agree to Paycrest's Contributor Code of Conduct and Contribution Guide.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation