@metamask-previews/notification-services-controller 0.10.0-preview-b673f62a → 0.10.0-preview-b7ea5d52
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.
- package/dist/NotificationServicesController/NotificationServicesController.cjs +85 -8
- package/dist/NotificationServicesController/NotificationServicesController.cjs.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.d.cts +36 -1
- package/dist/NotificationServicesController/NotificationServicesController.d.cts.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.d.mts +36 -1
- package/dist/NotificationServicesController/NotificationServicesController.d.mts.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.mjs +85 -8
- package/dist/NotificationServicesController/NotificationServicesController.mjs.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/index.cjs +1 -0
- package/dist/NotificationServicesController/__fixtures__/index.cjs.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/index.d.cts +1 -0
- package/dist/NotificationServicesController/__fixtures__/index.d.cts.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/index.d.mts +1 -0
- package/dist/NotificationServicesController/__fixtures__/index.d.mts.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/index.mjs +1 -0
- package/dist/NotificationServicesController/__fixtures__/index.mjs.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.cjs +0 -18
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.cjs.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.cts.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.mts.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.mjs +0 -18
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.mjs.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.cjs +29 -0
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.cjs.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.d.cts +8 -0
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.d.cts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.d.mts +8 -0
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.d.mts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.mjs +25 -0
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.mjs.map +1 -0
- package/dist/NotificationServicesController/constants/notification-schema.cjs +1 -0
- package/dist/NotificationServicesController/constants/notification-schema.cjs.map +1 -1
- package/dist/NotificationServicesController/constants/notification-schema.d.cts +2 -1
- package/dist/NotificationServicesController/constants/notification-schema.d.cts.map +1 -1
- package/dist/NotificationServicesController/constants/notification-schema.d.mts +2 -1
- package/dist/NotificationServicesController/constants/notification-schema.d.mts.map +1 -1
- package/dist/NotificationServicesController/constants/notification-schema.mjs +1 -0
- package/dist/NotificationServicesController/constants/notification-schema.mjs.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.cjs +5 -0
- package/dist/NotificationServicesController/processors/process-notifications.cjs.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.d.cts +3 -3
- package/dist/NotificationServicesController/processors/process-notifications.d.cts.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.d.mts +3 -3
- package/dist/NotificationServicesController/processors/process-notifications.d.mts.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.mjs +5 -0
- package/dist/NotificationServicesController/processors/process-notifications.mjs.map +1 -1
- package/dist/NotificationServicesController/processors/process-snap-notifications.cjs +23 -0
- package/dist/NotificationServicesController/processors/process-snap-notifications.cjs.map +1 -0
- package/dist/NotificationServicesController/processors/process-snap-notifications.d.cts +10 -0
- package/dist/NotificationServicesController/processors/process-snap-notifications.d.cts.map +1 -0
- package/dist/NotificationServicesController/processors/process-snap-notifications.d.mts +10 -0
- package/dist/NotificationServicesController/processors/process-snap-notifications.d.mts.map +1 -0
- package/dist/NotificationServicesController/processors/process-snap-notifications.mjs +19 -0
- package/dist/NotificationServicesController/processors/process-snap-notifications.mjs.map +1 -0
- package/dist/NotificationServicesController/types/notification/notification.cjs.map +1 -1
- package/dist/NotificationServicesController/types/notification/notification.d.cts +10 -6
- package/dist/NotificationServicesController/types/notification/notification.d.cts.map +1 -1
- package/dist/NotificationServicesController/types/notification/notification.d.mts +10 -6
- package/dist/NotificationServicesController/types/notification/notification.d.mts.map +1 -1
- package/dist/NotificationServicesController/types/notification/notification.mjs.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.cjs.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts +5 -5
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts +5 -5
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.mjs.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/schema.cjs.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/schema.d.cts +21 -6
- package/dist/NotificationServicesController/types/on-chain-notification/schema.d.cts.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/schema.d.mts +21 -6
- package/dist/NotificationServicesController/types/on-chain-notification/schema.d.mts.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/schema.mjs.map +1 -1
- package/dist/NotificationServicesController/types/snaps/index.cjs +18 -0
- package/dist/NotificationServicesController/types/snaps/index.cjs.map +1 -0
- package/dist/NotificationServicesController/types/snaps/index.d.cts +2 -0
- package/dist/NotificationServicesController/types/snaps/index.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/snaps/index.d.mts +2 -0
- package/dist/NotificationServicesController/types/snaps/index.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/snaps/index.mjs +2 -0
- package/dist/NotificationServicesController/types/snaps/index.mjs.map +1 -0
- package/dist/NotificationServicesController/types/snaps/snaps.cjs +3 -0
- package/dist/NotificationServicesController/types/snaps/snaps.cjs.map +1 -0
- package/dist/NotificationServicesController/types/snaps/snaps.d.cts +23 -0
- package/dist/NotificationServicesController/types/snaps/snaps.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/snaps/snaps.d.mts +23 -0
- package/dist/NotificationServicesController/types/snaps/snaps.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/snaps/snaps.mjs +2 -0
- package/dist/NotificationServicesController/types/snaps/snaps.mjs.map +1 -0
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs +3 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts +2 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts +2 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +3 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs.map +1 -1
- package/dist/NotificationServicesPushController/services/services.cjs +2 -2
- package/dist/NotificationServicesPushController/services/services.cjs.map +1 -1
- package/dist/NotificationServicesPushController/services/services.d.cts +1 -0
- package/dist/NotificationServicesPushController/services/services.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/services/services.d.mts +1 -0
- package/dist/NotificationServicesPushController/services/services.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/services/services.mjs +2 -2
- package/dist/NotificationServicesPushController/services/services.mjs.map +1 -1
- package/package.json +3 -2
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { TRIGGER_TYPES } from "../constants/notification-schema.mjs";
|
|
2
2
|
import { isFeatureAnnouncementRead, processFeatureAnnouncement } from "./process-feature-announcement.mjs";
|
|
3
3
|
import { processOnChainNotification } from "./process-onchain-notifications.mjs";
|
|
4
|
+
import { processSnapNotification } from "./process-snap-notifications.mjs";
|
|
4
5
|
const isOnChainNotification = (n) => Object.values(TRIGGER_TYPES).includes(n.type);
|
|
5
6
|
const isFeatureAnnouncement = (n) => n.type === TRIGGER_TYPES.FEATURES_ANNOUNCEMENT;
|
|
7
|
+
const isSnapNotification = (n) => n.type === TRIGGER_TYPES.SNAP;
|
|
6
8
|
/**
|
|
7
9
|
* Process feature announcement and wallet notifications into a shared/normalised notification shape.
|
|
8
10
|
* We can still differentiate notifications by the `type` property
|
|
@@ -21,6 +23,9 @@ export function processNotification(notification, readNotifications = []) {
|
|
|
21
23
|
n.isRead = isFeatureAnnouncementRead(n, readNotifications);
|
|
22
24
|
return n;
|
|
23
25
|
}
|
|
26
|
+
if (isSnapNotification(notification)) {
|
|
27
|
+
return processSnapNotification(notification);
|
|
28
|
+
}
|
|
24
29
|
if (isOnChainNotification(notification)) {
|
|
25
30
|
return processOnChainNotification(notification);
|
|
26
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-notifications.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/processors/process-notifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,6CAAyC;
|
|
1
|
+
{"version":3,"file":"process-notifications.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/processors/process-notifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,6CAAyC;AAQjE,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC3B,2CAAuC;AACxC,OAAO,EAAE,0BAA0B,EAAE,4CAAwC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,yCAAqC;AAEvE,MAAM,qBAAqB,GAAG,CAC5B,CAAuB,EACM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAEhF,MAAM,qBAAqB,GAAG,CAC5B,CAAuB,EACkB,EAAE,CAC3C,CAAC,CAAC,IAAI,KAAK,aAAa,CAAC,qBAAqB,CAAC;AAEjD,MAAM,kBAAkB,GAAG,CACzB,CAAuB,EACG,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,aAAa,CAAC,IAAI,CAAC;AAE7D;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,YAAkC,EAClC,oBAA8B,EAAE;IAEhC,MAAM,iBAAiB,GAAG,CAAC,CAAQ,EAAE,EAAE;QACrC,MAAM,IAAI,GAAW,YAAY,EAAE,IAAI,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,4CAA4C,IAAI,EAAE,CAAC,CAAC;IACtE,CAAC,CAAC;IAEF,IAAI,qBAAqB,CAAC,YAAY,CAAC,EAAE;QACvC,MAAM,CAAC,GAAG,0BAA0B,CAClC,YAAkD,CACnD,CAAC;QACF,CAAC,CAAC,MAAM,GAAG,yBAAyB,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC;QAC3D,OAAO,CAAC,CAAC;KACV;IAED,IAAI,kBAAkB,CAAC,YAAY,CAAC,EAAE;QACpC,OAAO,uBAAuB,CAAC,YAAY,CAAC,CAAC;KAC9C;IAED,IAAI,qBAAqB,CAAC,YAAY,CAAC,EAAE;QACvC,OAAO,0BAA0B,CAAC,YAAY,CAAC,CAAC;KACjD;IAED,OAAO,iBAAiB,CAAC,YAAqB,CAAC,CAAC;AAClD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,YAAkC,EAClC,oBAA8B,EAAE;IAEhC,IAAI;QACF,MAAM,qBAAqB,GAAG,mBAAmB,CAC/C,YAAY,EACZ,iBAAiB,CAClB,CAAC;QACF,OAAO,qBAAqB,CAAC;KAC9B;IAAC,MAAM;QACN,OAAO,SAAS,CAAC;KAClB;AACH,CAAC","sourcesContent":["import { TRIGGER_TYPES } from '../constants/notification-schema';\nimport type { FeatureAnnouncementRawNotification } from '../types/feature-announcement/feature-announcement';\nimport type {\n INotification,\n RawNotificationUnion,\n} from '../types/notification/notification';\nimport type { OnChainRawNotification } from '../types/on-chain-notification/on-chain-notification';\nimport type { RawSnapNotification } from '../types/snaps';\nimport {\n isFeatureAnnouncementRead,\n processFeatureAnnouncement,\n} from './process-feature-announcement';\nimport { processOnChainNotification } from './process-onchain-notifications';\nimport { processSnapNotification } from './process-snap-notifications';\n\nconst isOnChainNotification = (\n n: RawNotificationUnion,\n): n is OnChainRawNotification => Object.values(TRIGGER_TYPES).includes(n.type);\n\nconst isFeatureAnnouncement = (\n n: RawNotificationUnion,\n): n is FeatureAnnouncementRawNotification =>\n n.type === TRIGGER_TYPES.FEATURES_ANNOUNCEMENT;\n\nconst isSnapNotification = (\n n: RawNotificationUnion,\n): n is RawSnapNotification => n.type === TRIGGER_TYPES.SNAP;\n\n/**\n * Process feature announcement and wallet notifications into a shared/normalised notification shape.\n * We can still differentiate notifications by the `type` property\n *\n * @param notification - a feature announcement or on chain notification\n * @param readNotifications - all read notifications currently\n * @returns a processed notification\n */\nexport function processNotification(\n notification: RawNotificationUnion,\n readNotifications: string[] = [],\n): INotification {\n const exhaustedAllCases = (_: never) => {\n const type: string = notification?.type;\n throw new Error(`No processor found for notification kind ${type}`);\n };\n\n if (isFeatureAnnouncement(notification)) {\n const n = processFeatureAnnouncement(\n notification as FeatureAnnouncementRawNotification,\n );\n n.isRead = isFeatureAnnouncementRead(n, readNotifications);\n return n;\n }\n\n if (isSnapNotification(notification)) {\n return processSnapNotification(notification);\n }\n\n if (isOnChainNotification(notification)) {\n return processOnChainNotification(notification);\n }\n\n return exhaustedAllCases(notification as never);\n}\n\n/**\n * Safe version of processing a notification. Rather than throwing an error if failed to process, it will return the Notification or undefined\n *\n * @param notification - notification to processes\n * @param readNotifications - all read notifications currently\n * @returns a process notification or undefined if failed to process\n */\nexport function safeProcessNotification(\n notification: RawNotificationUnion,\n readNotifications: string[] = [],\n): INotification | undefined {\n try {\n const processedNotification = processNotification(\n notification,\n readNotifications,\n );\n return processedNotification;\n } catch {\n return undefined;\n }\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processSnapNotification = void 0;
|
|
4
|
+
const uuid_1 = require("uuid");
|
|
5
|
+
/**
|
|
6
|
+
* Processes a snap notification into a normalized shape.
|
|
7
|
+
*
|
|
8
|
+
* @param snapNotification - A raw snap notification.
|
|
9
|
+
* @returns a normalized snap notification.
|
|
10
|
+
*/
|
|
11
|
+
const processSnapNotification = (snapNotification) => {
|
|
12
|
+
const { data, type, readDate } = snapNotification;
|
|
13
|
+
return {
|
|
14
|
+
id: (0, uuid_1.v4)(),
|
|
15
|
+
readDate,
|
|
16
|
+
createdAt: new Date().toISOString(),
|
|
17
|
+
isRead: false,
|
|
18
|
+
type,
|
|
19
|
+
data,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
exports.processSnapNotification = processSnapNotification;
|
|
23
|
+
//# sourceMappingURL=process-snap-notifications.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-snap-notifications.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/processors/process-snap-notifications.ts"],"names":[],"mappings":";;;AAAA,+BAAkC;AAKlC;;;;;GAKG;AACI,MAAM,uBAAuB,GAAG,CACrC,gBAAqC,EACtB,EAAE;IACjB,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC;IAClD,OAAO;QACL,EAAE,EAAE,IAAA,SAAI,GAAE;QACV,QAAQ;QACR,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,MAAM,EAAE,KAAK;QACb,IAAI;QACJ,IAAI;KACL,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,uBAAuB,2BAYlC","sourcesContent":["import { v4 as uuid } from 'uuid';\n\nimport { type INotification } from '../types';\nimport type { RawSnapNotification } from '../types/snaps';\n\n/**\n * Processes a snap notification into a normalized shape.\n *\n * @param snapNotification - A raw snap notification.\n * @returns a normalized snap notification.\n */\nexport const processSnapNotification = (\n snapNotification: RawSnapNotification,\n): INotification => {\n const { data, type, readDate } = snapNotification;\n return {\n id: uuid(),\n readDate,\n createdAt: new Date().toISOString(),\n isRead: false,\n type,\n data,\n };\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type INotification } from "../types/index.cjs";
|
|
2
|
+
import type { RawSnapNotification } from "../types/snaps/index.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* Processes a snap notification into a normalized shape.
|
|
5
|
+
*
|
|
6
|
+
* @param snapNotification - A raw snap notification.
|
|
7
|
+
* @returns a normalized snap notification.
|
|
8
|
+
*/
|
|
9
|
+
export declare const processSnapNotification: (snapNotification: RawSnapNotification) => INotification;
|
|
10
|
+
//# sourceMappingURL=process-snap-notifications.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-snap-notifications.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesController/processors/process-snap-notifications.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,2BAAiB;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,iCAAuB;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,qBAChB,mBAAmB,KACpC,aAUF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type INotification } from "../types/index.mjs";
|
|
2
|
+
import type { RawSnapNotification } from "../types/snaps/index.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Processes a snap notification into a normalized shape.
|
|
5
|
+
*
|
|
6
|
+
* @param snapNotification - A raw snap notification.
|
|
7
|
+
* @returns a normalized snap notification.
|
|
8
|
+
*/
|
|
9
|
+
export declare const processSnapNotification: (snapNotification: RawSnapNotification) => INotification;
|
|
10
|
+
//# sourceMappingURL=process-snap-notifications.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-snap-notifications.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesController/processors/process-snap-notifications.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,2BAAiB;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,iCAAuB;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,qBAChB,mBAAmB,KACpC,aAUF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { v4 as uuid } from "uuid";
|
|
2
|
+
/**
|
|
3
|
+
* Processes a snap notification into a normalized shape.
|
|
4
|
+
*
|
|
5
|
+
* @param snapNotification - A raw snap notification.
|
|
6
|
+
* @returns a normalized snap notification.
|
|
7
|
+
*/
|
|
8
|
+
export const processSnapNotification = (snapNotification) => {
|
|
9
|
+
const { data, type, readDate } = snapNotification;
|
|
10
|
+
return {
|
|
11
|
+
id: uuid(),
|
|
12
|
+
readDate,
|
|
13
|
+
createdAt: new Date().toISOString(),
|
|
14
|
+
isRead: false,
|
|
15
|
+
type,
|
|
16
|
+
data,
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=process-snap-notifications.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-snap-notifications.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/processors/process-snap-notifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,aAAa;AAKlC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,gBAAqC,EACtB,EAAE;IACjB,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC;IAClD,OAAO;QACL,EAAE,EAAE,IAAI,EAAE;QACV,QAAQ;QACR,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,MAAM,EAAE,KAAK;QACb,IAAI;QACJ,IAAI;KACL,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { v4 as uuid } from 'uuid';\n\nimport { type INotification } from '../types';\nimport type { RawSnapNotification } from '../types/snaps';\n\n/**\n * Processes a snap notification into a normalized shape.\n *\n * @param snapNotification - A raw snap notification.\n * @returns a normalized snap notification.\n */\nexport const processSnapNotification = (\n snapNotification: RawSnapNotification,\n): INotification => {\n const { data, type, readDate } = snapNotification;\n return {\n id: uuid(),\n readDate,\n createdAt: new Date().toISOString(),\n isRead: false,\n type,\n data,\n };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"","sourcesContent":["import type { FeatureAnnouncementRawNotification } from '../feature-announcement/feature-announcement';\nimport type { OnChainRawNotification } from '../on-chain-notification/on-chain-notification';\nimport type { Compute } from '../type-utils';\n\nexport type
|
|
1
|
+
{"version":3,"file":"notification.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"","sourcesContent":["import type { FeatureAnnouncementRawNotification } from '../feature-announcement/feature-announcement';\nimport type { OnChainRawNotification } from '../on-chain-notification/on-chain-notification';\nimport type { RawSnapNotification } from '../snaps';\nimport type { Compute } from '../type-utils';\n\nexport type BaseNotification = {\n id: string;\n createdAt: string;\n isRead: boolean;\n};\n\nexport type RawNotificationUnion =\n | OnChainRawNotification\n | FeatureAnnouncementRawNotification\n | RawSnapNotification;\n\n/**\n * The shape of a \"generic\" notification.\n * Other than the fields listed below, tt will also contain:\n * - `type` field (declared in the Raw shapes)\n * - `data` field (declared in the Raw shapes)\n */\nexport type INotification = Compute<\n | (FeatureAnnouncementRawNotification & BaseNotification)\n | (OnChainRawNotification & BaseNotification)\n | (RawSnapNotification & BaseNotification & { readDate?: string | null })\n>;\n\n// NFT\nexport type NFT = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n token_id: string;\n image: string;\n collection?: {\n name: string;\n image: string;\n };\n};\n\nexport type MarkAsReadNotificationsParam = Pick<\n INotification,\n 'id' | 'type' | 'isRead'\n>[];\n"]}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import type { FeatureAnnouncementRawNotification } from "../feature-announcement/feature-announcement.cjs";
|
|
2
2
|
import type { OnChainRawNotification } from "../on-chain-notification/on-chain-notification.cjs";
|
|
3
|
+
import type { RawSnapNotification } from "../snaps/index.cjs";
|
|
3
4
|
import type { Compute } from "../type-utils.cjs";
|
|
4
|
-
export type
|
|
5
|
+
export type BaseNotification = {
|
|
6
|
+
id: string;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
isRead: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type RawNotificationUnion = OnChainRawNotification | FeatureAnnouncementRawNotification | RawSnapNotification;
|
|
5
11
|
/**
|
|
6
12
|
* The shape of a "generic" notification.
|
|
7
13
|
* Other than the fields listed below, tt will also contain:
|
|
8
14
|
* - `type` field (declared in the Raw shapes)
|
|
9
15
|
* - `data` field (declared in the Raw shapes)
|
|
10
16
|
*/
|
|
11
|
-
export type INotification = Compute<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
isRead: boolean;
|
|
15
|
-
}>;
|
|
17
|
+
export type INotification = Compute<(FeatureAnnouncementRawNotification & BaseNotification) | (OnChainRawNotification & BaseNotification) | (RawSnapNotification & BaseNotification & {
|
|
18
|
+
readDate?: string | null;
|
|
19
|
+
})>;
|
|
16
20
|
export type NFT = {
|
|
17
21
|
token_id: string;
|
|
18
22
|
image: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,yDAAqD;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,2DAAuD;AAC7F,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;AAE7C,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"notification.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,yDAAqD;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,2DAAuD;AAC7F,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAAiB;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;AAE7C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAC5B,sBAAsB,GACtB,kCAAkC,GAClC,mBAAmB,CAAC;AAExB;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,CAC/B,CAAC,kCAAkC,GAAG,gBAAgB,CAAC,GACvD,CAAC,sBAAsB,GAAG,gBAAgB,CAAC,GAC3C,CAAC,mBAAmB,GAAG,gBAAgB,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAC1E,CAAC;AAGF,MAAM,MAAM,GAAG,GAAG;IAEhB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAC7C,aAAa,EACb,IAAI,GAAG,MAAM,GAAG,QAAQ,CACzB,EAAE,CAAC"}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import type { FeatureAnnouncementRawNotification } from "../feature-announcement/feature-announcement.mjs";
|
|
2
2
|
import type { OnChainRawNotification } from "../on-chain-notification/on-chain-notification.mjs";
|
|
3
|
+
import type { RawSnapNotification } from "../snaps/index.mjs";
|
|
3
4
|
import type { Compute } from "../type-utils.mjs";
|
|
4
|
-
export type
|
|
5
|
+
export type BaseNotification = {
|
|
6
|
+
id: string;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
isRead: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type RawNotificationUnion = OnChainRawNotification | FeatureAnnouncementRawNotification | RawSnapNotification;
|
|
5
11
|
/**
|
|
6
12
|
* The shape of a "generic" notification.
|
|
7
13
|
* Other than the fields listed below, tt will also contain:
|
|
8
14
|
* - `type` field (declared in the Raw shapes)
|
|
9
15
|
* - `data` field (declared in the Raw shapes)
|
|
10
16
|
*/
|
|
11
|
-
export type INotification = Compute<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
isRead: boolean;
|
|
15
|
-
}>;
|
|
17
|
+
export type INotification = Compute<(FeatureAnnouncementRawNotification & BaseNotification) | (OnChainRawNotification & BaseNotification) | (RawSnapNotification & BaseNotification & {
|
|
18
|
+
readDate?: string | null;
|
|
19
|
+
})>;
|
|
16
20
|
export type NFT = {
|
|
17
21
|
token_id: string;
|
|
18
22
|
image: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,yDAAqD;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,2DAAuD;AAC7F,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;AAE7C,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"notification.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,yDAAqD;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,2DAAuD;AAC7F,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAAiB;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;AAE7C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAC5B,sBAAsB,GACtB,kCAAkC,GAClC,mBAAmB,CAAC;AAExB;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,CAC/B,CAAC,kCAAkC,GAAG,gBAAgB,CAAC,GACvD,CAAC,sBAAsB,GAAG,gBAAgB,CAAC,GAC3C,CAAC,mBAAmB,GAAG,gBAAgB,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAC1E,CAAC;AAGF,MAAM,MAAM,GAAG,GAAG;IAEhB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAC7C,aAAa,EACb,IAAI,GAAG,MAAM,GAAG,QAAQ,CACzB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"","sourcesContent":["import type { FeatureAnnouncementRawNotification } from '../feature-announcement/feature-announcement';\nimport type { OnChainRawNotification } from '../on-chain-notification/on-chain-notification';\nimport type { Compute } from '../type-utils';\n\nexport type
|
|
1
|
+
{"version":3,"file":"notification.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"","sourcesContent":["import type { FeatureAnnouncementRawNotification } from '../feature-announcement/feature-announcement';\nimport type { OnChainRawNotification } from '../on-chain-notification/on-chain-notification';\nimport type { RawSnapNotification } from '../snaps';\nimport type { Compute } from '../type-utils';\n\nexport type BaseNotification = {\n id: string;\n createdAt: string;\n isRead: boolean;\n};\n\nexport type RawNotificationUnion =\n | OnChainRawNotification\n | FeatureAnnouncementRawNotification\n | RawSnapNotification;\n\n/**\n * The shape of a \"generic\" notification.\n * Other than the fields listed below, tt will also contain:\n * - `type` field (declared in the Raw shapes)\n * - `data` field (declared in the Raw shapes)\n */\nexport type INotification = Compute<\n | (FeatureAnnouncementRawNotification & BaseNotification)\n | (OnChainRawNotification & BaseNotification)\n | (RawSnapNotification & BaseNotification & { readDate?: string | null })\n>;\n\n// NFT\nexport type NFT = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n token_id: string;\n image: string;\n collection?: {\n name: string;\n image: string;\n };\n};\n\nexport type MarkAsReadNotificationsParam = Pick<\n INotification,\n 'id' | 'type' | 'isRead'\n>[];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-chain-notification.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { TRIGGER_TYPES } from '../../constants/notification-schema';\nimport type { Compute } from '../type-utils';\nimport type { components } from './schema';\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
|
|
1
|
+
{"version":3,"file":"on-chain-notification.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { TRIGGER_TYPES } from '../../constants/notification-schema';\nimport type { Compute } from '../type-utils';\nimport type { components } from './schema';\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"]}
|
package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts
CHANGED
|
@@ -20,8 +20,7 @@ export type Data_LidoStakingRewards = components['schemas']['Data_LidoStakingRew
|
|
|
20
20
|
export type Data_RocketpoolStakingRewards = components['schemas']['Data_RocketpoolStakingRewards'];
|
|
21
21
|
export type Data_NotionalLoanExpiration = components['schemas']['Data_NotionalLoanExpiration'];
|
|
22
22
|
export type Data_SparkFiHealthFactor = components['schemas']['Data_SparkFiHealthFactor'];
|
|
23
|
-
type Notification = components['schemas']['
|
|
24
|
-
type NotificationDataKinds = NonNullable<Notification['data']>['kind'];
|
|
23
|
+
type Notification = components['schemas']['WalletNotification'] | components['schemas']['Web3Notification'];
|
|
25
24
|
type ConvertToEnum<Kind> = {
|
|
26
25
|
[K in TRIGGER_TYPES]: Kind extends `${K}` ? K : never;
|
|
27
26
|
}[TRIGGER_TYPES];
|
|
@@ -31,14 +30,15 @@ type ConvertToEnum<Kind> = {
|
|
|
31
30
|
* 2. It ensures that the `data` field is the correct Notification data for this `type`
|
|
32
31
|
* - The `Compute` utility merges the intersections (`&`) for a prettier type.
|
|
33
32
|
*/
|
|
34
|
-
|
|
35
|
-
[K in NotificationDataKinds]: Compute<Omit<
|
|
33
|
+
type NormalizeNotification<N extends Notification, NotificationDataKinds extends string = NonNullable<N['data']>['kind']> = {
|
|
34
|
+
[K in NotificationDataKinds]: Compute<Omit<N, 'data'> & {
|
|
36
35
|
type: ConvertToEnum<K>;
|
|
37
|
-
data: Extract<
|
|
36
|
+
data: Extract<N['data'], {
|
|
38
37
|
kind: K;
|
|
39
38
|
}>;
|
|
40
39
|
}>;
|
|
41
40
|
}[NotificationDataKinds];
|
|
41
|
+
export type OnChainRawNotification = Compute<NormalizeNotification<components['schemas']['WalletNotification']> | NormalizeNotification<components['schemas']['Web3Notification']>>;
|
|
42
42
|
export type UnprocessedOnChainRawNotification = Notification;
|
|
43
43
|
export type OnChainRawNotificationsWithNetworkFields = Extract<OnChainRawNotification, {
|
|
44
44
|
data: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-chain-notification.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,gDAA4C;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAiB;AAE3C,MAAM,MAAM,0BAA0B,GACpC,UAAU,CAAC,SAAS,CAAC,CAAC,4BAA4B,CAAC,CAAC;AACtD,MAAM,MAAM,gCAAgC,GAC1C,UAAU,CAAC,SAAS,CAAC,CAAC,kCAAkC,CAAC,CAAC;AAC5D,MAAM,MAAM,uBAAuB,GACjC,UAAU,CAAC,SAAS,CAAC,CAAC,yBAAyB,CAAC,CAAC;AACnD,MAAM,MAAM,4BAA4B,GACtC,UAAU,CAAC,SAAS,CAAC,CAAC,8BAA8B,CAAC,CAAC;AACxD,MAAM,MAAM,4BAA4B,GACtC,UAAU,CAAC,SAAS,CAAC,CAAC,8BAA8B,CAAC,CAAC;AACxD,MAAM,MAAM,6BAA6B,GACvC,UAAU,CAAC,SAAS,CAAC,CAAC,+BAA+B,CAAC,CAAC;AACzD,MAAM,MAAM,+BAA+B,GACzC,UAAU,CAAC,SAAS,CAAC,CAAC,iCAAiC,CAAC,CAAC;AAC3D,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAC;AACjE,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AACzE,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,CAAC;AACrE,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,CAAC;AAC7E,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,iBAAiB,CAAC,CAAC;AACvE,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC,CAAC;AAG/E,MAAM,MAAM,uBAAuB,GACjC,UAAU,CAAC,SAAS,CAAC,CAAC,yBAAyB,CAAC,CAAC;AACnD,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,CAAC;AAC7E,MAAM,MAAM,uBAAuB,GACjC,UAAU,CAAC,SAAS,CAAC,CAAC,yBAAyB,CAAC,CAAC;AACnD,MAAM,MAAM,6BAA6B,GACvC,UAAU,CAAC,SAAS,CAAC,CAAC,+BAA+B,CAAC,CAAC;AACzD,MAAM,MAAM,2BAA2B,GACrC,UAAU,CAAC,SAAS,CAAC,CAAC,6BAA6B,CAAC,CAAC;AACvD,MAAM,MAAM,wBAAwB,GAClC,UAAU,CAAC,SAAS,CAAC,CAAC,0BAA0B,CAAC,CAAC;AAEpD,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"on-chain-notification.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"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"}
|
package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts
CHANGED
|
@@ -20,8 +20,7 @@ export type Data_LidoStakingRewards = components['schemas']['Data_LidoStakingRew
|
|
|
20
20
|
export type Data_RocketpoolStakingRewards = components['schemas']['Data_RocketpoolStakingRewards'];
|
|
21
21
|
export type Data_NotionalLoanExpiration = components['schemas']['Data_NotionalLoanExpiration'];
|
|
22
22
|
export type Data_SparkFiHealthFactor = components['schemas']['Data_SparkFiHealthFactor'];
|
|
23
|
-
type Notification = components['schemas']['
|
|
24
|
-
type NotificationDataKinds = NonNullable<Notification['data']>['kind'];
|
|
23
|
+
type Notification = components['schemas']['WalletNotification'] | components['schemas']['Web3Notification'];
|
|
25
24
|
type ConvertToEnum<Kind> = {
|
|
26
25
|
[K in TRIGGER_TYPES]: Kind extends `${K}` ? K : never;
|
|
27
26
|
}[TRIGGER_TYPES];
|
|
@@ -31,14 +30,15 @@ type ConvertToEnum<Kind> = {
|
|
|
31
30
|
* 2. It ensures that the `data` field is the correct Notification data for this `type`
|
|
32
31
|
* - The `Compute` utility merges the intersections (`&`) for a prettier type.
|
|
33
32
|
*/
|
|
34
|
-
|
|
35
|
-
[K in NotificationDataKinds]: Compute<Omit<
|
|
33
|
+
type NormalizeNotification<N extends Notification, NotificationDataKinds extends string = NonNullable<N['data']>['kind']> = {
|
|
34
|
+
[K in NotificationDataKinds]: Compute<Omit<N, 'data'> & {
|
|
36
35
|
type: ConvertToEnum<K>;
|
|
37
|
-
data: Extract<
|
|
36
|
+
data: Extract<N['data'], {
|
|
38
37
|
kind: K;
|
|
39
38
|
}>;
|
|
40
39
|
}>;
|
|
41
40
|
}[NotificationDataKinds];
|
|
41
|
+
export type OnChainRawNotification = Compute<NormalizeNotification<components['schemas']['WalletNotification']> | NormalizeNotification<components['schemas']['Web3Notification']>>;
|
|
42
42
|
export type UnprocessedOnChainRawNotification = Notification;
|
|
43
43
|
export type OnChainRawNotificationsWithNetworkFields = Extract<OnChainRawNotification, {
|
|
44
44
|
data: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-chain-notification.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,gDAA4C;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAiB;AAE3C,MAAM,MAAM,0BAA0B,GACpC,UAAU,CAAC,SAAS,CAAC,CAAC,4BAA4B,CAAC,CAAC;AACtD,MAAM,MAAM,gCAAgC,GAC1C,UAAU,CAAC,SAAS,CAAC,CAAC,kCAAkC,CAAC,CAAC;AAC5D,MAAM,MAAM,uBAAuB,GACjC,UAAU,CAAC,SAAS,CAAC,CAAC,yBAAyB,CAAC,CAAC;AACnD,MAAM,MAAM,4BAA4B,GACtC,UAAU,CAAC,SAAS,CAAC,CAAC,8BAA8B,CAAC,CAAC;AACxD,MAAM,MAAM,4BAA4B,GACtC,UAAU,CAAC,SAAS,CAAC,CAAC,8BAA8B,CAAC,CAAC;AACxD,MAAM,MAAM,6BAA6B,GACvC,UAAU,CAAC,SAAS,CAAC,CAAC,+BAA+B,CAAC,CAAC;AACzD,MAAM,MAAM,+BAA+B,GACzC,UAAU,CAAC,SAAS,CAAC,CAAC,iCAAiC,CAAC,CAAC;AAC3D,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAC;AACjE,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AACzE,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,CAAC;AACrE,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,CAAC;AAC7E,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,iBAAiB,CAAC,CAAC;AACvE,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC,CAAC;AAG/E,MAAM,MAAM,uBAAuB,GACjC,UAAU,CAAC,SAAS,CAAC,CAAC,yBAAyB,CAAC,CAAC;AACnD,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,CAAC;AAC7E,MAAM,MAAM,uBAAuB,GACjC,UAAU,CAAC,SAAS,CAAC,CAAC,yBAAyB,CAAC,CAAC;AACnD,MAAM,MAAM,6BAA6B,GACvC,UAAU,CAAC,SAAS,CAAC,CAAC,+BAA+B,CAAC,CAAC;AACzD,MAAM,MAAM,2BAA2B,GACrC,UAAU,CAAC,SAAS,CAAC,CAAC,6BAA6B,CAAC,CAAC;AACvD,MAAM,MAAM,wBAAwB,GAClC,UAAU,CAAC,SAAS,CAAC,CAAC,0BAA0B,CAAC,CAAC;AAEpD,KAAK,YAAY,
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-chain-notification.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { TRIGGER_TYPES } from '../../constants/notification-schema';\nimport type { Compute } from '../type-utils';\nimport type { components } from './schema';\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
|
|
1
|
+
{"version":3,"file":"on-chain-notification.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { TRIGGER_TYPES } from '../../constants/notification-schema';\nimport type { Compute } from '../type-utils';\nimport type { components } from './schema';\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/schema.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD;;;;GAIG","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\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': components['schemas']['Notification'][];\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 Notification: {\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 | 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};\n\nexport type $defs = Record<string, never>;\n\nexport type operations = Record<string, never>;\n"]}
|
|
1
|
+
{"version":3,"file":"schema.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/schema.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD;;;;GAIG","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\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"]}
|
|
@@ -47,7 +47,7 @@ export type paths = {
|
|
|
47
47
|
[name: string]: unknown;
|
|
48
48
|
};
|
|
49
49
|
content: {
|
|
50
|
-
'application/json': components['schemas']['
|
|
50
|
+
'application/json': (components['schemas']['WalletNotification'] | components['schemas']['Web3Notification'])[];
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
53
|
};
|
|
@@ -369,7 +369,7 @@ export type components = {
|
|
|
369
369
|
/** Format: date-time */
|
|
370
370
|
created_at?: string;
|
|
371
371
|
};
|
|
372
|
-
|
|
372
|
+
WalletNotification: {
|
|
373
373
|
/** Format: uuid */
|
|
374
374
|
id: string;
|
|
375
375
|
/** Format: uuid */
|
|
@@ -377,20 +377,35 @@ export type components = {
|
|
|
377
377
|
/** @example 1 */
|
|
378
378
|
chain_id: number;
|
|
379
379
|
/** @example 17485840 */
|
|
380
|
-
block_number
|
|
381
|
-
block_timestamp
|
|
380
|
+
block_number: number;
|
|
381
|
+
block_timestamp: string;
|
|
382
382
|
/**
|
|
383
383
|
* Format: address
|
|
384
384
|
* @example 0x881D40237659C251811CEC9c364ef91dC08D300C
|
|
385
385
|
*/
|
|
386
|
-
tx_hash
|
|
386
|
+
tx_hash: string;
|
|
387
387
|
/** @example false */
|
|
388
388
|
unread: boolean;
|
|
389
389
|
/** Format: date-time */
|
|
390
390
|
created_at: string;
|
|
391
391
|
/** Format: address */
|
|
392
392
|
address: string;
|
|
393
|
-
data?: components['schemas']['Data_MetamaskSwapCompleted'] | components['schemas']['Data_LidoStakeReadyToBeWithdrawn'] | components['schemas']['Data_LidoStakeCompleted'] | components['schemas']['Data_LidoWithdrawalRequested'] | components['schemas']['Data_LidoWithdrawalCompleted'] | components['schemas']['Data_RocketPoolStakeCompleted'] | components['schemas']['Data_RocketPoolUnstakeCompleted'] | components['schemas']['Data_ETHSent'] | components['schemas']['Data_ETHReceived'] | components['schemas']['Data_ERC20Sent'] | components['schemas']['Data_ERC20Received'] | components['schemas']['Data_ERC721Sent'] | components['schemas']['Data_ERC721Received'] | components['schemas']['Data_ERC1155Sent'] | components['schemas']['Data_ERC1155Received']
|
|
393
|
+
data?: components['schemas']['Data_MetamaskSwapCompleted'] | components['schemas']['Data_LidoStakeReadyToBeWithdrawn'] | components['schemas']['Data_LidoStakeCompleted'] | components['schemas']['Data_LidoWithdrawalRequested'] | components['schemas']['Data_LidoWithdrawalCompleted'] | components['schemas']['Data_RocketPoolStakeCompleted'] | components['schemas']['Data_RocketPoolUnstakeCompleted'] | components['schemas']['Data_ETHSent'] | components['schemas']['Data_ETHReceived'] | components['schemas']['Data_ERC20Sent'] | components['schemas']['Data_ERC20Received'] | components['schemas']['Data_ERC721Sent'] | components['schemas']['Data_ERC721Received'] | components['schemas']['Data_ERC1155Sent'] | components['schemas']['Data_ERC1155Received'];
|
|
394
|
+
};
|
|
395
|
+
Web3Notification: {
|
|
396
|
+
/** Format: uuid */
|
|
397
|
+
id: string;
|
|
398
|
+
/** Format: uuid */
|
|
399
|
+
trigger_id: string;
|
|
400
|
+
/** @example 1 */
|
|
401
|
+
chain_id: number;
|
|
402
|
+
/** @example false */
|
|
403
|
+
unread: boolean;
|
|
404
|
+
/** Format: date-time */
|
|
405
|
+
created_at: string;
|
|
406
|
+
/** Format: address */
|
|
407
|
+
address: string;
|
|
408
|
+
data?: components['schemas']['Data_AaveV3HealthFactor'] | components['schemas']['Data_EnsExpiration'] | components['schemas']['Data_LidoStakingRewards'] | components['schemas']['Data_RocketpoolStakingRewards'] | components['schemas']['Data_NotionalLoanExpiration'] | components['schemas']['Data_SparkFiHealthFactor'];
|
|
394
409
|
};
|
|
395
410
|
Data_MetamaskSwapCompleted: {
|
|
396
411
|
/** @enum {string} */
|