@@ -12,14 +12,13 @@ import {
12
12
BtcScope ,
13
13
SolScope ,
14
14
SolAccountType ,
15
- SolMethod ,
16
15
} from '@metamask/keyring-api' ;
17
16
import { KeyringTypes } from '@metamask/keyring-controller' ;
18
17
import type { InternalAccount } from '@metamask/keyring-internal-api' ;
19
18
import type { NetworkClientId } from '@metamask/network-controller' ;
20
19
import type { SnapControllerState } from '@metamask/snaps-controllers' ;
21
20
import { SnapStatus } from '@metamask/snaps-utils' ;
22
- import type { CaipChainId , Json } from '@metamask/utils' ;
21
+ import type { CaipChainId } from '@metamask/utils' ;
23
22
import * as uuid from 'uuid' ;
24
23
import type { V4Options } from 'uuid' ;
25
24
@@ -629,8 +628,8 @@ describe('AccountsController', () => {
629
628
id : mockAccount4 . id ,
630
629
name : 'Snap Account 2' ,
631
630
address : mockAccount4 . address ,
632
- keyringType : mockAccount4 . metadata . keyring . type ,
633
- snapId : mockAccount4 . metadata . snap ?. id ,
631
+ keyringType : mockAccount4 . metadata . keyring . type as KeyringTypes ,
632
+ snap : mockAccount4 . metadata . snap ,
634
633
} ) ,
635
634
) ,
636
635
] ) ;
@@ -3229,47 +3228,6 @@ describe('AccountsController', () => {
3229
3228
expect ( accountName ) . toBe ( 'Account 4' ) ;
3230
3229
} ) ;
3231
3230
3232
- it ( 'throws error for snap accounts without entropy source' , async ( ) => {
3233
- const messenger = buildMessenger ( ) ;
3234
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
3235
- const accountsController = setupAccountsController ( {
3236
- initialState : {
3237
- internalAccounts : {
3238
- accounts : { } ,
3239
- selectedAccount : '' ,
3240
- } ,
3241
- } ,
3242
- messenger,
3243
- } ) ;
3244
-
3245
- expect ( ( ) =>
3246
- messenger . call ( 'AccountsController:getNextAvailableAccountName' , {
3247
- keyringType : KeyringTypes . snap ,
3248
- } ) ,
3249
- ) . toThrow ( 'Entropy source is required for snap accounts' ) ;
3250
- } ) ;
3251
-
3252
- it ( 'throws error for non-ETH snap accounts without chainId' , async ( ) => {
3253
- const messenger = buildMessenger ( ) ;
3254
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
3255
- const accountsController = setupAccountsController ( {
3256
- initialState : {
3257
- internalAccounts : {
3258
- accounts : { } ,
3259
- selectedAccount : '' ,
3260
- } ,
3261
- } ,
3262
- messenger,
3263
- } ) ;
3264
-
3265
- expect ( ( ) =>
3266
- messenger . call ( 'AccountsController:getNextAvailableAccountName' , {
3267
- keyringType : KeyringTypes . snap ,
3268
- entropySource : 'some-entropy-source' ,
3269
- } ) ,
3270
- ) . toThrow ( 'Chain ID is required for non-ETH snap accounts' ) ;
3271
- } ) ;
3272
-
3273
3231
it ( 'throws error for unsupported chain namespace' , async ( ) => {
3274
3232
const messenger = buildMessenger ( ) ;
3275
3233
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -3443,7 +3401,11 @@ describe('AccountsController', () => {
3443
3401
address : 'solana-address-1' ,
3444
3402
keyringType : KeyringTypes . snap ,
3445
3403
type : SolAccountType . DataAccount ,
3446
- snapId : 'solana-snap-id' ,
3404
+ snap : {
3405
+ id : 'solana-snap-id' ,
3406
+ enabled : true ,
3407
+ name : 'Solana Snap' ,
3408
+ } ,
3447
3409
} ) ;
3448
3410
3449
3411
const mockBitcoinAccount = createExpectedInternalAccount ( {
@@ -3452,7 +3414,11 @@ describe('AccountsController', () => {
3452
3414
address : 'bitcoin-address-2' ,
3453
3415
keyringType : KeyringTypes . snap ,
3454
3416
type : BtcAccountType . P2wpkh ,
3455
- snapId : 'bitcoin-snap-id' ,
3417
+ snap : {
3418
+ id : 'bitcoin-snap-id' ,
3419
+ enabled : true ,
3420
+ name : 'Bitcoin Snap' ,
3421
+ } ,
3456
3422
} ) ;
3457
3423
3458
3424
const { accountsController } = setupAccountsController ( {
@@ -3532,7 +3498,11 @@ describe('KeyringController:stateChange handling', () => {
3532
3498
address : '0x123' ,
3533
3499
keyringType : KeyringTypes . snap ,
3534
3500
type : SolAccountType . DataAccount ,
3535
- snapId : 'test-snap-id' ,
3501
+ snap : {
3502
+ id : 'test-snap-id' ,
3503
+ enabled : true ,
3504
+ name : 'Solana Snap' ,
3505
+ } ,
3536
3506
options : {
3537
3507
entropySource : 'test-entropy' as string ,
3538
3508
} ,
@@ -3548,7 +3518,11 @@ describe('KeyringController:stateChange handling', () => {
3548
3518
address : '0x123' ,
3549
3519
keyringType : KeyringTypes . snap ,
3550
3520
type : SolAccountType . DataAccount ,
3551
- snapId : 'test-snap-id' ,
3521
+ snap : {
3522
+ id : 'test-snap-id' ,
3523
+ enabled : true ,
3524
+ name : 'Solana Snap' ,
3525
+ } ,
3552
3526
} ) ;
3553
3527
3554
3528
// Ensure entropy source is set correctly
0 commit comments