|
1 | | -import { |
2 | | - getPersistentState, |
3 | | - deriveStateFromMetadata, |
4 | | -} from '@metamask/base-controller'; |
| 1 | +import { deriveStateFromMetadata } from '@metamask/base-controller'; |
5 | 2 | import { encrypt } from '@metamask/browser-passworder'; |
6 | 3 | import { |
7 | 4 | createAsyncMiddleware, |
@@ -88,7 +85,10 @@ import { |
88 | 85 | STATE_DEBOUNCE_TIMEOUT, |
89 | 86 | } from './constants'; |
90 | 87 | import { SnapsRegistryStatus } from './registry'; |
91 | | -import type { SnapControllerState } from './SnapController'; |
| 88 | +import type { |
| 89 | + PersistedSnapControllerState, |
| 90 | + SnapControllerState, |
| 91 | +} from './SnapController'; |
92 | 92 | import { |
93 | 93 | SNAP_APPROVAL_INSTALL, |
94 | 94 | SNAP_APPROVAL_RESULT, |
@@ -12622,7 +12622,7 @@ describe('SnapController', () => { |
12622 | 12622 | deriveStateFromMetadata( |
12623 | 12623 | controller.state, |
12624 | 12624 | controller.metadata, |
12625 | | - 'anonymous', |
| 12625 | + 'includeInDebugSnapshot', |
12626 | 12626 | ), |
12627 | 12627 | ).toMatchInlineSnapshot(`{}`); |
12628 | 12628 | }); |
@@ -12748,15 +12748,16 @@ describe('SnapController', () => { |
12748 | 12748 | ); |
12749 | 12749 |
|
12750 | 12750 | // persist the state somewhere |
12751 | | - const persistedState = getPersistentState<SnapControllerState>( |
| 12751 | + const persistedState = deriveStateFromMetadata<SnapControllerState>( |
12752 | 12752 | firstSnapController.state, |
12753 | 12753 | firstSnapController.metadata, |
| 12754 | + 'persist', |
12754 | 12755 | ); |
12755 | 12756 |
|
12756 | 12757 | // create a new controller |
12757 | 12758 | const secondSnapController = getSnapController( |
12758 | 12759 | getSnapControllerOptions({ |
12759 | | - state: persistedState, |
| 12760 | + state: persistedState as PersistedSnapControllerState, |
12760 | 12761 | }), |
12761 | 12762 | ); |
12762 | 12763 |
|
@@ -12787,15 +12788,16 @@ describe('SnapController', () => { |
12787 | 12788 | expect(firstSnapController.state.snaps[MOCK_SNAP_ID]).toBeDefined(); |
12788 | 12789 |
|
12789 | 12790 | // persist the state somewhere |
12790 | | - const persistedState = getPersistentState<SnapControllerState>( |
| 12791 | + const persistedState = deriveStateFromMetadata<SnapControllerState>( |
12791 | 12792 | firstSnapController.state, |
12792 | 12793 | firstSnapController.metadata, |
| 12794 | + 'persist', |
12793 | 12795 | ); |
12794 | 12796 |
|
12795 | 12797 | // create a new controller |
12796 | 12798 | const secondSnapController = getSnapController( |
12797 | 12799 | getSnapControllerOptions({ |
12798 | | - state: persistedState, |
| 12800 | + state: persistedState as PersistedSnapControllerState, |
12799 | 12801 | }), |
12800 | 12802 | ); |
12801 | 12803 |
|
|
0 commit comments