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

refactor: Typescript conversion of watch-asset.js #23776

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

NiranjanaBinoy
Copy link
Contributor

@NiranjanaBinoy NiranjanaBinoy commented Mar 28, 2024

Part of #23014
Fixes #23474

Converting the level 6 dependency file app/scripts/lib/rpc-method-middleware/handlers/watch-asset.js to typescript for contributing to metamask-controller.js.

Description

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've completed the PR template to the best of my ability
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

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.

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.

} & HandlerWrapper;

const watchAsset = {
methodNames: [MESSAGE_TYPE.WATCH_ASSET],
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
methodNames: [MESSAGE_TYPE.WATCH_ASSET],
methodNames: [MESSAGE_TYPE.WATCH_ASSET, MESSAGE_TYPE.WATCH_ASSET_LEGACY],

_next: JsonRpcEngineNextCallback,
end: JsonRpcEngineEndCallback,
{ handleWatchAssetRequest }: WatchAssetOptions,
) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a return type here?

@DDDDDanica
Copy link
Contributor

DDDDDanica commented Apr 8, 2024

BTW we can directly merge to develop :)

merge 2 commits into extract-wrapper-type from ts-watch-asset

Copy link
Contributor

github-actions bot commented Jun 8, 2024

This PR has been automatically marked as stale because it has not had recent activity in the last 60 days. It will be closed in 14 days. Thank you for your contributions.

@github-actions github-actions bot added the stale issues and PRs marked as stale label Jun 8, 2024
Copy link
Contributor

This PR was closed because there has been no follow up activity in the last 14 days. Thank you for your contributions.

@github-actions github-actions bot closed this Jun 22, 2024
@github-actions github-actions bot removed the stale issues and PRs marked as stale label Jun 28, 2024
@NiranjanaBinoy NiranjanaBinoy changed the base branch from extract-wrapper-type to develop July 19, 2024 21:16
@NiranjanaBinoy NiranjanaBinoy marked this pull request as ready for review July 20, 2024 00:39
@NiranjanaBinoy NiranjanaBinoy requested a review from a team as a code owner July 20, 2024 00:39
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

Converted watch-asset.js to TypeScript, enhancing type safety and maintainability.

  • New Type Definitions: Added app/scripts/lib/rpc-method-middleware/handlers/types.ts to define TypeScript types for the watch-asset handler.
  • File Removal: Deleted app/scripts/lib/rpc-method-middleware/handlers/watch-asset.js as part of the TypeScript conversion.
  • TypeScript Conversion: Created app/scripts/lib/rpc-method-middleware/handlers/watch-asset.ts to replace the JavaScript file, ensuring type safety and maintaining the same functionality.

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

Copy link

sonarcloud bot commented Aug 14, 2024

@metamaskbot
Copy link
Collaborator

Builds ready [2ec2750]
Page Load Metrics (73 ± 22 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint722971136130
domContentLoaded993312412
load38206734522
domInteractive993312412
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.

Project coverage is 69.98%. Comparing base (cdd543d) to head (2ec2750).
Report is 1133 commits behind head on develop.

Files with missing lines Patch % Lines
.../lib/rpc-method-middleware/handlers/watch-asset.ts 92.86% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #23776   +/-   ##
========================================
  Coverage    69.98%   69.98%           
========================================
  Files         1422     1422           
  Lines        49926    49926           
  Branches     13861    13861           
========================================
  Hits         34940    34940           
  Misses       14986    14986           

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

Copy link
Contributor

This PR has been automatically marked as stale because it has not had recent activity in the last 60 days. It will be closed in 14 days. Thank you for your contributions.

@github-actions github-actions bot added stale issues and PRs marked as stale and removed stale issues and PRs marked as stale labels Oct 14, 2024
@MajorLift MajorLift self-assigned this Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert watch-asset.js to Typescript
4 participants