@metamask/profile-sync-controller 8.1.1 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/README.md +32 -0
  3. package/auth/mocks/package.json +2 -2
  4. package/dist/controllers/authentication/index.cjs +1 -1
  5. package/dist/controllers/authentication/index.cjs.map +1 -1
  6. package/dist/controllers/authentication/index.d.cts +1 -1
  7. package/dist/controllers/authentication/index.d.cts.map +1 -1
  8. package/dist/controllers/authentication/index.d.mts +1 -1
  9. package/dist/controllers/authentication/index.d.mts.map +1 -1
  10. package/dist/controllers/authentication/index.mjs +1 -1
  11. package/dist/controllers/authentication/index.mjs.map +1 -1
  12. package/dist/controllers/authentication/mocks/index.cjs.map +1 -0
  13. package/dist/controllers/authentication/mocks/index.d.cts.map +1 -0
  14. package/dist/controllers/authentication/mocks/index.d.mts.map +1 -0
  15. package/dist/controllers/authentication/mocks/index.mjs.map +1 -0
  16. package/dist/controllers/authentication/mocks/mockResponses.cjs.map +1 -0
  17. package/dist/controllers/authentication/mocks/mockResponses.d.cts.map +1 -0
  18. package/dist/controllers/authentication/mocks/mockResponses.d.mts.map +1 -0
  19. package/dist/controllers/authentication/mocks/mockResponses.mjs.map +1 -0
  20. package/dist/controllers/user-storage/account-syncing/controller-integration.cjs +1 -1
  21. package/dist/controllers/user-storage/account-syncing/controller-integration.cjs.map +1 -1
  22. package/dist/controllers/user-storage/account-syncing/controller-integration.mjs +1 -1
  23. package/dist/controllers/user-storage/account-syncing/controller-integration.mjs.map +1 -1
  24. package/dist/controllers/user-storage/account-syncing/utils.cjs +2 -2
  25. package/dist/controllers/user-storage/account-syncing/utils.cjs.map +1 -1
  26. package/dist/controllers/user-storage/account-syncing/utils.mjs +2 -2
  27. package/dist/controllers/user-storage/account-syncing/utils.mjs.map +1 -1
  28. package/dist/controllers/user-storage/index.cjs +1 -1
  29. package/dist/controllers/user-storage/index.cjs.map +1 -1
  30. package/dist/controllers/user-storage/index.d.cts +1 -1
  31. package/dist/controllers/user-storage/index.d.cts.map +1 -1
  32. package/dist/controllers/user-storage/index.d.mts +1 -1
  33. package/dist/controllers/user-storage/index.d.mts.map +1 -1
  34. package/dist/controllers/user-storage/index.mjs +1 -1
  35. package/dist/controllers/user-storage/index.mjs.map +1 -1
  36. package/dist/controllers/user-storage/mocks/index.cjs.map +1 -0
  37. package/dist/controllers/user-storage/mocks/index.d.cts.map +1 -0
  38. package/dist/controllers/user-storage/mocks/index.d.mts.map +1 -0
  39. package/dist/controllers/user-storage/mocks/index.mjs.map +1 -0
  40. package/dist/controllers/user-storage/mocks/mockResponses.cjs.map +1 -0
  41. package/dist/controllers/user-storage/mocks/mockResponses.d.cts.map +1 -0
  42. package/dist/controllers/user-storage/mocks/mockResponses.d.mts.map +1 -0
  43. package/dist/controllers/user-storage/mocks/mockResponses.mjs.map +1 -0
  44. package/dist/controllers/user-storage/mocks/mockStorage.cjs.map +1 -0
  45. package/dist/controllers/user-storage/mocks/mockStorage.d.cts.map +1 -0
  46. package/dist/controllers/user-storage/mocks/mockStorage.d.mts.map +1 -0
  47. package/dist/controllers/user-storage/mocks/mockStorage.mjs.map +1 -0
  48. package/package.json +14 -14
  49. package/user-storage/mocks/package.json +2 -2
  50. package/dist/controllers/authentication/__fixtures__/index.cjs.map +0 -1
  51. package/dist/controllers/authentication/__fixtures__/index.d.cts.map +0 -1
  52. package/dist/controllers/authentication/__fixtures__/index.d.mts.map +0 -1
  53. package/dist/controllers/authentication/__fixtures__/index.mjs.map +0 -1
  54. package/dist/controllers/authentication/__fixtures__/mockResponses.cjs.map +0 -1
  55. package/dist/controllers/authentication/__fixtures__/mockResponses.d.cts.map +0 -1
  56. package/dist/controllers/authentication/__fixtures__/mockResponses.d.mts.map +0 -1
  57. package/dist/controllers/authentication/__fixtures__/mockResponses.mjs.map +0 -1
  58. package/dist/controllers/authentication/__fixtures__/mockServices.cjs +0 -37
  59. package/dist/controllers/authentication/__fixtures__/mockServices.cjs.map +0 -1
  60. package/dist/controllers/authentication/__fixtures__/mockServices.d.cts +0 -10
  61. package/dist/controllers/authentication/__fixtures__/mockServices.d.cts.map +0 -1
  62. package/dist/controllers/authentication/__fixtures__/mockServices.d.mts +0 -10
  63. package/dist/controllers/authentication/__fixtures__/mockServices.d.mts.map +0 -1
  64. package/dist/controllers/authentication/__fixtures__/mockServices.mjs +0 -35
  65. package/dist/controllers/authentication/__fixtures__/mockServices.mjs.map +0 -1
  66. package/dist/controllers/user-storage/__fixtures__/index.cjs.map +0 -1
  67. package/dist/controllers/user-storage/__fixtures__/index.d.cts.map +0 -1
  68. package/dist/controllers/user-storage/__fixtures__/index.d.mts.map +0 -1
  69. package/dist/controllers/user-storage/__fixtures__/index.mjs.map +0 -1
  70. package/dist/controllers/user-storage/__fixtures__/mockMessenger.cjs +0 -167
  71. package/dist/controllers/user-storage/__fixtures__/mockMessenger.cjs.map +0 -1
  72. package/dist/controllers/user-storage/__fixtures__/mockMessenger.d.cts +0 -105
  73. package/dist/controllers/user-storage/__fixtures__/mockMessenger.d.cts.map +0 -1
  74. package/dist/controllers/user-storage/__fixtures__/mockMessenger.d.mts +0 -105
  75. package/dist/controllers/user-storage/__fixtures__/mockMessenger.d.mts.map +0 -1
  76. package/dist/controllers/user-storage/__fixtures__/mockMessenger.mjs +0 -162
  77. package/dist/controllers/user-storage/__fixtures__/mockMessenger.mjs.map +0 -1
  78. package/dist/controllers/user-storage/__fixtures__/mockResponses.cjs.map +0 -1
  79. package/dist/controllers/user-storage/__fixtures__/mockResponses.d.cts.map +0 -1
  80. package/dist/controllers/user-storage/__fixtures__/mockResponses.d.mts.map +0 -1
  81. package/dist/controllers/user-storage/__fixtures__/mockResponses.mjs.map +0 -1
  82. package/dist/controllers/user-storage/__fixtures__/mockServices.cjs +0 -82
  83. package/dist/controllers/user-storage/__fixtures__/mockServices.cjs.map +0 -1
  84. package/dist/controllers/user-storage/__fixtures__/mockServices.d.cts +0 -15
  85. package/dist/controllers/user-storage/__fixtures__/mockServices.d.cts.map +0 -1
  86. package/dist/controllers/user-storage/__fixtures__/mockServices.d.mts +0 -15
  87. package/dist/controllers/user-storage/__fixtures__/mockServices.d.mts.map +0 -1
  88. package/dist/controllers/user-storage/__fixtures__/mockServices.mjs +0 -76
  89. package/dist/controllers/user-storage/__fixtures__/mockServices.mjs.map +0 -1
  90. package/dist/controllers/user-storage/__fixtures__/mockStorage.cjs.map +0 -1
  91. package/dist/controllers/user-storage/__fixtures__/mockStorage.d.cts.map +0 -1
  92. package/dist/controllers/user-storage/__fixtures__/mockStorage.d.mts.map +0 -1
  93. package/dist/controllers/user-storage/__fixtures__/mockStorage.mjs.map +0 -1
  94. package/dist/controllers/user-storage/__fixtures__/test-utils.cjs +0 -78
  95. package/dist/controllers/user-storage/__fixtures__/test-utils.cjs.map +0 -1
  96. package/dist/controllers/user-storage/__fixtures__/test-utils.d.cts +0 -38
  97. package/dist/controllers/user-storage/__fixtures__/test-utils.d.cts.map +0 -1
  98. package/dist/controllers/user-storage/__fixtures__/test-utils.d.mts +0 -38
  99. package/dist/controllers/user-storage/__fixtures__/test-utils.d.mts.map +0 -1
  100. package/dist/controllers/user-storage/__fixtures__/test-utils.mjs +0 -68
  101. package/dist/controllers/user-storage/__fixtures__/test-utils.mjs.map +0 -1
  102. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.cjs +0 -178
  103. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.cjs.map +0 -1
  104. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.d.cts +0 -91
  105. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.d.cts.map +0 -1
  106. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.d.mts +0 -91
  107. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.d.mts.map +0 -1
  108. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.mjs +0 -174
  109. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.mjs.map +0 -1
  110. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.cjs +0 -58
  111. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.cjs.map +0 -1
  112. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.d.cts +0 -87
  113. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.d.cts.map +0 -1
  114. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.d.mts +0 -87
  115. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.d.mts.map +0 -1
  116. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.mjs +0 -52
  117. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.mjs.map +0 -1
  118. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.cjs +0 -43
  119. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.cjs.map +0 -1
  120. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.cts +0 -11
  121. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.cts.map +0 -1
  122. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.mts +0 -11
  123. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.mts.map +0 -1
  124. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.mjs +0 -36
  125. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.mjs.map +0 -1
  126. package/dist/sdk/__fixtures__/mock-auth.cjs +0 -124
  127. package/dist/sdk/__fixtures__/mock-auth.cjs.map +0 -1
  128. package/dist/sdk/__fixtures__/mock-auth.d.cts +0 -42
  129. package/dist/sdk/__fixtures__/mock-auth.d.cts.map +0 -1
  130. package/dist/sdk/__fixtures__/mock-auth.d.mts +0 -42
  131. package/dist/sdk/__fixtures__/mock-auth.d.mts.map +0 -1
  132. package/dist/sdk/__fixtures__/mock-auth.mjs +0 -119
  133. package/dist/sdk/__fixtures__/mock-auth.mjs.map +0 -1
  134. package/dist/sdk/__fixtures__/mock-userstorage.cjs +0 -111
  135. package/dist/sdk/__fixtures__/mock-userstorage.cjs.map +0 -1
  136. package/dist/sdk/__fixtures__/mock-userstorage.d.cts +0 -20
  137. package/dist/sdk/__fixtures__/mock-userstorage.d.cts.map +0 -1
  138. package/dist/sdk/__fixtures__/mock-userstorage.d.mts +0 -20
  139. package/dist/sdk/__fixtures__/mock-userstorage.d.mts.map +0 -1
  140. package/dist/sdk/__fixtures__/mock-userstorage.mjs +0 -81
  141. package/dist/sdk/__fixtures__/mock-userstorage.mjs.map +0 -1
  142. package/dist/sdk/__fixtures__/test-utils.cjs +0 -90
  143. package/dist/sdk/__fixtures__/test-utils.cjs.map +0 -1
  144. package/dist/sdk/__fixtures__/test-utils.d.cts +0 -37
  145. package/dist/sdk/__fixtures__/test-utils.d.cts.map +0 -1
  146. package/dist/sdk/__fixtures__/test-utils.d.mts +0 -37
  147. package/dist/sdk/__fixtures__/test-utils.d.mts.map +0 -1
  148. package/dist/sdk/__fixtures__/test-utils.mjs +0 -84
  149. package/dist/sdk/__fixtures__/test-utils.mjs.map +0 -1
  150. /package/dist/controllers/authentication/{__fixtures__ → mocks}/index.cjs +0 -0
  151. /package/dist/controllers/authentication/{__fixtures__ → mocks}/index.d.cts +0 -0
  152. /package/dist/controllers/authentication/{__fixtures__ → mocks}/index.d.mts +0 -0
  153. /package/dist/controllers/authentication/{__fixtures__ → mocks}/index.mjs +0 -0
  154. /package/dist/controllers/authentication/{__fixtures__ → mocks}/mockResponses.cjs +0 -0
  155. /package/dist/controllers/authentication/{__fixtures__ → mocks}/mockResponses.d.cts +0 -0
  156. /package/dist/controllers/authentication/{__fixtures__ → mocks}/mockResponses.d.mts +0 -0
  157. /package/dist/controllers/authentication/{__fixtures__ → mocks}/mockResponses.mjs +0 -0
  158. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/index.cjs +0 -0
  159. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/index.d.cts +0 -0
  160. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/index.d.mts +0 -0
  161. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/index.mjs +0 -0
  162. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockResponses.cjs +0 -0
  163. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockResponses.d.cts +0 -0
  164. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockResponses.d.mts +0 -0
  165. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockResponses.mjs +0 -0
  166. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockStorage.cjs +0 -0
  167. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockStorage.d.cts +0 -0
  168. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockStorage.d.mts +0 -0
  169. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockStorage.mjs +0 -0
