@metamask-previews/notification-services-controller 0.0.0-preview-98d4c2a0 → 0.0.0-preview-23a96ae

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 (44) hide show
  1. package/dist/NotificationServicesController/NotificationServicesController.js +3 -3
  2. package/dist/NotificationServicesController/NotificationServicesController.mjs +2 -2
  3. package/dist/NotificationServicesController/index.js +4 -4
  4. package/dist/NotificationServicesController/index.mjs +3 -3
  5. package/dist/NotificationServicesController/services/onchain-notifications.js +2 -2
  6. package/dist/NotificationServicesController/services/onchain-notifications.mjs +1 -1
  7. package/dist/NotificationServicesPushController/NotificationServicesPushController.js +3 -3
  8. package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +3 -3
  9. package/dist/NotificationServicesPushController/index.js +5 -5
  10. package/dist/NotificationServicesPushController/index.mjs +4 -4
  11. package/dist/NotificationServicesPushController/services/push/push-web.js +3 -3
  12. package/dist/NotificationServicesPushController/services/push/push-web.mjs +3 -3
  13. package/dist/NotificationServicesPushController/services/services.js +3 -3
  14. package/dist/NotificationServicesPushController/services/services.mjs +3 -3
  15. package/dist/NotificationServicesPushController/utils/get-notification-message.js +3 -3
  16. package/dist/NotificationServicesPushController/utils/get-notification-message.mjs +3 -3
  17. package/dist/NotificationServicesPushController/utils/index.js +3 -3
  18. package/dist/NotificationServicesPushController/utils/index.mjs +3 -3
  19. package/dist/{chunk-DNTK4U5M.js → chunk-53Y2GNFU.js} +1938 -899
  20. package/dist/chunk-53Y2GNFU.js.map +1 -0
  21. package/dist/{chunk-3F4M3OUO.mjs → chunk-6PPEQMF5.mjs} +2 -2
  22. package/dist/{chunk-XNBTOK6G.js → chunk-AXZU6W3P.js} +7 -7
  23. package/dist/{chunk-KTQP5UDT.mjs → chunk-F6TSWKZK.mjs} +1943 -904
  24. package/dist/chunk-F6TSWKZK.mjs.map +1 -0
  25. package/dist/chunk-G2ROCNJN.mjs +965 -0
  26. package/dist/chunk-G2ROCNJN.mjs.map +1 -0
  27. package/dist/{chunk-6B5FOWRH.js → chunk-G5RGQ3AG.js} +3 -3
  28. package/dist/{chunk-5OYPOYXZ.mjs → chunk-KKWCKF5W.mjs} +2 -2
  29. package/dist/chunk-ZDG7PIUJ.js +965 -0
  30. package/dist/chunk-ZDG7PIUJ.js.map +1 -0
  31. package/dist/index.js +5 -5
  32. package/dist/index.mjs +4 -4
  33. package/dist/tsconfig.build.tsbuildinfo +1 -1
  34. package/package.json +2 -4
  35. package/dist/chunk-DNTK4U5M.js.map +0 -1
  36. package/dist/chunk-KTQP5UDT.mjs.map +0 -1
  37. package/dist/chunk-UIRZIKC3.mjs +0 -187
  38. package/dist/chunk-UIRZIKC3.mjs.map +0 -1
  39. package/dist/chunk-VOZ7Y2OO.js +0 -187
  40. package/dist/chunk-VOZ7Y2OO.js.map +0 -1
  41. /package/dist/{chunk-3F4M3OUO.mjs.map → chunk-6PPEQMF5.mjs.map} +0 -0
  42. /package/dist/{chunk-XNBTOK6G.js.map → chunk-AXZU6W3P.js.map} +0 -0
  43. /package/dist/{chunk-6B5FOWRH.js.map → chunk-G5RGQ3AG.js.map} +0 -0
  44. /package/dist/{chunk-5OYPOYXZ.mjs.map → chunk-KKWCKF5W.mjs.map} +0 -0
