@metamask-previews/notification-services-controller 19.0.0-preview-7b698bb → 19.0.0-preview-ba016213

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 (187) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/NotificationServicesController/NotificationServicesController.cjs +17 -38
  3. package/dist/NotificationServicesController/NotificationServicesController.cjs.map +1 -1
  4. package/dist/NotificationServicesController/NotificationServicesController.d.cts +2 -2
  5. package/dist/NotificationServicesController/NotificationServicesController.d.cts.map +1 -1
  6. package/dist/NotificationServicesController/NotificationServicesController.d.mts +2 -2
  7. package/dist/NotificationServicesController/NotificationServicesController.d.mts.map +1 -1
  8. package/dist/NotificationServicesController/NotificationServicesController.mjs +17 -15
  9. package/dist/NotificationServicesController/NotificationServicesController.mjs.map +1 -1
  10. package/dist/NotificationServicesController/constants/notification-schema.cjs +4 -14
  11. package/dist/NotificationServicesController/constants/notification-schema.cjs.map +1 -1
  12. package/dist/NotificationServicesController/constants/notification-schema.d.cts +3 -13
  13. package/dist/NotificationServicesController/constants/notification-schema.d.cts.map +1 -1
  14. package/dist/NotificationServicesController/constants/notification-schema.d.mts +3 -13
  15. package/dist/NotificationServicesController/constants/notification-schema.d.mts.map +1 -1
  16. package/dist/NotificationServicesController/constants/notification-schema.mjs +3 -13
  17. package/dist/NotificationServicesController/constants/notification-schema.mjs.map +1 -1
  18. package/dist/NotificationServicesController/mocks/mock-raw-notifications.cjs +428 -530
  19. package/dist/NotificationServicesController/mocks/mock-raw-notifications.cjs.map +1 -1
  20. package/dist/NotificationServicesController/mocks/mock-raw-notifications.d.cts +20 -50
  21. package/dist/NotificationServicesController/mocks/mock-raw-notifications.d.cts.map +1 -1
  22. package/dist/NotificationServicesController/mocks/mock-raw-notifications.d.mts +20 -50
  23. package/dist/NotificationServicesController/mocks/mock-raw-notifications.d.mts.map +1 -1
  24. package/dist/NotificationServicesController/mocks/mock-raw-notifications.mjs +425 -522
  25. package/dist/NotificationServicesController/mocks/mock-raw-notifications.mjs.map +1 -1
  26. package/dist/NotificationServicesController/mocks/mockResponses.cjs +5 -5
  27. package/dist/NotificationServicesController/mocks/mockResponses.cjs.map +1 -1
  28. package/dist/NotificationServicesController/mocks/mockResponses.d.cts +2 -2
  29. package/dist/NotificationServicesController/mocks/mockResponses.d.cts.map +1 -1
  30. package/dist/NotificationServicesController/mocks/mockResponses.d.mts +2 -2
  31. package/dist/NotificationServicesController/mocks/mockResponses.d.mts.map +1 -1
  32. package/dist/NotificationServicesController/mocks/mockResponses.mjs +1 -1
  33. package/dist/NotificationServicesController/mocks/mockResponses.mjs.map +1 -1
  34. package/dist/NotificationServicesController/processors/index.cjs +1 -1
  35. package/dist/NotificationServicesController/processors/index.cjs.map +1 -1
  36. package/dist/NotificationServicesController/processors/index.d.cts +1 -1
  37. package/dist/NotificationServicesController/processors/index.d.cts.map +1 -1
  38. package/dist/NotificationServicesController/processors/index.d.mts +1 -1
  39. package/dist/NotificationServicesController/processors/index.d.mts.map +1 -1
  40. package/dist/NotificationServicesController/processors/index.mjs +1 -1
  41. package/dist/NotificationServicesController/processors/index.mjs.map +1 -1
  42. package/dist/NotificationServicesController/processors/process-api-notifications.cjs +22 -0
  43. package/dist/NotificationServicesController/processors/process-api-notifications.cjs.map +1 -0
  44. package/dist/NotificationServicesController/processors/process-api-notifications.d.cts +10 -0
  45. package/dist/NotificationServicesController/processors/process-api-notifications.d.cts.map +1 -0
  46. package/dist/NotificationServicesController/processors/process-api-notifications.d.mts +10 -0
  47. package/dist/NotificationServicesController/processors/process-api-notifications.d.mts.map +1 -0
  48. package/dist/NotificationServicesController/processors/process-api-notifications.mjs +18 -0
  49. package/dist/NotificationServicesController/processors/process-api-notifications.mjs.map +1 -0
  50. package/dist/NotificationServicesController/processors/process-feature-announcement.cjs +2 -7
  51. package/dist/NotificationServicesController/processors/process-feature-announcement.cjs.map +1 -1
  52. package/dist/NotificationServicesController/processors/process-feature-announcement.d.cts.map +1 -1
  53. package/dist/NotificationServicesController/processors/process-feature-announcement.d.mts.map +1 -1
  54. package/dist/NotificationServicesController/processors/process-feature-announcement.mjs +1 -6
  55. package/dist/NotificationServicesController/processors/process-feature-announcement.mjs.map +1 -1
  56. package/dist/NotificationServicesController/processors/process-notifications.cjs +3 -3
  57. package/dist/NotificationServicesController/processors/process-notifications.cjs.map +1 -1
  58. package/dist/NotificationServicesController/processors/process-notifications.d.cts +398 -458
  59. package/dist/NotificationServicesController/processors/process-notifications.d.cts.map +1 -1
  60. package/dist/NotificationServicesController/processors/process-notifications.d.mts +398 -458
  61. package/dist/NotificationServicesController/processors/process-notifications.d.mts.map +1 -1
  62. package/dist/NotificationServicesController/processors/process-notifications.mjs +4 -4
  63. package/dist/NotificationServicesController/processors/process-notifications.mjs.map +1 -1
  64. package/dist/NotificationServicesController/services/{onchain-notifications.cjs → api-notifications.cjs} +28 -15
  65. package/dist/NotificationServicesController/services/api-notifications.cjs.map +1 -0
  66. package/dist/NotificationServicesController/services/{onchain-notifications.d.cts → api-notifications.d.cts} +9 -7
  67. package/dist/NotificationServicesController/services/api-notifications.d.cts.map +1 -0
  68. package/dist/NotificationServicesController/services/{onchain-notifications.d.mts → api-notifications.d.mts} +9 -7
  69. package/dist/NotificationServicesController/services/api-notifications.d.mts.map +1 -0
  70. package/dist/NotificationServicesController/services/{onchain-notifications.mjs → api-notifications.mjs} +26 -13
  71. package/dist/NotificationServicesController/services/api-notifications.mjs.map +1 -0
  72. package/dist/NotificationServicesController/services/perp-notifications.cjs +0 -1
  73. package/dist/NotificationServicesController/services/perp-notifications.cjs.map +1 -1
  74. package/dist/NotificationServicesController/services/perp-notifications.d.cts.map +1 -1
  75. package/dist/NotificationServicesController/services/perp-notifications.d.mts.map +1 -1
  76. package/dist/NotificationServicesController/services/perp-notifications.mjs +0 -1
  77. package/dist/NotificationServicesController/services/perp-notifications.mjs.map +1 -1
  78. package/dist/NotificationServicesController/types/index.cjs.map +1 -1
  79. package/dist/NotificationServicesController/types/index.d.cts +1 -1
  80. package/dist/NotificationServicesController/types/index.d.cts.map +1 -1
  81. package/dist/NotificationServicesController/types/index.d.mts +1 -1
  82. package/dist/NotificationServicesController/types/index.d.mts.map +1 -1
  83. package/dist/NotificationServicesController/types/index.mjs.map +1 -1
  84. package/dist/NotificationServicesController/types/notification/notification.cjs.map +1 -1
  85. package/dist/NotificationServicesController/types/notification/notification.d.cts +3 -11
  86. package/dist/NotificationServicesController/types/notification/notification.d.cts.map +1 -1
  87. package/dist/NotificationServicesController/types/notification/notification.d.mts +3 -11
  88. package/dist/NotificationServicesController/types/notification/notification.d.mts.map +1 -1
  89. package/dist/NotificationServicesController/types/notification/notification.mjs.map +1 -1
  90. package/dist/NotificationServicesController/types/notification-api/index.cjs.map +1 -0
  91. package/dist/NotificationServicesController/types/notification-api/index.d.cts +3 -0
  92. package/dist/NotificationServicesController/types/notification-api/index.d.cts.map +1 -0
  93. package/dist/NotificationServicesController/types/notification-api/index.d.mts +3 -0
  94. package/dist/NotificationServicesController/types/notification-api/index.d.mts.map +1 -0
  95. package/dist/NotificationServicesController/types/notification-api/index.mjs.map +1 -0
  96. package/dist/NotificationServicesController/types/{on-chain-notification/on-chain-notification.cjs → notification-api/notification-api.cjs} +1 -1
  97. package/dist/NotificationServicesController/types/notification-api/notification-api.cjs.map +1 -0
  98. package/dist/NotificationServicesController/types/notification-api/notification-api.d.cts +64 -0
  99. package/dist/NotificationServicesController/types/notification-api/notification-api.d.cts.map +1 -0
  100. package/dist/NotificationServicesController/types/notification-api/notification-api.d.mts +64 -0
  101. package/dist/NotificationServicesController/types/notification-api/notification-api.d.mts.map +1 -0
  102. package/dist/NotificationServicesController/types/notification-api/notification-api.mjs +2 -0
  103. package/dist/NotificationServicesController/types/notification-api/notification-api.mjs.map +1 -0
  104. package/dist/NotificationServicesController/types/notification-api/schema.cjs.map +1 -0
  105. package/dist/NotificationServicesController/types/notification-api/schema.d.cts +365 -0
  106. package/dist/NotificationServicesController/types/notification-api/schema.d.cts.map +1 -0
  107. package/dist/NotificationServicesController/types/notification-api/schema.d.mts +365 -0
  108. package/dist/NotificationServicesController/types/notification-api/schema.d.mts.map +1 -0
  109. package/dist/NotificationServicesController/types/notification-api/schema.mjs.map +1 -0
  110. package/dist/NotificationServicesController/utils/should-auto-expire.cjs +12 -0
  111. package/dist/NotificationServicesController/utils/should-auto-expire.cjs.map +1 -0
  112. package/dist/NotificationServicesController/utils/should-auto-expire.d.cts +2 -0
  113. package/dist/NotificationServicesController/utils/should-auto-expire.d.cts.map +1 -0
  114. package/dist/NotificationServicesController/utils/should-auto-expire.d.mts +2 -0
  115. package/dist/NotificationServicesController/utils/should-auto-expire.d.mts.map +1 -0
  116. package/dist/NotificationServicesController/utils/should-auto-expire.mjs +8 -0
  117. package/dist/NotificationServicesController/utils/should-auto-expire.mjs.map +1 -0
  118. package/dist/NotificationServicesPushController/services/push/push-web.cjs +5 -2
  119. package/dist/NotificationServicesPushController/services/push/push-web.cjs.map +1 -1
  120. package/dist/NotificationServicesPushController/services/push/push-web.d.cts.map +1 -1
  121. package/dist/NotificationServicesPushController/services/push/push-web.d.mts.map +1 -1
  122. package/dist/NotificationServicesPushController/services/push/push-web.mjs +6 -3
  123. package/dist/NotificationServicesPushController/services/push/push-web.mjs.map +1 -1
  124. package/dist/NotificationServicesPushController/utils/get-notification-message.cjs +51 -43
  125. package/dist/NotificationServicesPushController/utils/get-notification-message.cjs.map +1 -1
  126. package/dist/NotificationServicesPushController/utils/get-notification-message.d.cts +4 -2
  127. package/dist/NotificationServicesPushController/utils/get-notification-message.d.cts.map +1 -1
  128. package/dist/NotificationServicesPushController/utils/get-notification-message.d.mts +4 -2
  129. package/dist/NotificationServicesPushController/utils/get-notification-message.d.mts.map +1 -1
  130. package/dist/NotificationServicesPushController/utils/get-notification-message.mjs +51 -43
  131. package/dist/NotificationServicesPushController/utils/get-notification-message.mjs.map +1 -1
  132. package/dist/NotificationServicesPushController/web/push-utils.cjs +5 -2
  133. package/dist/NotificationServicesPushController/web/push-utils.cjs.map +1 -1
  134. package/dist/NotificationServicesPushController/web/push-utils.d.cts.map +1 -1
  135. package/dist/NotificationServicesPushController/web/push-utils.d.mts.map +1 -1
  136. package/dist/NotificationServicesPushController/web/push-utils.mjs +6 -3
  137. package/dist/NotificationServicesPushController/web/push-utils.mjs.map +1 -1
  138. package/dist/shared/is-onchain-notification.cjs +1 -2
  139. package/dist/shared/is-onchain-notification.cjs.map +1 -1
  140. package/dist/shared/is-onchain-notification.d.cts.map +1 -1
  141. package/dist/shared/is-onchain-notification.d.mts.map +1 -1
  142. package/dist/shared/is-onchain-notification.mjs +1 -2
  143. package/dist/shared/is-onchain-notification.mjs.map +1 -1
  144. package/dist/shared/to-raw-notification.cjs +19 -6
  145. package/dist/shared/to-raw-notification.cjs.map +1 -1
  146. package/dist/shared/to-raw-notification.d.cts +2 -2
  147. package/dist/shared/to-raw-notification.d.cts.map +1 -1
  148. package/dist/shared/to-raw-notification.d.mts +2 -2
  149. package/dist/shared/to-raw-notification.d.mts.map +1 -1
  150. package/dist/shared/to-raw-notification.mjs +17 -4
  151. package/dist/shared/to-raw-notification.mjs.map +1 -1
  152. package/package.json +1 -1
  153. package/dist/NotificationServicesController/processors/process-onchain-notifications.cjs +0 -19
  154. package/dist/NotificationServicesController/processors/process-onchain-notifications.cjs.map +0 -1
  155. package/dist/NotificationServicesController/processors/process-onchain-notifications.d.cts +0 -10
  156. package/dist/NotificationServicesController/processors/process-onchain-notifications.d.cts.map +0 -1
  157. package/dist/NotificationServicesController/processors/process-onchain-notifications.d.mts +0 -10
  158. package/dist/NotificationServicesController/processors/process-onchain-notifications.d.mts.map +0 -1
  159. package/dist/NotificationServicesController/processors/process-onchain-notifications.mjs +0 -15
  160. package/dist/NotificationServicesController/processors/process-onchain-notifications.mjs.map +0 -1
  161. package/dist/NotificationServicesController/services/onchain-notifications.cjs.map +0 -1
  162. package/dist/NotificationServicesController/services/onchain-notifications.d.cts.map +0 -1
  163. package/dist/NotificationServicesController/services/onchain-notifications.d.mts.map +0 -1
  164. package/dist/NotificationServicesController/services/onchain-notifications.mjs.map +0 -1
  165. package/dist/NotificationServicesController/types/on-chain-notification/index.cjs.map +0 -1
  166. package/dist/NotificationServicesController/types/on-chain-notification/index.d.cts +0 -2
  167. package/dist/NotificationServicesController/types/on-chain-notification/index.d.cts.map +0 -1
  168. package/dist/NotificationServicesController/types/on-chain-notification/index.d.mts +0 -2
  169. package/dist/NotificationServicesController/types/on-chain-notification/index.d.mts.map +0 -1
  170. package/dist/NotificationServicesController/types/on-chain-notification/index.mjs.map +0 -1
  171. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.cjs.map +0 -1
  172. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts +0 -49
  173. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts.map +0 -1
  174. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts +0 -49
  175. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts.map +0 -1
  176. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.mjs +0 -2
  177. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.mjs.map +0 -1
  178. package/dist/NotificationServicesController/types/on-chain-notification/schema.cjs.map +0 -1
  179. package/dist/NotificationServicesController/types/on-chain-notification/schema.d.cts +0 -681
  180. package/dist/NotificationServicesController/types/on-chain-notification/schema.d.cts.map +0 -1
  181. package/dist/NotificationServicesController/types/on-chain-notification/schema.d.mts +0 -681
  182. package/dist/NotificationServicesController/types/on-chain-notification/schema.d.mts.map +0 -1
  183. package/dist/NotificationServicesController/types/on-chain-notification/schema.mjs.map +0 -1
  184. /package/dist/NotificationServicesController/types/{on-chain-notification → notification-api}/index.cjs +0 -0
  185. /package/dist/NotificationServicesController/types/{on-chain-notification → notification-api}/index.mjs +0 -0
  186. /package/dist/NotificationServicesController/types/{on-chain-notification → notification-api}/schema.cjs +0 -0
  187. /package/dist/NotificationServicesController/types/{on-chain-notification → notification-api}/schema.mjs +0 -0
