@metamask-previews/profile-sync-controller 8.1.0-preview-dbdf1da → 8.1.1-preview-30bb9023

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 (161) hide show
  1. package/CHANGELOG.md +5 -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/index.cjs +1 -1
  21. package/dist/controllers/user-storage/index.cjs.map +1 -1
  22. package/dist/controllers/user-storage/index.d.cts +1 -1
  23. package/dist/controllers/user-storage/index.d.cts.map +1 -1
  24. package/dist/controllers/user-storage/index.d.mts +1 -1
  25. package/dist/controllers/user-storage/index.d.mts.map +1 -1
  26. package/dist/controllers/user-storage/index.mjs +1 -1
  27. package/dist/controllers/user-storage/index.mjs.map +1 -1
  28. package/dist/controllers/user-storage/mocks/index.cjs.map +1 -0
  29. package/dist/controllers/user-storage/mocks/index.d.cts.map +1 -0
  30. package/dist/controllers/user-storage/mocks/index.d.mts.map +1 -0
  31. package/dist/controllers/user-storage/mocks/index.mjs.map +1 -0
  32. package/dist/controllers/user-storage/mocks/mockResponses.cjs.map +1 -0
  33. package/dist/controllers/user-storage/mocks/mockResponses.d.cts.map +1 -0
  34. package/dist/controllers/user-storage/mocks/mockResponses.d.mts.map +1 -0
  35. package/dist/controllers/user-storage/mocks/mockResponses.mjs.map +1 -0
  36. package/dist/controllers/user-storage/mocks/mockStorage.cjs.map +1 -0
  37. package/dist/controllers/user-storage/mocks/mockStorage.d.cts.map +1 -0
  38. package/dist/controllers/user-storage/mocks/mockStorage.d.mts.map +1 -0
  39. package/dist/controllers/user-storage/mocks/mockStorage.mjs.map +1 -0
  40. package/package.json +11 -11
  41. package/user-storage/mocks/package.json +2 -2
  42. package/dist/controllers/authentication/__fixtures__/index.cjs.map +0 -1
  43. package/dist/controllers/authentication/__fixtures__/index.d.cts.map +0 -1
  44. package/dist/controllers/authentication/__fixtures__/index.d.mts.map +0 -1
  45. package/dist/controllers/authentication/__fixtures__/index.mjs.map +0 -1
  46. package/dist/controllers/authentication/__fixtures__/mockResponses.cjs.map +0 -1
  47. package/dist/controllers/authentication/__fixtures__/mockResponses.d.cts.map +0 -1
  48. package/dist/controllers/authentication/__fixtures__/mockResponses.d.mts.map +0 -1
  49. package/dist/controllers/authentication/__fixtures__/mockResponses.mjs.map +0 -1
  50. package/dist/controllers/authentication/__fixtures__/mockServices.cjs +0 -37
  51. package/dist/controllers/authentication/__fixtures__/mockServices.cjs.map +0 -1
  52. package/dist/controllers/authentication/__fixtures__/mockServices.d.cts +0 -10
  53. package/dist/controllers/authentication/__fixtures__/mockServices.d.cts.map +0 -1
  54. package/dist/controllers/authentication/__fixtures__/mockServices.d.mts +0 -10
  55. package/dist/controllers/authentication/__fixtures__/mockServices.d.mts.map +0 -1
  56. package/dist/controllers/authentication/__fixtures__/mockServices.mjs +0 -35
  57. package/dist/controllers/authentication/__fixtures__/mockServices.mjs.map +0 -1
  58. package/dist/controllers/user-storage/__fixtures__/index.cjs.map +0 -1
  59. package/dist/controllers/user-storage/__fixtures__/index.d.cts.map +0 -1
  60. package/dist/controllers/user-storage/__fixtures__/index.d.mts.map +0 -1
  61. package/dist/controllers/user-storage/__fixtures__/index.mjs.map +0 -1
  62. package/dist/controllers/user-storage/__fixtures__/mockMessenger.cjs +0 -167
  63. package/dist/controllers/user-storage/__fixtures__/mockMessenger.cjs.map +0 -1
  64. package/dist/controllers/user-storage/__fixtures__/mockMessenger.d.cts +0 -105
  65. package/dist/controllers/user-storage/__fixtures__/mockMessenger.d.cts.map +0 -1
  66. package/dist/controllers/user-storage/__fixtures__/mockMessenger.d.mts +0 -105
  67. package/dist/controllers/user-storage/__fixtures__/mockMessenger.d.mts.map +0 -1
  68. package/dist/controllers/user-storage/__fixtures__/mockMessenger.mjs +0 -162
  69. package/dist/controllers/user-storage/__fixtures__/mockMessenger.mjs.map +0 -1
  70. package/dist/controllers/user-storage/__fixtures__/mockResponses.cjs.map +0 -1
  71. package/dist/controllers/user-storage/__fixtures__/mockResponses.d.cts.map +0 -1
  72. package/dist/controllers/user-storage/__fixtures__/mockResponses.d.mts.map +0 -1
  73. package/dist/controllers/user-storage/__fixtures__/mockResponses.mjs.map +0 -1
  74. package/dist/controllers/user-storage/__fixtures__/mockServices.cjs +0 -82
  75. package/dist/controllers/user-storage/__fixtures__/mockServices.cjs.map +0 -1
  76. package/dist/controllers/user-storage/__fixtures__/mockServices.d.cts +0 -15
  77. package/dist/controllers/user-storage/__fixtures__/mockServices.d.cts.map +0 -1
  78. package/dist/controllers/user-storage/__fixtures__/mockServices.d.mts +0 -15
  79. package/dist/controllers/user-storage/__fixtures__/mockServices.d.mts.map +0 -1
  80. package/dist/controllers/user-storage/__fixtures__/mockServices.mjs +0 -76
  81. package/dist/controllers/user-storage/__fixtures__/mockServices.mjs.map +0 -1
  82. package/dist/controllers/user-storage/__fixtures__/mockStorage.cjs.map +0 -1
  83. package/dist/controllers/user-storage/__fixtures__/mockStorage.d.cts.map +0 -1
  84. package/dist/controllers/user-storage/__fixtures__/mockStorage.d.mts.map +0 -1
  85. package/dist/controllers/user-storage/__fixtures__/mockStorage.mjs.map +0 -1
  86. package/dist/controllers/user-storage/__fixtures__/test-utils.cjs +0 -78
  87. package/dist/controllers/user-storage/__fixtures__/test-utils.cjs.map +0 -1
  88. package/dist/controllers/user-storage/__fixtures__/test-utils.d.cts +0 -38
  89. package/dist/controllers/user-storage/__fixtures__/test-utils.d.cts.map +0 -1
  90. package/dist/controllers/user-storage/__fixtures__/test-utils.d.mts +0 -38
  91. package/dist/controllers/user-storage/__fixtures__/test-utils.d.mts.map +0 -1
  92. package/dist/controllers/user-storage/__fixtures__/test-utils.mjs +0 -68
  93. package/dist/controllers/user-storage/__fixtures__/test-utils.mjs.map +0 -1
  94. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.cjs +0 -178
  95. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.cjs.map +0 -1
  96. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.d.cts +0 -91
  97. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.d.cts.map +0 -1
  98. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.d.mts +0 -91
  99. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.d.mts.map +0 -1
  100. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.mjs +0 -174
  101. package/dist/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.mjs.map +0 -1
  102. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.cjs +0 -58
  103. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.cjs.map +0 -1
  104. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.d.cts +0 -87
  105. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.d.cts.map +0 -1
  106. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.d.mts +0 -87
  107. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.d.mts.map +0 -1
  108. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.mjs +0 -52
  109. package/dist/controllers/user-storage/account-syncing/__fixtures__/test-utils.mjs.map +0 -1
  110. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.cjs +0 -43
  111. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.cjs.map +0 -1
  112. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.cts +0 -11
  113. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.cts.map +0 -1
  114. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.mts +0 -11
  115. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.mts.map +0 -1
  116. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.mjs +0 -36
  117. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.mjs.map +0 -1
  118. package/dist/sdk/__fixtures__/mock-auth.cjs +0 -124
  119. package/dist/sdk/__fixtures__/mock-auth.cjs.map +0 -1
  120. package/dist/sdk/__fixtures__/mock-auth.d.cts +0 -42
  121. package/dist/sdk/__fixtures__/mock-auth.d.cts.map +0 -1
  122. package/dist/sdk/__fixtures__/mock-auth.d.mts +0 -42
  123. package/dist/sdk/__fixtures__/mock-auth.d.mts.map +0 -1
  124. package/dist/sdk/__fixtures__/mock-auth.mjs +0 -119
  125. package/dist/sdk/__fixtures__/mock-auth.mjs.map +0 -1
  126. package/dist/sdk/__fixtures__/mock-userstorage.cjs +0 -111
  127. package/dist/sdk/__fixtures__/mock-userstorage.cjs.map +0 -1
  128. package/dist/sdk/__fixtures__/mock-userstorage.d.cts +0 -20
  129. package/dist/sdk/__fixtures__/mock-userstorage.d.cts.map +0 -1
  130. package/dist/sdk/__fixtures__/mock-userstorage.d.mts +0 -20
  131. package/dist/sdk/__fixtures__/mock-userstorage.d.mts.map +0 -1
  132. package/dist/sdk/__fixtures__/mock-userstorage.mjs +0 -81
  133. package/dist/sdk/__fixtures__/mock-userstorage.mjs.map +0 -1
  134. package/dist/sdk/__fixtures__/test-utils.cjs +0 -90
  135. package/dist/sdk/__fixtures__/test-utils.cjs.map +0 -1
  136. package/dist/sdk/__fixtures__/test-utils.d.cts +0 -37
  137. package/dist/sdk/__fixtures__/test-utils.d.cts.map +0 -1
  138. package/dist/sdk/__fixtures__/test-utils.d.mts +0 -37
  139. package/dist/sdk/__fixtures__/test-utils.d.mts.map +0 -1
  140. package/dist/sdk/__fixtures__/test-utils.mjs +0 -84
  141. package/dist/sdk/__fixtures__/test-utils.mjs.map +0 -1
  142. /package/dist/controllers/authentication/{__fixtures__ → mocks}/index.cjs +0 -0
  143. /package/dist/controllers/authentication/{__fixtures__ → mocks}/index.d.cts +0 -0
  144. /package/dist/controllers/authentication/{__fixtures__ → mocks}/index.d.mts +0 -0
  145. /package/dist/controllers/authentication/{__fixtures__ → mocks}/index.mjs +0 -0
  146. /package/dist/controllers/authentication/{__fixtures__ → mocks}/mockResponses.cjs +0 -0
  147. /package/dist/controllers/authentication/{__fixtures__ → mocks}/mockResponses.d.cts +0 -0
  148. /package/dist/controllers/authentication/{__fixtures__ → mocks}/mockResponses.d.mts +0 -0
  149. /package/dist/controllers/authentication/{__fixtures__ → mocks}/mockResponses.mjs +0 -0
  150. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/index.cjs +0 -0
  151. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/index.d.cts +0 -0
  152. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/index.d.mts +0 -0
  153. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/index.mjs +0 -0
  154. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockResponses.cjs +0 -0
  155. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockResponses.d.cts +0 -0
  156. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockResponses.d.mts +0 -0
  157. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockResponses.mjs +0 -0
  158. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockStorage.cjs +0 -0
  159. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockStorage.d.cts +0 -0
  160. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockStorage.d.mts +0 -0
  161. /package/dist/controllers/user-storage/{__fixtures__ → mocks}/mockStorage.mjs +0 -0
