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

feat(29629): Construct exhaustive state object for metamask slice with default values #30378

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

DDDDDanica
Copy link
Contributor

@DDDDDanica DDDDDanica commented Feb 18, 2025

Description

Open in GitHub Codespaces

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.

@DDDDDanica DDDDDanica requested a review from MajorLift February 18, 2025 04:28
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.

@metamaskbot metamaskbot added the team-extension-platform Extension Platform team label Feb 18, 2025
@DDDDDanica DDDDDanica force-pushed the feature/29629-state-object branch from 2d74da2 to f61915d Compare February 18, 2025 17:44
@DDDDDanica DDDDDanica force-pushed the feature/29629-state-object branch from f61915d to a78e207 Compare February 18, 2025 17:44
Comment on lines 217 to 252
const MOCK_SNAP: Snap = {
id: 'local:mock-snap' as SnapId,
origin: 'local:mock-snap' as SnapId,
version: '1.3.7' as SemVerVersion,
status: SnapStatus.Installing,
iconUrl: null,
initialPermissions: {},
sourceCode: 'sourceCode',
enabled: true,
blocked: false,
manifest: {
version: '1.3.7' as SemVerVersion,
initialPermissions: {},
manifestVersion: '0.1',
description: 'mock-description',
proposedName: 'mock-snap-name',
source: {
location: {
npm: {
registry: 'https://registry.npmjs.org',
filePath: 'dist/bundle.js',
packageName: 'local:mock-snap',
},
},
shasum: 'L1k+dT9Q+y3KfIqzaH09MpDZVPS9ZowEh9w01ZMTWMU=',
locales: ['en'],
},
},
versionHistory: [
{
date: 1680686075921,
origin: 'https://metamask.github.io',
version: '1.3.7' as SemVerVersion,
},
],
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like we might want to consider making @metamask/utils a peerDep like our controllers. For now, this resolves the type errors:

Suggested change
const MOCK_SNAP: Snap = {
id: 'local:mock-snap' as SnapId,
origin: 'local:mock-snap' as SnapId,
version: '1.3.7' as SemVerVersion,
status: SnapStatus.Installing,
iconUrl: null,
initialPermissions: {},
sourceCode: 'sourceCode',
enabled: true,
blocked: false,
manifest: {
version: '1.3.7' as SemVerVersion,
initialPermissions: {},
manifestVersion: '0.1',
description: 'mock-description',
proposedName: 'mock-snap-name',
source: {
location: {
npm: {
registry: 'https://registry.npmjs.org',
filePath: 'dist/bundle.js',
packageName: 'local:mock-snap',
},
},
shasum: 'L1k+dT9Q+y3KfIqzaH09MpDZVPS9ZowEh9w01ZMTWMU=',
locales: ['en'],
},
},
versionHistory: [
{
date: 1680686075921,
origin: 'https://metamask.github.io',
version: '1.3.7' as SemVerVersion,
},
],
};
const MOCK_SNAP = {
id: 'local:mock-snap' as SnapId,
origin: 'local:mock-snap' as SnapId,
version: '1.3.7' as Snap['version'],
status: SnapStatus.Installing,
iconUrl: null,
initialPermissions: {},
sourceCode: 'sourceCode',
enabled: true,
blocked: false,
manifest: {
version: '1.3.7' as Snap['manifest']['version'],
initialPermissions: {},
manifestVersion: '0.1',
description: 'mock-description',
proposedName: 'mock-snap-name',
source: {
location: {
npm: {
registry: 'https://registry.npmjs.org',
filePath: 'dist/bundle.js',
packageName: 'local:mock-snap',
},
},
shasum: 'L1k+dT9Q+y3KfIqzaH09MpDZVPS9ZowEh9w01ZMTWMU=',
locales: ['en'],
},
},
versionHistory: [
{
date: 1680686075921,
origin: 'https://metamask.github.io',
version: '1.3.7',
},
],
} as const satisfies Snap & { origin: SnapId; iconUrl: string | null };

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestions, it is a good workaround, addressed in 3a05d05

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-extension-platform Extension Platform team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants