remove celo from migration path#451
Conversation
📝 WalkthroughWalkthroughRestricts balance queries and chain mappings to a migration-specific network list ( Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Modal as WalletTransferApprovalModal
participant Hook as useEIP7702Account / useWalletMigrationStatus
participant BalanceCtx as BalanceContext
participant Fetch as Balance Fetch Logic
participant Networks as migrationChecklistNetworks
User->>Modal: open migration modal
Modal->>Networks: build CHAIN_MAP from migrationChecklistNetworks
Modal->>BalanceCtx: request balances/tokens
BalanceCtx->>Fetch: query on-chain balances for migrationChecklistNetworks
Fetch->>BalanceCtx: return per-chain balances
BalanceCtx->>BalanceCtx: compute totalMigrationRelevant & totalAll
BalanceCtx->>Hook: expose smartWalletCrossChainTotals
Hook->>Hook: determine needsMigration using totalMigrationRelevant
Hook->>Modal: provide migration status / zero-balance decision
Modal->>User: render tokens and migration UI for migration-relevant chains
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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/components/WalletTransferApprovalModal.tsx`:
- Around line 96-98: The UI is misleading because WalletTransferApprovalModal
filters balances by migrationChecklistNetworks (variable
migrationChecklistNetworks) but still labels the aggregate as “Total wallet
balance”; change the label where the total is rendered (the string used around
the total balance display) to “Migration-eligible balance” (or similar), compute
and render this value from the already-filtered balances (e.g.,
migrationEligibleBalance), and add a short, prominent notice below that total
(or as a tooltip) stating that excluded-chain balances are not included and will
not be transferred by this migration; also ensure the token list below is
clearly scoped to migration-eligible tokens (leave full SCW balances off or
moved to a separate “Excluded-chain balances” section if desired) so users
aren’t misled.
In `@app/context/BalanceContext.tsx`:
- Around line 321-327: The current fallback to show EOA entries is tied to
totalMigrationRelevant, which hides SCW balances on chains excluded by the
migration filter; change the logic so the EOA fallback is based on scwTotalAll
=== 0 instead. Update the place that reads setSmartWalletCrossChainTotals and
any conditional that checks totalMigrationRelevant (or totalMigrationRelevant
=== 0) to instead use scwTotalAll (or scwTotalAll === 0) for deciding whether to
flip crossChainBalances to EOA, while still using
scwCrossChainTotalMigrationRelevant/totalMigrationRelevant only for
banner/prompt decisions.
In `@app/hooks/useEIP7702Account.ts`:
- Around line 90-93: The logic in useEIP7702Account.ts currently sets
smartWalletCrossChainTotal using
smartWalletCrossChainTotals?.totalMigrationRelevant which makes nav/actions
treat wallets with funds on excluded chains as EOA-backed; change
smartWalletCrossChainTotal to use smartWalletCrossChainTotals?.totalAll instead
so useShouldUseEOA reflects the all-chain SCW balance, and keep
totalMigrationRelevant reserved for the migration-specific flag (e.g.,
needsMigration) rather than for nav/action decisioning.
🪄 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: f714232a-da34-44a2-b801-1eb670035e0a
📒 Files selected for processing (4)
app/components/WalletTransferApprovalModal.tsxapp/context/BalanceContext.tsxapp/hooks/useEIP7702Account.tsapp/mocks.ts
…com/paycrest/noblocks into fix-remove-celo-from-migration-path
There was a problem hiding this comment.
♻️ Duplicate comments (2)
app/hooks/useEIP7702Account.ts (1)
86-93:⚠️ Potential issue | 🟠 Major
useShouldUseEOAshould use all-chain SCW total.This hook controls nav/actions, not just migration prompts. Using
totalMigrationRelevantmeans a user with funds only on excluded chains (e.g., Celo) is treated as fully EOA-backed, so the app stops using the old smart wallet even though it still has assets. Keep this keyed offtotalAll, and reservetotalMigrationRelevantforneedsMigration.💡 Minimal fix
const smartWalletCrossChainTotal = hasSmartWallet && !isMigrationComplete - ? (smartWalletCrossChainTotals?.totalMigrationRelevant ?? 0) + ? (smartWalletCrossChainTotals?.totalAll ?? 0) : 0;Based on learnings, the app only flips to the EOA path when the non-migrated smart wallet has zero balance across all networks.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/hooks/useEIP7702Account.ts` around lines 86 - 93, The hook is using smartWalletCrossChainTotals.totalMigrationRelevant to decide whether to treat the account as EOA-backed; change the computation in useEIP7702Account (the smartWalletCrossChainTotal variable) to use smartWalletCrossChainTotals.totalAll (i.e., totalAll or equivalent "all-chain" total) instead of totalMigrationRelevant so the app only flips to EOA when the smart wallet truly has zero balance across all networks; keep the hasSmartWallet guard and leave totalMigrationRelevant reserved for the needsMigration logic elsewhere.app/context/BalanceContext.tsx (1)
350-354:⚠️ Potential issue | 🟠 MajorEOA fallback should use all-chain total, not migration-relevant total.
Line 350 flips
crossChainBalancesto EOA entries whenscwCrossChainTotalMigrationRelevant === 0. This hides SCW balances on excluded chains (e.g., Celo) from the main wallet view, even though the old wallet still holds assets. The fallback should stay tied toscwTotalAll === 0; use the migration-filtered total only for banner/prompt decisions.💡 Minimal fix
- if (scwCrossChainTotalMigrationRelevant === 0 && embeddedWalletAccount) { + if (scwTotalAll === 0 && embeddedWalletAccount) {Based on learnings, when a non-migrated user has zero SCW balance across all networks, the system intentionally switches
crossChainBalancesto display EOA entries instead of SCW entries.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/context/BalanceContext.tsx` around lines 350 - 354, The code flips to EOA entries when scwCrossChainTotalMigrationRelevant === 0 which hides SCW balances on excluded chains; change the condition that sets primaryIsEOA and calls fetchCrossChainEntriesForAddress/setCrossChainBalances to check scwTotalAll === 0 instead, leaving scwCrossChainTotalMigrationRelevant intact for banner/prompt logic; update the if in the block that assigns primaryIsEOA and calls fetchCrossChainEntriesForAddress(embeddedWalletAccount.address) so it uses scwTotalAll === 0.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@app/context/BalanceContext.tsx`:
- Around line 350-354: The code flips to EOA entries when
scwCrossChainTotalMigrationRelevant === 0 which hides SCW balances on excluded
chains; change the condition that sets primaryIsEOA and calls
fetchCrossChainEntriesForAddress/setCrossChainBalances to check scwTotalAll ===
0 instead, leaving scwCrossChainTotalMigrationRelevant intact for banner/prompt
logic; update the if in the block that assigns primaryIsEOA and calls
fetchCrossChainEntriesForAddress(embeddedWalletAccount.address) so it uses
scwTotalAll === 0.
In `@app/hooks/useEIP7702Account.ts`:
- Around line 86-93: The hook is using
smartWalletCrossChainTotals.totalMigrationRelevant to decide whether to treat
the account as EOA-backed; change the computation in useEIP7702Account (the
smartWalletCrossChainTotal variable) to use smartWalletCrossChainTotals.totalAll
(i.e., totalAll or equivalent "all-chain" total) instead of
totalMigrationRelevant so the app only flips to EOA when the smart wallet truly
has zero balance across all networks; keep the hasSmartWallet guard and leave
totalMigrationRelevant reserved for the needsMigration logic elsewhere.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: dcf42459-aa8e-48e0-842c-b600624fadc6
📒 Files selected for processing (4)
app/components/WalletTransferApprovalModal.tsxapp/context/BalanceContext.tsxapp/hooks/useEIP7702Account.tsapp/mocks.ts
✅ Files skipped from review due to trivial changes (1)
- app/components/WalletTransferApprovalModal.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- app/mocks.ts
* 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. --------- Co-authored-by: Isaac Onyemaechi Ugwu <Amaechiisaac450@gmail.com> Co-authored-by: Prosper <40717516+onahprosper@users.noreply.github.com> Co-authored-by: Agom Michael Junior <agomichaeljnr@gmail.com> Co-authored-by: Francis Ocholi <5raan6@gmail.com> Co-authored-by: chibie <chibuotu@gmail.com>
* 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
This pull request refines the wallet migration logic to more accurately handle network exclusions (notably Celo) throughout the migration UX and related balance computations. It introduces new helpers and state to distinguish between all-chain totals and migration-relevant totals, ensuring that UI and migration logic consistently exclude balances on unsupported chains. These changes help prevent migration prompts or banners from appearing when a user only has funds on excluded chains.
Migration network filtering and logic:
migrationChecklistNetworks(excluding Celo) and updated all relevant balance queries and UI logic to use this filtered list instead of the fullnetworksarray. This ensures that migration flows and banners only consider balances on supported chains. [1] [2] [3] [4] [5]Balance calculation improvements:
sumMigrationRelevantTotalsandsumAllChainTotalsto compute cross-chain totals for migration-relevant and all networks, respectively, and integrated these into the balance provider logic. [1] [2] [3]crossChainTotalMigrationRelevantand a newsmartWalletCrossChainTotalsobject containing both migration-relevant and all-chain totals, for use in migration logic and UI. [1] [2] [3] [4] [5] [6] [7]Migration status and UI logic updates:
useShouldUseEOAanduseWalletMigrationStatushooks to use the new migration-relevant totals, ensuring migration prompts and banners are only shown if the user has funds on eligible chains, and not when funds exist solely on excluded chains like Celo. [1] [2] [3]These changes together ensure that the wallet migration experience is accurate, clear, and only prompts users when action is actually needed.
References
Testing
Checklist
mainBy submitting a PR, I agree to Paycrest's Contributor Code of Conduct and Contribution Guide.
Summary by CodeRabbit
Bug Fixes
Refactor