@@ -0,0 +1,965 @@
1
+ import {
2
+ processors_exports
3
+ } from "./chunk-QTK2RMF7.mjs";
4
+ import {
5
+ types_exports
6
+ } from "./chunk-B4ECJJ5C.mjs";
7
+ import {
8
+ NotificationServicesController,
9
+ defaultState
10
+ } from "./chunk-KKWCKF5W.mjs";
11
+ import {
12
+ FEATURE_ANNOUNCEMENT_API
13
+ } from "./chunk-EQWVJX6K.mjs";
14
+ import {
15
+ NOTIFICATION_API_LIST_ENDPOINT,
16
+ NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT,
17
+ TRIGGER_API_BATCH_ENDPOINT,
18
+ require_nock
19
+ } from "./chunk-F6TSWKZK.mjs";
20
+ import {
21
+ initializeUserStorage
22
+ } from "./chunk-SMKJEA45.mjs";
23
+ import {
24
+ constants_exports
25
+ } from "./chunk-VE4DTN4R.mjs";
26
+ import {
27
+ USER_STORAGE_VERSION_KEY
28
+ } from "./chunk-6ZDVTRRT.mjs";
29
+ import {
30
+ __export,
31
+ __toESM
32
+ } from "./chunk-26CCETCM.mjs";
33
+
34
+ // src/NotificationServicesController/index.ts
35
+ var NotificationServicesController_exports = {};
36
+ __export(NotificationServicesController_exports, {
37
+ Constants: () => constants_exports,
38
+ Mocks: () => fixtures_exports,
39
+ NotificationServicesController: () => NotificationServicesController,
40
+ Processors: () => processors_exports,
41
+ Types: () => types_exports,
42
+ defaultState: () => defaultState
43
+ });
44
+
45
+ // src/NotificationServicesController/__fixtures__/index.ts
46
+ var fixtures_exports = {};
47
+ __export(fixtures_exports, {
48
+ CONTENTFUL_RESPONSE: () => CONTENTFUL_RESPONSE,
49
+ MOCK_RAW_ON_CHAIN_NOTIFICATIONS: () => MOCK_RAW_ON_CHAIN_NOTIFICATIONS,
50
+ MOCK_USER_STORAGE_ACCOUNT: () => MOCK_USER_STORAGE_ACCOUNT,
51
+ MOCK_USER_STORAGE_CHAIN: () => MOCK_USER_STORAGE_CHAIN,
52
+ createMockFeatureAnnouncementAPIResult: () => createMockFeatureAnnouncementAPIResult,
53
+ createMockFeatureAnnouncementRaw: () => createMockFeatureAnnouncementRaw,
54
+ createMockFullUserStorage: () => createMockFullUserStorage,
55
+ createMockNotificationERC1155Received: () => createMockNotificationERC1155Received,
56
+ createMockNotificationERC1155Sent: () => createMockNotificationERC1155Sent,
57
+ createMockNotificationERC20Received: () => createMockNotificationERC20Received,
58
+ createMockNotificationERC20Sent: () => createMockNotificationERC20Sent,
59
+ createMockNotificationERC721Received: () => createMockNotificationERC721Received,
60
+ createMockNotificationERC721Sent: () => createMockNotificationERC721Sent,
61
+ createMockNotificationEthReceived: () => createMockNotificationEthReceived,
62
+ createMockNotificationEthSent: () => createMockNotificationEthSent,
63
+ createMockNotificationLidoReadyToBeWithdrawn: () => createMockNotificationLidoReadyToBeWithdrawn,
64
+ createMockNotificationLidoStakeCompleted: () => createMockNotificationLidoStakeCompleted,
65
+ createMockNotificationLidoWithdrawalCompleted: () => createMockNotificationLidoWithdrawalCompleted,
66
+ createMockNotificationLidoWithdrawalRequested: () => createMockNotificationLidoWithdrawalRequested,
67
+ createMockNotificationMetaMaskSwapsCompleted: () => createMockNotificationMetaMaskSwapsCompleted,
68
+ createMockNotificationRocketPoolStakeCompleted: () => createMockNotificationRocketPoolStakeCompleted,
69
+ createMockNotificationRocketPoolUnStakeCompleted: () => createMockNotificationRocketPoolUnStakeCompleted,
70
+ createMockNotificationTrigger: () => createMockNotificationTrigger,
71
+ createMockRawOnChainNotifications: () => createMockRawOnChainNotifications,
72
+ createMockUserStorage: () => createMockUserStorage,
73
+ createMockUserStorageWithTriggers: () => createMockUserStorageWithTriggers,
74
+ getMockBatchCreateTriggersResponse: () => getMockBatchCreateTriggersResponse,
75
+ getMockBatchDeleteTriggersResponse: () => getMockBatchDeleteTriggersResponse,
76
+ getMockFeatureAnnouncementResponse: () => getMockFeatureAnnouncementResponse,
77
+ getMockListNotificationsResponse: () => getMockListNotificationsResponse,
78
+ getMockMarkNotificationsAsReadResponse: () => getMockMarkNotificationsAsReadResponse,
79
+ mockBatchCreateTriggers: () => mockBatchCreateTriggers,
80
+ mockBatchDeleteTriggers: () => mockBatchDeleteTriggers,
81
+ mockFetchFeatureAnnouncementNotifications: () => mockFetchFeatureAnnouncementNotifications,
82
+ mockListNotifications: () => mockListNotifications,
83
+ mockMarkNotificationsAsRead: () => mockMarkNotificationsAsRead
84
+ });
85
+
86
+ // src/NotificationServicesController/__fixtures__/mock-feature-announcements.ts
87
+ function createMockFeatureAnnouncementAPIResult() {
88
+ return {
89
+ sys: {
90
+ type: "Array"
91
+ },
92
+ total: 17,
93
+ skip: 0,
94
+ limit: 1,
95
+ items: [
96
+ {
97
+ metadata: {
98
+ tags: []
99
+ },
100
+ sys: {
101
+ space: {
102
+ sys: {
103
+ type: "Link",
104
+ linkType: "Space",
105
+ id: "jdkgyfmyd9sw"
106
+ }
107
+ },
108
+ id: "1ABRmHaNCgmxROKXXLXsMu",
109
+ type: "Entry",
110
+ createdAt: "2024-04-09T13:24:01.872Z",
111
+ updatedAt: "2024-04-09T13:24:01.872Z",
112
+ environment: {
113
+ sys: {
114
+ id: "master",
115
+ type: "Link",
116
+ linkType: "Environment"
117
+ }
118
+ },
119
+ revision: 1,
120
+ contentType: {
121
+ sys: {
122
+ type: "Link",
123
+ linkType: "ContentType",
124
+ id: "productAnnouncement"
125
+ }
126
+ },
127
+ locale: "en-US"
128
+ },
129
+ fields: {
130
+ title: "Don\u2019t miss out on airdrops and new NFT mints!",
131
+ id: "dont-miss-out-on-airdrops-and-new-nft-mints",
132
+ category: "ANNOUNCEMENT",
133
+ shortDescription: "Check your airdrop eligibility and see trending NFT drops. Head over to the Explore tab to get started. ",
134
+ image: {
135
+ sys: {
136
+ type: "Link",
137
+ linkType: "Asset",
138
+ id: "5jqq8sFeLc6XEoeWlpI3aB"
139
+ }
140
+ },
141
+ longDescription: {
142
+ data: {},
143
+ content: [
144
+ {
145
+ data: {},
146
+ content: [
147
+ {
148
+ data: {},
149
+ marks: [],
150
+ value: "You can now verify if any of your connected addresses are eligible for airdrops and other ERC-20 claims in a secure and convenient way. We\u2019ve also added trending NFT mints based on creators you\u2019ve minted from before or other tokens you hold. Head over to the Explore tab to get started. \n",
151
+ nodeType: "text"
152
+ }
153
+ ],
154
+ nodeType: "paragraph"
155
+ }
156
+ ],
157
+ nodeType: "document"
158
+ },
159
+ link: {
160
+ sys: {
161
+ type: "Link",
162
+ linkType: "Entry",
163
+ id: "62xKYM2ydo4F1mS5q97K5q"
164
+ }
165
+ }
166
+ }
167
+ }
168
+ ],
169
+ includes: {
170
+ Entry: [
171
+ {
172
+ metadata: {
173
+ tags: []
174
+ },
175
+ sys: {
176
+ space: {
177
+ sys: {
178
+ type: "Link",
179
+ linkType: "Space",
180
+ id: "jdkgyfmyd9sw"
181
+ }
182
+ },
183
+ id: "62xKYM2ydo4F1mS5q97K5q",
184
+ type: "Entry",
185
+ createdAt: "2024-04-09T13:23:03.636Z",
186
+ updatedAt: "2024-04-09T13:23:03.636Z",
187
+ environment: {
188
+ sys: {
189
+ id: "master",
190
+ type: "Link",
191
+ linkType: "Environment"
192
+ }
193
+ },
194
+ revision: 1,
195
+ contentType: {
196
+ sys: {
197
+ type: "Link",
198
+ linkType: "ContentType",
199
+ id: "link"
200
+ }
201
+ },
202
+ locale: "en-US"
203
+ },
204
+ fields: {
205
+ extensionLinkText: "Try now",
206
+ extensionLinkRoute: "home.html"
207
+ }
208
+ }
209
+ ],
210
+ Asset: [
211
+ {
212
+ metadata: {
213
+ tags: []
214
+ },
215
+ sys: {
216
+ space: {
217
+ sys: {
218
+ type: "Link",
219
+ linkType: "Space",
220
+ id: "jdkgyfmyd9sw"
221
+ }
222
+ },
223
+ id: "5jqq8sFeLc6XEoeWlpI3aB",
224
+ type: "Asset",
225
+ createdAt: "2024-04-09T13:23:13.327Z",
226
+ updatedAt: "2024-04-09T13:23:13.327Z",
227
+ environment: {
228
+ sys: {
229
+ id: "master",
230
+ type: "Link",
231
+ linkType: "Environment"
232
+ }
233
+ },
234
+ revision: 1,
235
+ locale: "en-US"
236
+ },
237
+ fields: {
238
+ title: "PDAPP notification image Airdrops & NFT mints",
239
+ description: "",
240
+ file: {
241
+ url: "//images.ctfassets.net/jdkgyfmyd9sw/5jqq8sFeLc6XEoeWlpI3aB/73ee0f1afa9916c3a7538b0bbee09c26/PDAPP_notification_image_Airdrops___NFT_mints.png",
242
+ details: {
243
+ size: 797731,
244
+ image: {
245
+ width: 2880,
246
+ height: 1921
247
+ }
248
+ },
249
+ fileName: "PDAPP notification image_Airdrops & NFT mints.png",
250
+ contentType: "image/png"
251
+ }
252
+ }
253
+ }
254
+ ]
255
+ }
256
+ };
257
+ }
258
+ function createMockFeatureAnnouncementRaw() {
259
+ return {
260
+ type: "features_announcement" /* FEATURES_ANNOUNCEMENT */,
261
+ createdAt: "2999-04-09T13:24:01.872Z",
262
+ data: {
263
+ id: "dont-miss-out-on-airdrops-and-new-nft-mints",
264
+ category: "ANNOUNCEMENT",
265
+ title: "Don\u2019t miss out on airdrops and new NFT mints!",
266
+ longDescription: `<p>You can now verify if any of your connected addresses are eligible for airdrops and other ERC-20 claims in a secure and convenient way. We\u2019ve also added trending NFT mints based on creators you\u2019ve minted from before or other tokens you hold. Head over to the Explore tab to get started.</p>`,
267
+ shortDescription: "Check your airdrop eligibility and see trending NFT drops. Head over to the Explore tab to get started.",
268
+ image: {
269
+ title: "PDAPP notification image Airdrops & NFT mints",
270
+ description: "",
271
+ url: "//images.ctfassets.net/jdkgyfmyd9sw/5jqq8sFeLc6XEoeWlpI3aB/73ee0f1afa9916c3a7538b0bbee09c26/PDAPP_notification_image_Airdrops___NFT_mints.png"
272
+ },
273
+ extensionLink: {
274
+ extensionLinkText: "Try now",
275
+ extensionLinkRoute: "home.html"
276
+ }
277
+ }
278
+ };
279
+ }
280
+
281
+ // src/NotificationServicesController/__fixtures__/mock-notification-trigger.ts
282
+ import { v4 as uuidv4 } from "uuid";
283
+ function createMockNotificationTrigger(override) {
284
+ return {
285
+ id: uuidv4(),
286
+ address: "0xFAKE_ADDRESS",
287
+ chainId: "1",
288
+ kind: "eth_sent",
289
+ enabled: true,
290
+ ...override
291
+ };
292
+ }
293
+
294
+ // src/NotificationServicesController/__fixtures__/mock-notification-user-storage.ts
295
+ var MOCK_USER_STORAGE_ACCOUNT = "0x0000000000000000000000000000000000000000";
296
+ var MOCK_USER_STORAGE_CHAIN = "1";
297
+ function createMockUserStorage(override) {
298
+ return {
299
+ [USER_STORAGE_VERSION_KEY]: "1",
300
+ [MOCK_USER_STORAGE_ACCOUNT]: {
301
+ [MOCK_USER_STORAGE_CHAIN]: {
302
+ "111-111-111-111": {
303
+ k: "erc20_received" /* ERC20_RECEIVED */,
304
+ e: true
305
+ },
306
+ "222-222-222-222": {
307
+ k: "erc20_sent" /* ERC20_SENT */,
308
+ e: true
309
+ }
310
+ }
311
+ },
312
+ ...override
313
+ };
314
+ }
315
+ function createMockUserStorageWithTriggers(triggers) {
316
+ const userStorage = {
317
+ [USER_STORAGE_VERSION_KEY]: "1",
318
+ [MOCK_USER_STORAGE_ACCOUNT]: {
319
+ [MOCK_USER_STORAGE_CHAIN]: {}
320
+ }
321
+ };
322
+ triggers.forEach((t) => {
323
+ let tId;
324
+ let e;
325
+ let k;
326
+ if (typeof t === "string") {
327
+ tId = t;
328
+ e = true;
329
+ k = "erc20_received" /* ERC20_RECEIVED */;
330
+ } else {
331
+ tId = t.id;
332
+ e = t.e;
333
+ k = t.k ?? "erc20_received" /* ERC20_RECEIVED */;
334
+ }
335
+ userStorage[MOCK_USER_STORAGE_ACCOUNT][MOCK_USER_STORAGE_CHAIN][tId] = {
336
+ k,
337
+ e
338
+ };
339
+ });
340
+ return userStorage;
341
+ }
342
+ function createMockFullUserStorage(props = {}) {
343
+ return initializeUserStorage(
344
+ [{ address: props.address ?? MOCK_USER_STORAGE_ACCOUNT }],
345
+ props.triggersEnabled ?? true
346
+ );
347
+ }
348
+
349
+ // src/NotificationServicesController/__fixtures__/mock-raw-notifications.ts
350
+ function createMockNotificationEthSent() {
351
+ const mockNotification = {
352
+ type: "eth_sent" /* ETH_SENT */,
353
+ id: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
354
+ trigger_id: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
355
+ chain_id: 1,
356
+ block_number: 17485840,
357
+ block_timestamp: "2022-03-01T00:00:00Z",
358
+ tx_hash: "0x881D40237659C251811CEC9c364ef91dC08D300C",
359
+ unread: true,
360
+ created_at: "2022-03-01T00:00:00Z",
361
+ address: "0x881D40237659C251811CEC9c364ef91dC08D300C",
362
+ data: {
363
+ kind: "eth_sent",
364
+ network_fee: {
365
+ gas_price: "207806259583",
366
+ native_token_price_in_usd: "0.83"
367
+ },
368
+ from: "0x881D40237659C251811CEC9c364ef91dC08D300C",
369
+ to: "0x881D40237659C251811CEC9c364ef91dC08D300D",
370
+ amount: {
371
+ usd: "670.64",
372
+ eth: "0.005"
373
+ }
374
+ }
375
+ };
376
+ return mockNotification;
377
+ }
378
+ function createMockNotificationEthReceived() {
379
+ const mockNotification = {
380
+ type: "eth_received" /* ETH_RECEIVED */,
381
+ id: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
382
+ trigger_id: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
383
+ chain_id: 1,
384
+ block_number: 17485840,
385
+ block_timestamp: "2022-03-01T00:00:00Z",
386
+ tx_hash: "0x881D40237659C251811CEC9c364ef91dC08D300C",
387
+ unread: true,
388
+ created_at: "2022-03-01T00:00:00Z",
389
+ address: "0x881D40237659C251811CEC9c364ef91dC08D300C",
390
+ data: {
391
+ kind: "eth_received",
392
+ network_fee: {
393
+ gas_price: "207806259583",
394
+ native_token_price_in_usd: "0.83"
395
+ },
396
+ from: "0x881D40237659C251811CEC9c364ef91dC08D300C",
397
+ to: "0x881D40237659C251811CEC9c364ef91dC08D300D",
398
+ amount: {
399
+ usd: "670.64",
400
+ eth: "808.000000000000000000"
401
+ }
402
+ }
403
+ };
404
+ return mockNotification;
405
+ }
406
+ function createMockNotificationERC20Sent() {
407
+ const mockNotification = {
408
+ type: "erc20_sent" /* ERC20_SENT */,
409
+ id: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
410
+ trigger_id: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
411
+ chain_id: 1,
412
+ block_number: 17485840,
413
+ block_timestamp: "2022-03-01T00:00:00Z",
414
+ tx_hash: "0x881D40237659C251811CEC9c364ef91dC08D300C",
415
+ unread: true,
416
+ created_at: "2022-03-01T00:00:00Z",
417
+ address: "0x881D40237659C251811CEC9c364ef91dC08D300C",
418
+ data: {
419
+ kind: "erc20_sent",
420
+ network_fee: {
421
+ gas_price: "207806259583",
422
+ native_token_price_in_usd: "0.83"
423
+ },
424
+ to: "0xecc19e177d24551aa7ed6bc6fe566eca726cc8a9",
425
+ from: "0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae",
426
+ token: {
427
+ usd: "1.00",
428
+ name: "USDC",
429
+ image: "https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/usdc.svg",
430
+ amount: "4956250000",
431
+ symbol: "USDC",
432
+ address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
433
+ decimals: "6"
434
+ }
435
+ }
436
+ };
437
+ return mockNotification;
438
+ }
439
+ function createMockNotificationERC20Received() {
440
+ const mockNotification = {
441
+ type: "erc20_received" /* ERC20_RECEIVED */,
442
+ id: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
443
+ trigger_id: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
444
+ chain_id: 1,
445
+ block_number: 17485840,
446
+ block_timestamp: "2022-03-01T00:00:00Z",
447
+ tx_hash: "0x881D40237659C251811CEC9c364ef91dC08D300C",
448
+ unread: true,
449
+ created_at: "2022-03-01T00:00:00Z",
450
+ address: "0x881D40237659C251811CEC9c364ef91dC08D300C",
451
+ data: {
452
+ kind: "erc20_received",
453
+ network_fee: {
454
+ gas_price: "207806259583",
455
+ native_token_price_in_usd: "0.83"
456
+ },
457
+ to: "0xeae7380dd4cef6fbd1144f49e4d1e6964258a4f4",
458
+ from: "0x51c72848c68a965f66fa7a88855f9f7784502a7f",
459
+ token: {
460
+ usd: "0.00",
461
+ name: "SHIBA INU",
462
+ image: "https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/shib.svg",
463
+ amount: "8382798736999999457296646144",
464
+ symbol: "SHIB",
465
+ address: "0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce",
466
+ decimals: "18"
467
+ }
468
+ }
469
+ };
470
+ return mockNotification;
471
+ }
472
+ function createMockNotificationERC721Sent() {
473
+ const mockNotification = {
474
+ type: "erc721_sent" /* ERC721_SENT */,
475
+ block_number: 18576643,
476
+ block_timestamp: "1700043467",
477
+ chain_id: 1,
478
+ created_at: "2023-11-15T11:08:17.895407Z",
479
+ address: "0x881D40237659C251811CEC9c364ef91dC08D300C",
480
+ data: {
481
+ to: "0xf47f628fe3bd2595e9ab384bfffc3859b448e451",
482
+ nft: {
483
+ name: "Captainz #8680",
484
+ image: "https://i.seadn.io/s/raw/files/ae0fc06714ff7fb40217340d8a242c0e.gif?w=500&auto=format",
485
+ token_id: "8680",
486
+ collection: {
487
+ name: "The Captainz",
488
+ image: "https://i.seadn.io/gcs/files/6df4d75778066bce740050615bc84e21.png?w=500&auto=format",
489
+ symbol: "Captainz",
490
+ address: "0x769272677fab02575e84945f03eca517acc544cc"
491
+ }
492
+ },
493
+ from: "0x24a0bb54b7e7a8e406e9b28058a9fd6c49e6df4f",
494
+ kind: "erc721_sent",
495
+ network_fee: {
496
+ gas_price: "24550653274",
497
+ native_token_price_in_usd: "1986.61"
498
+ }
499
+ },
500
+ id: "a4193058-9814-537e-9df4-79dcac727fb6",
501
+ trigger_id: "028485be-b994-422b-a93b-03fcc01ab715",
502
+ tx_hash: "0x0833c69fb41cf972a0f031fceca242939bc3fcf82b964b74606649abcad371bd",
503
+ unread: true
504
+ };
505
+ return mockNotification;
506
+ }
507
+ function createMockNotificationERC721Received() {
508
+ const mockNotification = {
509
+ type: "erc721_received" /* ERC721_RECEIVED */,
510
+ block_number: 18571446,
511
+ block_timestamp: "1699980623",
512
+ chain_id: 1,
513
+ created_at: "2023-11-14T17:40:52.319281Z",
514
+ address: "0x881D40237659C251811CEC9c364ef91dC08D300C",
515
+ data: {
516
+ to: "0xba7f3daa8adfdad686574406ab9bd5d2f0a49d2e",
517
+ nft: {
518
+ name: "The Plague #2722",
519
+ image: "https://i.seadn.io/s/raw/files/a96f90ec8ebf55a2300c66a0c46d6a16.png?w=500&auto=format",
520
+ token_id: "2722",
521
+ collection: {
522
+ name: "The Plague NFT",
523
+ image: "https://i.seadn.io/gcs/files/4577987a5ca45ca5118b2e31559ee4d1.jpg?w=500&auto=format",
524
+ symbol: "FROG",
525
+ address: "0xc379e535caff250a01caa6c3724ed1359fe5c29b"
526
+ }
527
+ },
528
+ from: "0x24a0bb54b7e7a8e406e9b28058a9fd6c49e6df4f",
529
+ kind: "erc721_received",
530
+ network_fee: {
531
+ gas_price: "53701898538",
532
+ native_token_price_in_usd: "2047.01"
533
+ }
534
+ },
535
+ id: "00a79d24-befa-57ed-a55a-9eb8696e1654",
536
+ trigger_id: "d24ac26a-8579-49ec-9947-d04d63592ebd",
537
+ tx_hash: "0xe554c9e29e6eeca8ba94da4d047334ba08b8eb9ca3b801dd69cec08dfdd4ae43",
538
+ unread: true
539
+ };
540
+ return mockNotification;
541
+ }
542
+ function createMockNotificationERC1155Sent() {
543
+ const mockNotification = {
544
+ type: "erc1155_sent" /* ERC1155_SENT */,
545
+ block_number: 18615206,
546
+ block_timestamp: "1700510003",
547
+ chain_id: 1,
548
+ created_at: "2023-11-20T20:44:10.110706Z",
549
+ address: "0x881D40237659C251811CEC9c364ef91dC08D300C",
550
+ data: {
551
+ to: "0x15bd77ccacf2da39b84f0c31fee2e451225bb190",
552
+ nft: {
553
+ name: "IlluminatiNFT DAO",
554
+ image: "https://i.seadn.io/gcs/files/79a77cb37c7b2f1069f752645d29fea7.jpg?w=500&auto=format",
555
+ token_id: "1",
556
+ collection: {
557
+ name: "IlluminatiNFT DAO",
558
+ image: "https://i.seadn.io/gae/LTKz3om2eCQfn3M6PkqEmY7KhLtdMCOm0QVch2318KJq7-KyToCH7NBTMo4UuJ0AZI-oaBh1HcgrAEIEWYbXY3uMcYpuGXunaXEh?w=500&auto=format",
559
+ symbol: "TRUTH",
560
+ address: "0xe25f0fe686477f9df3c2876c4902d3b85f75f33a"
561
+ }
562
+ },
563
+ from: "0x0000000000000000000000000000000000000000",
564
+ kind: "erc1155_sent",
565
+ network_fee: {
566
+ gas_price: "33571446596",
567
+ native_token_price_in_usd: "2038.88"
568
+ }
569
+ },
570
+ id: "a09ff9d1-623a-52ab-a3d4-c7c8c9a58362",
571
+ trigger_id: "e2130f7d-78b8-4c34-999a-3f3d3bb5b03c",
572
+ tx_hash: "0x03381aba290facbaf71c123e263c8dc3dd550aac00ef589cce395182eaeff76f",
573
+ unread: true
574
+ };
575
+ return mockNotification;
576
+ }
577
+ function createMockNotificationERC1155Received() {
578
+ const mockNotification = {
579
+ type: "erc1155_received" /* ERC1155_RECEIVED */,
580
+ block_number: 18615206,
581
+ block_timestamp: "1700510003",
582
+ chain_id: 1,
583
+ created_at: "2023-11-20T20:44:10.110706Z",
584
+ address: "0x881D40237659C251811CEC9c364ef91dC08D300C",
585
+ data: {
586
+ to: "0x15bd77ccacf2da39b84f0c31fee2e451225bb190",
587
+ nft: {
588
+ name: "IlluminatiNFT DAO",
589
+ image: "https://i.seadn.io/gcs/files/79a77cb37c7b2f1069f752645d29fea7.jpg?w=500&auto=format",
590
+ token_id: "1",
591
+ collection: {
592
+ name: "IlluminatiNFT DAO",
593
+ image: "https://i.seadn.io/gae/LTKz3om2eCQfn3M6PkqEmY7KhLtdMCOm0QVch2318KJq7-KyToCH7NBTMo4UuJ0AZI-oaBh1HcgrAEIEWYbXY3uMcYpuGXunaXEh?w=500&auto=format",
594
+ symbol: "TRUTH",
595
+ address: "0xe25f0fe686477f9df3c2876c4902d3b85f75f33a"
596
+ }
597
+ },
598
+ from: "0x0000000000000000000000000000000000000000",
599
+ kind: "erc1155_received",
600
+ network_fee: {
601
+ gas_price: "33571446596",
602
+ native_token_price_in_usd: "2038.88"
603
+ }
604
+ },
605
+ id: "b6b93c84-e8dc-54ed-9396-7ea50474843a",
606
+ trigger_id: "710c8abb-43a9-42a5-9d86-9dd258726c82",
607
+ tx_hash: "0x03381aba290facbaf71c123e263c8dc3dd550aac00ef589cce395182eaeff76f",
608
+ unread: true
609
+ };
610
+ return mockNotification;
611
+ }
612
+ function createMockNotificationMetaMaskSwapsCompleted() {
613
+ const mockNotification = {
614
+ type: "metamask_swap_completed" /* METAMASK_SWAP_COMPLETED */,
615
+ block_number: 18377666,
616
+ block_timestamp: "1697637275",
617
+ chain_id: 1,
618
+ created_at: "2023-10-18T13:58:49.854596Z",
619
+ address: "0x881D40237659C251811CEC9c364ef91dC08D300C",
620
+ data: {
621
+ kind: "metamask_swap_completed",
622
+ rate: "1558.27",
623
+ token_in: {
624
+ usd: "1576.73",
625
+ image: "https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg",
626
+ amount: "9000000000000000",
627
+ symbol: "ETH",
628
+ address: "0x0000000000000000000000000000000000000000",
629
+ decimals: "18",
630
+ name: "Ethereum"
631
+ },
632
+ token_out: {
633
+ usd: "1.00",
634
+ image: "https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/usdt.svg",
635
+ amount: "14024419",
636
+ symbol: "USDT",
637
+ address: "0xdac17f958d2ee523a2206206994597c13d831ec7",
638
+ decimals: "6",
639
+ name: "USDT"
640
+ },
641
+ network_fee: {
642
+ gas_price: "15406129273",
643
+ native_token_price_in_usd: "1576.73"
644
+ }
645
+ },
646
+ id: "7ddfe6a1-ac52-5ffe-aa40-f04242db4b8b",
647
+ trigger_id: "d2eaa2eb-2e6e-4fd5-8763-b70ea571b46c",
648
+ tx_hash: "0xf69074290f3aa11bce567aabc9ca0df7a12559dfae1b80ba1a124e9dfe19ecc5",
649
+ unread: true
650
+ };
651
+ return mockNotification;
652
+ }
653
+ function createMockNotificationRocketPoolStakeCompleted() {
654
+ const mockNotification = {
655
+ type: "rocketpool_stake_completed" /* ROCKETPOOL_STAKE_COMPLETED */,
656
+ block_number: 18585057,
657
+ block_timestamp: "1700145059",
658
+ chain_id: 1,
659
+ created_at: "2023-11-20T12:02:48.796824Z",
660
+ address: "0x881D40237659C251811CEC9c364ef91dC08D300C",
661
+ data: {
662
+ kind: "rocketpool_stake_completed",
663
+ stake_in: {
664
+ usd: "2031.86",
665
+ name: "Ethereum",
666
+ image: "https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg",
667
+ amount: "190690478063438272",
668
+ symbol: "ETH",
669
+ address: "0x0000000000000000000000000000000000000000",
670
+ decimals: "18"
671
+ },
672
+ stake_out: {
673
+ usd: "2226.49",
674
+ name: "Rocket Pool ETH",
675
+ image: "https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/rETH.svg",
676
+ amount: "175024360778165879",
677
+ symbol: "RETH",
678
+ address: "0xae78736Cd615f374D3085123A210448E74Fc6393",
679
+ decimals: "18"
680
+ },
681
+ network_fee: {
682
+ gas_price: "36000000000",
683
+ native_token_price_in_usd: "2031.86"
684
+ }
685
+ },
686
+ id: "c2a2f225-b2fb-5d6c-ba56-e27a5c71ffb9",
687
+ trigger_id: "5110ff97-acff-40c0-83b4-11d487b8c7b0",
688
+ tx_hash: "0xcfc0693bf47995907b0f46ef0644cf16dd9a0de797099b2e00fd481e1b2117d3",
689
+ unread: true
690
+ };
691
+ return mockNotification;
692
+ }
693
+ function createMockNotificationRocketPoolUnStakeCompleted() {
694
+ const mockNotification = {
695
+ type: "rocketpool_unstake_completed" /* ROCKETPOOL_UNSTAKE_COMPLETED */,
696
+ block_number: 18384336,
697
+ block_timestamp: "1697718011",
698
+ chain_id: 1,
699
+ created_at: "2023-10-19T13:11:10.623042Z",
700
+ address: "0x881D40237659C251811CEC9c364ef91dC08D300C",
701
+ data: {
702
+ kind: "rocketpool_unstake_completed",
703
+ stake_in: {
704
+ usd: "1686.34",
705
+ image: "https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/rETH.svg",
706
+ amount: "66608041413696770",
707
+ symbol: "RETH",
708
+ address: "0xae78736Cd615f374D3085123A210448E74Fc6393",
709
+ decimals: "18",
710
+ name: "Rocketpool Eth"
711
+ },
712
+ stake_out: {
713
+ usd: "1553.75",
714
+ image: "https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg",
715
+ amount: "72387843427700824",
716
+ symbol: "ETH",
717
+ address: "0x0000000000000000000000000000000000000000",
718
+ decimals: "18",
719
+ name: "Ethereum"
720
+ },
721
+ network_fee: {
722
+ gas_price: "5656322987",
723
+ native_token_price_in_usd: "1553.75"
724
+ }
725
+ },
726
+ id: "d8c246e7-a0a4-5f1d-b079-2b1707665fbc",
727
+ trigger_id: "291ec897-f569-4837-b6c0-21001b198dff",
728
+ tx_hash: "0xc7972a7e409abfc62590ec90e633acd70b9b74e76ad02305be8bf133a0e22d5f",
729
+ unread: true
730
+ };
731
+ return mockNotification;
732
+ }
733
+ function createMockNotificationLidoStakeCompleted() {
734
+ const mockNotification = {
735
+ type: "lido_stake_completed" /* LIDO_STAKE_COMPLETED */,
736
+ block_number: 18487118,
737
+ block_timestamp: "1698961091",
738
+ chain_id: 1,
739
+ created_at: "2023-11-02T22:28:49.970865Z",
740
+ address: "0x881D40237659C251811CEC9c364ef91dC08D300C",
741
+ data: {
742
+ kind: "lido_stake_completed",
743
+ stake_in: {
744
+ usd: "1806.33",
745
+ name: "Ethereum",
746
+ image: "https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg",
747
+ amount: "330303634023928032",
748
+ symbol: "ETH",
749
+ address: "0x0000000000000000000000000000000000000000",
750
+ decimals: "18"
751
+ },
752
+ stake_out: {
753
+ usd: "1801.30",
754
+ name: "Liquid staked Ether 2.0",
755
+ image: "https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/stETH.svg",
756
+ amount: "330303634023928032",
757
+ symbol: "STETH",
758
+ address: "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
759
+ decimals: "18"
760
+ },
761
+ network_fee: {
762
+ gas_price: "26536359866",
763
+ native_token_price_in_usd: "1806.33"
764
+ }
765
+ },
766
+ id: "9d9b1467-b3ee-5492-8ca2-22382657b690",
767
+ trigger_id: "ec10d66a-f78f-461f-83c9-609aada8cc50",
768
+ tx_hash: "0x8cc0fa805f7c3b1743b14f3b91c6b824113b094f26d4ccaf6a71ad8547ce6a0f",
769
+ unread: true
770
+ };
771
+ return mockNotification;
772
+ }
773
+ function createMockNotificationLidoWithdrawalRequested() {
774
+ const mockNotification = {
775
+ type: "lido_withdrawal_requested" /* LIDO_WITHDRAWAL_REQUESTED */,
776
+ block_number: 18377760,
777
+ block_timestamp: "1697638415",
778
+ chain_id: 1,
779
+ created_at: "2023-10-18T15:04:02.482526Z",
780
+ address: "0x881D40237659C251811CEC9c364ef91dC08D300C",
781
+ data: {
782
+ kind: "lido_withdrawal_requested",
783
+ stake_in: {
784
+ usd: "1568.54",
785
+ image: "https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/stETH.svg",
786
+ amount: "97180668792218669859",
787
+ symbol: "STETH",
788
+ address: "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
789
+ decimals: "18",
790
+ name: "Staked Eth"
791
+ },
792
+ stake_out: {
793
+ usd: "1576.73",
794
+ image: "https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg",
795
+ amount: "97180668792218669859",
796
+ symbol: "ETH",
797
+ address: "0x0000000000000000000000000000000000000000",
798
+ decimals: "18",
799
+ name: "Ethereum"
800
+ },
801
+ network_fee: {
802
+ gas_price: "11658906980",
803
+ native_token_price_in_usd: "1576.73"
804
+ }
805
+ },
806
+ id: "29ddc718-78c6-5f91-936f-2bef13a605f0",
807
+ trigger_id: "ef003925-3379-4ba7-9e2d-8218690cadc8",
808
+ tx_hash: "0x58b5f82e084cb750ea174e02b20fbdfd2ba8d78053deac787f34fc38e5d427aa",
809
+ unread: true
810
+ };
811
+ return mockNotification;
812
+ }
813
+ function createMockNotificationLidoWithdrawalCompleted() {
814
+ const mockNotification = {
815
+ type: "lido_withdrawal_completed" /* LIDO_WITHDRAWAL_COMPLETED */,
816
+ block_number: 18378208,
817
+ block_timestamp: "1697643851",
818
+ chain_id: 1,
819
+ created_at: "2023-10-18T16:35:03.147606Z",
820
+ address: "0x881D40237659C251811CEC9c364ef91dC08D300C",
821
+ data: {
822
+ kind: "lido_withdrawal_completed",
823
+ stake_in: {
824
+ usd: "1570.23",
825
+ image: "https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/stETH.svg",
826
+ amount: "35081997661451346",
827
+ symbol: "STETH",
828
+ address: "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
829
+ decimals: "18",
830
+ name: "Staked Eth"
831
+ },
832
+ stake_out: {
833
+ usd: "1571.74",
834
+ image: "https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg",
835
+ amount: "35081997661451346",
836
+ symbol: "ETH",
837
+ address: "0x0000000000000000000000000000000000000000",
838
+ decimals: "18",
839
+ name: "Ethereum"
840
+ },
841
+ network_fee: {
842
+ gas_price: "12699495150",
843
+ native_token_price_in_usd: "1571.74"
844
+ }
845
+ },
846
+ id: "f4ef0b7f-5612-537f-9144-0b5c63ae5391",
847
+ trigger_id: "d73df14d-ce73-4f38-bad3-ab028154042c",
848
+ tx_hash: "0xe6d210d2e601ef3dd1075c48e71452cf35f2daae3886911e964e3babad8ac657",
849
+ unread: true
850
+ };
851
+ return mockNotification;
852
+ }
853
+ function createMockNotificationLidoReadyToBeWithdrawn() {
854
+ const mockNotification = {
855
+ type: "lido_stake_ready_to_be_withdrawn" /* LIDO_STAKE_READY_TO_BE_WITHDRAWN */,
856
+ block_number: 18378208,
857
+ block_timestamp: "1697643851",
858
+ chain_id: 1,
859
+ created_at: "2023-10-18T16:35:03.147606Z",
860
+ address: "0x881D40237659C251811CEC9c364ef91dC08D300C",
861
+ data: {
862
+ kind: "lido_stake_ready_to_be_withdrawn",
863
+ request_id: "123456789",
864
+ staked_eth: {
865
+ address: "0x881D40237659C251811CEC9c364ef91dC08D300F",
866
+ symbol: "ETH",
867
+ name: "Ethereum",
868
+ amount: "2.5",
869
+ decimals: "18",
870
+ image: "https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg",
871
+ usd: "10000.00"
872
+ }
873
+ },
874
+ id: "f4ef0b7f-5612-537f-9144-0b5c63ae5391",
875
+ trigger_id: "d73df14d-ce73-4f38-bad3-ab028154042c",
876
+ tx_hash: "0xe6d210d2e601ef3dd1075c48e71452cf35f2daae3886911e964e3babad8ac657",
877
+ unread: true
878
+ };
879
+ return mockNotification;
880
+ }
881
+ function createMockRawOnChainNotifications() {
882
+ return [1, 2, 3].map((id) => {
883
+ const notification = createMockNotificationEthSent();
884
+ notification.id += `-${id}`;
885
+ return notification;
886
+ });
887
+ }
888
+
889
+ // src/NotificationServicesController/__fixtures__/mockResponses.ts
890
+ var CONTENTFUL_RESPONSE = createMockFeatureAnnouncementAPIResult();
891
+ var getMockFeatureAnnouncementResponse = () => {
892
+ return {
893
+ url: FEATURE_ANNOUNCEMENT_API,
894
+ requestMethod: "GET",
895
+ response: CONTENTFUL_RESPONSE
896
+ };
897
+ };
898
+ var getMockBatchCreateTriggersResponse = () => {
899
+ return {
900
+ url: TRIGGER_API_BATCH_ENDPOINT,
901
+ requestMethod: "POST",
902
+ response: null
903
+ };
904
+ };
905
+ var getMockBatchDeleteTriggersResponse = () => {
906
+ return {
907
+ url: TRIGGER_API_BATCH_ENDPOINT,
908
+ requestMethod: "DELETE",
909
+ response: null
910
+ };
911
+ };
912
+ var MOCK_RAW_ON_CHAIN_NOTIFICATIONS = createMockRawOnChainNotifications();
913
+ var getMockListNotificationsResponse = () => {
914
+ return {
915
+ url: NOTIFICATION_API_LIST_ENDPOINT,
916
+ requestMethod: "POST",
917
+ response: MOCK_RAW_ON_CHAIN_NOTIFICATIONS
918
+ };
919
+ };
920
+ var getMockMarkNotificationsAsReadResponse = () => {
921
+ return {
922
+ url: NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT,
923
+ requestMethod: "POST",
924
+ response: null
925
+ };
926
+ };
927
+
928
+ // src/NotificationServicesController/__fixtures__/mockServices.ts
929
+ var import_nock = __toESM(require_nock());
930
+ var mockFetchFeatureAnnouncementNotifications = (mockReply) => {
931
+ const mockResponse = getMockFeatureAnnouncementResponse();
932
+ const reply = mockReply ?? { status: 200, body: mockResponse.response };
933
+ const mockEndpoint = (0, import_nock.default)(mockResponse.url).get("").query(true).reply(reply.status, reply.body);
934
+ return mockEndpoint;
935
+ };
936
+ var mockBatchCreateTriggers = (mockReply) => {
937
+ const mockResponse = getMockBatchCreateTriggersResponse();
938
+ const reply = mockReply ?? { status: 204 };
939
+ const mockEndpoint = (0, import_nock.default)(mockResponse.url).post("").reply(reply.status, reply.body);
940
+ return mockEndpoint;
941
+ };
942
+ var mockBatchDeleteTriggers = (mockReply) => {
943
+ const mockResponse = getMockBatchDeleteTriggersResponse();
944
+ const reply = mockReply ?? { status: 204 };
945
+ const mockEndpoint = (0, import_nock.default)(mockResponse.url).delete("").reply(reply.status, reply.body);
946
+ return mockEndpoint;
947
+ };
948
+ var mockListNotifications = (mockReply) => {
949
+ const mockResponse = getMockListNotificationsResponse();
950
+ const reply = mockReply ?? { status: 200, body: mockResponse.response };
951
+ const mockEndpoint = (0, import_nock.default)(mockResponse.url).post("").query(true).reply(reply.status, reply.body);
952
+ return mockEndpoint;
953
+ };
954
+ var mockMarkNotificationsAsRead = (mockReply) => {
955
+ const mockResponse = getMockMarkNotificationsAsReadResponse();
956
+ const reply = mockReply ?? { status: 200 };
957
+ const mockEndpoint = (0, import_nock.default)(mockResponse.url).post("").reply(reply.status, reply.body);
958
+ return mockEndpoint;
959
+ };
960
+
961
+ export {
962
+ fixtures_exports,
963
+ NotificationServicesController_exports
964
+ };
965
+ //# sourceMappingURL=chunk-G2ROCNJN.mjs.map