@@ -1,49 +0,0 @@
1
- import type { components } from "./schema.mjs";
2
- import type { TRIGGER_TYPES } from "../../constants/notification-schema.mjs";
3
- import type { Compute } from "../type-utils.mjs";
4
- export type Data_MetamaskSwapCompleted = components['schemas']['Data_MetamaskSwapCompleted'];
5
- export type Data_LidoStakeReadyToBeWithdrawn = components['schemas']['Data_LidoStakeReadyToBeWithdrawn'];
6
- export type Data_LidoStakeCompleted = components['schemas']['Data_LidoStakeCompleted'];
7
- export type Data_LidoWithdrawalRequested = components['schemas']['Data_LidoWithdrawalRequested'];
8
- export type Data_LidoWithdrawalCompleted = components['schemas']['Data_LidoWithdrawalCompleted'];
9
- export type Data_RocketPoolStakeCompleted = components['schemas']['Data_RocketPoolStakeCompleted'];
10
- export type Data_RocketPoolUnstakeCompleted = components['schemas']['Data_RocketPoolUnstakeCompleted'];
11
- export type Data_ETHSent = components['schemas']['Data_ETHSent'];
12
- export type Data_ETHReceived = components['schemas']['Data_ETHReceived'];
13
- export type Data_ERC20Sent = components['schemas']['Data_ERC20Sent'];
14
- export type Data_ERC20Received = components['schemas']['Data_ERC20Received'];
15
- export type Data_ERC721Sent = components['schemas']['Data_ERC721Sent'];
16
- export type Data_ERC721Received = components['schemas']['Data_ERC721Received'];
17
- export type Data_AaveV3HealthFactor = components['schemas']['Data_AaveV3HealthFactor'];
18
- export type Data_EnsExpiration = components['schemas']['Data_EnsExpiration'];
19
- export type Data_LidoStakingRewards = components['schemas']['Data_LidoStakingRewards'];
20
- export type Data_RocketpoolStakingRewards = components['schemas']['Data_RocketpoolStakingRewards'];
21
- export type Data_NotionalLoanExpiration = components['schemas']['Data_NotionalLoanExpiration'];
22
- export type Data_SparkFiHealthFactor = components['schemas']['Data_SparkFiHealthFactor'];
23
- type Notification = components['schemas']['WalletNotification'] | components['schemas']['Web3Notification'];
24
- type ConvertToEnum<Kind> = {
25
- [K in TRIGGER_TYPES]: Kind extends `${K}` ? K : never;
26
- }[TRIGGER_TYPES];
27
- /**
28
- * Type-Computation.
29
- * 1. Adds a `type` field to the notification, it converts the schema type into the ENUM we use.
30
- * 2. It ensures that the `data` field is the correct Notification data for this `type`
31
- * - The `Compute` utility merges the intersections (`&`) for a prettier type.
32
- */
33
- type NormalizeNotification<N extends Notification, NotificationDataKinds extends string = NonNullable<N['data']>['kind']> = {
34
- [K in NotificationDataKinds]: Compute<Omit<N, 'data'> & {
35
- type: ConvertToEnum<K>;
36
- data: Extract<N['data'], {
37
- kind: K;
38
- }>;
39
- }>;
40
- }[NotificationDataKinds];
41
- export type OnChainRawNotification = Compute<NormalizeNotification<components['schemas']['WalletNotification']> | NormalizeNotification<components['schemas']['Web3Notification']>>;
42
- export type UnprocessedOnChainRawNotification = Notification;
43
- export type OnChainRawNotificationsWithNetworkFields = Extract<OnChainRawNotification, {
44
- data: {
45
- network_fee: unknown;
46
- };
47
- }>;
48
- export {};
49
- //# sourceMappingURL=on-chain-notification.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"on-chain-notification.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"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"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=on-chain-notification.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"on-chain-notification.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"","sourcesContent":["import type { components } from './schema';\nimport type { TRIGGER_TYPES } from '../../constants/notification-schema';\nimport type { Compute } from '../type-utils';\n\nexport type Data_MetamaskSwapCompleted =\n components['schemas']['Data_MetamaskSwapCompleted'];\nexport type Data_LidoStakeReadyToBeWithdrawn =\n components['schemas']['Data_LidoStakeReadyToBeWithdrawn'];\nexport type Data_LidoStakeCompleted =\n components['schemas']['Data_LidoStakeCompleted'];\nexport type Data_LidoWithdrawalRequested =\n components['schemas']['Data_LidoWithdrawalRequested'];\nexport type Data_LidoWithdrawalCompleted =\n components['schemas']['Data_LidoWithdrawalCompleted'];\nexport type Data_RocketPoolStakeCompleted =\n components['schemas']['Data_RocketPoolStakeCompleted'];\nexport type Data_RocketPoolUnstakeCompleted =\n components['schemas']['Data_RocketPoolUnstakeCompleted'];\nexport type Data_ETHSent = components['schemas']['Data_ETHSent'];\nexport type Data_ETHReceived = components['schemas']['Data_ETHReceived'];\nexport type Data_ERC20Sent = components['schemas']['Data_ERC20Sent'];\nexport type Data_ERC20Received = components['schemas']['Data_ERC20Received'];\nexport type Data_ERC721Sent = components['schemas']['Data_ERC721Sent'];\nexport type Data_ERC721Received = components['schemas']['Data_ERC721Received'];\n\n// Web3Notifications\nexport type Data_AaveV3HealthFactor =\n components['schemas']['Data_AaveV3HealthFactor'];\nexport type Data_EnsExpiration = components['schemas']['Data_EnsExpiration'];\nexport type Data_LidoStakingRewards =\n components['schemas']['Data_LidoStakingRewards'];\nexport type Data_RocketpoolStakingRewards =\n components['schemas']['Data_RocketpoolStakingRewards'];\nexport type Data_NotionalLoanExpiration =\n components['schemas']['Data_NotionalLoanExpiration'];\nexport type Data_SparkFiHealthFactor =\n components['schemas']['Data_SparkFiHealthFactor'];\n\ntype Notification =\n | components['schemas']['WalletNotification']\n | components['schemas']['Web3Notification'];\ntype ConvertToEnum<Kind> = {\n [K in TRIGGER_TYPES]: Kind extends `${K}` ? K : never;\n}[TRIGGER_TYPES];\n\n/**\n * Type-Computation.\n * 1. Adds a `type` field to the notification, it converts the schema type into the ENUM we use.\n * 2. It ensures that the `data` field is the correct Notification data for this `type`\n * - The `Compute` utility merges the intersections (`&`) for a prettier type.\n */\ntype NormalizeNotification<\n N extends Notification,\n NotificationDataKinds extends string = NonNullable<N['data']>['kind'],\n> = {\n [K in NotificationDataKinds]: Compute<\n Omit<N, 'data'> & {\n type: ConvertToEnum<K>;\n data: Extract<N['data'], { kind: K }>;\n }\n >;\n}[NotificationDataKinds];\n\nexport type OnChainRawNotification = Compute<\n | NormalizeNotification<components['schemas']['WalletNotification']>\n | NormalizeNotification<components['schemas']['Web3Notification']>\n>;\n\nexport type UnprocessedOnChainRawNotification = Notification;\n\nexport type OnChainRawNotificationsWithNetworkFields = Extract<\n OnChainRawNotification,\n { data: { network_fee: unknown } }\n>;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/schema.ts"],"names":[],"mappings":";AAAA,oCAAoC;AACpC,0CAA0C;AAC1C;;;;GAIG","sourcesContent":["/* eslint-disable jsdoc/tag-lines */\n/* eslint-disable jsdoc/check-tag-names */\n/**\n * This file was auto-generated by openapi-typescript.\n * Do not make direct changes to the file.\n * Script: `npx openapi-typescript <PATH TO NOTIFICATION API SPEC> -o ./schema.d.ts`\n */\n\n/**\n * This file was auto-generated by openapi-typescript.\n * Do not make direct changes to the file.\n */\n\nexport type paths = {\n '/api/v1/notifications': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /** List all notifications ordered by most recent */\n post: {\n parameters: {\n query?: {\n /** @description Page number for pagination */\n page?: number;\n /** @description Number of notifications per page for pagination */\n per_page?: number;\n };\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: {\n content: {\n 'application/json': {\n trigger_ids: string[];\n chain_ids?: number[];\n kinds?: string[];\n unread?: boolean;\n };\n };\n };\n responses: {\n /** @description Successfully fetched a list of notifications */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content: {\n 'application/json': (\n | components['schemas']['WalletNotification']\n | components['schemas']['Web3Notification']\n )[];\n };\n };\n };\n };\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n '/api/v1/notifications/mark-as-read': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /** Mark notifications as read */\n post: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n 'application/json': {\n ids?: string[];\n };\n };\n };\n responses: {\n /** @description Successfully marked notifications as read */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n '/api/internal/v1/topics': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /** Get all topics created (internal) */\n get: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Successfully fetched all topics */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content: {\n 'application/json': components['schemas']['Topic'][];\n };\n };\n };\n };\n put?: never;\n /** Create a new topic (internal) */\n post: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n 'application/json': {\n name: string;\n desc?: string;\n };\n };\n };\n responses: {\n /** @description Successfully created a new topic */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n '/api/internal/v1/subtopics': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /** Get all sub-topics created (internal) */\n get: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Successfully fetched all subtopics */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content: {\n 'application/json': components['schemas']['SubTopic'][];\n };\n };\n };\n };\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n '/api/internal/v1/global-notifications': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /** Insert a new Global Notification (internal) */\n post: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n 'application/json': components['schemas']['GlobalNotificationWrite'];\n };\n };\n responses: {\n /** @description Successfully created a new global notification */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n '/api/v1/global-notifications': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /** Get all Global Notifications for a UserID */\n get: {\n parameters: {\n query: {\n /** @description Platform(s) to filter notifications by */\n platform: ('portfolio' | 'extension' | 'mobile')[];\n /** @description Delivery channel(s) to filter notifications by */\n deliveryChannel: ('inbox' | 'push')[];\n };\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Successfully fetched global notifications */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content: {\n 'application/json': components['schemas']['GlobalNotification'][];\n };\n };\n };\n };\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n '/api/v1/user-preferences': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /** Get all preferences for a UserID */\n get: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Successfully fetched preferences */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content: {\n 'application/json': components['schemas']['Topic'][];\n };\n };\n /** @description User not found */\n 404: {\n headers: {\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n put?: never;\n /** Update Preferences for a UserID */\n post: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n 'application/json': {\n topics: string[];\n };\n };\n };\n responses: {\n /** @description Successfully updated topics preferences */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n};\nexport type webhooks = Record<string, never>;\nexport type components = {\n schemas: {\n GlobalNotification: {\n title: string;\n body: string;\n /** Format: date-time */\n created_at: string;\n };\n GlobalNotificationWrite: {\n title: string;\n body: string;\n 'sub-topic': string;\n platforms: ('portfolio' | 'extension' | 'mobile')[];\n delivery_channels: ('inbox' | 'push')[];\n };\n Topic: {\n name: string;\n description?: string;\n /** Format: date-time */\n created_at?: string;\n };\n SubTopic: {\n name: string;\n /** Format: date-time */\n created_at?: string;\n };\n WalletNotification: {\n /** Format: uuid */\n id: string;\n /** Format: uuid */\n trigger_id: string;\n /** @example 1 */\n chain_id: number;\n /** @example 17485840 */\n block_number: number;\n block_timestamp: string;\n /**\n * Format: address\n * @example 0x881D40237659C251811CEC9c364ef91dC08D300C\n */\n tx_hash: string;\n /** @example false */\n unread: boolean;\n /** Format: date-time */\n created_at: string;\n /** Format: address */\n address: string;\n data?:\n | components['schemas']['Data_MetamaskSwapCompleted']\n | components['schemas']['Data_LidoStakeReadyToBeWithdrawn']\n | components['schemas']['Data_LidoStakeCompleted']\n | components['schemas']['Data_LidoWithdrawalRequested']\n | components['schemas']['Data_LidoWithdrawalCompleted']\n | components['schemas']['Data_RocketPoolStakeCompleted']\n | components['schemas']['Data_RocketPoolUnstakeCompleted']\n | components['schemas']['Data_ETHSent']\n | components['schemas']['Data_ETHReceived']\n | components['schemas']['Data_ERC20Sent']\n | components['schemas']['Data_ERC20Received']\n | components['schemas']['Data_ERC721Sent']\n | components['schemas']['Data_ERC721Received']\n | components['schemas']['Data_ERC1155Sent']\n | components['schemas']['Data_ERC1155Received'];\n };\n Web3Notification: {\n /** Format: uuid */\n id: string;\n /** Format: uuid */\n trigger_id: string;\n /** @example 1 */\n chain_id: number;\n /** @example false */\n unread: boolean;\n /** Format: date-time */\n created_at: string;\n /** Format: address */\n address: string;\n data?:\n | components['schemas']['Data_AaveV3HealthFactor']\n | components['schemas']['Data_EnsExpiration']\n | components['schemas']['Data_LidoStakingRewards']\n | components['schemas']['Data_RocketpoolStakingRewards']\n | components['schemas']['Data_NotionalLoanExpiration']\n | components['schemas']['Data_SparkFiHealthFactor'];\n };\n Data_MetamaskSwapCompleted: {\n /** @enum {string} */\n kind: 'metamask_swap_completed';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: decimal */\n rate: string;\n token_in: components['schemas']['Token'];\n token_out: components['schemas']['Token'];\n };\n Data_LidoStakeCompleted: {\n /** @enum {string} */\n kind: 'lido_stake_completed';\n network_fee: components['schemas']['NetworkFee'];\n stake_in: components['schemas']['Stake'];\n stake_out: components['schemas']['Stake'];\n };\n Data_LidoWithdrawalRequested: {\n /** @enum {string} */\n kind: 'lido_withdrawal_requested';\n network_fee: components['schemas']['NetworkFee'];\n stake_in: components['schemas']['Stake'];\n stake_out: components['schemas']['Stake'];\n };\n Data_LidoStakeReadyToBeWithdrawn: {\n /** @enum {string} */\n kind: 'lido_stake_ready_to_be_withdrawn';\n /** Format: decimal */\n request_id: string;\n staked_eth: components['schemas']['Stake'];\n };\n Data_LidoWithdrawalCompleted: {\n /** @enum {string} */\n kind: 'lido_withdrawal_completed';\n network_fee: components['schemas']['NetworkFee'];\n stake_in: components['schemas']['Stake'];\n stake_out: components['schemas']['Stake'];\n };\n Data_RocketPoolStakeCompleted: {\n /** @enum {string} */\n kind: 'rocketpool_stake_completed';\n network_fee: components['schemas']['NetworkFee'];\n stake_in: components['schemas']['Stake'];\n stake_out: components['schemas']['Stake'];\n };\n Data_RocketPoolUnstakeCompleted: {\n /** @enum {string} */\n kind: 'rocketpool_unstake_completed';\n network_fee: components['schemas']['NetworkFee'];\n stake_in: components['schemas']['Stake'];\n stake_out: components['schemas']['Stake'];\n };\n Data_ETHSent: {\n /** @enum {string} */\n kind: 'eth_sent';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n amount: {\n /** Format: decimal */\n usd: string;\n /** Format: decimal */\n eth: string;\n };\n };\n Data_ETHReceived: {\n /** @enum {string} */\n kind: 'eth_received';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n amount: {\n /** Format: decimal */\n usd: string;\n /** Format: decimal */\n eth: string;\n };\n };\n Data_ERC20Sent: {\n /** @enum {string} */\n kind: 'erc20_sent';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n token: components['schemas']['Token'];\n };\n Data_ERC20Received: {\n /** @enum {string} */\n kind: 'erc20_received';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n token: components['schemas']['Token'];\n };\n Data_ERC721Sent: {\n /** @enum {string} */\n kind: 'erc721_sent';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n nft: components['schemas']['NFT'];\n };\n Data_ERC721Received: {\n /** @enum {string} */\n kind: 'erc721_received';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n nft: components['schemas']['NFT'];\n };\n Data_ERC1155Sent: {\n /** @enum {string} */\n kind: 'erc1155_sent';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n nft?: components['schemas']['NFT'];\n };\n Data_ERC1155Received: {\n /** @enum {string} */\n kind: 'erc1155_received';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n nft?: components['schemas']['NFT'];\n };\n Data_AaveV3HealthFactor: {\n /** @enum {string} */\n kind: 'aave_v3_health_factor';\n /** @example 1 */\n chainId: number;\n /** Format: decimal */\n healthFactor: string;\n /** Format: decimal */\n threshold: string;\n };\n Data_EnsExpiration: {\n /** @enum {string} */\n kind: 'ens_expiration';\n chainId: number;\n reverseEnsName: string;\n /** Format: date-time */\n expirationDateIso: string;\n /** @example 86400 */\n reminderDelayInSeconds: number;\n };\n Data_LidoStakingRewards: {\n /** @enum {string} */\n kind: 'lido_staking_rewards';\n chainId: number;\n /** Format: decimal */\n currentStethBalance: string;\n /** Format: decimal */\n currentEthValue: string;\n /** Format: decimal */\n estimatedTotalRewardInPeriod: string;\n /** @example 1 */\n daysSinceLastNotification: number;\n /** @example 1 */\n notificationIntervalDays: number;\n };\n Data_NotionalLoanExpiration: {\n /** @enum {string} */\n kind: 'notional_loan_expiration';\n chainId: number;\n loans: {\n /** Format: decimal */\n amount: string;\n symbol: string;\n /** Format: date-time */\n maturityDateIso: string;\n }[];\n /** @example 86400 */\n reminderDelayInSeconds: number;\n };\n Data_RocketpoolStakingRewards: {\n /** @enum {string} */\n kind: 'rocketpool_staking_rewards';\n chainId: number;\n /** Format: decimal */\n currentRethBalance: string;\n /** Format: decimal */\n currentEthValue: string;\n /** Format: decimal */\n estimatedTotalRewardInPeriod: string;\n /** @example 1 */\n daysSinceLastNotification: number;\n /** @example 1 */\n notificationIntervalDays: number;\n };\n Data_SparkFiHealthFactor: {\n /** @enum {string} */\n kind: 'spark_fi_health_factor';\n chainId: number;\n /** Format: decimal */\n healthFactor: string;\n /** Format: decimal */\n threshold: string;\n };\n NetworkFee: {\n /** Format: decimal */\n gas_price: string;\n /** Format: decimal */\n native_token_price_in_usd: string;\n };\n Token: {\n /** Format: address */\n address: string;\n symbol: string;\n name: string;\n /** Format: decimal */\n amount: string;\n /** Format: int32 */\n decimals: string;\n /** Format: uri */\n image: string;\n /** Format: decimal */\n usd: string;\n };\n NFT: {\n name: string;\n token_id: string;\n /** Format: uri */\n image: string;\n collection: {\n /** Format: address */\n address: string;\n name: string;\n symbol: string;\n /** Format: uri */\n image: string;\n };\n };\n Stake: {\n /** Format: address */\n address: string;\n symbol: string;\n name: string;\n /** Format: decimal */\n amount: string;\n /** Format: int32 */\n decimals: string;\n /** Format: uri */\n image: string;\n /** Format: decimal */\n usd: string;\n };\n };\n responses: never;\n parameters: never;\n requestBodies: never;\n headers: never;\n pathItems: never;\n};\nexport type $defs = Record<string, never>;\nexport type operations = Record<string, never>;\n"]}