Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: MMI move custody component to TS #26096

Merged
merged 16 commits into from
Jul 26, 2024

Conversation

zone-live
Copy link
Contributor

Description

Moves Custody component to TS.

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@zone-live zone-live added the team-mmi PRs from the MMI team label Jul 24, 2024
@zone-live zone-live requested a review from a team as a code owner July 24, 2024 14:16
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

The Custody component has been migrated to TypeScript, enhancing type safety and maintainability.

  • ui/components/institutional/qr-code-modal/qr-code-modal.tsx: Updated QRCodeModalProps to allow custodianURL to be string | undefined.
  • ui/pages/institutional/custodian-list-view/custodian-list-view.tsx: Converted to TypeScript, defining custodianList prop as React.ReactNode[].
  • ui/pages/institutional/custody/custody.stories.tsx: Converted to TypeScript, updating imports and Redux store configuration.
  • ui/pages/institutional/custody/custody.test.tsx: Converted to TypeScript, adding type annotations and defining MockedFuseType.
  • ui/pages/institutional/manual-connect-custodian/manual-connect-custodian.tsx: Added TypeScript types for props and state, improving type safety.

7 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

The Custody component has been migrated to TypeScript, enhancing type safety and maintainability.

  • .circleci/config.yml: Removed test-e2e-swap-playwright job, potentially reducing test coverage for swap functionality.
  • app/scripts/background.js: Added logic for test environments, including fake keyring bridges and socket communication.
  • ui/components/institutional/confirm-remove-jwt-modal/*: Converted to TypeScript, ensuring type safety and better integration with Storybook.
  • ui/components/institutional/custody-confirm-link-modal/*: Converted to TypeScript, improving type safety and maintainability.
  • package.json: Updated dependencies and scripts to support TypeScript migration, ensuring compatibility and type safety.

118 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

The Custody component has been migrated to TypeScript, enhancing type safety and maintainability.

  • development/generate-rc-commits.js: Refactored to dynamically fetch authorTeams from teams.json in MetaMask-planning repository, improving maintainability.
  • ui/components/institutional/custody-confirm-link-modal/*: Converted to TypeScript, ensuring type safety and better integration with Storybook.
  • ui/pages/institutional/custody/custody.js: Migrated to TypeScript, enhancing type safety and maintainability.
  • ui/store/institutional/institution-actions.ts: Added TypeScript support, improving type safety and maintainability.
  • test/e2e/playwright/mmi/custodian-hooks/*: Updated to TypeScript, ensuring type safety and better integration with Playwright tests.

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

The Custody component has been migrated to TypeScript, enhancing type safety and maintainability.

  • app/_locales/en/messages.json: Added onboardingMetametricsPrivacyDescription key for MetaMetrics onboarding.
  • shared/lib/transaction-controller-utils.js: Introduced precision parameter in getSwapsTokensReceivedFromTxMeta for flexible rounding.
  • test/e2e/accounts/common.ts: Added delay to ensure popup window closure in installSnapSimpleKeyring.
  • ui/components/app/transaction-breakdown/transaction-breakdown.container.js: Added .toFixed() to calcTokenAmount calls for fixed-point formatting.
  • ui/pages/onboarding-flow/metametrics/metametrics.js: Refactored to use BoxComponent and added MetaMask privacy policy link.

18 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

@metamaskbot
Copy link
Collaborator

Builds ready [ca4348e]
Page Load Metrics (149 ± 179 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint66154932311
domContentLoaded95923168
load401769149372179
domInteractive95923168
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link

codecov bot commented Jul 25, 2024

Codecov Report

Attention: Patch coverage is 64.15094% with 19 lines in your changes missing coverage. Please review.

Project coverage is 69.69%. Comparing base (f9f3cff) to head (bf7ef25).
Report is 1 commits behind head on develop.

Files Patch % Lines
ui/pages/institutional/custody/custody.tsx 62.00% 19 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #26096      +/-   ##
===========================================
- Coverage    69.70%   69.69%   -0.01%     
===========================================
  Files         1409     1409              
  Lines        49788    49808      +20     
  Branches     13768    13785      +17     
===========================================
+ Hits         34702    34712      +10     
- Misses       15086    15096      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

albertolive
albertolive previously approved these changes Jul 25, 2024
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

The Custody component has been migrated to TypeScript, enhancing type safety and maintainability.

  • app/scripts/lib/transaction/metrics.ts: Added getIsConfirmationAdvancedDetailsOpen method for advanced transaction details.
  • ui/pages/confirmations/components/confirm/info/row/text-token-units.tsx: Introduced ConfirmInfoRowTextTokenUnits component with TypeScript.
  • ui/pages/confirmations/components/signature-request-original/signature-request-original.component.js: Added QueuedRequestsBannerAlert component for queued requests.
  • ui/pages/institutional/account-list/account-list.tsx: Converted CustodyAccountList to TypeScript, improving type safety.
  • ui/pages/confirmations/hooks/useQueuedConfirmationEvents.ts: Added useQueuedConfirmationsEvent hook for tracking queued confirmation events.

78 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

The Custody component has been migrated to TypeScript, enhancing type safety and maintainability.

  • ui/components/institutional/custody-labels/custody-labels.tsx: Converted to TypeScript; imports LabelItem type for consistency.
  • ui/pages/institutional/account-list/account-list.tsx: Converted to TypeScript; introduces types for props and uses optional chaining.
  • ui/pages/institutional/custody/custody.tsx: Converted to TypeScript; adds type definitions for various objects and state variables, improving robustness.

These changes improve type safety and maintainability but require thorough testing to ensure no runtime errors are introduced.

3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

The Custody component has been migrated to TypeScript, enhancing type safety and maintainability.

  • ui/pages/institutional/custody/custody.tsx: Converted to TypeScript; adds type definitions for various objects and state variables, improving robustness.
  • Optional Properties: Certain properties in Account and AccountDetails types are now optional, which could lead to runtime errors if not handled properly.
  • Component Update: CustodyPage component updated to handle optional properties appropriately.
  • Testing: Thorough testing is required to ensure that the optional properties do not cause unexpected behavior.

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

@metamaskbot
Copy link
Collaborator

Builds ready [bf7ef25]
Page Load Metrics (140 ± 150 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint59180982713
domContentLoaded96424168
load421495140311150
domInteractive96424168
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@zone-live zone-live requested a review from albertolive July 25, 2024 14:18
albertolive
albertolive previously approved these changes Jul 26, 2024
key: string;
value: string;
};
import { LabelItem } from '../../../pages/institutional/custody/custody';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we move the interface to a file that's more public accessible as institutional/custody/types;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll address in another PR. Ticket: https://consensyssoftware.atlassian.net/browse/MMI-5328

onChange={(e) => setSelectAllAccounts(e)}
checked={isCheckBoxSelected}
checked={isCheckBoxSelected ?? undefined}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you can leave it as isCheckBoxSelected because
true ?? undefined => true
undefined ?? undefined => undefined

Comment on lines 495 to 497
const handleQrConnectionRequest = (message: string) => {
setQrConnectionRequest(message);
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
const handleQrConnectionRequest = (message: string) => {
setQrConnectionRequest(message);
};
const _setQrConnectionRequest = (message: string) => {
setQrConnectionRequest(message);
};

Copy link

@metamaskbot
Copy link
Collaborator

Builds ready [fdb5821]
Page Load Metrics (620 ± 461 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint715501479847
domContentLoaded9114392613
load412832620961461
domInteractive9114392613
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@albertolive albertolive merged commit 08c7333 into develop Jul 26, 2024
75 of 76 checks passed
@albertolive albertolive deleted the MMI-5306-custody-component-to-ts branch July 26, 2024 15:33
@github-actions github-actions bot locked and limited conversation to collaborators Jul 26, 2024
@metamaskbot metamaskbot added the release-12.4.0 Issue or pull request that will be included in release 12.4.0 label Jul 26, 2024
@gauthierpetetin gauthierpetetin added release-12.3.0 Issue or pull request that will be included in release 12.3.0 and removed release-12.4.0 Issue or pull request that will be included in release 12.4.0 labels Sep 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.3.0 Issue or pull request that will be included in release 12.3.0 team-mmi PRs from the MMI team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants