mirror of
https://github.com/luxfi/safe-wallet.git
synced 2026-10-30 15:19:21 +00:00
* feat(web): move transaction status widget (#6339) * feat(web): move transaction status widget Signed-off-by: dsh <[email protected]> * fix: remove unused code Signed-off-by: dsh <[email protected]> * fix: update layout and styles for transaction flow components - Adjusted media query breakpoints for responsive design. - Refactored grid layout for improved content organization and spacing. * fix: update styling values for widget Signed-off-by: dsh <[email protected]> * fix: show progressbar on small screens Signed-off-by: dsh <[email protected]> * fix: update TxLayout Signed-off-by: dsh <[email protected]> --------- Signed-off-by: dsh <[email protected]> Co-authored-by: Tim Schwarz <[email protected]> * feat(safe-shield): widget empty state + tx-flow layout update (#6416) * refactor: extract SafeHeaderInfo into separate component for re-usability * refactor: move TxNote component to the main area * feat: add SafeShieldWidget component with empty state * refactor: update tx flow layout according to designs * fix: update styling of TxStatus widget * feat: add dark mode support for SafeShieldWidget with new logo assets * fix: formatting * fix: styling * refactor: use classes to switch SVGs in light/dark mode * fix: remove duplicate css class definition * fix: formatting * fix: tx flow sidebar layout to have fixed max width * refactor: update styling of TxNoteInput * refactor: show TxNote in main area instead of in a separate card - Introduce SlotName.Main for content being shown in the main area slot - Render TxNote in the main slot * fix: e2e test string * fix: remove unused imports * feat(Safe Shield): add useAddressBookCheck hook (#6423) * feat(web): move transaction status widget (#6339) * feat(web): move transaction status widget Signed-off-by: dsh <[email protected]> * fix: remove unused code Signed-off-by: dsh <[email protected]> * fix: update layout and styles for transaction flow components - Adjusted media query breakpoints for responsive design. - Refactored grid layout for improved content organization and spacing. * fix: update styling values for widget Signed-off-by: dsh <[email protected]> * fix: show progressbar on small screens Signed-off-by: dsh <[email protected]> * fix: update TxLayout Signed-off-by: dsh <[email protected]> --------- Signed-off-by: dsh <[email protected]> Co-authored-by: Tim Schwarz <[email protected]> * feat(web): add address activity analysis feature Add service and React hook to analyze Ethereum address activity by checking transaction count and calculating an activity score. This helps detect low-activity addresses to prevent users from accidentally sending funds to potentially lost addresses. Features: - `analyzeAddressActivity()` service that fetches tx count via eth_getTransactionCount - `useAddressActivity()` React hook with async state management - Activity score calculation (0-1) based on configurable thresholds - `isLowActivityAddress()` helper to detect suspicious low-activity addresses * refactor: use useChainId inside hook instead of parameter Remove chainId parameter from useAddressActivity hook and use useChainId() internally to get the current chain ID. This simplifies the API and follows the existing pattern in the codebase. * feat: add title and description fields to hook result Refactor to use discrete activity levels instead of float scores: - Replace activityScore with activityLevel enum - Activity levels: NO_ACTIVITY, VERY_LOW_ACTIVITY, LOW_ACTIVITY, MODERATE_ACTIVITY, HIGH_ACTIVITY - Move ACTIVITY_THRESHOLDS and ActivityMessages to config.ts - Hook returns title and description based on activity level * test: add unit tests for address activity analysis Add comprehensive unit tests for both the service and hook: - addressActivityService.test.ts: 13 tests covering all activity levels, error handling, and the isLowActivityAddress helper - useAddressActivity.test.ts: 10 tests covering hook behavior, title/description mapping, error handling, and re-fetching on dependency changes All tests passing with 100% coverage of core functionality. * refactor: remove unnecessary chainId dependency Remove chainId from useAddressActivity hook dependencies since web3ReadOnly already updates when the chain changes. This eliminates redundant re-fetching and simplifies the hook. Updated test to verify re-fetching on web3ReadOnly changes instead of chainId changes. * feat(web): add useAddressBookCheck hook Add new hook to check if an address is known from various sources: - Address book contacts (merged local and Spaces) - Owned Safes The hook returns: - isKnownAddress: true if found in any source - isAddressBookContact: true if in address book - isOwnedSafe: true if in owned Safes - description: enum describing the source - severity: "OK" for known, "INFO" for unknown - loading and error states Includes comprehensive test coverage. * Lint and prettier * feat(safe-shield): widget empty state + tx-flow layout update (#6416) * refactor: extract SafeHeaderInfo into separate component for re-usability * refactor: move TxNote component to the main area * feat: add SafeShieldWidget component with empty state * refactor: update tx flow layout according to designs * fix: update styling of TxStatus widget * feat: add dark mode support for SafeShieldWidget with new logo assets * fix: formatting * fix: styling * refactor: use classes to switch SVGs in light/dark mode * fix: remove duplicate css class definition * fix: formatting * fix: tx flow sidebar layout to have fixed max width * refactor: update styling of TxNoteInput * refactor: show TxNote in main area instead of in a separate card - Introduce SlotName.Main for content being shown in the main area slot - Render TxNote in the main slot * fix: e2e test string * fix: remove unused imports --------- Signed-off-by: dsh <[email protected]> Co-authored-by: Dasha Kobzeva <[email protected]> Co-authored-by: Tim Schwarz <[email protected]> * feat(Safe Shield): add address activity analysis feature (#6422) * feat(web): move transaction status widget (#6339) * feat(web): move transaction status widget Signed-off-by: dsh <[email protected]> * fix: remove unused code Signed-off-by: dsh <[email protected]> * fix: update layout and styles for transaction flow components - Adjusted media query breakpoints for responsive design. - Refactored grid layout for improved content organization and spacing. * fix: update styling values for widget Signed-off-by: dsh <[email protected]> * fix: show progressbar on small screens Signed-off-by: dsh <[email protected]> * fix: update TxLayout Signed-off-by: dsh <[email protected]> --------- Signed-off-by: dsh <[email protected]> Co-authored-by: Tim Schwarz <[email protected]> * feat(web): add address activity analysis feature Add service and React hook to analyze Ethereum address activity by checking transaction count and calculating an activity score. This helps detect low-activity addresses to prevent users from accidentally sending funds to potentially lost addresses. Features: - `analyzeAddressActivity()` service that fetches tx count via eth_getTransactionCount - `useAddressActivity()` React hook with async state management - Activity score calculation (0-1) based on configurable thresholds - `isLowActivityAddress()` helper to detect suspicious low-activity addresses * refactor: use useChainId inside hook instead of parameter Remove chainId parameter from useAddressActivity hook and use useChainId() internally to get the current chain ID. This simplifies the API and follows the existing pattern in the codebase. * feat: add title and description fields to hook result Refactor to use discrete activity levels instead of float scores: - Replace activityScore with activityLevel enum - Activity levels: NO_ACTIVITY, VERY_LOW_ACTIVITY, LOW_ACTIVITY, MODERATE_ACTIVITY, HIGH_ACTIVITY - Move ACTIVITY_THRESHOLDS and ActivityMessages to config.ts - Hook returns title and description based on activity level * test: add unit tests for address activity analysis Add comprehensive unit tests for both the service and hook: - addressActivityService.test.ts: 13 tests covering all activity levels, error handling, and the isLowActivityAddress helper - useAddressActivity.test.ts: 10 tests covering hook behavior, title/description mapping, error handling, and re-fetching on dependency changes All tests passing with 100% coverage of core functionality. * refactor: remove unnecessary chainId dependency Remove chainId from useAddressActivity hook dependencies since web3ReadOnly already updates when the chain changes. This eliminates redundant re-fetching and simplifies the hook. Updated test to verify re-fetching on web3ReadOnly changes instead of chainId changes. * refactor: rename hook to useAddressActivityCheck and add severity field - Rename useAddressActivity to useAddressActivityCheck for clarity - Add severity field: 'WARN' for LOW_ACTIVITY/VERY_LOW_ACTIVITY, 'INFO' otherwise - Update all tests to reflect new hook name and severity field * feat(safe-shield): widget empty state + tx-flow layout update (#6416) * refactor: extract SafeHeaderInfo into separate component for re-usability * refactor: move TxNote component to the main area * feat: add SafeShieldWidget component with empty state * refactor: update tx flow layout according to designs * fix: update styling of TxStatus widget * feat: add dark mode support for SafeShieldWidget with new logo assets * fix: formatting * fix: styling * refactor: use classes to switch SVGs in light/dark mode * fix: remove duplicate css class definition * fix: formatting * fix: tx flow sidebar layout to have fixed max width * refactor: update styling of TxNoteInput * refactor: show TxNote in main area instead of in a separate card - Introduce SlotName.Main for content being shown in the main area slot - Render TxNote in the main slot * fix: e2e test string * fix: remove unused imports * Prettier * feat: add severity field to useAddressActivity hook - Add severity field to hook return type ('WARN' | 'INFO') - Use isLowActivityAddress function to determine severity - Includes NO_ACTIVITY, VERY_LOW_ACTIVITY, and LOW_ACTIVITY as 'WARN' - Update all tests to verify severity field --------- Signed-off-by: dsh <[email protected]> Co-authored-by: Dasha Kobzeva <[email protected]> Co-authored-by: Tim Schwarz <[email protected]> * fix(safe-shield): safe info tx flow (#6429) * fix: update Safe info in tx flow to align with design - Added a separate SafeInfo component to display safe address details, including ENS name and address shortening in the tx flow - Replaced SafeHeaderInfo with SafeInfo in TxFlowContent and TxLayout. - Integrated address copying functionality with CopyAddressButton. * fix: styling for a long name * refactor(Safe Shield): organize features into subfolders (#6430) * refactor(address-analysis): organize features into subfolders Reorganized address-analysis features into dedicated subfolders for better code organization: - Created address-activity/ subfolder for address activity analysis - Created address-book-check/ subfolder for address book validation - Updated all import paths to reflect new structure * refactor(address-analysis): consolidate shared types and messages in config - Created shared `AnalysisSeverity` enum (OK, INFO, WARN) for all address analysis hooks - Converted `AddressCheckDescription` enum to `AddressCheckMessages` object with title/description structure matching `ActivityMessages` - Updated `useAddressBookCheck` to return `checkType`, `title`, and `description` fields - Updated `useAddressActivity` to use `AnalysisSeverity` enum instead of string literals - Updated all tests to use new structure - Centralized all shared types and messages in config.ts for consistency * Prettier --------- * Feat(Safe Shield): widget component (#6433) * feat: Safe Shield widget UI and storybook * fix: remove wrong export * fix: lodash import Co-authored-by: katspaugh <[email protected]> * fix: formatting --------- Co-authored-by: katspaugh <[email protected]> * fix(Safe Shield): Tx flow layout (#6440) * fix(tx-flow): update layout and styling for responsive design - Replaced Stack with Grid for better layout control in TxFlowContent and TxLayout components. - Adjusted media query breakpoints for small and desktop screens. - Introduced a styled StatusLabel in TxStatusWidget for consistent typography. - Enhanced sidebar and main content organization for improved user experience. * fix: styling for NestedSafeCreation screen * feat(Safe Shield): Recipient analysis data fetching (#6456) * feat: fetch recipient analysis data from backend - Added new hook `useFetchRecipientAnalysis` to fetch recipient analysis from the backend, tracking which recipients have been fetched to optimize API calls. - Introduced utility hooks `useEffectDeepCompare` and `useAsyncDeepCompare` for deep equality checks in effect and async operations. - Updated types in `types.ts` to include new recipient activity statuses and refined the structure of analysis result types for better clarity and maintainability * feat: useRecipientAnalysis hook for combining backend results with local check results Move and refactor hooks for address activity and address book checks to the safe-shield feature folder. * fix: linter errors * fix: linter errors * feat: clear address activity cache and results when web3ReadOnly provider changes * feat: clear useFetchRecipientAnalysis cache and results when chainId or safeAddress changes * test: unit tests for `useFetchRecipientAnalysis` hook * fix: formatting * fix: update `useFetchRecipientAnalysis` tests to use GATEWAY_URL for API calls * test: add unit tests for `useRecipientAnalysis` hook * feat: add RecipientAnalysisResultBuilder for recipient status analysis * chore: add auto-generated RTK handlers for recipient analysis fetching * feat: implement `useFetchMultiRecipientAnalysis` hook for batch recipient analysis fetching with unit tests * refactor: simplify `useFetchRecipientAnalysis` by integrating `useFetchMultiRecipientAnalysis` for improved recipient analysis fetching * chore: move safe-shield hooks to utils package * refactor: move builders and types to utils package * chore: remove old builders * refactor: remove old types file and use the types from utils package instead * feat(Safe Shield): recipient analysis UI (#6488) * refactor: move util functions to the @safe-global/utils package * feat: add constants and utility functions for overall status analysis - Introduced `SEVERITY_TO_TITLE` mapping for severity titles. - Implemented `getOverallStatus` function to aggregate and determine overall security status from recipient, contract, and threat analysis results. - Updated `types.ts` to include new status group types and analysis result structures. * feat: add multi-recipient analysis utilities - Introduced `MULTI_RESULT_DESCRIPTION` for generating descriptive messages based on recipient status. - Added utility functions `capitalise` and `formatCount` for string manipulation and count formatting. - Implemented `mapConsolidatedAnalysisResults` to consolidate address analysis results and generate appropriate descriptions. * test: add unit tests for getOverallStatus function * feat: add util function to map analysis results to the visible ones * chore: remove old file * feat: show recipient analysis results in the widget - Added `SEVERITY_COLORS` constant to define color mappings for different severity levels. - Refactored `AnalysisGroupCard` to utilize the new `SeverityIcon` component for displaying severity icons. - Updated `SafeShieldHeader` and `SafeShieldContent` components to handle recipient and contract analysis results more effectively. - Introduced `SeverityIcon` component for better separation of concerns in rendering severity icons. * feat: enhance Safe Shield types and builders for contract analysis - Introduced `StatusGroupType` to better define status group mappings for contract analysis. - Updated `ContractAddressBuilder` and `ContractAnalysisResultBuilder` to utilize the new type for improved type safety. - Refactored `ContractAnalysisBuilder` to return a more structured response for contract analysis results. - Enhanced `LiveAnalysisResponse` to use `AsyncResult` for recipient and contract analysis, improving consistency in data handling. * feat: enhance RecipientAnalysisResultBuilder for improved recipient status handling - Updated RecipientAnalysisResultBuilder to support BridgeStatus for enhanced analysis capabilities. - Refactored titles and descriptions for recipient statuses to follow consistent casing and improved clarity. - Introduced new method incompatibleSafe() to handle scenarios where a Safe account cannot be created on the destination chain. * feat: add recipient analysis builders for enhanced recipient status handling - Introduced `RecipientAnalysisBuilder` and `RecipientAddressBuilder` to facilitate structured recipient analysis. - Added methods for managing various recipient states, including address book, interaction, activity, and bridge states. * feat: enhance LiveAnalysisResponseBuilder with recipient analysis support - Added `recipient` method to manage recipient analysis results, merging current and new data. - Introduced `knownRecipient` static method for convenient recipient initialization using `RecipientAnalysisBuilder`. - Updated `contract` method to handle structured responses for contract analysis, improving data consistency. * feat: update SafeShield stories to include recipient analysis and improve loading/error states - Enhanced stories for SafeShieldDisplay to incorporate recipient analysis using RecipientAnalysisBuilder. - Updated the ChecksPassed, UnverifiedContract, and UnableToVerifyContract stories to reflect new recipient data handling. - Improved loading and error state representations for better clarity in the widget's behavior during contract analysis. - Refactored story descriptions for consistency and clarity. * fix: use correct dark/light mode colors in Storybook * feat(Safe Shield): integrate recipient analysis (#6498) * feat(Safe Shield): enhance recipient analysis hooks to handle undefined results - Updated `useFetchRecipientAnalysis` and `useAddressActivity` hooks to return `undefined` instead of empty objects when no results are available, improving clarity in handling API responses. - Refactored `mergeAnalysisResults` to conditionally merge address book results only when fetched results are present, ensuring more accurate data representation. - Adjusted related tests to reflect the new behavior of returning `undefined` for empty results, enhancing test coverage and reliability. * feat: add SafeShieldContext and hooks for recipient analysis - Introduced `SafeShieldContext` and `SafeShieldProvider` to manage recipient addresses and their analysis. - Added `useSafeShield` hook for accessing context values and `useSafeShieldForRecipients` hook for registering recipient addresses for analysis. * feat: integrate SafeShieldProvider into TxFlow and TxLayout components - Added `SafeShieldProvider` to `TxFlow` and `TxLayout` components to manage recipient analysis context. - Set the recipient addresses from the TokenTransferFlow in to context * reafactor: improve SeverityIcon component * refactor: migrate SafeShieldWidget to features directory and update imports - Removed the old SafeShieldWidget component and its tests. - Introduced a new SafeShieldWidget in the features directory, utilizing the SafeShieldDisplay component and context for recipient analysis. - Updated imports in TxFlowContent to reflect the new location of SafeShieldWidget. * refactor: enhance string utility functions and update analysis result mapping - Simplified the `capitalise` function for better readability. - Introduced a new `pluralise` function to handle singular and plural word forms based on count. - Updated `formatCount` to utilize the new `pluralise` function for improved count formatting. - Modified `mapConsolidatedAnalysisResults` to use a more flexible description generation approach with the new `pluralise` utility. * test: add unit tests for string utility functions * test: add unit tests for mapConsolidatedAnalysisResults and mapVisibleAnalysisResults functions * feat: enhance multi-recipient analysis descriptions - Updated `MULTI_RESULT_DESCRIPTION` to include new `BridgeStatus` and `ContractStatus` mappings for improved clarity in recipient analysis. * feat: add Story for multi recipients + contracts results case * test: fix CreateTokenTransfer tests * fix: type-check error * refactor: replace inline Card styles with CSS class for SafeInfo component * fix: formatting * refactor: rename variable for clarity in mapConsolidatedAnalysisResults function * refactor: improve code readability * refactor: remove unnecessary double exclamation marks * feat(Safe Shield): counterparty analysis data fetching (#6502) * chore: fetch CGW API schema * feat: move mergeAnalysisResults utility function to a separate file * feat: add useCounterpartyAnalysis hook for analyzing counterparty addresses - Introduced `useCounterpartyAnalysis` hook to fetch and analyze recipient and contract addresses. - The hook performs backend API calls and local checks, returning structured results with loading and error states. * feat: add useCounterpartyAnalysis wrapper hook to web package which calls the corresponding hook from @safe-global/utils package * test: add unit tests for mergeAnalysisResults utility function * test: fix useRecipientAnalysis tests to use checksummed addresses * fix: type-check error * fix: use getAddress for address normalization in useCounterpartyAnalysis hook * test: add unit tests for useCounterpartyAnalysis hook to validate transaction analysis and recipient data handling * feat(web): Safe shield ui for threat analysis (#6505) * feat(web): create threat analysis builders * feat(web): adjust safe-shield types to include threat analysis format * feat(web): adjust SafeShield components to cover threat analysis scenarios * feat(web): add storybooks for threat analysis components * feat(web): create 'master copy change' threat variant * feat(web): add unit tests for the SafeShieldDisplay component * fix(web): safe shield import types * chore(web): sort the issues by severity type * chore(web): add bullet points to the issues list component * fix(web): add threat results in the SafeShieldHeader * chore(web): create ThreatAnalysisResult type * fix(web): eslint for the threat analysis group * fix(web): remove console.log * fix(web): getOverallStatus unit tests * refactor(web): fix lint * feat(Safe Shield): move Tenderly simulation to Safe Shield widget (#6490) * feat(Safe Shield): wip move tenderly widget to safe shield side bar * fix: resolve type checks * feat(Safe Shield): add TenderlySimulation component to Safe Shield * fix: address comments * fix: add nested and normal tx check * fix: change colors and show tooltip conditional * fix: prettier format * move nested tx logic into hook * fix: resolve type errors * fix: Reset tx only when it changed * fix: run prettier * fix: remove comments * fix: remove tx check * fix: right align view button * feat(Safe Shield): integrate counterparty analysis (#6508) * feat: enhance SafeShieldContext to support contract analysis - Updated `SafeShieldContext` to include contract analysis alongside recipient analysis. - Refactored `SafeShieldProvider` to provide both recipient and contract analysis results. * refactor: update `SafeShieldWidget` to utilize `recipient` and `contract` from `useSafeShield` * feat: show recipient and contract analysis results correctly in `SafeShieldContent` * refactor: make `recipients` param in `useRecipientAnalysis` hook optional * refactor: only merge different results after all of them are available * fix: only refetch counterparty analysis if relevant tx data fields change * test: fix tests * refactor: use prefix "all these" for counterparty analysis results * test: fix test * refactor: remove unnecessary deep comparison * fix: copy texts for analysis result descriptions * tests: fix tests * feat: update formatCount to take allPrefix param * feat(Safe Shield): integrate widget in NFT and ExecuteBatch flows (#6520) * feat: integrate recipient analysis in SendNftBatch flow * refactor: add safeTx prop to SafeShield components - Enhanced SafeShieldDisplay and SafeShieldContent components to accept a new safeTx prop of type SafeTransaction. - Updated SafeShieldContent to utilize the safeTx prop for improved transaction handling. * feat: enhance SafeShield context and widget for transaction analysis - Added safeTx state management to SafeShieldContext for improved transaction handling. - Updated SafeShieldWidget to utilize the new safeTx prop in SafeShieldDisplay. - Introduced useSafeShieldForTxData hook to register transaction data for analysis. * feat: enable SafeShield transaction simulation in ExecuteBatch flow - Utilized useSafeShieldForTxData hook for transaction data analysis. * fix(Safe Shield): check only for low recipient activity (#6521) * refactor: simplify address activity analysis and remove unused code - Removed the `addressActivityService` and its related tests to streamline address activity analysis. - Introduced a new `LowActivityAnalysisResult` for low activity addresses. - Updated `config.ts` to reflect changes in activity thresholds and messages. - Refactored `useAddressActivity` to utilize the new low activity analysis structure. * test: fix tests * refactor: remove unused HIGH_ACTIVITY enum value * chore: remove unused highActivity builder function * refactor: update useCounterpartyAnalysis and useRecipientAnalysis hooks to include activityCheckLoading in result merging logic * refactor: remove unused HIGH_ACTIVITY message builder from safe-shield constants * test: fix tests * chore: update api schema and DTOs * fix(web): merge issues * feat(Safe Shield): implement error status for a single analysis item (#6528) * feat(Safe Shield): integrate error status for single analysis * feat(Safe Shield): adjust ui for single anlysis error * fix(Safe Shield): unit tests * fix(Safe Shield): remove SafeShieldAnalysisError component * feat(Safe Shield): fix eslint errors * fix(Safe Shield): remove unnecessary error comparison * refactor(Safe Shield): move unit tests function to be inside the builders * chore(Safe Shield): code style * feat(Safe Shield): Show addresses on multi-send tx analysis (#6532) * feat(Safe Shield): add ShowAllAddress component for displaying multiple addresses * feat(Safe Shield): enhance analysis result types and consolidate address results * fix(Safe Shield): consider address map info in the unit tests * feat(Safe Shield): threat analysis (#6529) * fix: update ThreatStatus naming convention for consistency Renamed `MASTER_COPY_CHANGE` to `MASTERCOPY_CHANGE` * chore: fetch CGW API schema * refactor: improve safe-shield types and update analysis builders for consistency - Replaced `LiveAnalysisResponseBuilder` with `FullAnalysisBuilder` across components and tests to unify threat analysis handling. - Updated type definitions to reflect changes in analysis results, including renaming `AddressAnalysisResults` to `GroupedAnalysisResults`. - Refactored components to utilize the new `FullAnalysisBuilder` for constructing analysis responses. - Enhanced type safety and consistency in threat analysis results across the Safe Shield feature. * feat: add threat analysis hook and utility functions - Introduced `useThreatAnalysis` hook for fetching and analyzing security threats in transactions using EIP-712 typed data. - Added `generateTypedData` utility function to convert SafeTransaction objects to EIP-712 format for threat analysis. - Implemented type guards in `safeTransaction.ts` to validate SafeTransaction data structures. * test: add unit tests for useThreatAnalysis hook * test: add unit tests for generateTypedData utility function * feat: add useThreatAnalysis wrapper hook for web app - Introduced `useThreatAnalysis` wrapper hook for analyzing security threats in transactions using the same named hook from `@safe-global/utils` package * feat: integrate threat analysis into web app - Updated SafeShieldWidget to include threat data from the useSafeShield hook. - Modified SafeShieldContext to provide threat analysis results alongside recipient and contract data. * fix: override safeTx to be threat analyzed if custom one is defined - Updated `useThreatAnalysis` hook to accept an optional `overrideSafeTx` parameter for improved flexibility in threat data analysis. - Modified `SafeShieldContext` to pass the current transaction data to the `useThreatAnalysis` hook, ensuring accurate threat assessments based on the latest transaction context. * fix: test * feat: enhance Safe Shield analysis with COMMON status group - Introduced COMMON status group to improve threat analysis categorization. - Updated SafeShieldContent to normalize threat data, excluding BALANCE_CHANGE. - Modified hooks (useCounterpartyAnalysis, useRecipientAnalysis) to utilize COMMON status for error handling, ensuring consistent analysis results across components. - Adjusted type definitions to incorporate COMMON status in analysis results. * fix: update useThreatAnalysis hook to handle fetch errors with COMMON status - Enhanced the `useThreatAnalysis` hook to return a structured error response when a mutation fails, utilizing the COMMON status group. - Updated related tests to verify the new error handling behavior, ensuring consistency in threat analysis results. * chore: update SafeShield storybook * fix: simplify useCounterpartyAnalysis hook to make sure recipient errors are being displayed - Refactored the recipient result assignment to improve readability and maintainability. - Ensured that the recipient is only set when mergedRecipientResults is available, streamlining the return structure. * fix: clarify behavior in useThreatAnalysis hook for undefined origins * fix: typedData generation in useThreatAnalysis hook * refactor: simplify props structure in useThreatAnalysis hook - Replaced inline type definition with a dedicated UseThreatAnalysisProps type for improved readability and maintainability. - This change enhances the clarity of the hook's parameters, making it easier to understand and use. * feat(Safe Shield): show balance info retrieved from Safe Shield API (#6537) * feat: refactor balance change info to use data from Safe Shield integration - Updated `FungibleBalanceChange` and `NFTBalanceChange` components to utilize new Safe Shield types for improved type safety. - Refactored `BalanceChange` component to differentiate between fungible and NFT changes using type guards. - Integrated threat analysis results from the `useSafeShield` hook into the `BalanceChanges` component, replacing previous context usage. * feat: refactor transaction review to integrate BalanceChanges component by registering in main slot - Removed BlockaidBalanceChanges from ReviewTransactionContent and replaced it with the new BalanceChanges component. - Introduced BalanceChanges component to handle balance change information based on transaction context. * fix: revert removal of Blockaid component from TxFlow * fix: add missing export * fix(Safe Shield): Only show the first analysis border color (#6538) * fix(Safe Shield): only show the status color for the first analysis * fix(Safe Shield): lint * feat(Safe Shield): risk confirmation (#6542) * feat: replace Blockaid with RiskConfirmation component - Removed the Blockaid component and its associated file. - Introduced a new RiskConfirmation component to handle risk acknowledgment in transaction flows. - Updated TxFlow to integrate RiskConfirmation and adjusted exports accordingly. - Enhanced SafeShieldContext to manage risk confirmation state. * feat: integrate SafeShield context into transaction forms - Updated transaction forms (ReviewTransactionContent, ExecuteForm, ExecuteThroughRoleForm, ProposerForm, SignForm, CounterfactualForm) to utilize the SafeShield context for risk confirmation handling. - Removed previous TxSecurityContext references and replaced them with useSafeShield for improved risk management. - Adjusted button states in ReviewTransactionContent to account for risk confirmation requirements. - Enhanced overall transaction flow by ensuring risk acknowledgment is properly integrated across all relevant components. * refactor: integrate SafeShield for risk confirmation handling - Replaced the use of TxSecurityContext with useSafeShield to manage risk confirmation state. - Updated the SignMessage component to reflect changes in risk acknowledgment logic. - Adjusted the disabled state logic to include risk confirmation checks. - Swapped Blockaid component for RiskConfirmation to enhance user experience in transaction flows. * fix: tests * fix: update setRecipientAddresses type in SafeShieldContext - Changed the type of setRecipientAddresses from a function accepting string arrays to a Dispatch type for better type safety and flexibility in managing recipient addresses. * fix: tests * fix: handle non-array group results in getOverallStatus * fix: skip non-array group results in mapConsolidatedAnalysisResults * fix: skip non-array group results in mapVisibleAnalysisResults and add corresponding tests * fix(tests): enable previously skipped test for confirming already proposed messages in SignMessage component * feat(Safe Shield): remove old tenderly block (#6546) * refactor: remove TxChecks component from ReviewBatch and RecoverAccountFlowReview * refactor: remove TxChecks component and its related files from tx-flow features * refactor: remove Tenderly simulation component and its related styles * refactor: remove unused SignOrExecuteForm component * refactor: rename SignOrExecuteFormV2 to SignOrExecuteForm and update related imports * feat(Safe Shield): remove old bridge warnings (#6552) * refactor: remove old bridge warnings - The old bridge warnings in the transaction confirmation view are being replaced by the SafeShield widget - Deleted the BridgeRecipientWarnings component and its test file - Updated the BridgeTransaction index to remove references to the deleted component, ensuring no warnings are displayed * refactor: remove showWarnings prop from BridgeTransaction component - Updated the BridgeTransaction component to eliminate the showWarnings prop, simplifying its interface. - Adjusted the confirmation view logic to reflect this change, ensuring consistent behavior across transaction views. * feat: hide SafeShield widget on RecoveryAttempt, SignMessage, and ActivateAccount flows (#6548) - Introduced hideSafeShield prop in TxLayout to control the visibility of the Safe Shield sidebar. * feat(safe-schield): Add custom AnalysisCard for delegate call (#6556) * feat(safe-schield): Add custom AnalysisCard for delegate call Signed-off-by: dsh <[email protected]> * chore: refactor duplicates Signed-off-by: dsh <[email protected]> --------- Signed-off-by: dsh <[email protected]> * fix(Safe Shield): add back missing builder properties (#6540) * fix(Safe Shield): put in/out addresses back again into the master copy story * feat(Safe Shield): add threat issues back to its stories * fix(Safe Chield): unit tests * feat(Safe Shield): local recipient activity analysis only for non-Safe addresses (#6559) * feat(safe-shield): fetch RECIPIENT_ACTIVITY for Safes from API Signed-off-by: dsh <[email protected]> * refactor: optimize address fetching logic in useAddressActivity hook - Removed unnecessary useMemo for addressesToFetch and replaced it with useEffectDeepCompare to directly set addresses to fetch. - Simplified conditions for fetching results by removing redundant checks. - Updated state management for results based on address length. * refactor: simplify recipient filtering logic in useCounterpartyAnalysis and useRecipientAnalysis hooks - Updated filterNonSafeRecipients function to accept only analysis results, removing the need for recipient addresses as input. - Adjusted useMemo hooks in both useCounterpartyAnalysis and useRecipientAnalysis to reflect the new filtering logic. - Enhanced test coverage for filtering behavior, ensuring correct handling of Safe and non-Safe addresses in various scenarios. * refactor: centraly align text tooltip content in TenderlySimulation component --------- Signed-off-by: dsh <[email protected]> Co-authored-by: dsh <[email protected]> * fix(Safe Shield): tenderly (#6554) * fix(Safe Shield): remove gaps (#6565) * fix: enhance layout and structure in transaction review components - Added a Divider component for better visual separation in ReviewTransactionContent. - Updated SignerSelect to use a Stack for improved spacing and layout. - Removed unnecessary TxCard wrappers in SignerForm for cleaner structure. * fix: remove gap below header - Updated TxCard component to accept an optional `sx` prop for custom styling. - Adjusted usages in RecoverAccountFlowSetup and ReviewSpendingLimitTx to utilize the new `sx` prop for layout adjustments. * fix: improve layout in ReviewBatch component - Added a Divider component for better visual separation in the ReviewBatch component. - Adjusted the structure by removing an unnecessary TxCard wrapper, enhancing overall layout clarity. * fix: streamline layout in RecoverAccountFlowReview component - Removed unnecessary TxCard wrapper to enhance layout clarity. - Added a Divider component for improved visual separation. * fix: remove unused SlotName enum value - Eliminated the 'Feature' value from the SlotName enum in SlotProvider for cleaner code and improved maintainability. * fix: lint issues * fix: update snapshot for ReviewTransactionV2 component --------- Co-authored-by: Dasha Kobzeva <[email protected]> * feat(Safe Shield): remove old contract update warnings + cleanup old blockaid logic (#6553) * feat(safe-shield): widget empty state + tx-flow layout update (#6416) * refactor: extract SafeHeaderInfo into separate component for re-usability * refactor: move TxNote component to the main area * feat: add SafeShieldWidget component with empty state * refactor: update tx flow layout according to designs * fix: update styling of TxStatus widget * feat: add dark mode support for SafeShieldWidget with new logo assets * fix: formatting * fix: styling * refactor: use classes to switch SVGs in light/dark mode * fix: remove duplicate css class definition * fix: formatting * fix: tx flow sidebar layout to have fixed max width * refactor: update styling of TxNoteInput * refactor: show TxNote in main area instead of in a separate card - Introduce SlotName.Main for content being shown in the main area slot - Render TxNote in the main slot * fix: e2e test string * fix: remove unused imports * feat(Safe Shield): integrate recipient analysis (#6498) * feat(Safe Shield): enhance recipient analysis hooks to handle undefined results - Updated `useFetchRecipientAnalysis` and `useAddressActivity` hooks to return `undefined` instead of empty objects when no results are available, improving clarity in handling API responses. - Refactored `mergeAnalysisResults` to conditionally merge address book results only when fetched results are present, ensuring more accurate data representation. - Adjusted related tests to reflect the new behavior of returning `undefined` for empty results, enhancing test coverage and reliability. * feat: add SafeShieldContext and hooks for recipient analysis - Introduced `SafeShieldContext` and `SafeShieldProvider` to manage recipient addresses and their analysis. - Added `useSafeShield` hook for accessing context values and `useSafeShieldForRecipients` hook for registering recipient addresses for analysis. * feat: integrate SafeShieldProvider into TxFlow and TxLayout components - Added `SafeShieldProvider` to `TxFlow` and `TxLayout` components to manage recipient analysis context. - Set the recipient addresses from the TokenTransferFlow in to context * reafactor: improve SeverityIcon component * refactor: migrate SafeShieldWidget to features directory and update imports - Removed the old SafeShieldWidget component and its tests. - Introduced a new SafeShieldWidget in the features directory, utilizing the SafeShieldDisplay component and context for recipient analysis. - Updated imports in TxFlowContent to reflect the new location of SafeShieldWidget. * refactor: enhance string utility functions and update analysis result mapping - Simplified the `capitalise` function for better readability. - Introduced a new `pluralise` function to handle singular and plural word forms based on count. - Updated `formatCount` to utilize the new `pluralise` function for improved count formatting. - Modified `mapConsolidatedAnalysisResults` to use a more flexible description generation approach with the new `pluralise` utility. * test: add unit tests for string utility functions * test: add unit tests for mapConsolidatedAnalysisResults and mapVisibleAnalysisResults functions * feat: enhance multi-recipient analysis descriptions - Updated `MULTI_RESULT_DESCRIPTION` to include new `BridgeStatus` and `ContractStatus` mappings for improved clarity in recipient analysis. * feat: add Story for multi recipients + contracts results case * test: fix CreateTokenTransfer tests * fix: type-check error * refactor: replace inline Card styles with CSS class for SafeInfo component * fix: formatting * refactor: rename variable for clarity in mapConsolidatedAnalysisResults function * refactor: improve code readability * refactor: remove unnecessary double exclamation marks * refactor: update RiskConfirmationError component to use SafeShield context for risk confirmation handling * refactor: replace TxSecurityContext with useSafeShield in SignForm for risk confirmation handling * refactor: remove obsolete security components - Deleted unused security-related components: BlockaidHint, ContractChangeWarning, and their associated styles and utility functions. - This cleanup simplifies the transaction flow by removing legacy code that is no longer needed. * refactor: remove TxSecurityContext and related components from transaction flow - Deleted the TxSecurityContext and its provider from the transaction flow components. - This change simplifies the transaction flow by eliminating the obsolete security context, which is no longer needed following the integration of SafeShield for risk confirmation handling. * fix(tests): update SignForm tests to use new txSecurity structure * refactor: remove Blockaid module and its tests - Deleted the Blockaid module and its associated test file as part of the ongoing cleanup of obsolete security components. - This change simplifies the transaction flow by removing unused code that is no longer necessary following the integration of new security features. * refactor: remove Blockaid scan result event from analytics modals * refactor: remove Blockaid client ID from environment variables in README - Deleted the `NEXT_PUBLIC_BLOCKAID_CLIENT_ID` entry from the README as part of the ongoing cleanup of obsolete security components. This aligns with recent removals of the Blockaid module and simplifies the documentation by removing references to unused features. * refactor: remove unused styles for security components * refactor: rename component BlockaidBalanceChanges -> BalanceChanges * refactor: update TxLayout to conditionally render sidebar based on hideSafeShield prop * refactor: remove DelegateCallWarning from tx flow - add isQueue prop to DecodedData for conditional rendering of DelegateCallWarning Signed-off-by: dsh <[email protected]> --------- Signed-off-by: dsh <[email protected]> * fix(safe-shield): update low activity message (#6573) Signed-off-by: dsh <[email protected]> * fix(web): remove clipPath from swap icon (#6581) * fix(safe-shield): design QA (#6571) * fix(web): add tenderly in the sync of the safe shield header widget * fix(web): severity header and icon colors * fix(web): replace check icon as per figma desing * fix(web): higlighted colors on tenderly simulation * fix(web): eslint * chore(web): get rid of 'isPrimary' variable in the AnalysisGroupCardItem component * fix(web): remove isPrimary attribute from DelegateCallItem component * feat(Safe Shield): Improve loading animation (#6593) * feat(web): change safe shield animation design * feat(web): change SafeShieldContent to mount the loading bar separated from the empty state and delay the content components * fix(web): loading jumping issue * fix(web): unit tests * fix(web): use tenderly status on the useHighlightedSeverity hook (#6596) * fix(web): use tenderly status on the useHighlightedSeverity hook * fix: lint error Signed-off-by: dsh <[email protected]> --------- Signed-off-by: dsh <[email protected]> Co-authored-by: dsh <[email protected]> * chore: update layout of Recovery flow (#6597) * chore: update layout of Recovery flow Signed-off-by: dsh <[email protected]> * chore: update styles Signed-off-by: dsh <[email protected]> --------- Signed-off-by: dsh <[email protected]> * fix: show delegate-call warning on history and queue views (#6600) Signed-off-by: dsh <[email protected]> * fix(Safe Shield): Show nested safe simulation on execTransaction type (#6603) * fix(web): consider execTransaction types as nestedTx simulation * fix(web): move utility functions to utils folder * fix(web): lint * fix(Safe Shield): Enforce animation delay after request is done (#6609) * fix(web): animation delay * fix(web): decrease recipient delay * fix: reset RiskConfirmation state (#6610) Signed-off-by: dsh <[email protected]> * chore: remove unused import Signed-off-by: dsh <[email protected]> --------- Signed-off-by: dsh <[email protected]> Co-authored-by: Dasha Kobzeva <[email protected]> Co-authored-by: katspaugh <[email protected]> Co-authored-by: Clóvis Neto <[email protected]> Co-authored-by: valleXYZ <[email protected]> Co-authored-by: Daniel Dimitrov <[email protected]> Co-authored-by: Hanzo Dev <[email protected]>
818 B
818 B