Skip to content

chore: Integrate SnapInsightsController#26411

Merged
FrederikBolding merged 5 commits intodevelopfrom
fb/snap-insights-controller
Aug 19, 2024
Merged

chore: Integrate SnapInsightsController#26411
FrederikBolding merged 5 commits intodevelopfrom
fb/snap-insights-controller

Conversation

@FrederikBolding
Copy link
Copy Markdown
Member

@FrederikBolding FrederikBolding commented Aug 14, 2024

Description

This PR integrates the SnapInsightsController and ports the existing insights functionality to use this controller instead of the existing hooks. This replaces our existing implementations with a useInsightSnaps hook that returns all insights for a given confirmation ID directly from the UI state.

The intention is that this matches the existing implementation as much as possible, with one caveat that the timing for loading the insights might have changed. Each insight is now added to state as soon as the Snap responds.

Open in GitHub Codespaces

Related issues

Closes: MetaMask/snaps#2568

Manual testing steps

  1. Install one or more transaction insights Snaps
  2. Use the test-dapp to trigger transaction confirmations
  3. See the transaction insights still works (including the modal)
  4. Install one or more signature insights Snaps
  5. Use the test-dapp to trigger signature confirmations
  6. See that signature insights still works (including the modal)

@FrederikBolding FrederikBolding added the team-snaps-platform-deprecated DEPRECATED: please use "team-core-platform" instead (or "team-new-networks" for Solana snap issues) label Aug 14, 2024
@FrederikBolding FrederikBolding force-pushed the fb/snap-insights-controller branch from fc23b5b to 79bbdfd Compare August 15, 2024 20:44
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 16, 2024

Codecov Report

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

Project coverage is 70.18%. Comparing base (1b22343) to head (351d047).

Files Patch % Lines
ui/hooks/useTransactionInsights.js 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #26411      +/-   ##
===========================================
- Coverage    70.19%   70.18%   -0.01%     
===========================================
  Files         1420     1420              
  Lines        49769    49773       +4     
  Branches     13828    13828              
===========================================
- Hits         34933    34930       -3     
- Misses       14836    14843       +7     

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

@FrederikBolding FrederikBolding marked this pull request as ready for review August 16, 2024 07:47
@FrederikBolding FrederikBolding requested review from a team as code owners August 16, 2024 07:47
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Aug 16, 2024
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [5e429ca]
Page Load Metrics (480 ± 344 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint693171155225
domContentLoaded96026115
load482022480716344
domInteractive96026115
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 641 Bytes (0.02%)
  • ui: -4.18 KiB (-0.06%)
  • common: 196 Bytes (0.00%)

ritave
ritave previously approved these changes Aug 16, 2024
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  if (insightSnaps.length === 1) {
    //////
    assert(data !== undefined && data.length === 1);
    //////
    insightComponent = (
      <Tab
        className="confirm-page-container-content__tab"
        name={snapsNameGetter(selectedSnap.id)}
      >
        // And we remove the null check here.
        <SnapInsight snapId={selectedInsightSnapId} data={data[0]} />
      </Tab>
    );
  }

david0xd
david0xd previously approved these changes Aug 16, 2024
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [56cd133]
Page Load Metrics (332 ± 352 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint881661162211
domContentLoaded196036136
load562630332734352
domInteractive196036136
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 641 Bytes (0.02%)
  • ui: -4.11 KiB (-0.06%)
  • common: 196 Bytes (0.00%)

@sonarqubecloud
Copy link
Copy Markdown

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [351d047]
Page Load Metrics (67 ± 7 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint70173932311
domContentLoaded4212064178
load4612067167
domInteractive97425136
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 641 Bytes (0.02%)
  • ui: -4.11 KiB (-0.06%)
  • common: 196 Bytes (0.00%)

@FrederikBolding FrederikBolding merged commit d3541a3 into develop Aug 19, 2024
@FrederikBolding FrederikBolding deleted the fb/snap-insights-controller branch August 19, 2024 14:31
@github-actions github-actions bot locked and limited conversation to collaborators Aug 19, 2024
@metamaskbot metamaskbot added the release-12.5.0 Issue or pull request that will be included in release 12.5.0 label Aug 19, 2024
@gauthierpetetin gauthierpetetin added release-12.4.0 Issue or pull request that will be included in release 12.4.0 and removed release-12.5.0 Issue or pull request that will be included in release 12.5.0 labels Sep 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

INVALID-PR-TEMPLATE PR's body doesn't match template release-12.4.0 Issue or pull request that will be included in release 12.4.0 team-snaps-platform-deprecated DEPRECATED: please use "team-core-platform" instead (or "team-new-networks" for Solana snap issues)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port existing extension insights implementation to use SnapInsightsController

6 participants