-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
base: main
Are you sure you want to change the base?
Conversation
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. |
2d74da2
to
f61915d
Compare
f61915d
to
a78e207
Compare
test/data/mock-state.ts
Outdated
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, | ||
}, | ||
], | ||
}; |
There was a problem hiding this comment.
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:
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 }; |
There was a problem hiding this comment.
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
Description
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist