MCPcopy Create free account
hub / github.com/ICBNetwork/web3-Wallet / constructTitleAndMessage

Function constructTitleAndMessage

app/core/NotificationManager.js:20–78  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

18import { selectChainId } from '../selectors/networkController';
19import { store } from '../store';
20const constructTitleAndMessage = (data) => {
21 let title, message;
22 switch (data.type) {
23 case NotificationTransactionTypes.pending:
24 title = strings('notifications.pending_title');
25 message = strings('notifications.pending_message');
26 break;
27 case NotificationTransactionTypes.pending_deposit:
28 title = strings('notifications.pending_deposit_title');
29 message = strings('notifications.pending_deposit_message');
30 break;
31 case NotificationTransactionTypes.pending_withdrawal:
32 title = strings('notifications.pending_withdrawal_title');
33 message = strings('notifications.pending_withdrawal_message');
34 break;
35 case NotificationTransactionTypes.success:
36 title = strings('notifications.success_title', {
37 nonce: data?.transaction?.nonce || '',
38 });
39 message = strings('notifications.success_message');
40 break;
41 case NotificationTransactionTypes.speedup:
42 title = strings('notifications.speedup_title', {
43 nonce: data?.transaction?.nonce || '',
44 });
45 message = strings('notifications.speedup_message');
46 break;
47 case NotificationTransactionTypes.success_withdrawal:
48 title = strings('notifications.success_withdrawal_title');
49 message = strings('notifications.success_withdrawal_message');
50 break;
51 case NotificationTransactionTypes.success_deposit:
52 title = strings('notifications.success_deposit_title');
53 message = strings('notifications.success_deposit_message');
54 break;
55 case NotificationTransactionTypes.error:
56 title = strings('notifications.error_title');
57 message = strings('notifications.error_message');
58 break;
59 case NotificationTransactionTypes.cancelled:
60 title = strings('notifications.cancelled_title');
61 message = strings('notifications.cancelled_message');
62 break;
63 case NotificationTransactionTypes.received:
64 title = strings('notifications.received_title', {
65 amount: data.transaction.amount,
66 assetType: data.transaction.assetType,
67 });
68 message = strings('notifications.received_message');
69 break;
70 case NotificationTransactionTypes.received_payment:
71 title = strings('notifications.received_payment_title');
72 message = strings('notifications.received_payment_message', {
73 amount: data.transaction.amount,
74 });
75 break;
76 }
77 return { title, message };

Callers 1

_showNotificationMethod · 0.85

Calls 1

stringsFunction · 0.90

Tested by

no test coverage detected