@@ -1,91 +0,0 @@
1
- import { EthAccountType } from "@metamask/keyring-api";
2
- import { KeyringTypes } from "@metamask/keyring-controller";
3
- /**
4
- * Get a random default account name from the list of localized default account names
5
- *
6
- * @returns A random default account name
7
- */
8
- export declare const getMockRandomDefaultAccountName: () => "Account" | "መለያ" | "الحساب" | "Профил" | "অ্যাকাউন্ট" | "Compte" | "Účet" | "Konto" | "Λογαριασμός" | "Cuenta" | "حساب" | "Tili" | "એકાઉન્ટ" | "חשבון" | "अकाउंट" | "खाता" | "Račun" | "Kont" | "Fiók" | "Akun" | "アカウント" | "ಖಾತೆ" | "계정" | "Paskyra" | "Konts" | "അക്കൗണ്ട്" | "खाते" | "Akaun" | "Conta" | "Cont" | "Счет" | "налог" | "Akaunti" | "கணக்கு" | "ఖాతా" | "บัญชี" | "Hesap" | "Обліковий запис" | "Tài khoản" | "账户" | "帳戶";
9
- export declare const MOCK_INTERNAL_ACCOUNTS: {
10
- EMPTY: never[];
11
- ONE: {
12
- address: string;
13
- id: string;
14
- type: EthAccountType;
15
- metadata: {
16
- name: string;
17
- nameLastUpdatedAt: number;
18
- keyring: {
19
- type: KeyringTypes;
20
- };
21
- };
22
- }[];
23
- ONE_DEFAULT_NAME: {
24
- address: string;
25
- id: string;
26
- type: EthAccountType;
27
- metadata: {
28
- name: string;
29
- nameLastUpdatedAt: number;
30
- keyring: {
31
- type: KeyringTypes;
32
- };
33
- };
34
- }[];
35
- ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED: {
36
- address: string;
37
- id: string;
38
- type: EthAccountType;
39
- metadata: {
40
- name: string;
41
- keyring: {
42
- type: KeyringTypes;
43
- };
44
- };
45
- }[];
46
- ONE_CUSTOM_NAME_WITH_LAST_UPDATED: {
47
- address: string;
48
- id: string;
49
- type: EthAccountType;
50
- metadata: {
51
- name: string;
52
- nameLastUpdatedAt: number;
53
- keyring: {
54
- type: KeyringTypes;
55
- };
56
- };
57
- }[];
58
- ONE_CUSTOM_NAME_WITH_LAST_UPDATED_MOST_RECENT: {
59
- address: string;
60
- id: string;
61
- type: EthAccountType;
62
- metadata: {
63
- name: string;
64
- nameLastUpdatedAt: number;
65
- keyring: {
66
- type: KeyringTypes;
67
- };
68
- };
69
- }[];
70
- ALL: {
71
- address: string;
72
- id: string;
73
- type: EthAccountType;
74
- metadata: {
75
- name: string;
76
- nameLastUpdatedAt: number;
77
- keyring: {
78
- type: KeyringTypes;
79
- };
80
- };
81
- }[];
82
- };
83
- export declare const MOCK_USER_STORAGE_ACCOUNTS: {
84
- SAME_AS_INTERNAL_ALL: import("../types.cjs").UserStorageAccount[];
85
- ONE: import("../types.cjs").UserStorageAccount[];
86
- TWO_DEFAULT_NAMES_WITH_ONE_BOGUS: import("../types.cjs").UserStorageAccount[];
87
- ONE_DEFAULT_NAME: import("../types.cjs").UserStorageAccount[];
88
- ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED: import("../types.cjs").UserStorageAccount[];
89
- ONE_CUSTOM_NAME_WITH_LAST_UPDATED: import("../types.cjs").UserStorageAccount[];
90
- };
91
- //# sourceMappingURL=mockAccounts.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockAccounts.d.cts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,8BAA8B;AACvD,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAiB5D;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,mbAGzC,CAAC;AAEJ,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyHlC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;CAyCtC,CAAC"}
@@ -1,91 +0,0 @@
1
- import { EthAccountType } from "@metamask/keyring-api";
2
- import { KeyringTypes } from "@metamask/keyring-controller";
3
- /**
4
- * Get a random default account name from the list of localized default account names
5
- *
6
- * @returns A random default account name
7
- */
8
- export declare const getMockRandomDefaultAccountName: () => "Account" | "መለያ" | "الحساب" | "Профил" | "অ্যাকাউন্ট" | "Compte" | "Účet" | "Konto" | "Λογαριασμός" | "Cuenta" | "حساب" | "Tili" | "એકાઉન્ટ" | "חשבון" | "अकाउंट" | "खाता" | "Račun" | "Kont" | "Fiók" | "Akun" | "アカウント" | "ಖಾತೆ" | "계정" | "Paskyra" | "Konts" | "അക്കൗണ്ട്" | "खाते" | "Akaun" | "Conta" | "Cont" | "Счет" | "налог" | "Akaunti" | "கணக்கு" | "ఖాతా" | "บัญชี" | "Hesap" | "Обліковий запис" | "Tài khoản" | "账户" | "帳戶";
9
- export declare const MOCK_INTERNAL_ACCOUNTS: {
10
- EMPTY: never[];
11
- ONE: {
12
- address: string;
13
- id: string;
14
- type: EthAccountType;
15
- metadata: {
16
- name: string;
17
- nameLastUpdatedAt: number;
18
- keyring: {
19
- type: KeyringTypes;
20
- };
21
- };
22
- }[];
23
- ONE_DEFAULT_NAME: {
24
- address: string;
25
- id: string;
26
- type: EthAccountType;
27
- metadata: {
28
- name: string;
29
- nameLastUpdatedAt: number;
30
- keyring: {
31
- type: KeyringTypes;
32
- };
33
- };
34
- }[];
35
- ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED: {
36
- address: string;
37
- id: string;
38
- type: EthAccountType;
39
- metadata: {
40
- name: string;
41
- keyring: {
42
- type: KeyringTypes;
43
- };
44
- };
45
- }[];
46
- ONE_CUSTOM_NAME_WITH_LAST_UPDATED: {
47
- address: string;
48
- id: string;
49
- type: EthAccountType;
50
- metadata: {
51
- name: string;
52
- nameLastUpdatedAt: number;
53
- keyring: {
54
- type: KeyringTypes;
55
- };
56
- };
57
- }[];
58
- ONE_CUSTOM_NAME_WITH_LAST_UPDATED_MOST_RECENT: {
59
- address: string;
60
- id: string;
61
- type: EthAccountType;
62
- metadata: {
63
- name: string;
64
- nameLastUpdatedAt: number;
65
- keyring: {
66
- type: KeyringTypes;
67
- };
68
- };
69
- }[];
70
- ALL: {
71
- address: string;
72
- id: string;
73
- type: EthAccountType;
74
- metadata: {
75
- name: string;
76
- nameLastUpdatedAt: number;
77
- keyring: {
78
- type: KeyringTypes;
79
- };
80
- };
81
- }[];
82
- };
83
- export declare const MOCK_USER_STORAGE_ACCOUNTS: {
84
- SAME_AS_INTERNAL_ALL: import("../types.mjs").UserStorageAccount[];
85
- ONE: import("../types.mjs").UserStorageAccount[];
86
- TWO_DEFAULT_NAMES_WITH_ONE_BOGUS: import("../types.mjs").UserStorageAccount[];
87
- ONE_DEFAULT_NAME: import("../types.mjs").UserStorageAccount[];
88
- ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED: import("../types.mjs").UserStorageAccount[];
89
- ONE_CUSTOM_NAME_WITH_LAST_UPDATED: import("../types.mjs").UserStorageAccount[];
90
- };
91
- //# sourceMappingURL=mockAccounts.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockAccounts.d.mts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,8BAA8B;AACvD,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAiB5D;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,mbAGzC,CAAC;AAEJ,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyHlC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;CAyCtC,CAAC"}
@@ -1,174 +0,0 @@
1
- import { EthAccountType } from "@metamask/keyring-api";
2
- import { KeyringTypes } from "@metamask/keyring-controller";
3
- import { LOCALIZED_DEFAULT_ACCOUNT_NAMES } from "../constants.mjs";
4
- import { mapInternalAccountToUserStorageAccount } from "../utils.mjs";
5
- /**
6
- * Map an array of internal accounts to an array of user storage accounts
7
- * Only used for testing purposes
8
- *
9
- * @param internalAccounts - An array of internal accounts
10
- * @returns An array of user storage accounts
11
- */
12
- const mapInternalAccountsListToUserStorageAccountsList = (internalAccounts) => internalAccounts.map(mapInternalAccountToUserStorageAccount);
13
- /**
14
- * Get a random default account name from the list of localized default account names
15
- *
16
- * @returns A random default account name
17
- */
18
- export const getMockRandomDefaultAccountName = () => LOCALIZED_DEFAULT_ACCOUNT_NAMES[Math.floor(Math.random() * LOCALIZED_DEFAULT_ACCOUNT_NAMES.length)];
19
- export const MOCK_INTERNAL_ACCOUNTS = {
20
- EMPTY: [],
21
- ONE: [
22
- {
23
- address: '0x123',
24
- id: '1',
25
- type: EthAccountType.Eoa,
26
- metadata: {
27
- name: 'test',
28
- nameLastUpdatedAt: 1,
29
- keyring: {
30
- type: KeyringTypes.hd,
31
- },
32
- },
33
- },
34
- ],
35
- ONE_DEFAULT_NAME: [
36
- {
37
- address: '0x123',
38
- id: '1',
39
- type: EthAccountType.Eoa,
40
- metadata: {
41
- name: `${getMockRandomDefaultAccountName()} 1`,
42
- nameLastUpdatedAt: 1,
43
- keyring: {
44
- type: KeyringTypes.hd,
45
- },
46
- },
47
- },
48
- ],
49
- ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED: [
50
- {
51
- address: '0x123',
52
- id: '1',
53
- type: EthAccountType.Eoa,
54
- metadata: {
55
- name: 'Internal account custom name without nameLastUpdatedAt',
56
- keyring: {
57
- type: KeyringTypes.hd,
58
- },
59
- },
60
- },
61
- ],
62
- ONE_CUSTOM_NAME_WITH_LAST_UPDATED: [
63
- {
64
- address: '0x123',
65
- id: '1',
66
- type: EthAccountType.Eoa,
67
- metadata: {
68
- name: 'Internal account custom name with nameLastUpdatedAt',
69
- nameLastUpdatedAt: 1,
70
- keyring: {
71
- type: KeyringTypes.hd,
72
- },
73
- },
74
- },
75
- ],
76
- ONE_CUSTOM_NAME_WITH_LAST_UPDATED_MOST_RECENT: [
77
- {
78
- address: '0x123',
79
- id: '1',
80
- type: EthAccountType.Eoa,
81
- metadata: {
82
- name: 'Internal account custom name with nameLastUpdatedAt',
83
- nameLastUpdatedAt: 9999,
84
- keyring: {
85
- type: KeyringTypes.hd,
86
- },
87
- },
88
- },
89
- ],
90
- ALL: [
91
- {
92
- address: '0x123',
93
- id: '1',
94
- type: EthAccountType.Eoa,
95
- metadata: {
96
- name: 'test',
97
- nameLastUpdatedAt: 1,
98
- keyring: {
99
- type: KeyringTypes.hd,
100
- },
101
- },
102
- },
103
- {
104
- address: '0x456',
105
- id: '2',
106
- type: EthAccountType.Eoa,
107
- metadata: {
108
- name: 'Account 2',
109
- nameLastUpdatedAt: 2,
110
- keyring: {
111
- type: KeyringTypes.hd,
112
- },
113
- },
114
- },
115
- {
116
- address: '0x789',
117
- id: '3',
118
- type: EthAccountType.Eoa,
119
- metadata: {
120
- name: 'Účet 2',
121
- nameLastUpdatedAt: 3,
122
- keyring: {
123
- type: KeyringTypes.hd,
124
- },
125
- },
126
- },
127
- {
128
- address: '0xabc',
129
- id: '4',
130
- type: EthAccountType.Eoa,
131
- metadata: {
132
- name: 'My Account 4',
133
- nameLastUpdatedAt: 4,
134
- keyring: {
135
- type: KeyringTypes.hd,
136
- },
137
- },
138
- },
139
- ],
140
- };
141
- export const MOCK_USER_STORAGE_ACCOUNTS = {
142
- SAME_AS_INTERNAL_ALL: mapInternalAccountsListToUserStorageAccountsList(MOCK_INTERNAL_ACCOUNTS.ALL),
143
- ONE: mapInternalAccountsListToUserStorageAccountsList(MOCK_INTERNAL_ACCOUNTS.ONE),
144
- TWO_DEFAULT_NAMES_WITH_ONE_BOGUS: mapInternalAccountsListToUserStorageAccountsList([
145
- ...MOCK_INTERNAL_ACCOUNTS.ONE_DEFAULT_NAME,
146
- {
147
- ...MOCK_INTERNAL_ACCOUNTS.ONE_DEFAULT_NAME[0],
148
- address: '0x000000',
149
- metadata: {
150
- name: `${getMockRandomDefaultAccountName()} 1`,
151
- nameLastUpdatedAt: 2,
152
- },
153
- },
154
- ]),
155
- ONE_DEFAULT_NAME: mapInternalAccountsListToUserStorageAccountsList(MOCK_INTERNAL_ACCOUNTS.ONE_DEFAULT_NAME),
156
- ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED: mapInternalAccountsListToUserStorageAccountsList([
157
- {
158
- ...MOCK_INTERNAL_ACCOUNTS.ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED[0],
159
- metadata: {
160
- name: 'User storage account custom name without nameLastUpdatedAt',
161
- },
162
- },
163
- ]),
164
- ONE_CUSTOM_NAME_WITH_LAST_UPDATED: mapInternalAccountsListToUserStorageAccountsList([
165
- {
166
- ...MOCK_INTERNAL_ACCOUNTS.ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED[0],
167
- metadata: {
168
- name: 'User storage account custom name with nameLastUpdatedAt',
169
- nameLastUpdatedAt: 3,
170
- },
171
- },
172
- ]),
173
- };
174
- //# sourceMappingURL=mockAccounts.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockAccounts.mjs","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,8BAA8B;AACvD,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAG5D,OAAO,EAAE,+BAA+B,EAAE,yBAAqB;AAC/D,OAAO,EAAE,sCAAsC,EAAE,qBAAiB;AAElE;;;;;;GAMG;AACH,MAAM,gDAAgD,GAAG,CACvD,gBAAmC,EACnC,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;AAElE;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,EAAE,CAClD,+BAA+B,CAC7B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,+BAA+B,CAAC,MAAM,CAAC,CACnE,CAAC;AAEJ,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,KAAK,EAAE,EAAE;IACT,GAAG,EAAE;QACH;YACE,OAAO,EAAE,OAAO;YAChB,EAAE,EAAE,GAAG;YACP,IAAI,EAAE,cAAc,CAAC,GAAG;YACxB,QAAQ,EAAE;gBACR,IAAI,EAAE,MAAM;gBACZ,iBAAiB,EAAE,CAAC;gBACpB,OAAO,EAAE;oBACP,IAAI,EAAE,YAAY,CAAC,EAAE;iBACtB;aACF;SACF;KACF;IACD,gBAAgB,EAAE;QAChB;YACE,OAAO,EAAE,OAAO;YAChB,EAAE,EAAE,GAAG;YACP,IAAI,EAAE,cAAc,CAAC,GAAG;YACxB,QAAQ,EAAE;gBACR,IAAI,EAAE,GAAG,+BAA+B,EAAE,IAAI;gBAC9C,iBAAiB,EAAE,CAAC;gBACpB,OAAO,EAAE;oBACP,IAAI,EAAE,YAAY,CAAC,EAAE;iBACtB;aACF;SACF;KACF;IACD,oCAAoC,EAAE;QACpC;YACE,OAAO,EAAE,OAAO;YAChB,EAAE,EAAE,GAAG;YACP,IAAI,EAAE,cAAc,CAAC,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ourcesContent":["import { EthAccountType } from '@metamask/keyring-api';\nimport { KeyringTypes } from '@metamask/keyring-controller';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\n\nimport { LOCALIZED_DEFAULT_ACCOUNT_NAMES } from '../constants';\nimport { mapInternalAccountToUserStorageAccount } from '../utils';\n\n/**\n * Map an array of internal accounts to an array of user storage accounts\n * Only used for testing purposes\n *\n * @param internalAccounts - An array of internal accounts\n * @returns An array of user storage accounts\n */\nconst mapInternalAccountsListToUserStorageAccountsList = (\n internalAccounts: InternalAccount[],\n) => internalAccounts.map(mapInternalAccountToUserStorageAccount);\n\n/**\n * Get a random default account name from the list of localized default account names\n *\n * @returns A random default account name\n */\nexport const getMockRandomDefaultAccountName = () =>\n LOCALIZED_DEFAULT_ACCOUNT_NAMES[\n Math.floor(Math.random() * LOCALIZED_DEFAULT_ACCOUNT_NAMES.length)\n ];\n\nexport const MOCK_INTERNAL_ACCOUNTS = {\n EMPTY: [],\n ONE: [\n {\n address: '0x123',\n id: '1',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'test',\n nameLastUpdatedAt: 1,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n ],\n ONE_DEFAULT_NAME: [\n {\n address: '0x123',\n id: '1',\n type: EthAccountType.Eoa,\n metadata: {\n name: `${getMockRandomDefaultAccountName()} 1`,\n nameLastUpdatedAt: 1,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n ],\n ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED: [\n {\n address: '0x123',\n id: '1',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'Internal account custom name without nameLastUpdatedAt',\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n ],\n ONE_CUSTOM_NAME_WITH_LAST_UPDATED: [\n {\n address: '0x123',\n id: '1',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'Internal account custom name with nameLastUpdatedAt',\n nameLastUpdatedAt: 1,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n ],\n ONE_CUSTOM_NAME_WITH_LAST_UPDATED_MOST_RECENT: [\n {\n address: '0x123',\n id: '1',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'Internal account custom name with nameLastUpdatedAt',\n nameLastUpdatedAt: 9999,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n ],\n ALL: [\n {\n address: '0x123',\n id: '1',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'test',\n nameLastUpdatedAt: 1,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n {\n address: '0x456',\n id: '2',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'Account 2',\n nameLastUpdatedAt: 2,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n {\n address: '0x789',\n id: '3',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'Účet 2',\n nameLastUpdatedAt: 3,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n {\n address: '0xabc',\n id: '4',\n type: EthAccountType.Eoa,\n metadata: {\n name: 'My Account 4',\n nameLastUpdatedAt: 4,\n keyring: {\n type: KeyringTypes.hd,\n },\n },\n },\n ],\n};\n\nexport const MOCK_USER_STORAGE_ACCOUNTS = {\n SAME_AS_INTERNAL_ALL: mapInternalAccountsListToUserStorageAccountsList(\n MOCK_INTERNAL_ACCOUNTS.ALL as InternalAccount[],\n ),\n ONE: mapInternalAccountsListToUserStorageAccountsList(\n MOCK_INTERNAL_ACCOUNTS.ONE as InternalAccount[],\n ),\n TWO_DEFAULT_NAMES_WITH_ONE_BOGUS:\n mapInternalAccountsListToUserStorageAccountsList([\n ...MOCK_INTERNAL_ACCOUNTS.ONE_DEFAULT_NAME,\n {\n ...MOCK_INTERNAL_ACCOUNTS.ONE_DEFAULT_NAME[0],\n address: '0x000000',\n metadata: {\n name: `${getMockRandomDefaultAccountName()} 1`,\n nameLastUpdatedAt: 2,\n },\n },\n ] as InternalAccount[]),\n ONE_DEFAULT_NAME: mapInternalAccountsListToUserStorageAccountsList(\n MOCK_INTERNAL_ACCOUNTS.ONE_DEFAULT_NAME as InternalAccount[],\n ),\n ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED:\n mapInternalAccountsListToUserStorageAccountsList([\n {\n ...MOCK_INTERNAL_ACCOUNTS.ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED[0],\n metadata: {\n name: 'User storage account custom name without nameLastUpdatedAt',\n },\n },\n ] as InternalAccount[]),\n ONE_CUSTOM_NAME_WITH_LAST_UPDATED:\n mapInternalAccountsListToUserStorageAccountsList([\n {\n ...MOCK_INTERNAL_ACCOUNTS.ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED[0],\n metadata: {\n name: 'User storage account custom name with nameLastUpdatedAt',\n nameLastUpdatedAt: 3,\n },\n },\n ] as InternalAccount[]),\n};\n"]}
@@ -1,58 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createExpectedAccountSyncBatchDeleteBody = exports.createExpectedAccountSyncBatchUpsertBody = exports.mockUserStorageMessengerForAccountSyncing = void 0;
4
- const keyring_controller_1 = require("@metamask/keyring-controller");
5
- const mockAccounts_1 = require("./mockAccounts.cjs");
6
- const encryption_1 = require("../../../../shared/encryption/index.cjs");
7
- const mockMessenger_1 = require("../../__fixtures__/mockMessenger.cjs");
8
- const utils_1 = require("../utils.cjs");
9
- /**
10
- * Test Utility - create a mock user storage messenger for account syncing tests
11
- *
12
- * @param options - options for the mock messenger
13
- * @param options.accounts - options for the accounts part of the controller
14
- * @param options.accounts.accountsList - list of accounts to return for the 'AccountsController:listAccounts' action
15
- * @returns Mock User Storage Messenger
16
- */
17
- function mockUserStorageMessengerForAccountSyncing(options) {
18
- const messengerMocks = (0, mockMessenger_1.mockUserStorageMessenger)();
19
- messengerMocks.mockKeyringAddAccounts.mockImplementation(async () => {
20
- messengerMocks.baseMessenger.publish('AccountsController:accountAdded', mockAccounts_1.MOCK_INTERNAL_ACCOUNTS.ONE[0]);
21
- });
22
- messengerMocks.mockKeyringGetAccounts.mockImplementation(async () => {
23
- return (options?.accounts?.accountsList
24
- ?.filter((a) => a.metadata.keyring.type === keyring_controller_1.KeyringTypes.hd)
25
- .map((a) => a.address) ??
26
- mockAccounts_1.MOCK_INTERNAL_ACCOUNTS.ALL.map((a) => a.address));
27
- });
28
- messengerMocks.mockAccountsListAccounts.mockReturnValue((options?.accounts?.accountsList ??
29
- mockAccounts_1.MOCK_INTERNAL_ACCOUNTS.ALL));
30
- return messengerMocks;
31
- }
32
- exports.mockUserStorageMessengerForAccountSyncing = mockUserStorageMessengerForAccountSyncing;
33
- /**
34
- * Test Utility - creates a realistic expected batch upsert payload
35
- *
36
- * @param data - data supposed to be upserted
37
- * @param storageKey - storage key
38
- * @returns expected body
39
- */
40
- function createExpectedAccountSyncBatchUpsertBody(data, storageKey) {
41
- return data.map(([entryKey, entryValue]) => [
42
- (0, encryption_1.createSHA256Hash)(String(entryKey) + storageKey),
43
- JSON.stringify((0, utils_1.mapInternalAccountToUserStorageAccount)(entryValue)),
44
- ]);
45
- }
46
- exports.createExpectedAccountSyncBatchUpsertBody = createExpectedAccountSyncBatchUpsertBody;
47
- /**
48
- * Test Utility - creates a realistic expected batch delete payload
49
- *
50
- * @param data - data supposed to be deleted
51
- * @param storageKey - storage key
52
- * @returns expected body
53
- */
54
- function createExpectedAccountSyncBatchDeleteBody(data, storageKey) {
55
- return data.map((entryKey) => (0, encryption_1.createSHA256Hash)(String(entryKey) + storageKey));
56
- }
57
- exports.createExpectedAccountSyncBatchDeleteBody = createExpectedAccountSyncBatchDeleteBody;
58
- //# sourceMappingURL=test-utils.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-utils.cjs","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/account-syncing/__fixtures__/test-utils.ts"],"names":[],"mappings":";;;AAAA,qEAA4D;AAG5D,qDAAwD;AACxD,wEAAiE;AACjE,wEAA4E;AAC5E,wCAAkE;AAElE;;;;;;;GAOG;AACH,SAAg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4FAQC;AAED;;;;;;GAMG;AACH,SAAgB,wCAAwC,CACtD,IAAc,EACd,UAAkB;IAElB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAC3B,IAAA,6BAAgB,EAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC,CAChD,CAAC;AACJ,CAAC;AAPD,4FAOC","sourcesContent":["import { KeyringTypes } from '@metamask/keyring-controller';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\n\nimport { MOCK_INTERNAL_ACCOUNTS } from './mockAccounts';\nimport { createSHA256Hash } from '../../../../shared/encryption';\nimport { mockUserStorageMessenger } from '../../__fixtures__/mockMessenger';\nimport { mapInternalAccountToUserStorageAccount } from '../utils';\n\n/**\n * Test Utility - create a mock user storage messenger for account syncing tests\n *\n * @param options - options for the mock messenger\n * @param options.accounts - options for the accounts part of the controller\n * @param options.accounts.accountsList - list of accounts to return for the 'AccountsController:listAccounts' action\n * @returns Mock User Storage Messenger\n */\nexport function mockUserStorageMessengerForAccountSyncing(options?: {\n accounts?: {\n accountsList?: InternalAccount[];\n };\n}) {\n const messengerMocks = mockUserStorageMessenger();\n\n messengerMocks.mockKeyringAddAccounts.mockImplementation(async () => {\n messengerMocks.baseMessenger.publish(\n 'AccountsController:accountAdded',\n MOCK_INTERNAL_ACCOUNTS.ONE[0] as InternalAccount,\n );\n });\n\n messengerMocks.mockKeyringGetAccounts.mockImplementation(async () => {\n return (\n options?.accounts?.accountsList\n ?.filter((a) => a.metadata.keyring.type === KeyringTypes.hd)\n .map((a) => a.address) ??\n MOCK_INTERNAL_ACCOUNTS.ALL.map((a) => a.address)\n );\n });\n\n messengerMocks.mockAccountsListAccounts.mockReturnValue(\n (options?.accounts?.accountsList ??\n MOCK_INTERNAL_ACCOUNTS.ALL) as InternalAccount[],\n );\n\n return messengerMocks;\n}\n\n/**\n * Test Utility - creates a realistic expected batch upsert payload\n *\n * @param data - data supposed to be upserted\n * @param storageKey - storage key\n * @returns expected body\n */\nexport function createExpectedAccountSyncBatchUpsertBody(\n data: [string, InternalAccount][],\n storageKey: string,\n) {\n return data.map(([entryKey, entryValue]) => [\n createSHA256Hash(String(entryKey) + storageKey),\n JSON.stringify(mapInternalAccountToUserStorageAccount(entryValue)),\n ]);\n}\n\n/**\n * Test Utility - creates a realistic expected batch delete payload\n *\n * @param data - data supposed to be deleted\n * @param storageKey - storage key\n * @returns expected body\n */\nexport function createExpectedAccountSyncBatchDeleteBody(\n data: string[],\n storageKey: string,\n) {\n return data.map((entryKey) =>\n createSHA256Hash(String(entryKey) + storageKey),\n );\n}\n"]}
@@ -1,87 +0,0 @@
1
- /// <reference types="jest" />
2
- import type { InternalAccount } from "@metamask/keyring-internal-api";
3
- /**
4
- * Test Utility - create a mock user storage messenger for account syncing tests
5
- *
6
- * @param options - options for the mock messenger
7
- * @param options.accounts - options for the accounts part of the controller
8
- * @param options.accounts.accountsList - list of accounts to return for the 'AccountsController:listAccounts' action
9
- * @returns Mock User Storage Messenger
10
- */
11
- export declare function mockUserStorageMessengerForAccountSyncing(options?: {
12
- accounts?: {
13
- accountsList?: InternalAccount[];
14
- };
15
- }): {
16
- baseMessenger: import("@metamask/base-controller").Messenger<import("../../index.cjs").AllowedActions, import("../../index.cjs").AllowedEvents>;
17
- messenger: import("@metamask/base-controller").RestrictedMessenger<"UserStorageController", import("@metamask/snaps-controllers").HandleSnapRequest | {
18
- type: "AuthenticationController:isSignedIn";
19
- handler: () => boolean;
20
- } | {
21
- type: "AuthenticationController:performSignIn";
22
- handler: () => Promise<string>;
23
- } | {
24
- type: "AuthenticationController:performSignOut";
25
- handler: () => void;
26
- } | {
27
- type: "AuthenticationController:getBearerToken";
28
- handler: () => Promise<string>;
29
- } | {
30
- type: "AuthenticationController:getSessionProfile";
31
- handler: () => Promise<{
32
- identifierId: string;
33
- profileId: string;
34
- }>;
35
- } | import("@metamask/keyring-controller").KeyringControllerGetStateAction | import("@metamask/accounts-controller").AccountsControllerListAccountsAction | import("@metamask/accounts-controller").AccountsControllerUpdateAccountMetadataAction | import("@metamask/keyring-controller").KeyringControllerWithKeyringAction | import("@metamask/network-controller").NetworkControllerGetStateAction | import("@metamask/network-controller").NetworkControllerAddNetworkAction | import("@metamask/network-controller").NetworkControllerRemoveNetworkAction | import("@metamask/network-controller").NetworkControllerUpdateNetworkAction, import("@metamask/keyring-controller").KeyringControllerLockEvent | import("@metamask/keyring-controller").KeyringControllerUnlockEvent | import("../../index.cjs").UserStorageControllerStateChangeEvent | import("@metamask/accounts-controller").AccountsControllerAccountAddedEvent | import("@metamask/accounts-controller").AccountsControllerAccountRenamedEvent | import("@metamask/network-controller").NetworkControllerNetworkRemovedEvent, "SnapController:handleRequest" | "KeyringController:getState" | "AuthenticationController:isSignedIn" | "AuthenticationController:performSignIn" | "AuthenticationController:performSignOut" | "AuthenticationController:getBearerToken" | "AuthenticationController:getSessionProfile" | "AccountsController:listAccounts" | "AccountsController:updateAccountMetadata" | "KeyringController:withKeyring" | "NetworkController:getState" | "NetworkController:addNetwork" | "NetworkController:removeNetwork" | "NetworkController:updateNetwork", "KeyringController:lock" | "KeyringController:unlock" | "AccountsController:accountAdded" | "AccountsController:accountRenamed" | "NetworkController:networkRemoved">;
36
- mockSnapGetPublicKey: jest.Mock<any, any>;
37
- mockSnapSignMessage: jest.Mock<any, any>;
38
- mockAuthGetBearerToken: jest.Mock<Promise<string>, []>;
39
- mockAuthGetSessionProfile: jest.Mock<Promise<{
40
- identifierId: string;
41
- profileId: string;
42
- }>, []>;
43
- mockAuthPerformSignIn: jest.Mock<Promise<string>, []>;
44
- mockAuthIsSignedIn: jest.Mock<boolean, []>;
45
- mockAuthPerformSignOut: jest.Mock<void, []>;
46
- mockKeyringGetAccounts: jest.Mock<any, any>;
47
- mockKeyringAddAccounts: jest.Mock<any, any>;
48
- mockKeyringWithKeyring: jest.Mock<Promise<unknown>, [selector: import("@metamask/keyring-controller").KeyringSelector, operation: (keyring: import("@metamask/keyring-internal-api").EthKeyring<import("@metamask/utils").Json>) => Promise<unknown>]>;
49
- mockAccountsUpdateAccountMetadata: jest.Mock<void, [accountId: string, metadata: Partial<{
50
- name: string;
51
- importTime: number;
52
- keyring: {
53
- type: string;
54
- };
55
- nameLastUpdatedAt?: number | undefined;
56
- snap?: {
57
- name: string;
58
- id: string;
59
- enabled: boolean;
60
- } | undefined;
61
- lastSelected?: number | undefined;
62
- }>]>;
63
- mockAccountsListAccounts: jest.Mock<any, any>;
64
- mockNetworkControllerGetState: jest.Mock<import("@metamask/network-controller").NetworkState, []>;
65
- mockNetworkControllerAddNetwork: jest.Mock<import("@metamask/network-controller").NetworkConfiguration, [fields: import("@metamask/network-controller").AddNetworkFields]>;
66
- mockNetworkControllerRemoveNetwork: jest.Mock<void, [chainId: `0x${string}`]>;
67
- mockNetworkControllerUpdateNetwork: jest.Mock<Promise<import("@metamask/network-controller").NetworkConfiguration>, [`0x${string}`, import("@metamask/network-controller").UpdateNetworkFields, ({
68
- replacementSelectedRpcEndpointIndex?: number | undefined;
69
- } | undefined)?]>;
70
- };
71
- /**
72
- * Test Utility - creates a realistic expected batch upsert payload
73
- *
74
- * @param data - data supposed to be upserted
75
- * @param storageKey - storage key
76
- * @returns expected body
77
- */
78
- export declare function createExpectedAccountSyncBatchUpsertBody(data: [string, InternalAccount][], storageKey: string): string[][];
79
- /**
80
- * Test Utility - creates a realistic expected batch delete payload
81
- *
82
- * @param data - data supposed to be deleted
83
- * @param storageKey - storage key
84
- * @returns expected body
85
- */
86
- export declare function createExpectedAccountSyncBatchDeleteBody(data: string[], storageKey: string): string[];
87
- //# sourceMappingURL=test-utils.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-utils.d.cts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/account-syncing/__fixtures__/test-utils.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AAOtE;;;;;;;GAOG;AACH,wBAAgB,yCAAyC,CAAC,OAAO,CAAC,EAAE;IAClE,QAAQ,CAAC,EAAE;QACT,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;KAClC,CAAC;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBA;AAED;;;;;;GAMG;AACH,wBAAgB,wCAAwC,CACtD,IAAI,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE,EACjC,UAAU,EAAE,MAAM,cAMnB;AAED;;;;;;GAMG;AACH,wBAAgB,wCAAwC,CACtD,IAAI,EAAE,MAAM,EAAE,EACd,UAAU,EAAE,MAAM,YAKnB"}
@@ -1,87 +0,0 @@
1
- /// <reference types="jest" />
2
- import type { InternalAccount } from "@metamask/keyring-internal-api";
3
- /**
4
- * Test Utility - create a mock user storage messenger for account syncing tests
5
- *
6
- * @param options - options for the mock messenger
7
- * @param options.accounts - options for the accounts part of the controller
8
- * @param options.accounts.accountsList - list of accounts to return for the 'AccountsController:listAccounts' action
9
- * @returns Mock User Storage Messenger
10
- */
11
- export declare function mockUserStorageMessengerForAccountSyncing(options?: {
12
- accounts?: {
13
- accountsList?: InternalAccount[];
14
- };
15
- }): {
16
- baseMessenger: import("@metamask/base-controller").Messenger<import("../../index.mjs").AllowedActions, import("../../index.mjs").AllowedEvents>;
17
- messenger: import("@metamask/base-controller").RestrictedMessenger<"UserStorageController", import("@metamask/snaps-controllers").HandleSnapRequest | {
18
- type: "AuthenticationController:isSignedIn";
19
- handler: () => boolean;
20
- } | {
21
- type: "AuthenticationController:performSignIn";
22
- handler: () => Promise<string>;
23
- } | {
24
- type: "AuthenticationController:performSignOut";
25
- handler: () => void;
26
- } | {
27
- type: "AuthenticationController:getBearerToken";
28
- handler: () => Promise<string>;
29
- } | {
30
- type: "AuthenticationController:getSessionProfile";
31
- handler: () => Promise<{
32
- identifierId: string;
33
- profileId: string;
34
- }>;
35
- } | import("@metamask/keyring-controller").KeyringControllerGetStateAction | import("@metamask/accounts-controller").AccountsControllerListAccountsAction | import("@metamask/accounts-controller").AccountsControllerUpdateAccountMetadataAction | import("@metamask/keyring-controller").KeyringControllerWithKeyringAction | import("@metamask/network-controller").NetworkControllerGetStateAction | import("@metamask/network-controller").NetworkControllerAddNetworkAction | import("@metamask/network-controller").NetworkControllerRemoveNetworkAction | import("@metamask/network-controller").NetworkControllerUpdateNetworkAction, import("@metamask/keyring-controller").KeyringControllerLockEvent | import("@metamask/keyring-controller").KeyringControllerUnlockEvent | import("../../index.mjs").UserStorageControllerStateChangeEvent | import("@metamask/accounts-controller").AccountsControllerAccountAddedEvent | import("@metamask/accounts-controller").AccountsControllerAccountRenamedEvent | import("@metamask/network-controller").NetworkControllerNetworkRemovedEvent, "SnapController:handleRequest" | "KeyringController:getState" | "AuthenticationController:isSignedIn" | "AuthenticationController:performSignIn" | "AuthenticationController:performSignOut" | "AuthenticationController:getBearerToken" | "AuthenticationController:getSessionProfile" | "AccountsController:listAccounts" | "AccountsController:updateAccountMetadata" | "KeyringController:withKeyring" | "NetworkController:getState" | "NetworkController:addNetwork" | "NetworkController:removeNetwork" | "NetworkController:updateNetwork", "KeyringController:lock" | "KeyringController:unlock" | "AccountsController:accountAdded" | "AccountsController:accountRenamed" | "NetworkController:networkRemoved">;
36
- mockSnapGetPublicKey: jest.Mock<any, any>;
37
- mockSnapSignMessage: jest.Mock<any, any>;
38
- mockAuthGetBearerToken: jest.Mock<Promise<string>, []>;
39
- mockAuthGetSessionProfile: jest.Mock<Promise<{
40
- identifierId: string;
41
- profileId: string;
42
- }>, []>;
43
- mockAuthPerformSignIn: jest.Mock<Promise<string>, []>;
44
- mockAuthIsSignedIn: jest.Mock<boolean, []>;
45
- mockAuthPerformSignOut: jest.Mock<void, []>;
46
- mockKeyringGetAccounts: jest.Mock<any, any>;
47
- mockKeyringAddAccounts: jest.Mock<any, any>;
48
- mockKeyringWithKeyring: jest.Mock<Promise<unknown>, [selector: import("@metamask/keyring-controller").KeyringSelector, operation: (keyring: import("@metamask/keyring-internal-api").EthKeyring<import("@metamask/utils").Json>) => Promise<unknown>]>;
49
- mockAccountsUpdateAccountMetadata: jest.Mock<void, [accountId: string, metadata: Partial<{
50
- name: string;
51
- importTime: number;
52
- keyring: {
53
- type: string;
54
- };
55
- nameLastUpdatedAt?: number | undefined;
56
- snap?: {
57
- name: string;
58
- id: string;
59
- enabled: boolean;
60
- } | undefined;
61
- lastSelected?: number | undefined;
62
- }>]>;
63
- mockAccountsListAccounts: jest.Mock<any, any>;
64
- mockNetworkControllerGetState: jest.Mock<import("@metamask/network-controller").NetworkState, []>;
65
- mockNetworkControllerAddNetwork: jest.Mock<import("@metamask/network-controller").NetworkConfiguration, [fields: import("@metamask/network-controller").AddNetworkFields]>;
66
- mockNetworkControllerRemoveNetwork: jest.Mock<void, [chainId: `0x${string}`]>;
67
- mockNetworkControllerUpdateNetwork: jest.Mock<Promise<import("@metamask/network-controller").NetworkConfiguration>, [`0x${string}`, import("@metamask/network-controller").UpdateNetworkFields, ({
68
- replacementSelectedRpcEndpointIndex?: number | undefined;
69
- } | undefined)?]>;
70
- };
71
- /**
72
- * Test Utility - creates a realistic expected batch upsert payload
73
- *
74
- * @param data - data supposed to be upserted
75
- * @param storageKey - storage key
76
- * @returns expected body
77
- */
78
- export declare function createExpectedAccountSyncBatchUpsertBody(data: [string, InternalAccount][], storageKey: string): string[][];
79
- /**
80
- * Test Utility - creates a realistic expected batch delete payload
81
- *
82
- * @param data - data supposed to be deleted
83
- * @param storageKey - storage key
84
- * @returns expected body
85
- */
86
- export declare function createExpectedAccountSyncBatchDeleteBody(data: string[], storageKey: string): string[];
87
- //# sourceMappingURL=test-utils.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-utils.d.mts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/account-syncing/__fixtures__/test-utils.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AAOtE;;;;;;;GAOG;AACH,wBAAgB,yCAAyC,CAAC,OAAO,CAAC,EAAE;IAClE,QAAQ,CAAC,EAAE;QACT,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;KAClC,CAAC;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBA;AAED;;;;;;GAMG;AACH,wBAAgB,wCAAwC,CACtD,IAAI,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE,EACjC,UAAU,EAAE,MAAM,cAMnB;AAED;;;;;;GAMG;AACH,wBAAgB,wCAAwC,CACtD,IAAI,EAAE,MAAM,EAAE,EACd,UAAU,EAAE,MAAM,YAKnB"}