@@ -1,178 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MOCK_USER_STORAGE_ACCOUNTS = exports.MOCK_INTERNAL_ACCOUNTS = exports.getMockRandomDefaultAccountName = void 0;
4
- const keyring_api_1 = require("@metamask/keyring-api");
5
- const keyring_controller_1 = require("@metamask/keyring-controller");
6
- const constants_1 = require("../constants.cjs");
7
- const utils_1 = require("../utils.cjs");
8
- /**
9
- * Map an array of internal accounts to an array of user storage accounts
10
- * Only used for testing purposes
11
- *
12
- * @param internalAccounts - An array of internal accounts
13
- * @returns An array of user storage accounts
14
- */
15
- const mapInternalAccountsListToUserStorageAccountsList = (internalAccounts) => internalAccounts.map(utils_1.mapInternalAccountToUserStorageAccount);
16
- /**
17
- * Get a random default account name from the list of localized default account names
18
- *
19
- * @returns A random default account name
20
- */
21
- const getMockRandomDefaultAccountName = () => constants_1.LOCALIZED_DEFAULT_ACCOUNT_NAMES[Math.floor(Math.random() * constants_1.LOCALIZED_DEFAULT_ACCOUNT_NAMES.length)];
22
- exports.getMockRandomDefaultAccountName = getMockRandomDefaultAccountName;
23
- exports.MOCK_INTERNAL_ACCOUNTS = {
24
- EMPTY: [],
25
- ONE: [
26
- {
27
- address: '0x123',
28
- id: '1',
29
- type: keyring_api_1.EthAccountType.Eoa,
30
- metadata: {
31
- name: 'test',
32
- nameLastUpdatedAt: 1,
33
- keyring: {
34
- type: keyring_controller_1.KeyringTypes.hd,
35
- },
36
- },
37
- },
38
- ],
39
- ONE_DEFAULT_NAME: [
40
- {
41
- address: '0x123',
42
- id: '1',
43
- type: keyring_api_1.EthAccountType.Eoa,
44
- metadata: {
45
- name: `${(0, exports.getMockRandomDefaultAccountName)()} 1`,
46
- nameLastUpdatedAt: 1,
47
- keyring: {
48
- type: keyring_controller_1.KeyringTypes.hd,
49
- },
50
- },
51
- },
52
- ],
53
- ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED: [
54
- {
55
- address: '0x123',
56
- id: '1',
57
- type: keyring_api_1.EthAccountType.Eoa,
58
- metadata: {
59
- name: 'Internal account custom name without nameLastUpdatedAt',
60
- keyring: {
61
- type: keyring_controller_1.KeyringTypes.hd,
62
- },
63
- },
64
- },
65
- ],
66
- ONE_CUSTOM_NAME_WITH_LAST_UPDATED: [
67
- {
68
- address: '0x123',
69
- id: '1',
70
- type: keyring_api_1.EthAccountType.Eoa,
71
- metadata: {
72
- name: 'Internal account custom name with nameLastUpdatedAt',
73
- nameLastUpdatedAt: 1,
74
- keyring: {
75
- type: keyring_controller_1.KeyringTypes.hd,
76
- },
77
- },
78
- },
79
- ],
80
- ONE_CUSTOM_NAME_WITH_LAST_UPDATED_MOST_RECENT: [
81
- {
82
- address: '0x123',
83
- id: '1',
84
- type: keyring_api_1.EthAccountType.Eoa,
85
- metadata: {
86
- name: 'Internal account custom name with nameLastUpdatedAt',
87
- nameLastUpdatedAt: 9999,
88
- keyring: {
89
- type: keyring_controller_1.KeyringTypes.hd,
90
- },
91
- },
92
- },
93
- ],
94
- ALL: [
95
- {
96
- address: '0x123',
97
- id: '1',
98
- type: keyring_api_1.EthAccountType.Eoa,
99
- metadata: {
100
- name: 'test',
101
- nameLastUpdatedAt: 1,
102
- keyring: {
103
- type: keyring_controller_1.KeyringTypes.hd,
104
- },
105
- },
106
- },
107
- {
108
- address: '0x456',
109
- id: '2',
110
- type: keyring_api_1.EthAccountType.Eoa,
111
- metadata: {
112
- name: 'Account 2',
113
- nameLastUpdatedAt: 2,
114
- keyring: {
115
- type: keyring_controller_1.KeyringTypes.hd,
116
- },
117
- },
118
- },
119
- {
120
- address: '0x789',
121
- id: '3',
122
- type: keyring_api_1.EthAccountType.Eoa,
123
- metadata: {
124
- name: 'Účet 2',
125
- nameLastUpdatedAt: 3,
126
- keyring: {
127
- type: keyring_controller_1.KeyringTypes.hd,
128
- },
129
- },
130
- },
131
- {
132
- address: '0xabc',
133
- id: '4',
134
- type: keyring_api_1.EthAccountType.Eoa,
135
- metadata: {
136
- name: 'My Account 4',
137
- nameLastUpdatedAt: 4,
138
- keyring: {
139
- type: keyring_controller_1.KeyringTypes.hd,
140
- },
141
- },
142
- },
143
- ],
144
- };
145
- exports.MOCK_USER_STORAGE_ACCOUNTS = {
146
- SAME_AS_INTERNAL_ALL: mapInternalAccountsListToUserStorageAccountsList(exports.MOCK_INTERNAL_ACCOUNTS.ALL),
147
- ONE: mapInternalAccountsListToUserStorageAccountsList(exports.MOCK_INTERNAL_ACCOUNTS.ONE),
148
- TWO_DEFAULT_NAMES_WITH_ONE_BOGUS: mapInternalAccountsListToUserStorageAccountsList([
149
- ...exports.MOCK_INTERNAL_ACCOUNTS.ONE_DEFAULT_NAME,
150
- {
151
- ...exports.MOCK_INTERNAL_ACCOUNTS.ONE_DEFAULT_NAME[0],
152
- address: '0x000000',
153
- metadata: {
154
- name: `${(0, exports.getMockRandomDefaultAccountName)()} 1`,
155
- nameLastUpdatedAt: 2,
156
- },
157
- },
158
- ]),
159
- ONE_DEFAULT_NAME: mapInternalAccountsListToUserStorageAccountsList(exports.MOCK_INTERNAL_ACCOUNTS.ONE_DEFAULT_NAME),
160
- ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED: mapInternalAccountsListToUserStorageAccountsList([
161
- {
162
- ...exports.MOCK_INTERNAL_ACCOUNTS.ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED[0],
163
- metadata: {
164
- name: 'User storage account custom name without nameLastUpdatedAt',
165
- },
166
- },
167
- ]),
168
- ONE_CUSTOM_NAME_WITH_LAST_UPDATED: mapInternalAccountsListToUserStorageAccountsList([
169
- {
170
- ...exports.MOCK_INTERNAL_ACCOUNTS.ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED[0],
171
- metadata: {
172
- name: 'User storage account custom name with nameLastUpdatedAt',
173
- nameLastUpdatedAt: 3,
174
- },
175
- },
176
- ]),
177
- };
178
- //# sourceMappingURL=mockAccounts.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockAccounts.cjs","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/account-syncing/__fixtures__/mockAccounts.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,qEAA4D;AAG5D,gDAA+D;AAC/D,wCAAkE;AAElE;;;;;;GAMG;AACH,MAAM,gDAAgD,GAAG,CACvD,gBAAmC,EACnC,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,8CAAsC,CAAC,CAAC;AAElE;;;;GAIG;AACI,MAAM,+BAA+B,GAAG,GAAG,EAAE,CAClD,2CAA+B,CAC7B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,2CAA+B,CAAC,MAAM,CAAC,CACnE,CAAC;AAHS,QAAA,+BAA+B,mCAGxC;AAES,QAAA,sBAAsB,GAAG;IACpC,KAAK,EAAE,EAAE;IACT,GAAG,EAAE;QACH;YACE,OAAO,EAAE,OAAO;YAChB,EAAE,EAAE,GAAG;YACP,IAAI,EAAE,4BAAc,CAAC,GAAG;YACxB,QAAQ,EAAE;gBACR,IAAI,EAAE,MAAM;gBACZ,iBAAiB,EAAE,CAAC;gBACpB,OAAO,EAAE;oBACP,IAAI,EAAE,iCAAY,CAAC,EAAE;iBACtB;aACF;SACF;KACF;IACD,gBAAgB,EAAE;QAChB;YACE,OAAO,EAAE,OAAO;YAChB,EAAE,EAAE,GAAG;YACP,IAAI,EAAE,4BAAc,CAAC,GAAG;YACxB,QAAQ,EAAE;gBACR,IAAI,EAAE,GAAG,IAAA,uCAA+B,GAAE,IAAI;gBAC9C,iBAAiB,EAAE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AiC,EAC/B,gDAAgD,CAAC;QAC/C;YACE,GAAG,8BAAsB,CAAC,oCAAoC,CAAC,CAAC,CAAC;YACjE,QAAQ,EAAE;gBACR,IAAI,EAAE,yDAAyD;gBAC/D,iBAAiB,EAAE,CAAC;aACrB;SACF;KACmB,CAAC;CAC1B,CAAC","sourcesContent":["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,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,o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E;gBACR,IAAI,EAAE,yDAAyD;gBAC/D,iBAAiB,EAAE,CAAC;aACrB;SACF;KACmB,CAAC;CAC1B,CAAC","sourcesContent":["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,qE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AAI,CAAC,SAAS,CAAC,IAAA,8CAAsC,EAAC,UAAU,CAAC,CAAC;KACnE,CAAC,CAAC;AACL,CAAC;AARD,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"]}