@metamask-previews/notification-services-controller 0.10.0-preview-557a8fcb → 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-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/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
|
@@ -3,4 +3,5 @@ export * from "./mock-notification-trigger.mjs";
|
|
|
3
3
|
export * from "./mock-notification-user-storage.mjs";
|
|
4
4
|
export * from "./mock-raw-notifications.mjs";
|
|
5
5
|
export * from "./mockResponses.mjs";
|
|
6
|
+
export * from "./mock-snap-notification.mjs";
|
|
6
7
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/index.ts"],"names":[],"mappings":"AAAA,iDAA6C;AAC7C,gDAA4C;AAC5C,qDAAiD;AACjD,6CAAyC;AACzC,oCAAgC","sourcesContent":["export * from './mock-feature-announcements';\nexport * from './mock-notification-trigger';\nexport * from './mock-notification-user-storage';\nexport * from './mock-raw-notifications';\nexport * from './mockResponses';\n"]}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/index.ts"],"names":[],"mappings":"AAAA,iDAA6C;AAC7C,gDAA4C;AAC5C,qDAAiD;AACjD,6CAAyC;AACzC,oCAAgC;AAChC,6CAAyC","sourcesContent":["export * from './mock-feature-announcements';\nexport * from './mock-notification-trigger';\nexport * from './mock-notification-user-storage';\nexport * from './mock-raw-notifications';\nexport * from './mockResponses';\nexport * from './mock-snap-notification';\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMockSnapNotification = void 0;
|
|
4
|
+
const constants_1 = require("../constants/index.cjs");
|
|
5
|
+
/**
|
|
6
|
+
* Mocking Utility - create a mock raw snap notification
|
|
7
|
+
*
|
|
8
|
+
* @returns Mock Raw Snap Notification
|
|
9
|
+
*/
|
|
10
|
+
function createMockSnapNotification() {
|
|
11
|
+
return {
|
|
12
|
+
type: constants_1.TRIGGER_TYPES.SNAP,
|
|
13
|
+
readDate: null,
|
|
14
|
+
data: {
|
|
15
|
+
message: 'fooBar',
|
|
16
|
+
origin: '@metamask/example-snap',
|
|
17
|
+
detailedView: {
|
|
18
|
+
title: 'Detailed View',
|
|
19
|
+
interfaceId: '1',
|
|
20
|
+
footerLink: {
|
|
21
|
+
text: 'Go Home',
|
|
22
|
+
href: 'metamask://client/',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.createMockSnapNotification = createMockSnapNotification;
|
|
29
|
+
//# sourceMappingURL=mock-snap-notification.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-snap-notification.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/mock-snap-notification.ts"],"names":[],"mappings":";;;AAAA,sDAA6C;AAG7C;;;;GAIG;AACH,SAAgB,0BAA0B;IACxC,OAAO;QACL,IAAI,EAAE,yBAAa,CAAC,IAAI;QACxB,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE;YACJ,OAAO,EAAE,QAAQ;YACjB,MAAM,EAAE,wBAAwB;YAChC,YAAY,EAAE;gBACZ,KAAK,EAAE,eAAe;gBACtB,WAAW,EAAE,GAAG;gBAChB,UAAU,EAAE;oBACV,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,oBAAoB;iBAC3B;aACF;SACF;KACF,CAAC;AACJ,CAAC;AAjBD,gEAiBC","sourcesContent":["import { TRIGGER_TYPES } from '../constants';\nimport { type RawSnapNotification } from '../types/snaps';\n\n/**\n * Mocking Utility - create a mock raw snap notification\n *\n * @returns Mock Raw Snap Notification\n */\nexport function createMockSnapNotification(): RawSnapNotification {\n return {\n type: TRIGGER_TYPES.SNAP,\n readDate: null,\n data: {\n message: 'fooBar',\n origin: '@metamask/example-snap',\n detailedView: {\n title: 'Detailed View',\n interfaceId: '1',\n footerLink: {\n text: 'Go Home',\n href: 'metamask://client/',\n },\n },\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type RawSnapNotification } from "../types/snaps/index.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* Mocking Utility - create a mock raw snap notification
|
|
4
|
+
*
|
|
5
|
+
* @returns Mock Raw Snap Notification
|
|
6
|
+
*/
|
|
7
|
+
export declare function createMockSnapNotification(): RawSnapNotification;
|
|
8
|
+
//# sourceMappingURL=mock-snap-notification.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-snap-notification.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/mock-snap-notification.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,mBAAmB,EAAE,iCAAuB;AAE1D;;;;GAIG;AACH,wBAAgB,0BAA0B,IAAI,mBAAmB,CAiBhE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type RawSnapNotification } from "../types/snaps/index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Mocking Utility - create a mock raw snap notification
|
|
4
|
+
*
|
|
5
|
+
* @returns Mock Raw Snap Notification
|
|
6
|
+
*/
|
|
7
|
+
export declare function createMockSnapNotification(): RawSnapNotification;
|
|
8
|
+
//# sourceMappingURL=mock-snap-notification.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-snap-notification.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/mock-snap-notification.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,mBAAmB,EAAE,iCAAuB;AAE1D;;;;GAIG;AACH,wBAAgB,0BAA0B,IAAI,mBAAmB,CAiBhE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TRIGGER_TYPES } from "../constants/index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Mocking Utility - create a mock raw snap notification
|
|
4
|
+
*
|
|
5
|
+
* @returns Mock Raw Snap Notification
|
|
6
|
+
*/
|
|
7
|
+
export function createMockSnapNotification() {
|
|
8
|
+
return {
|
|
9
|
+
type: TRIGGER_TYPES.SNAP,
|
|
10
|
+
readDate: null,
|
|
11
|
+
data: {
|
|
12
|
+
message: 'fooBar',
|
|
13
|
+
origin: '@metamask/example-snap',
|
|
14
|
+
detailedView: {
|
|
15
|
+
title: 'Detailed View',
|
|
16
|
+
interfaceId: '1',
|
|
17
|
+
footerLink: {
|
|
18
|
+
text: 'Go Home',
|
|
19
|
+
href: 'metamask://client/',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=mock-snap-notification.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-snap-notification.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/mock-snap-notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,+BAAqB;AAG7C;;;;GAIG;AACH,MAAM,UAAU,0BAA0B;IACxC,OAAO;QACL,IAAI,EAAE,aAAa,CAAC,IAAI;QACxB,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE;YACJ,OAAO,EAAE,QAAQ;YACjB,MAAM,EAAE,wBAAwB;YAChC,YAAY,EAAE;gBACZ,KAAK,EAAE,eAAe;gBACtB,WAAW,EAAE,GAAG;gBAChB,UAAU,EAAE;oBACV,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,oBAAoB;iBAC3B;aACF;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { TRIGGER_TYPES } from '../constants';\nimport { type RawSnapNotification } from '../types/snaps';\n\n/**\n * Mocking Utility - create a mock raw snap notification\n *\n * @returns Mock Raw Snap Notification\n */\nexport function createMockSnapNotification(): RawSnapNotification {\n return {\n type: TRIGGER_TYPES.SNAP,\n readDate: null,\n data: {\n message: 'fooBar',\n origin: '@metamask/example-snap',\n detailedView: {\n title: 'Detailed View',\n interfaceId: '1',\n footerLink: {\n text: 'Go Home',\n href: 'metamask://client/',\n },\n },\n },\n };\n}\n"]}
|
|
@@ -26,6 +26,7 @@ var TRIGGER_TYPES;
|
|
|
26
26
|
TRIGGER_TYPES["ROCKETPOOL_STAKING_REWARDS"] = "rocketpool_staking_rewards";
|
|
27
27
|
TRIGGER_TYPES["NOTIONAL_LOAN_EXPIRATION"] = "notional_loan_expiration";
|
|
28
28
|
TRIGGER_TYPES["SPARK_FI_HEALTH_FACTOR"] = "spark_fi_health_factor";
|
|
29
|
+
TRIGGER_TYPES["SNAP"] = "snap";
|
|
29
30
|
})(TRIGGER_TYPES || (exports.TRIGGER_TYPES = TRIGGER_TYPES = {}));
|
|
30
31
|
exports.TRIGGER_TYPES_WALLET_SET = new Set([
|
|
31
32
|
TRIGGER_TYPES.METAMASK_SWAP_COMPLETED,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-schema.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/constants/notification-schema.ts"],"names":[],"mappings":";;;AAEA,yDAAyD;AACzD,IAAY,
|
|
1
|
+
{"version":3,"file":"notification-schema.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/constants/notification-schema.ts"],"names":[],"mappings":";;;AAEA,yDAAyD;AACzD,IAAY,aAwBX;AAxBD,WAAY,aAAa;IACvB,gEAA+C,CAAA;IAC/C,oEAAmD,CAAA;IACnD,0CAAyB,CAAA;IACzB,kDAAiC,CAAA;IACjC,sCAAqB,CAAA;IACrB,8CAA6B,CAAA;IAC7B,0EAAyD,CAAA;IACzD,8EAA6D,CAAA;IAC7D,8DAA6C,CAAA;IAC7C,wEAAuD,CAAA;IACvD,wEAAuD,CAAA;IACvD,sFAAqE,CAAA;IACrE,4CAA2B,CAAA;IAC3B,oDAAmC,CAAA;IACnC,8CAA6B,CAAA;I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B,CAAC,EAAE;QAC5C,gBAAgB,EAAE,CAAC,2BAAmB,CAAC,QAAQ,CAAC;KACjD;IACD,CAAC,aAAa,CAAC,oBAAoB,CAAC,EAAE;QACpC,gBAAgB,EAAE,CAAC,2BAAmB,CAAC,QAAQ,CAAC;KACjD;IACD,CAAC,aAAa,CAAC,yBAAyB,CAAC,EAAE;QACzC,gBAAgB,EAAE,CAAC,2BAAmB,CAAC,QAAQ,CAAC;KACjD;IACD,CAAC,aAAa,CAAC,yBAAyB,CAAC,EAAE;QACzC,gBAAgB,EAAE,CAAC,2BAAmB,CAAC,QAAQ,CAAC;KACjD;CACF,CAAC","sourcesContent":["import type { Compute } from '../types/type-utils';\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum TRIGGER_TYPES {\n FEATURES_ANNOUNCEMENT = 'features_announcement',\n METAMASK_SWAP_COMPLETED = 'metamask_swap_completed',\n ERC20_SENT = 'erc20_sent',\n ERC20_RECEIVED = 'erc20_received',\n ETH_SENT = 'eth_sent',\n ETH_RECEIVED = 'eth_received',\n ROCKETPOOL_STAKE_COMPLETED = 'rocketpool_stake_completed',\n ROCKETPOOL_UNSTAKE_COMPLETED = 'rocketpool_unstake_completed',\n LIDO_STAKE_COMPLETED = 'lido_stake_completed',\n LIDO_WITHDRAWAL_REQUESTED = 'lido_withdrawal_requested',\n LIDO_WITHDRAWAL_COMPLETED = 'lido_withdrawal_completed',\n LIDO_STAKE_READY_TO_BE_WITHDRAWN = 'lido_stake_ready_to_be_withdrawn',\n ERC721_SENT = 'erc721_sent',\n ERC721_RECEIVED = 'erc721_received',\n ERC1155_SENT = 'erc1155_sent',\n ERC1155_RECEIVED = 'erc1155_received',\n AAVE_V3_HEALTH_FACTOR = 'aave_v3_health_factor',\n ENS_EXPIRATION = 'ens_expiration',\n LIDO_STAKING_REWARDS = 'lido_staking_rewards',\n ROCKETPOOL_STAKING_REWARDS = 'rocketpool_staking_rewards',\n NOTIONAL_LOAN_EXPIRATION = 'notional_loan_expiration',\n SPARK_FI_HEALTH_FACTOR = 'spark_fi_health_factor',\n SNAP = 'snap',\n}\n\nexport const TRIGGER_TYPES_WALLET_SET: Set<string> = new Set([\n TRIGGER_TYPES.METAMASK_SWAP_COMPLETED,\n TRIGGER_TYPES.ERC20_SENT,\n TRIGGER_TYPES.ERC20_RECEIVED,\n TRIGGER_TYPES.ETH_SENT,\n TRIGGER_TYPES.ETH_RECEIVED,\n TRIGGER_TYPES.ROCKETPOOL_STAKE_COMPLETED,\n TRIGGER_TYPES.ROCKETPOOL_UNSTAKE_COMPLETED,\n TRIGGER_TYPES.LIDO_STAKE_COMPLETED,\n TRIGGER_TYPES.LIDO_WITHDRAWAL_REQUESTED,\n TRIGGER_TYPES.LIDO_WITHDRAWAL_COMPLETED,\n TRIGGER_TYPES.LIDO_STAKE_READY_TO_BE_WITHDRAWN,\n TRIGGER_TYPES.ERC721_SENT,\n TRIGGER_TYPES.ERC721_RECEIVED,\n TRIGGER_TYPES.ERC1155_SENT,\n TRIGGER_TYPES.ERC1155_RECEIVED,\n]) satisfies Set<Exclude<TRIGGER_TYPES, TRIGGER_TYPES.FEATURES_ANNOUNCEMENT>>;\n\nexport enum TRIGGER_TYPES_GROUPS {\n RECEIVED = 'received',\n SENT = 'sent',\n DEFI = 'defi',\n}\n\nexport const NOTIFICATION_CHAINS_ID = {\n ETHEREUM: '1',\n OPTIMISM: '10',\n BSC: '56',\n POLYGON: '137',\n ARBITRUM: '42161',\n AVALANCHE: '43114',\n LINEA: '59144',\n} as const;\n\ntype ToPrimitiveKeys<TObj> = Compute<{\n [K in keyof TObj]: TObj[K] extends string ? string : TObj[K];\n}>;\nexport const NOTIFICATION_CHAINS: ToPrimitiveKeys<\n typeof NOTIFICATION_CHAINS_ID\n> = NOTIFICATION_CHAINS_ID;\n\nexport const CHAIN_SYMBOLS = {\n [NOTIFICATION_CHAINS.ETHEREUM]: 'ETH',\n [NOTIFICATION_CHAINS.OPTIMISM]: 'ETH',\n [NOTIFICATION_CHAINS.BSC]: 'BNB',\n [NOTIFICATION_CHAINS.POLYGON]: 'POL',\n [NOTIFICATION_CHAINS.ARBITRUM]: 'ETH',\n [NOTIFICATION_CHAINS.AVALANCHE]: 'AVAX',\n [NOTIFICATION_CHAINS.LINEA]: 'ETH',\n};\n\nexport const SUPPORTED_CHAINS = [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.OPTIMISM,\n NOTIFICATION_CHAINS.BSC,\n NOTIFICATION_CHAINS.POLYGON,\n NOTIFICATION_CHAINS.ARBITRUM,\n NOTIFICATION_CHAINS.AVALANCHE,\n NOTIFICATION_CHAINS.LINEA,\n];\n\nexport type Trigger = {\n supported_chains: (typeof SUPPORTED_CHAINS)[number][];\n};\n\nexport const TRIGGERS: Partial<Record<TRIGGER_TYPES, Trigger>> = {\n [TRIGGER_TYPES.METAMASK_SWAP_COMPLETED]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.OPTIMISM,\n NOTIFICATION_CHAINS.BSC,\n NOTIFICATION_CHAINS.POLYGON,\n NOTIFICATION_CHAINS.ARBITRUM,\n NOTIFICATION_CHAINS.AVALANCHE,\n ],\n },\n [TRIGGER_TYPES.ERC20_SENT]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.OPTIMISM,\n NOTIFICATION_CHAINS.BSC,\n NOTIFICATION_CHAINS.POLYGON,\n NOTIFICATION_CHAINS.ARBITRUM,\n NOTIFICATION_CHAINS.AVALANCHE,\n NOTIFICATION_CHAINS.LINEA,\n ],\n },\n [TRIGGER_TYPES.ERC20_RECEIVED]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.OPTIMISM,\n NOTIFICATION_CHAINS.BSC,\n NOTIFICATION_CHAINS.POLYGON,\n NOTIFICATION_CHAINS.ARBITRUM,\n NOTIFICATION_CHAINS.AVALANCHE,\n NOTIFICATION_CHAINS.LINEA,\n ],\n },\n [TRIGGER_TYPES.ERC721_SENT]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.POLYGON,\n ],\n },\n [TRIGGER_TYPES.ERC721_RECEIVED]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.POLYGON,\n ],\n },\n [TRIGGER_TYPES.ERC1155_SENT]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.POLYGON,\n ],\n },\n [TRIGGER_TYPES.ERC1155_RECEIVED]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.POLYGON,\n ],\n },\n [TRIGGER_TYPES.ETH_SENT]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.OPTIMISM,\n NOTIFICATION_CHAINS.BSC,\n NOTIFICATION_CHAINS.POLYGON,\n NOTIFICATION_CHAINS.ARBITRUM,\n NOTIFICATION_CHAINS.AVALANCHE,\n NOTIFICATION_CHAINS.LINEA,\n ],\n },\n [TRIGGER_TYPES.ETH_RECEIVED]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.OPTIMISM,\n NOTIFICATION_CHAINS.BSC,\n NOTIFICATION_CHAINS.POLYGON,\n NOTIFICATION_CHAINS.ARBITRUM,\n NOTIFICATION_CHAINS.AVALANCHE,\n NOTIFICATION_CHAINS.LINEA,\n ],\n },\n [TRIGGER_TYPES.ROCKETPOOL_STAKE_COMPLETED]: {\n supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],\n },\n [TRIGGER_TYPES.ROCKETPOOL_UNSTAKE_COMPLETED]: {\n supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],\n },\n [TRIGGER_TYPES.LIDO_STAKE_COMPLETED]: {\n supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],\n },\n [TRIGGER_TYPES.LIDO_WITHDRAWAL_REQUESTED]: {\n supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],\n },\n [TRIGGER_TYPES.LIDO_WITHDRAWAL_COMPLETED]: {\n supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],\n },\n};\n"]}
|
|
@@ -21,7 +21,8 @@ export declare enum TRIGGER_TYPES {
|
|
|
21
21
|
LIDO_STAKING_REWARDS = "lido_staking_rewards",
|
|
22
22
|
ROCKETPOOL_STAKING_REWARDS = "rocketpool_staking_rewards",
|
|
23
23
|
NOTIONAL_LOAN_EXPIRATION = "notional_loan_expiration",
|
|
24
|
-
SPARK_FI_HEALTH_FACTOR = "spark_fi_health_factor"
|
|
24
|
+
SPARK_FI_HEALTH_FACTOR = "spark_fi_health_factor",
|
|
25
|
+
SNAP = "snap"
|
|
25
26
|
}
|
|
26
27
|
export declare const TRIGGER_TYPES_WALLET_SET: Set<string>;
|
|
27
28
|
export declare enum TRIGGER_TYPES_GROUPS {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-schema.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesController/constants/notification-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,gCAA4B;AAGnD,oBAAY,aAAa;IACvB,qBAAqB,0BAA0B;IAC/C,uBAAuB,4BAA4B;IACnD,UAAU,eAAe;IACzB,cAAc,mBAAmB;IACjC,QAAQ,aAAa;IACrB,YAAY,iBAAiB;IAC7B,0BAA0B,+BAA+B;IACzD,4BAA4B,iCAAiC;IAC7D,oBAAoB,yBAAyB;IAC7C,yBAAyB,8BAA8B;IACvD,yBAAyB,8BAA8B;IACvD,gCAAgC,qCAAqC;IACrE,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,YAAY,iBAAiB;IAC7B,gBAAgB,qBAAqB;IACrC,qBAAqB,0BAA0B;IAC/C,cAAc,mBAAmB;IACjC,oBAAoB,yBAAyB;IAC7C,0BAA0B,+BAA+B;IACzD,wBAAwB,6BAA6B;IACrD,sBAAsB,2BAA2B;
|
|
1
|
+
{"version":3,"file":"notification-schema.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesController/constants/notification-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,gCAA4B;AAGnD,oBAAY,aAAa;IACvB,qBAAqB,0BAA0B;IAC/C,uBAAuB,4BAA4B;IACnD,UAAU,eAAe;IACzB,cAAc,mBAAmB;IACjC,QAAQ,aAAa;IACrB,YAAY,iBAAiB;IAC7B,0BAA0B,+BAA+B;IACzD,4BAA4B,iCAAiC;IAC7D,oBAAoB,yBAAyB;IAC7C,yBAAyB,8BAA8B;IACvD,yBAAyB,8BAA8B;IACvD,gCAAgC,qCAAqC;IACrE,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,YAAY,iBAAiB;IAC7B,gBAAgB,qBAAqB;IACrC,qBAAqB,0BAA0B;IAC/C,cAAc,mBAAmB;IACjC,oBAAoB,yBAAyB;IAC7C,0BAA0B,+BAA+B;IACzD,wBAAwB,6BAA6B;IACrD,sBAAsB,2BAA2B;IACjD,IAAI,SAAS;CACd;AAED,eAAO,MAAM,wBAAwB,EAAE,GAAG,CAAC,MAAM,CAgB4B,CAAC;AAE9E,oBAAY,oBAAoB;IAC9B,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,IAAI,SAAS;CACd;AAED,eAAO,MAAM,sBAAsB;;;;;;;;CAQzB,CAAC;AAEX,KAAK,eAAe,CAAC,IAAI,IAAI,OAAO,CAAC;KAClC,CAAC,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;CAC7D,CAAC,CAAC;AACH,eAAO,MAAM,mBAAmB,EAAE,eAAe,CAC/C,OAAO,sBAAsB,CACL,CAAC;AAE3B,eAAO,MAAM,aAAa;;CAQzB,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAQ5B,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,gBAAgB,EAAE,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;CACvD,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CA8F5D,CAAC"}
|
|
@@ -21,7 +21,8 @@ export declare enum TRIGGER_TYPES {
|
|
|
21
21
|
LIDO_STAKING_REWARDS = "lido_staking_rewards",
|
|
22
22
|
ROCKETPOOL_STAKING_REWARDS = "rocketpool_staking_rewards",
|
|
23
23
|
NOTIONAL_LOAN_EXPIRATION = "notional_loan_expiration",
|
|
24
|
-
SPARK_FI_HEALTH_FACTOR = "spark_fi_health_factor"
|
|
24
|
+
SPARK_FI_HEALTH_FACTOR = "spark_fi_health_factor",
|
|
25
|
+
SNAP = "snap"
|
|
25
26
|
}
|
|
26
27
|
export declare const TRIGGER_TYPES_WALLET_SET: Set<string>;
|
|
27
28
|
export declare enum TRIGGER_TYPES_GROUPS {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-schema.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesController/constants/notification-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,gCAA4B;AAGnD,oBAAY,aAAa;IACvB,qBAAqB,0BAA0B;IAC/C,uBAAuB,4BAA4B;IACnD,UAAU,eAAe;IACzB,cAAc,mBAAmB;IACjC,QAAQ,aAAa;IACrB,YAAY,iBAAiB;IAC7B,0BAA0B,+BAA+B;IACzD,4BAA4B,iCAAiC;IAC7D,oBAAoB,yBAAyB;IAC7C,yBAAyB,8BAA8B;IACvD,yBAAyB,8BAA8B;IACvD,gCAAgC,qCAAqC;IACrE,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,YAAY,iBAAiB;IAC7B,gBAAgB,qBAAqB;IACrC,qBAAqB,0BAA0B;IAC/C,cAAc,mBAAmB;IACjC,oBAAoB,yBAAyB;IAC7C,0BAA0B,+BAA+B;IACzD,wBAAwB,6BAA6B;IACrD,sBAAsB,2BAA2B;
|
|
1
|
+
{"version":3,"file":"notification-schema.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesController/constants/notification-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,gCAA4B;AAGnD,oBAAY,aAAa;IACvB,qBAAqB,0BAA0B;IAC/C,uBAAuB,4BAA4B;IACnD,UAAU,eAAe;IACzB,cAAc,mBAAmB;IACjC,QAAQ,aAAa;IACrB,YAAY,iBAAiB;IAC7B,0BAA0B,+BAA+B;IACzD,4BAA4B,iCAAiC;IAC7D,oBAAoB,yBAAyB;IAC7C,yBAAyB,8BAA8B;IACvD,yBAAyB,8BAA8B;IACvD,gCAAgC,qCAAqC;IACrE,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,YAAY,iBAAiB;IAC7B,gBAAgB,qBAAqB;IACrC,qBAAqB,0BAA0B;IAC/C,cAAc,mBAAmB;IACjC,oBAAoB,yBAAyB;IAC7C,0BAA0B,+BAA+B;IACzD,wBAAwB,6BAA6B;IACrD,sBAAsB,2BAA2B;IACjD,IAAI,SAAS;CACd;AAED,eAAO,MAAM,wBAAwB,EAAE,GAAG,CAAC,MAAM,CAgB4B,CAAC;AAE9E,oBAAY,oBAAoB;IAC9B,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,IAAI,SAAS;CACd;AAED,eAAO,MAAM,sBAAsB;;;;;;;;CAQzB,CAAC;AAEX,KAAK,eAAe,CAAC,IAAI,IAAI,OAAO,CAAC;KAClC,CAAC,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;CAC7D,CAAC,CAAC;AACH,eAAO,MAAM,mBAAmB,EAAE,eAAe,CAC/C,OAAO,sBAAsB,CACL,CAAC;AAE3B,eAAO,MAAM,aAAa;;CAQzB,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAQ5B,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,gBAAgB,EAAE,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;CACvD,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CA8F5D,CAAC"}
|
|
@@ -23,6 +23,7 @@ export var TRIGGER_TYPES;
|
|
|
23
23
|
TRIGGER_TYPES["ROCKETPOOL_STAKING_REWARDS"] = "rocketpool_staking_rewards";
|
|
24
24
|
TRIGGER_TYPES["NOTIONAL_LOAN_EXPIRATION"] = "notional_loan_expiration";
|
|
25
25
|
TRIGGER_TYPES["SPARK_FI_HEALTH_FACTOR"] = "spark_fi_health_factor";
|
|
26
|
+
TRIGGER_TYPES["SNAP"] = "snap";
|
|
26
27
|
})(TRIGGER_TYPES || (TRIGGER_TYPES = {}));
|
|
27
28
|
export const TRIGGER_TYPES_WALLET_SET = new Set([
|
|
28
29
|
TRIGGER_TYPES.METAMASK_SWAP_COMPLETED,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-schema.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/constants/notification-schema.ts"],"names":[],"mappings":"AAEA,yDAAyD;AACzD,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"notification-schema.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/constants/notification-schema.ts"],"names":[],"mappings":"AAEA,yDAAyD;AACzD,MAAM,CAAN,IAAY,aAwBX;AAxBD,WAAY,aAAa;IACvB,gEAA+C,CAAA;IAC/C,oEAAmD,CAAA;IACnD,0CAAyB,CAAA;IACzB,kDAAiC,CAAA;IACjC,sCAAqB,CAAA;IACrB,8CAA6B,CAAA;IAC7B,0EAAyD,CAAA;IACzD,8EAA6D,CAAA;I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C3B,mBAAmB,CAAC,QAAQ;YAC5B,mBAAmB,CAAC,SAAS;YAC7B,mBAAmB,CAAC,KAAK;SAC1B;KACF;IACD,CAAC,aAAa,CAAC,0BAA0B,CAAC,EAAE;QAC1C,gBAAgB,EAAE,CAAC,mBAAmB,CAAC,QAAQ,CAAC;KACjD;IACD,CAAC,aAAa,CAAC,4BAA4B,CAAC,EAAE;QAC5C,gBAAgB,EAAE,CAAC,mBAAmB,CAAC,QAAQ,CAAC;KACjD;IACD,CAAC,aAAa,CAAC,oBAAoB,CAAC,EAAE;QACpC,gBAAgB,EAAE,CAAC,mBAAmB,CAAC,QAAQ,CAAC;KACjD;IACD,CAAC,aAAa,CAAC,yBAAyB,CAAC,EAAE;QACzC,gBAAgB,EAAE,CAAC,mBAAmB,CAAC,QAAQ,CAAC;KACjD;IACD,CAAC,aAAa,CAAC,yBAAyB,CAAC,EAAE;QACzC,gBAAgB,EAAE,CAAC,mBAAmB,CAAC,QAAQ,CAAC;KACjD;CACF,CAAC","sourcesContent":["import type { Compute } from '../types/type-utils';\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum TRIGGER_TYPES {\n FEATURES_ANNOUNCEMENT = 'features_announcement',\n METAMASK_SWAP_COMPLETED = 'metamask_swap_completed',\n ERC20_SENT = 'erc20_sent',\n ERC20_RECEIVED = 'erc20_received',\n ETH_SENT = 'eth_sent',\n ETH_RECEIVED = 'eth_received',\n ROCKETPOOL_STAKE_COMPLETED = 'rocketpool_stake_completed',\n ROCKETPOOL_UNSTAKE_COMPLETED = 'rocketpool_unstake_completed',\n LIDO_STAKE_COMPLETED = 'lido_stake_completed',\n LIDO_WITHDRAWAL_REQUESTED = 'lido_withdrawal_requested',\n LIDO_WITHDRAWAL_COMPLETED = 'lido_withdrawal_completed',\n LIDO_STAKE_READY_TO_BE_WITHDRAWN = 'lido_stake_ready_to_be_withdrawn',\n ERC721_SENT = 'erc721_sent',\n ERC721_RECEIVED = 'erc721_received',\n ERC1155_SENT = 'erc1155_sent',\n ERC1155_RECEIVED = 'erc1155_received',\n AAVE_V3_HEALTH_FACTOR = 'aave_v3_health_factor',\n ENS_EXPIRATION = 'ens_expiration',\n LIDO_STAKING_REWARDS = 'lido_staking_rewards',\n ROCKETPOOL_STAKING_REWARDS = 'rocketpool_staking_rewards',\n NOTIONAL_LOAN_EXPIRATION = 'notional_loan_expiration',\n SPARK_FI_HEALTH_FACTOR = 'spark_fi_health_factor',\n SNAP = 'snap',\n}\n\nexport const TRIGGER_TYPES_WALLET_SET: Set<string> = new Set([\n TRIGGER_TYPES.METAMASK_SWAP_COMPLETED,\n TRIGGER_TYPES.ERC20_SENT,\n TRIGGER_TYPES.ERC20_RECEIVED,\n TRIGGER_TYPES.ETH_SENT,\n TRIGGER_TYPES.ETH_RECEIVED,\n TRIGGER_TYPES.ROCKETPOOL_STAKE_COMPLETED,\n TRIGGER_TYPES.ROCKETPOOL_UNSTAKE_COMPLETED,\n TRIGGER_TYPES.LIDO_STAKE_COMPLETED,\n TRIGGER_TYPES.LIDO_WITHDRAWAL_REQUESTED,\n TRIGGER_TYPES.LIDO_WITHDRAWAL_COMPLETED,\n TRIGGER_TYPES.LIDO_STAKE_READY_TO_BE_WITHDRAWN,\n TRIGGER_TYPES.ERC721_SENT,\n TRIGGER_TYPES.ERC721_RECEIVED,\n TRIGGER_TYPES.ERC1155_SENT,\n TRIGGER_TYPES.ERC1155_RECEIVED,\n]) satisfies Set<Exclude<TRIGGER_TYPES, TRIGGER_TYPES.FEATURES_ANNOUNCEMENT>>;\n\nexport enum TRIGGER_TYPES_GROUPS {\n RECEIVED = 'received',\n SENT = 'sent',\n DEFI = 'defi',\n}\n\nexport const NOTIFICATION_CHAINS_ID = {\n ETHEREUM: '1',\n OPTIMISM: '10',\n BSC: '56',\n POLYGON: '137',\n ARBITRUM: '42161',\n AVALANCHE: '43114',\n LINEA: '59144',\n} as const;\n\ntype ToPrimitiveKeys<TObj> = Compute<{\n [K in keyof TObj]: TObj[K] extends string ? string : TObj[K];\n}>;\nexport const NOTIFICATION_CHAINS: ToPrimitiveKeys<\n typeof NOTIFICATION_CHAINS_ID\n> = NOTIFICATION_CHAINS_ID;\n\nexport const CHAIN_SYMBOLS = {\n [NOTIFICATION_CHAINS.ETHEREUM]: 'ETH',\n [NOTIFICATION_CHAINS.OPTIMISM]: 'ETH',\n [NOTIFICATION_CHAINS.BSC]: 'BNB',\n [NOTIFICATION_CHAINS.POLYGON]: 'POL',\n [NOTIFICATION_CHAINS.ARBITRUM]: 'ETH',\n [NOTIFICATION_CHAINS.AVALANCHE]: 'AVAX',\n [NOTIFICATION_CHAINS.LINEA]: 'ETH',\n};\n\nexport const SUPPORTED_CHAINS = [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.OPTIMISM,\n NOTIFICATION_CHAINS.BSC,\n NOTIFICATION_CHAINS.POLYGON,\n NOTIFICATION_CHAINS.ARBITRUM,\n NOTIFICATION_CHAINS.AVALANCHE,\n NOTIFICATION_CHAINS.LINEA,\n];\n\nexport type Trigger = {\n supported_chains: (typeof SUPPORTED_CHAINS)[number][];\n};\n\nexport const TRIGGERS: Partial<Record<TRIGGER_TYPES, Trigger>> = {\n [TRIGGER_TYPES.METAMASK_SWAP_COMPLETED]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.OPTIMISM,\n NOTIFICATION_CHAINS.BSC,\n NOTIFICATION_CHAINS.POLYGON,\n NOTIFICATION_CHAINS.ARBITRUM,\n NOTIFICATION_CHAINS.AVALANCHE,\n ],\n },\n [TRIGGER_TYPES.ERC20_SENT]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.OPTIMISM,\n NOTIFICATION_CHAINS.BSC,\n NOTIFICATION_CHAINS.POLYGON,\n NOTIFICATION_CHAINS.ARBITRUM,\n NOTIFICATION_CHAINS.AVALANCHE,\n NOTIFICATION_CHAINS.LINEA,\n ],\n },\n [TRIGGER_TYPES.ERC20_RECEIVED]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.OPTIMISM,\n NOTIFICATION_CHAINS.BSC,\n NOTIFICATION_CHAINS.POLYGON,\n NOTIFICATION_CHAINS.ARBITRUM,\n NOTIFICATION_CHAINS.AVALANCHE,\n NOTIFICATION_CHAINS.LINEA,\n ],\n },\n [TRIGGER_TYPES.ERC721_SENT]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.POLYGON,\n ],\n },\n [TRIGGER_TYPES.ERC721_RECEIVED]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.POLYGON,\n ],\n },\n [TRIGGER_TYPES.ERC1155_SENT]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.POLYGON,\n ],\n },\n [TRIGGER_TYPES.ERC1155_RECEIVED]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.POLYGON,\n ],\n },\n [TRIGGER_TYPES.ETH_SENT]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.OPTIMISM,\n NOTIFICATION_CHAINS.BSC,\n NOTIFICATION_CHAINS.POLYGON,\n NOTIFICATION_CHAINS.ARBITRUM,\n NOTIFICATION_CHAINS.AVALANCHE,\n NOTIFICATION_CHAINS.LINEA,\n ],\n },\n [TRIGGER_TYPES.ETH_RECEIVED]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.OPTIMISM,\n NOTIFICATION_CHAINS.BSC,\n NOTIFICATION_CHAINS.POLYGON,\n NOTIFICATION_CHAINS.ARBITRUM,\n NOTIFICATION_CHAINS.AVALANCHE,\n NOTIFICATION_CHAINS.LINEA,\n ],\n },\n [TRIGGER_TYPES.ROCKETPOOL_STAKE_COMPLETED]: {\n supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],\n },\n [TRIGGER_TYPES.ROCKETPOOL_UNSTAKE_COMPLETED]: {\n supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],\n },\n [TRIGGER_TYPES.LIDO_STAKE_COMPLETED]: {\n supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],\n },\n [TRIGGER_TYPES.LIDO_WITHDRAWAL_REQUESTED]: {\n supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],\n },\n [TRIGGER_TYPES.LIDO_WITHDRAWAL_COMPLETED]: {\n supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],\n },\n};\n"]}
|
|
@@ -4,8 +4,10 @@ exports.safeProcessNotification = exports.processNotification = void 0;
|
|
|
4
4
|
const notification_schema_1 = require("../constants/notification-schema.cjs");
|
|
5
5
|
const process_feature_announcement_1 = require("./process-feature-announcement.cjs");
|
|
6
6
|
const process_onchain_notifications_1 = require("./process-onchain-notifications.cjs");
|
|
7
|
+
const process_snap_notifications_1 = require("./process-snap-notifications.cjs");
|
|
7
8
|
const isOnChainNotification = (n) => Object.values(notification_schema_1.TRIGGER_TYPES).includes(n.type);
|
|
8
9
|
const isFeatureAnnouncement = (n) => n.type === notification_schema_1.TRIGGER_TYPES.FEATURES_ANNOUNCEMENT;
|
|
10
|
+
const isSnapNotification = (n) => n.type === notification_schema_1.TRIGGER_TYPES.SNAP;
|
|
9
11
|
/**
|
|
10
12
|
* Process feature announcement and wallet notifications into a shared/normalised notification shape.
|
|
11
13
|
* We can still differentiate notifications by the `type` property
|
|
@@ -24,6 +26,9 @@ function processNotification(notification, readNotifications = []) {
|
|
|
24
26
|
n.isRead = (0, process_feature_announcement_1.isFeatureAnnouncementRead)(n, readNotifications);
|
|
25
27
|
return n;
|
|
26
28
|
}
|
|
29
|
+
if (isSnapNotification(notification)) {
|
|
30
|
+
return (0, process_snap_notifications_1.processSnapNotification)(notification);
|
|
31
|
+
}
|
|
27
32
|
if (isOnChainNotification(notification)) {
|
|
28
33
|
return (0, process_onchain_notifications_1.processOnChainNotification)(notification);
|
|
29
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-notifications.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/processors/process-notifications.ts"],"names":[],"mappings":";;;AAAA,8EAAiE;
|
|
1
|
+
{"version":3,"file":"process-notifications.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/processors/process-notifications.ts"],"names":[],"mappings":";;;AAAA,8EAAiE;AAQjE,qFAGwC;AACxC,uFAA6E;AAC7E,iFAAuE;AAEvE,MAAM,qBAAqB,GAAG,CAC5B,CAAuB,EACM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,mCAAa,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAEhF,MAAM,qBAAqB,GAAG,CAC5B,CAAuB,EACkB,EAAE,CAC3C,CAAC,CAAC,IAAI,KAAK,mCAAa,CAAC,qBAAqB,CAAC;AAEjD,MAAM,kBAAkB,GAAG,CACzB,CAAuB,EACG,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,mCAAa,CAAC,IAAI,CAAC;AAE7D;;;;;;;GAOG;AACH,SAAgB,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,IAAA,yDAA0B,EAClC,YAAkD,CACnD,CAAC;QACF,CAAC,CAAC,MAAM,GAAG,IAAA,wDAAyB,EAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC;QAC3D,OAAO,CAAC,CAAC;KACV;IAED,IAAI,kBAAkB,CAAC,YAAY,CAAC,EAAE;QACpC,OAAO,IAAA,oDAAuB,EAAC,YAAY,CAAC,CAAC;KAC9C;IAED,IAAI,qBAAqB,CAAC,YAAY,CAAC,EAAE;QACvC,OAAO,IAAA,0DAA0B,EAAC,YAAY,CAAC,CAAC;KACjD;IAED,OAAO,iBAAiB,CAAC,YAAqB,CAAC,CAAC;AAClD,CAAC;AA1BD,kDA0BC;AAED;;;;;;GAMG;AACH,SAAgB,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;AAbD,0DAaC","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"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { INotification,
|
|
1
|
+
import type { INotification, RawNotificationUnion } from "../types/notification/notification.cjs";
|
|
2
2
|
/**
|
|
3
3
|
* Process feature announcement and wallet notifications into a shared/normalised notification shape.
|
|
4
4
|
* We can still differentiate notifications by the `type` property
|
|
@@ -7,7 +7,7 @@ import type { INotification, NotificationUnion } from "../types/notification/not
|
|
|
7
7
|
* @param readNotifications - all read notifications currently
|
|
8
8
|
* @returns a processed notification
|
|
9
9
|
*/
|
|
10
|
-
export declare function processNotification(notification:
|
|
10
|
+
export declare function processNotification(notification: RawNotificationUnion, readNotifications?: string[]): INotification;
|
|
11
11
|
/**
|
|
12
12
|
* Safe version of processing a notification. Rather than throwing an error if failed to process, it will return the Notification or undefined
|
|
13
13
|
*
|
|
@@ -15,5 +15,5 @@ export declare function processNotification(notification: NotificationUnion, rea
|
|
|
15
15
|
* @param readNotifications - all read notifications currently
|
|
16
16
|
* @returns a process notification or undefined if failed to process
|
|
17
17
|
*/
|
|
18
|
-
export declare function safeProcessNotification(notification:
|
|
18
|
+
export declare function safeProcessNotification(notification: RawNotificationUnion, readNotifications?: string[]): INotification | undefined;
|
|
19
19
|
//# sourceMappingURL=process-notifications.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-notifications.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesController/processors/process-notifications.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"process-notifications.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesController/processors/process-notifications.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACrB,+CAA2C;AAuB5C;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,oBAAoB,EAClC,iBAAiB,GAAE,MAAM,EAAO,GAC/B,aAAa,CAuBf;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,oBAAoB,EAClC,iBAAiB,GAAE,MAAM,EAAO,GAC/B,aAAa,GAAG,SAAS,CAU3B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { INotification,
|
|
1
|
+
import type { INotification, RawNotificationUnion } from "../types/notification/notification.mjs";
|
|
2
2
|
/**
|
|
3
3
|
* Process feature announcement and wallet notifications into a shared/normalised notification shape.
|
|
4
4
|
* We can still differentiate notifications by the `type` property
|
|
@@ -7,7 +7,7 @@ import type { INotification, NotificationUnion } from "../types/notification/not
|
|
|
7
7
|
* @param readNotifications - all read notifications currently
|
|
8
8
|
* @returns a processed notification
|
|
9
9
|
*/
|
|
10
|
-
export declare function processNotification(notification:
|
|
10
|
+
export declare function processNotification(notification: RawNotificationUnion, readNotifications?: string[]): INotification;
|
|
11
11
|
/**
|
|
12
12
|
* Safe version of processing a notification. Rather than throwing an error if failed to process, it will return the Notification or undefined
|
|
13
13
|
*
|
|
@@ -15,5 +15,5 @@ export declare function processNotification(notification: NotificationUnion, rea
|
|
|
15
15
|
* @param readNotifications - all read notifications currently
|
|
16
16
|
* @returns a process notification or undefined if failed to process
|
|
17
17
|
*/
|
|
18
|
-
export declare function safeProcessNotification(notification:
|
|
18
|
+
export declare function safeProcessNotification(notification: RawNotificationUnion, readNotifications?: string[]): INotification | undefined;
|
|
19
19
|
//# sourceMappingURL=process-notifications.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-notifications.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesController/processors/process-notifications.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"process-notifications.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesController/processors/process-notifications.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACrB,+CAA2C;AAuB5C;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,oBAAoB,EAClC,iBAAiB,GAAE,MAAM,EAAO,GAC/B,aAAa,CAuBf;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,oBAAoB,EAClC,iBAAiB,GAAE,MAAM,EAAO,GAC/B,aAAa,GAAG,SAAS,CAU3B"}
|
|
@@ -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;
|