From 87389b4322a96573930a6175fbc577a2c57d8faf Mon Sep 17 00:00:00 2001 From: Egor Komarov Date: Tue, 22 Oct 2024 14:12:49 +0200 Subject: [PATCH] fix(EWM-346): allow legacy wallet types in `SeedList` (#126) Co-authored-by: Egor Komarov --- lib/src/nekoton_repository.dart | 5 +-- test/src/seeds_list_test.dart | 56 --------------------------------- 2 files changed, 1 insertion(+), 60 deletions(-) diff --git a/lib/src/nekoton_repository.dart b/lib/src/nekoton_repository.dart index e342992..c4c98cd 100644 --- a/lib/src/nekoton_repository.dart +++ b/lib/src/nekoton_repository.dart @@ -256,11 +256,8 @@ class NekotonRepository required Map seedMeta, }) { final planeExternalAccounts = externalAccounts.values.expand((e) => e); - final transportedAllAccounts = allAccounts.where( - (a) => transport.availableWalletTypes.contains(a.tonWallet.contract), - ); final mapped = >{}; - for (final account in transportedAllAccounts) { + for (final account in allAccounts) { final key = account.publicKey; final isHidden = hiddenAccounts.contains(account.address); final isExternal = planeExternalAccounts.contains(account.address); diff --git a/test/src/seeds_list_test.dart b/test/src/seeds_list_test.dart index c766031..a8ea9d4 100644 --- a/test/src/seeds_list_test.dart +++ b/test/src/seeds_list_test.dart @@ -383,61 +383,5 @@ void main() { ); expect(seed2.subKeys, equals([])); }); - - test('Only WalletType.v3 available by transport', () { - final strategy = OnlyV3WalletTypeSupports(); - final seedsList = NekotonRepository().buildSeeds( - allKeys: [masterKey, subKey1, subKey2, masterKey2], - allAccounts: [ - account1Pure.account, - account1ExternalHidden.account, - accountSub1Pure.account, - accountSub2Hidden.account, - account2External.account, - ], - hiddenAccounts: [ - account1ExternalHidden.account.address, - accountSub2Hidden.account.address, - ], - externalAccounts: { - masterKey.publicKey: [account1ExternalHidden.account.address], - masterKey2.publicKey: [account2External.account.address], - }, - transport: strategy, - seedMeta: {}, - ); - - expect(seedsList.seeds.length, 2); - final seed1 = seedsList.findSeed(key1)!; - expect(seed1.name, key1Ellipse); - expect( - seed1.masterKey, - SeedKey( - key: masterKey, - accountList: AccountList.empty(masterKey.publicKey), - ), - ); - expect(seed1.masterKey.accountList.allAccounts.length, 0); - expect( - seed1.subKeys, - equals([ - SeedKey( - key: subKey1, - accountList: AccountList.empty(subKey1.publicKey), - ), - SeedKey(key: subKey2, accountList: accountsSub2), - ]), - ); - final seed2 = seedsList.findSeed(key4)!; - expect(seed2.name, key4Ellipse); - expect( - seed2.masterKey, - SeedKey( - key: masterKey2, - accountList: AccountList.empty(masterKey2.publicKey), - ), - ); - expect(seed2.subKeys, equals([])); - }); }); }