@subwallet/extension-base 1.3.2-0 → 1.3.4-0
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/background/KoniTypes.d.ts +13 -0
- package/background/KoniTypes.js +1 -0
- package/cjs/background/KoniTypes.js +1 -0
- package/cjs/constants/blocked-actions-list.js +1 -2
- package/cjs/constants/index.js +16 -1
- package/cjs/constants/remind-notification-time.js +14 -0
- package/cjs/core/logic-validation/transfer.js +12 -6
- package/cjs/core/substrate/xcm-parser.js +13 -1
- package/cjs/koni/api/contract-handler/utils/index.js +20 -1
- package/cjs/koni/api/nft/assethub_nft/index.js +30 -7
- package/cjs/koni/background/handlers/Extension.js +110 -23
- package/cjs/koni/background/handlers/State.js +5 -2
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/process.js +2 -1
- package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +11 -12
- package/cjs/services/balance-service/transfer/xcm/availBridge.js +198 -0
- package/cjs/services/balance-service/transfer/xcm/index.js +50 -5
- package/cjs/services/chain-service/handler/EvmApi.js +12 -21
- package/cjs/services/chain-service/handler/SubstrateChainHandler.js +29 -0
- package/cjs/services/chain-service/index.js +44 -13
- package/cjs/services/chain-service/utils/index.js +20 -0
- package/cjs/services/earning-service/handlers/base.js +14 -4
- package/cjs/services/earning-service/handlers/native-staking/amplitude.js +10 -2
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +2 -0
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +2 -0
- package/cjs/services/earning-service/handlers/native-staking/tao.js +25 -38
- package/cjs/services/earning-service/handlers/nomination-pool/index.js +9 -4
- package/cjs/services/earning-service/service.js +5 -0
- package/cjs/services/earning-service/utils/index.js +0 -11
- package/cjs/services/inapp-notification-service/consts.js +31 -0
- package/cjs/services/inapp-notification-service/index.js +260 -0
- package/cjs/services/inapp-notification-service/interfaces.js +32 -0
- package/cjs/services/inapp-notification-service/utils.js +197 -0
- package/cjs/services/keyring-service/context/account-context.js +9 -0
- package/cjs/services/keyring-service/context/state.js +4 -0
- package/cjs/services/setting-service/SettingService.js +9 -1
- package/cjs/services/setting-service/constants.js +16 -1
- package/cjs/services/storage-service/DatabaseService.js +42 -3
- package/cjs/services/storage-service/databases/index.js +3 -0
- package/cjs/services/storage-service/db-stores/InappNotification.js +81 -0
- package/cjs/services/transaction-service/index.js +13 -0
- package/cjs/services/transaction-service/utils.js +3 -0
- package/cjs/types/avail-bridge/index.js +1 -0
- package/cjs/types/notification/index.js +1 -0
- package/cjs/utils/account/transform.js +9 -5
- package/cjs/utils/staticData/index.js +7 -2
- package/constants/blocked-actions-list.js +1 -2
- package/constants/index.d.ts +2 -0
- package/constants/index.js +3 -1
- package/constants/remind-notification-time.d.ts +2 -0
- package/constants/remind-notification-time.js +7 -0
- package/core/logic-validation/transfer.js +12 -6
- package/core/substrate/xcm-parser.d.ts +1 -0
- package/core/substrate/xcm-parser.js +12 -1
- package/koni/api/contract-handler/utils/avail_bridge_abi.json +1659 -0
- package/koni/api/contract-handler/utils/avail_test_bridge_abi.json +1692 -0
- package/koni/api/contract-handler/utils/index.d.ts +4 -0
- package/koni/api/contract-handler/utils/index.js +15 -0
- package/koni/api/nft/assethub_nft/index.d.ts +2 -0
- package/koni/api/nft/assethub_nft/index.js +30 -7
- package/koni/background/handlers/Extension.d.ts +7 -0
- package/koni/background/handlers/Extension.js +112 -25
- package/koni/background/handlers/State.d.ts +2 -0
- package/koni/background/handlers/State.js +5 -2
- package/package.json +54 -6
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/process.js +2 -1
- package/services/balance-service/helpers/subscribe/substrate/index.js +5 -6
- package/services/balance-service/transfer/xcm/availBridge.d.ts +45 -0
- package/services/balance-service/transfer/xcm/availBridge.js +186 -0
- package/services/balance-service/transfer/xcm/index.d.ts +8 -8
- package/services/balance-service/transfer/xcm/index.js +46 -5
- package/services/chain-service/handler/EvmApi.js +12 -21
- package/services/chain-service/handler/SubstrateChainHandler.d.ts +2 -0
- package/services/chain-service/handler/SubstrateChainHandler.js +29 -0
- package/services/chain-service/index.d.ts +2 -0
- package/services/chain-service/index.js +45 -14
- package/services/chain-service/types.d.ts +2 -1
- package/services/chain-service/utils/index.d.ts +3 -0
- package/services/chain-service/utils/index.js +14 -0
- package/services/earning-service/handlers/base.d.ts +2 -0
- package/services/earning-service/handlers/base.js +11 -1
- package/services/earning-service/handlers/native-staking/amplitude.js +10 -2
- package/services/earning-service/handlers/native-staking/para-chain.js +2 -0
- package/services/earning-service/handlers/native-staking/relay-chain.js +2 -0
- package/services/earning-service/handlers/native-staking/tao.d.ts +15 -11
- package/services/earning-service/handlers/native-staking/tao.js +21 -38
- package/services/earning-service/handlers/nomination-pool/index.d.ts +1 -1
- package/services/earning-service/handlers/nomination-pool/index.js +9 -4
- package/services/earning-service/service.d.ts +2 -0
- package/services/earning-service/service.js +5 -0
- package/services/earning-service/utils/index.d.ts +0 -2
- package/services/earning-service/utils/index.js +0 -10
- package/services/inapp-notification-service/consts.d.ts +18 -0
- package/services/inapp-notification-service/consts.js +22 -0
- package/services/inapp-notification-service/index.d.ts +37 -0
- package/services/inapp-notification-service/index.js +252 -0
- package/services/inapp-notification-service/interfaces.d.ts +77 -0
- package/services/inapp-notification-service/interfaces.js +24 -0
- package/services/inapp-notification-service/utils.d.ts +55 -0
- package/services/inapp-notification-service/utils.js +173 -0
- package/services/keyring-service/context/account-context.d.ts +3 -0
- package/services/keyring-service/context/account-context.js +9 -0
- package/services/keyring-service/context/state.d.ts +1 -0
- package/services/keyring-service/context/state.js +4 -0
- package/services/setting-service/SettingService.js +9 -1
- package/services/setting-service/constants.d.ts +2 -0
- package/services/setting-service/constants.js +15 -0
- package/services/storage-service/DatabaseService.d.ts +15 -0
- package/services/storage-service/DatabaseService.js +42 -3
- package/services/storage-service/databases/index.d.ts +2 -0
- package/services/storage-service/databases/index.js +3 -0
- package/services/storage-service/db-stores/InappNotification.d.ts +14 -0
- package/services/storage-service/db-stores/InappNotification.js +73 -0
- package/services/transaction-service/index.js +13 -0
- package/services/transaction-service/utils.js +3 -0
- package/types/avail-bridge/index.d.ts +6 -0
- package/types/avail-bridge/index.js +1 -0
- package/types/notification/index.d.ts +9 -0
- package/types/notification/index.js +1 -0
- package/utils/account/transform.js +9 -5
- package/utils/staticData/index.d.ts +5 -1
- package/utils/staticData/index.js +5 -2
- package/utils/staticData/remindNotificationTime.json +1 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AvailBridgeTransactionStatus = exports.AvailBridgeSourceChain = exports.AVAIL_BRIDGE_INDEXER = exports.AVAIL_BRIDGE_API = void 0;
|
|
7
|
+
exports.createClaimNotification = createClaimNotification;
|
|
8
|
+
exports.createWithdrawNotifications = createWithdrawNotifications;
|
|
9
|
+
exports.fetchAllAvailBridgeClaimable = fetchAllAvailBridgeClaimable;
|
|
10
|
+
exports.fetchAvailBridgeTransactions = fetchAvailBridgeTransactions;
|
|
11
|
+
exports.filterClaimableOfAddress = filterClaimableOfAddress;
|
|
12
|
+
exports.getAvailBridgeClaimDescription = getAvailBridgeClaimDescription;
|
|
13
|
+
exports.getClaimDescription = getClaimDescription;
|
|
14
|
+
exports.getIsTabRead = getIsTabRead;
|
|
15
|
+
exports.getReceiveDescription = getReceiveDescription;
|
|
16
|
+
exports.getSendDescription = getSendDescription;
|
|
17
|
+
exports.getWithdrawDescription = getWithdrawDescription;
|
|
18
|
+
exports.hrsToMillisecond = hrsToMillisecond;
|
|
19
|
+
var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
|
|
20
|
+
var _utils = require("@subwallet/extension-base/services/chain-service/utils");
|
|
21
|
+
var _consts = require("@subwallet/extension-base/services/inapp-notification-service/consts");
|
|
22
|
+
var _interfaces = require("@subwallet/extension-base/services/inapp-notification-service/interfaces");
|
|
23
|
+
var _types = require("@subwallet/extension-base/types");
|
|
24
|
+
var _utils2 = require("@subwallet/extension-base/utils");
|
|
25
|
+
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
26
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
27
|
+
|
|
28
|
+
/* Description */
|
|
29
|
+
function getWithdrawDescription(amount, symbol, stakingType) {
|
|
30
|
+
if (stakingType === _types.YieldPoolType.LIQUID_STAKING) {
|
|
31
|
+
return `${amount} ${symbol} ready to withdraw from ${symbol} liquid staking. Click to withdraw now!`;
|
|
32
|
+
}
|
|
33
|
+
return `${amount} ${symbol} ready to withdraw from ${symbol} staking. Click to withdraw now!`;
|
|
34
|
+
}
|
|
35
|
+
function getClaimDescription(amount, symbol) {
|
|
36
|
+
return `${amount} ${symbol} ready to claim from ${symbol} staking. Click to claim now!`;
|
|
37
|
+
}
|
|
38
|
+
function getSendDescription(amount, symbol) {
|
|
39
|
+
return `You have just sent ${amount} ${symbol}`;
|
|
40
|
+
}
|
|
41
|
+
function getReceiveDescription(amount, symbol) {
|
|
42
|
+
return `You have just received ${amount} ${symbol}`;
|
|
43
|
+
}
|
|
44
|
+
function getAvailBridgeClaimDescription(amount, symbol) {
|
|
45
|
+
return `${amount} ${symbol} ready to claim from ${symbol} cross-chain transfer. Click to claim now!`;
|
|
46
|
+
}
|
|
47
|
+
/* Description */
|
|
48
|
+
|
|
49
|
+
function getIsTabRead(notificationTab) {
|
|
50
|
+
if (notificationTab === _interfaces.NotificationTab.UNREAD) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
if (notificationTab === _interfaces.NotificationTab.READ) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
function createWithdrawNotification(amount, address, symbol, stakingSlug, stakingType) {
|
|
59
|
+
const actionType = _interfaces.NotificationActionType.WITHDRAW;
|
|
60
|
+
const extrinsicType = _KoniTypes.ExtrinsicType.STAKING_WITHDRAW;
|
|
61
|
+
const time = Date.now();
|
|
62
|
+
return {
|
|
63
|
+
id: `${actionType}___${stakingSlug}___${time}`,
|
|
64
|
+
title: _consts.NotificationTitleMap[actionType].replace('{{tokenSymbol}}', symbol),
|
|
65
|
+
description: _consts.NotificationDescriptionMap[actionType](amount, symbol, stakingType),
|
|
66
|
+
address,
|
|
67
|
+
time,
|
|
68
|
+
extrinsicType,
|
|
69
|
+
isRead: false,
|
|
70
|
+
actionType,
|
|
71
|
+
metadata: {
|
|
72
|
+
stakingType,
|
|
73
|
+
stakingSlug
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function createWithdrawNotifications(unstakingInfos, tokenInfo, address, stakingSlug, stakingType) {
|
|
78
|
+
const allWithdrawNotifications = [];
|
|
79
|
+
for (const unstaking of unstakingInfos) {
|
|
80
|
+
if (unstaking.status !== _types.UnstakingStatus.CLAIMABLE) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const rawClaimableAmount = unstaking.claimable;
|
|
84
|
+
const decimals = (0, _utils._getAssetDecimals)(tokenInfo);
|
|
85
|
+
const symbol = (0, _utils._getAssetSymbol)(tokenInfo);
|
|
86
|
+
const amount = (0, _utils2.formatNumber)(rawClaimableAmount, decimals);
|
|
87
|
+
allWithdrawNotifications.push(createWithdrawNotification(amount, address, symbol, stakingSlug, stakingType));
|
|
88
|
+
}
|
|
89
|
+
return allWithdrawNotifications;
|
|
90
|
+
}
|
|
91
|
+
function createClaimNotification(claimItemInfo, tokenInfo) {
|
|
92
|
+
const {
|
|
93
|
+
address,
|
|
94
|
+
slug,
|
|
95
|
+
type,
|
|
96
|
+
unclaimedReward = '0'
|
|
97
|
+
} = claimItemInfo;
|
|
98
|
+
const decimals = (0, _utils._getAssetDecimals)(tokenInfo);
|
|
99
|
+
const symbol = (0, _utils._getAssetSymbol)(tokenInfo);
|
|
100
|
+
const amount = (0, _utils2.formatNumber)(unclaimedReward, decimals);
|
|
101
|
+
const actionType = _interfaces.NotificationActionType.CLAIM;
|
|
102
|
+
const extrinsicType = _KoniTypes.ExtrinsicType.STAKING_CLAIM_REWARD;
|
|
103
|
+
const time = Date.now();
|
|
104
|
+
return {
|
|
105
|
+
id: `${actionType}___${slug}___${time}`,
|
|
106
|
+
title: _consts.NotificationTitleMap[actionType].replace('{{tokenSymbol}}', symbol),
|
|
107
|
+
description: _consts.NotificationDescriptionMap[actionType](amount, symbol),
|
|
108
|
+
address,
|
|
109
|
+
time,
|
|
110
|
+
extrinsicType,
|
|
111
|
+
isRead: false,
|
|
112
|
+
actionType,
|
|
113
|
+
metadata: {
|
|
114
|
+
stakingType: type,
|
|
115
|
+
stakingSlug: slug
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// todo: can refactor utils and const of avail bridge to a new file. Also check in /transfer/xcm/availBridge.ts file
|
|
121
|
+
|
|
122
|
+
const AVAIL_BRIDGE_INDEXER = {
|
|
123
|
+
AVAIL_MAINNET: 'https://bridge-indexer.avail.so',
|
|
124
|
+
AVAIL_TESTNET: 'https://turing-bridge-indexer.fra.avail.so'
|
|
125
|
+
};
|
|
126
|
+
exports.AVAIL_BRIDGE_INDEXER = AVAIL_BRIDGE_INDEXER;
|
|
127
|
+
const AVAIL_BRIDGE_API = {
|
|
128
|
+
AVAIL_MAINNET: 'https://bridge-api.avail.so',
|
|
129
|
+
AVAIL_TESTNET: 'https://turing-bridge-api.fra.avail.so'
|
|
130
|
+
};
|
|
131
|
+
exports.AVAIL_BRIDGE_API = AVAIL_BRIDGE_API;
|
|
132
|
+
let AvailBridgeTransactionStatus;
|
|
133
|
+
exports.AvailBridgeTransactionStatus = AvailBridgeTransactionStatus;
|
|
134
|
+
(function (AvailBridgeTransactionStatus) {
|
|
135
|
+
AvailBridgeTransactionStatus["READY_TO_CLAIM"] = "READY_TO_CLAIM";
|
|
136
|
+
AvailBridgeTransactionStatus["CLAIMED"] = "CLAIMED";
|
|
137
|
+
AvailBridgeTransactionStatus["BRIDGED"] = "BRIDGED";
|
|
138
|
+
})(AvailBridgeTransactionStatus || (exports.AvailBridgeTransactionStatus = AvailBridgeTransactionStatus = {}));
|
|
139
|
+
let AvailBridgeSourceChain;
|
|
140
|
+
exports.AvailBridgeSourceChain = AvailBridgeSourceChain;
|
|
141
|
+
(function (AvailBridgeSourceChain) {
|
|
142
|
+
AvailBridgeSourceChain["AVAIL"] = "AVAIL";
|
|
143
|
+
AvailBridgeSourceChain["ETHEREUM"] = "ETHEREUM";
|
|
144
|
+
})(AvailBridgeSourceChain || (exports.AvailBridgeSourceChain = AvailBridgeSourceChain = {}));
|
|
145
|
+
async function fetchAllAvailBridgeClaimable(address, sourceChain, isTestnet) {
|
|
146
|
+
const transactions = [];
|
|
147
|
+
let isContinue = true;
|
|
148
|
+
let page = 0;
|
|
149
|
+
const pageSize = 100;
|
|
150
|
+
while (isContinue) {
|
|
151
|
+
const response = await fetchAvailBridgeTransactions(address, sourceChain, AvailBridgeTransactionStatus.READY_TO_CLAIM, pageSize, page, isTestnet);
|
|
152
|
+
if (!response) {
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
transactions.push(...filterClaimableOfAddress(address, response.data.result));
|
|
156
|
+
isContinue = response.data.paginationData.hasNextPage;
|
|
157
|
+
page = page + 1;
|
|
158
|
+
}
|
|
159
|
+
return transactions;
|
|
160
|
+
}
|
|
161
|
+
async function fetchAvailBridgeTransactions(userAddress, sourceChain, status) {
|
|
162
|
+
let pageSize = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 100;
|
|
163
|
+
let page = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
164
|
+
let isTestnet = arguments.length > 5 ? arguments[5] : undefined;
|
|
165
|
+
const params = new URLSearchParams({
|
|
166
|
+
userAddress,
|
|
167
|
+
sourceChain,
|
|
168
|
+
status,
|
|
169
|
+
pageSize: pageSize.toString(),
|
|
170
|
+
page: page.toString()
|
|
171
|
+
});
|
|
172
|
+
try {
|
|
173
|
+
const api = isTestnet ? AVAIL_BRIDGE_INDEXER.AVAIL_TESTNET : AVAIL_BRIDGE_INDEXER.AVAIL_MAINNET;
|
|
174
|
+
const rawResponse = await fetch(`${api}/transactions?${params.toString()}`, {
|
|
175
|
+
method: 'GET',
|
|
176
|
+
headers: {
|
|
177
|
+
'Content-Type': 'application/json',
|
|
178
|
+
'Access-Control-Allow-Origin': '*'
|
|
179
|
+
},
|
|
180
|
+
credentials: 'omit'
|
|
181
|
+
});
|
|
182
|
+
if (!rawResponse.ok) {
|
|
183
|
+
console.error('Error fetching claimable bridge transactions');
|
|
184
|
+
return undefined;
|
|
185
|
+
}
|
|
186
|
+
return await rawResponse.json();
|
|
187
|
+
} catch (e) {
|
|
188
|
+
console.error(e);
|
|
189
|
+
return undefined;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function filterClaimableOfAddress(address, transactions) {
|
|
193
|
+
return transactions.filter(transaction => transaction.receiverAddress.toLowerCase() === address.toLowerCase());
|
|
194
|
+
}
|
|
195
|
+
function hrsToMillisecond(hours) {
|
|
196
|
+
return hours * 60 * 60 * 1000;
|
|
197
|
+
}
|
|
@@ -61,9 +61,15 @@ class AccountContext {
|
|
|
61
61
|
isUnifiedAccount(proxyId) {
|
|
62
62
|
return this.state.isUnifiedAccount(proxyId);
|
|
63
63
|
}
|
|
64
|
+
belongUnifiedAccount(address) {
|
|
65
|
+
return this.state.belongUnifiedAccount(address);
|
|
66
|
+
}
|
|
64
67
|
addressesByProxyId(proxyId) {
|
|
65
68
|
return this.state.addressesByProxyId(proxyId);
|
|
66
69
|
}
|
|
70
|
+
getCurrentAccountProxyName(proxyId) {
|
|
71
|
+
return this.state.getAccountProxyName(proxyId);
|
|
72
|
+
}
|
|
67
73
|
|
|
68
74
|
/* Modify accounts */
|
|
69
75
|
|
|
@@ -104,6 +110,9 @@ class AccountContext {
|
|
|
104
110
|
let allowGetAllAccount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
105
111
|
return this.state.getDecodedAddresses(accountProxy, allowGetAllAccount);
|
|
106
112
|
}
|
|
113
|
+
getAllAddresses() {
|
|
114
|
+
return this.state.getAllAddresses();
|
|
115
|
+
}
|
|
107
116
|
|
|
108
117
|
/* Get address for another service */
|
|
109
118
|
|
|
@@ -41,9 +41,17 @@ class SettingService {
|
|
|
41
41
|
}
|
|
42
42
|
getSettings(update) {
|
|
43
43
|
this.settingsStore.get('Settings', value => {
|
|
44
|
+
var _value$notificationSe, _value$notificationSe2, _value$notificationSe3;
|
|
44
45
|
update({
|
|
45
46
|
..._constants2.DEFAULT_SETTING,
|
|
46
|
-
...(value || {})
|
|
47
|
+
...(value || {}),
|
|
48
|
+
notificationSetup: {
|
|
49
|
+
isEnabled: (_value$notificationSe = value === null || value === void 0 ? void 0 : (_value$notificationSe2 = value.notificationSetup) === null || _value$notificationSe2 === void 0 ? void 0 : _value$notificationSe2.isEnabled) !== null && _value$notificationSe !== void 0 ? _value$notificationSe : _constants2.DEFAULT_SETTING.notificationSetup.isEnabled,
|
|
50
|
+
showNotice: {
|
|
51
|
+
..._constants2.DEFAULT_SETTING.notificationSetup.showNotice,
|
|
52
|
+
...((value === null || value === void 0 ? void 0 : (_value$notificationSe3 = value.notificationSetup) === null || _value$notificationSe3 === void 0 ? void 0 : _value$notificationSe3.showNotice) || {})
|
|
53
|
+
}
|
|
54
|
+
}
|
|
47
55
|
});
|
|
48
56
|
});
|
|
49
57
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.DEFAULT_UNLOCK_TYPE = exports.DEFAULT_THEME = exports.DEFAULT_SHOW_ZERO_BALANCE = exports.DEFAULT_SHOW_BALANCE = exports.DEFAULT_SETTING = exports.DEFAULT_NOTIFICATION_TYPE = exports.DEFAULT_LANGUAGE = exports.DEFAULT_CURRENCY = exports.DEFAULT_CHAIN_PATROL_ENABLE = exports.DEFAULT_CAMERA_ENABLE = exports.DEFAULT_AUTO_LOCK_TIME = exports.DEFAULT_ALL_LOGO = void 0;
|
|
6
|
+
exports.DEFAULT_UNLOCK_TYPE = exports.DEFAULT_THEME = exports.DEFAULT_SHOW_ZERO_BALANCE = exports.DEFAULT_SHOW_BALANCE = exports.DEFAULT_SETTING = exports.DEFAULT_NOTIFICATION_TYPE = exports.DEFAULT_NOTIFICATION_SETUP = exports.DEFAULT_LANGUAGE = exports.DEFAULT_CURRENCY = exports.DEFAULT_CHAIN_PATROL_ENABLE = exports.DEFAULT_CAMERA_ENABLE = exports.DEFAULT_AUTO_LOCK_TIME = exports.DEFAULT_ALL_LOGO = void 0;
|
|
7
7
|
var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
|
|
8
8
|
var _utils = require("@subwallet/extension-base/utils");
|
|
9
9
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
@@ -31,6 +31,20 @@ const DEFAULT_ALL_LOGO = '';
|
|
|
31
31
|
exports.DEFAULT_ALL_LOGO = DEFAULT_ALL_LOGO;
|
|
32
32
|
const DEFAULT_CAMERA_ENABLE = false;
|
|
33
33
|
exports.DEFAULT_CAMERA_ENABLE = DEFAULT_CAMERA_ENABLE;
|
|
34
|
+
const DEFAULT_NOTIFICATION_SETUP = {
|
|
35
|
+
isEnabled: true,
|
|
36
|
+
showNotice: {
|
|
37
|
+
// send: true,
|
|
38
|
+
// receive: true,
|
|
39
|
+
earningClaim: true,
|
|
40
|
+
earningWithdraw: true,
|
|
41
|
+
availBridgeClaim: true
|
|
42
|
+
// isHideWithdraw: false, // todo: just for test, remove later
|
|
43
|
+
// isHideMarketing: false,
|
|
44
|
+
// isHideAnnouncement: false
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
exports.DEFAULT_NOTIFICATION_SETUP = DEFAULT_NOTIFICATION_SETUP;
|
|
34
48
|
const DEFAULT_SETTING = {
|
|
35
49
|
language: DEFAULT_LANGUAGE,
|
|
36
50
|
currency: DEFAULT_CURRENCY,
|
|
@@ -43,6 +57,7 @@ const DEFAULT_SETTING = {
|
|
|
43
57
|
camera: DEFAULT_CAMERA_ENABLE,
|
|
44
58
|
timeAutoLock: DEFAULT_AUTO_LOCK_TIME,
|
|
45
59
|
enableChainPatrol: DEFAULT_CHAIN_PATROL_ENABLE,
|
|
60
|
+
notificationSetup: DEFAULT_NOTIFICATION_SETUP,
|
|
46
61
|
walletReference: ''
|
|
47
62
|
};
|
|
48
63
|
exports.DEFAULT_SETTING = DEFAULT_SETTING;
|
|
@@ -10,6 +10,7 @@ var _databases = _interopRequireDefault(require("@subwallet/extension-base/servi
|
|
|
10
10
|
var _dbStores = require("@subwallet/extension-base/services/storage-service/db-stores");
|
|
11
11
|
var _Campaign = _interopRequireDefault(require("@subwallet/extension-base/services/storage-service/db-stores/Campaign"));
|
|
12
12
|
var _ChainStakingMetadata = _interopRequireDefault(require("@subwallet/extension-base/services/storage-service/db-stores/ChainStakingMetadata"));
|
|
13
|
+
var _InappNotification = _interopRequireDefault(require("@subwallet/extension-base/services/storage-service/db-stores/InappNotification"));
|
|
13
14
|
var _MantaPay = _interopRequireDefault(require("@subwallet/extension-base/services/storage-service/db-stores/MantaPay"));
|
|
14
15
|
var _NominatorMetadata = _interopRequireDefault(require("@subwallet/extension-base/services/storage-service/db-stores/NominatorMetadata"));
|
|
15
16
|
var _YieldPoolStore = _interopRequireDefault(require("@subwallet/extension-base/services/storage-service/db-stores/YieldPoolStore"));
|
|
@@ -53,11 +54,13 @@ class DatabaseService {
|
|
|
53
54
|
chainStakingMetadata: new _ChainStakingMetadata.default(this._db.chainStakingMetadata),
|
|
54
55
|
nominatorMetadata: new _NominatorMetadata.default(this._db.nominatorMetadata),
|
|
55
56
|
mantaPay: new _MantaPay.default(this._db.mantaPay),
|
|
56
|
-
campaign: new _Campaign.default(this._db.campaign)
|
|
57
|
+
campaign: new _Campaign.default(this._db.campaign),
|
|
57
58
|
// assetRef: new AssetRefStore(this._db.assetRef)
|
|
59
|
+
|
|
60
|
+
// inapp notification
|
|
61
|
+
inappNotification: new _InappNotification.default(this._db.inappNotification)
|
|
58
62
|
};
|
|
59
63
|
}
|
|
60
|
-
|
|
61
64
|
async updatePriceStore(priceData) {
|
|
62
65
|
await this.stores.price.table.put(priceData);
|
|
63
66
|
}
|
|
@@ -370,7 +373,7 @@ class DatabaseService {
|
|
|
370
373
|
}
|
|
371
374
|
async resetWallet(resetAll) {
|
|
372
375
|
return new Promise((resolve, reject) => {
|
|
373
|
-
const stores = [this.stores.balance, this.stores.nft, this.stores.nftCollection, this.stores.crowdloan, this.stores.staking, this.stores.transaction, this.stores.nominatorMetadata];
|
|
376
|
+
const stores = [this.stores.balance, this.stores.nft, this.stores.nftCollection, this.stores.crowdloan, this.stores.staking, this.stores.transaction, this.stores.nominatorMetadata, this.stores.inappNotification];
|
|
374
377
|
if (resetAll) {
|
|
375
378
|
stores.push(this.stores.chain, this.stores.asset);
|
|
376
379
|
}
|
|
@@ -457,6 +460,9 @@ class DatabaseService {
|
|
|
457
460
|
async updateYieldPositions(data) {
|
|
458
461
|
await this.stores.yieldPosition.bulkUpsert(data);
|
|
459
462
|
}
|
|
463
|
+
async getYieldPositions() {
|
|
464
|
+
return this.stores.yieldPosition.getAll();
|
|
465
|
+
}
|
|
460
466
|
async getYieldPositionByAddress(addresses) {
|
|
461
467
|
return this.stores.yieldPosition.getByAddress(addresses);
|
|
462
468
|
}
|
|
@@ -486,6 +492,39 @@ class DatabaseService {
|
|
|
486
492
|
upsertCampaign(campaign) {
|
|
487
493
|
return this.stores.campaign.upsertCampaign(campaign);
|
|
488
494
|
}
|
|
495
|
+
|
|
496
|
+
/* Inapp Notification */
|
|
497
|
+
|
|
498
|
+
getNotification(id) {
|
|
499
|
+
return this.stores.inappNotification.getNotificationInfo(id);
|
|
500
|
+
}
|
|
501
|
+
updateNotification(notification) {
|
|
502
|
+
return this.stores.inappNotification.upsert(notification);
|
|
503
|
+
}
|
|
504
|
+
async getNotificationsByParams(params) {
|
|
505
|
+
return this.stores.inappNotification.getNotificationsByParams(params);
|
|
506
|
+
}
|
|
507
|
+
cleanUpOldNotifications(overdueTime) {
|
|
508
|
+
return this.stores.inappNotification.cleanUpOldNotifications(overdueTime);
|
|
509
|
+
}
|
|
510
|
+
subscribeUnreadNotificationsCountMap() {
|
|
511
|
+
return this.stores.inappNotification.subscribeUnreadNotificationsCount();
|
|
512
|
+
}
|
|
513
|
+
getUnreadNotificationsCountMap() {
|
|
514
|
+
return this.stores.inappNotification.getUnreadNotificationsCountMap();
|
|
515
|
+
}
|
|
516
|
+
upsertNotifications(notifications) {
|
|
517
|
+
return this.stores.inappNotification.bulkUpsert(notifications);
|
|
518
|
+
}
|
|
519
|
+
markAllRead(proxyId) {
|
|
520
|
+
return this.stores.inappNotification.markAllRead(proxyId);
|
|
521
|
+
}
|
|
522
|
+
switchReadStatus(params) {
|
|
523
|
+
return this.stores.inappNotification.switchReadStatus(params);
|
|
524
|
+
}
|
|
525
|
+
removeAccountNotifications(proxyId) {
|
|
526
|
+
return this.stores.inappNotification.removeAccountNotifications(proxyId);
|
|
527
|
+
}
|
|
489
528
|
async exportDB() {
|
|
490
529
|
const blob = await (0, _dexieExportImport.exportDB)(this._db, {
|
|
491
530
|
filter: (table, value, key) => {
|
|
@@ -50,6 +50,9 @@ class KoniDatabase extends _dexie.default {
|
|
|
50
50
|
this.conditionalVersion(6, {
|
|
51
51
|
keyValue: 'key'
|
|
52
52
|
});
|
|
53
|
+
this.conditionalVersion(7, {
|
|
54
|
+
inappNotification: 'id, address, proxyId, [proxyId+actionType], actionType'
|
|
55
|
+
});
|
|
53
56
|
}
|
|
54
57
|
conditionalVersion(version, schema, upgrade) {
|
|
55
58
|
if (this.schemaVersion != null && this.schemaVersion < version) {
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _constants = require("@subwallet/extension-base/constants");
|
|
9
|
+
var _interfaces = require("@subwallet/extension-base/services/inapp-notification-service/interfaces");
|
|
10
|
+
var _utils = require("@subwallet/extension-base/services/inapp-notification-service/utils");
|
|
11
|
+
var _BaseStore = _interopRequireDefault(require("@subwallet/extension-base/services/storage-service/db-stores/BaseStore"));
|
|
12
|
+
var _dexie = require("dexie");
|
|
13
|
+
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
14
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
15
|
+
|
|
16
|
+
class InappNotificationStore extends _BaseStore.default {
|
|
17
|
+
async getNotificationInfo(id) {
|
|
18
|
+
return this.table.get(id);
|
|
19
|
+
}
|
|
20
|
+
async getAll() {
|
|
21
|
+
return this.table.toArray();
|
|
22
|
+
}
|
|
23
|
+
async getNotificationsByParams(params) {
|
|
24
|
+
const {
|
|
25
|
+
notificationTab,
|
|
26
|
+
proxyId
|
|
27
|
+
} = params;
|
|
28
|
+
const isAllAccount = proxyId === _constants.ALL_ACCOUNT_KEY;
|
|
29
|
+
const isTabAll = notificationTab === _interfaces.NotificationTab.ALL;
|
|
30
|
+
if (isTabAll && isAllAccount) {
|
|
31
|
+
return this.getAll();
|
|
32
|
+
}
|
|
33
|
+
const filteredTable = this.table.filter(item => {
|
|
34
|
+
const matchesProxyId = item.proxyId === proxyId;
|
|
35
|
+
const matchesReadStatus = item.isRead === (0, _utils.getIsTabRead)(notificationTab);
|
|
36
|
+
if (isTabAll) {
|
|
37
|
+
return matchesProxyId;
|
|
38
|
+
}
|
|
39
|
+
if (isAllAccount) {
|
|
40
|
+
return matchesReadStatus;
|
|
41
|
+
}
|
|
42
|
+
return matchesProxyId && matchesReadStatus;
|
|
43
|
+
});
|
|
44
|
+
return filteredTable.toArray();
|
|
45
|
+
}
|
|
46
|
+
async cleanUpOldNotifications(overdueTime) {
|
|
47
|
+
const currentTimestamp = Date.now();
|
|
48
|
+
return this.table.filter(item => item.time <= currentTimestamp - overdueTime).delete();
|
|
49
|
+
}
|
|
50
|
+
subscribeUnreadNotificationsCount() {
|
|
51
|
+
return (0, _dexie.liveQuery)(async () => {
|
|
52
|
+
return await this.getUnreadNotificationsCountMap();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
async getUnreadNotificationsCountMap() {
|
|
56
|
+
const unreadNotifications = await this.table.filter(item => !item.isRead).toArray();
|
|
57
|
+
return unreadNotifications.reduce((countMap, item) => {
|
|
58
|
+
countMap[item.proxyId] = (countMap[item.proxyId] || 0) + 1;
|
|
59
|
+
return countMap;
|
|
60
|
+
}, {});
|
|
61
|
+
}
|
|
62
|
+
markAllRead(proxyId) {
|
|
63
|
+
if (proxyId === _constants.ALL_ACCOUNT_KEY) {
|
|
64
|
+
return this.table.toCollection().modify({
|
|
65
|
+
isRead: true
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return this.table.where('proxyId').equalsIgnoreCase(proxyId).modify({
|
|
69
|
+
isRead: true
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
switchReadStatus(params) {
|
|
73
|
+
return this.table.where('id').equals(params.id).modify({
|
|
74
|
+
isRead: !params.isRead
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
removeAccountNotifications(proxyId) {
|
|
78
|
+
return this.table.where('proxyId').equalsIgnoreCase(proxyId).delete();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.default = InappNotificationStore;
|
|
@@ -585,6 +585,19 @@ class TransactionService {
|
|
|
585
585
|
historyItem.additionalInfo = data;
|
|
586
586
|
break;
|
|
587
587
|
}
|
|
588
|
+
case _KoniTypes.ExtrinsicType.CLAIM_AVAIL_BRIDGE:
|
|
589
|
+
{
|
|
590
|
+
const data = (0, _utils3.parseTransactionData)(transaction.data); // TODO: switch by provider
|
|
591
|
+
const metadata = data.notification.metadata;
|
|
592
|
+
const claimAsset = this.state.chainService.getAssetBySlug(metadata.tokenSlug);
|
|
593
|
+
historyItem.amount = {
|
|
594
|
+
value: metadata.amount,
|
|
595
|
+
symbol: (0, _utils2._getAssetSymbol)(claimAsset),
|
|
596
|
+
decimals: (0, _utils2._getAssetDecimals)(claimAsset)
|
|
597
|
+
};
|
|
598
|
+
historyItem.additionalInfo = data;
|
|
599
|
+
break;
|
|
600
|
+
}
|
|
588
601
|
case _KoniTypes.ExtrinsicType.UNKNOWN:
|
|
589
602
|
break;
|
|
590
603
|
}
|
|
@@ -60,6 +60,9 @@ function getExplorerLink(chainInfo, value, type) {
|
|
|
60
60
|
return `${explorerLink}${explorerLink.endsWith('/') ? '' : '/'}${route}/${value}`;
|
|
61
61
|
}
|
|
62
62
|
if (explorerLink && value.startsWith('0x')) {
|
|
63
|
+
if (chainInfo.slug === 'bittensor') {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
63
66
|
const route = getBlockExplorerTxRoute(chainInfo);
|
|
64
67
|
return `${explorerLink}${explorerLink.endsWith('/') ? '' : '/'}${route}/${value}`;
|
|
65
68
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -145,23 +145,24 @@ const EARN_QDOT_ACTIONS = [_KoniTypes.ExtrinsicType.MINT_QDOT, _KoniTypes.Extrin
|
|
|
145
145
|
const EARN_STDOT_ACTIONS = [_KoniTypes.ExtrinsicType.MINT_STDOT, _KoniTypes.ExtrinsicType.REDEEM_STDOT, _KoniTypes.ExtrinsicType.UNSTAKE_STDOT];
|
|
146
146
|
const EARN_VMANTA_ACTIONS = [_KoniTypes.ExtrinsicType.MINT_VMANTA, _KoniTypes.ExtrinsicType.REDEEM_VMANTA, _KoniTypes.ExtrinsicType.UNSTAKE_VMANTA];
|
|
147
147
|
const EVM_ACTIONS = [_KoniTypes.ExtrinsicType.TOKEN_SPENDING_APPROVAL, _KoniTypes.ExtrinsicType.EVM_EXECUTE];
|
|
148
|
+
const CLAIM_AVAIL_BRIDGE = [_KoniTypes.ExtrinsicType.CLAIM_AVAIL_BRIDGE];
|
|
148
149
|
const OTHER_ACTIONS = [_KoniTypes.ExtrinsicType.TRANSFER_XCM, _KoniTypes.ExtrinsicType.SEND_NFT, _KoniTypes.ExtrinsicType.SWAP, _KoniTypes.ExtrinsicType.CROWDLOAN];
|
|
149
150
|
const getAccountTransactionActions = (signMode, networkType, type, _meta, _specialNetwork) => {
|
|
150
151
|
if ([_types2.AccountSignMode.PASSWORD, _types2.AccountSignMode.INJECTED].includes(signMode)) {
|
|
151
152
|
switch (networkType) {
|
|
152
153
|
case _types2.AccountChainType.SUBSTRATE:
|
|
153
|
-
return [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_VDOT_ACTIONS, ...EARN_LDOT_ACTIONS, ...EARN_SDOT_ACTIONS, ...EARN_QDOT_ACTIONS, ...EARN_VMANTA_ACTIONS, ...OTHER_ACTIONS];
|
|
154
|
+
return [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_VDOT_ACTIONS, ...EARN_LDOT_ACTIONS, ...EARN_SDOT_ACTIONS, ...EARN_QDOT_ACTIONS, ...EARN_VMANTA_ACTIONS, ...CLAIM_AVAIL_BRIDGE, ...OTHER_ACTIONS];
|
|
154
155
|
case _types2.AccountChainType.ETHEREUM:
|
|
155
|
-
return [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_STDOT_ACTIONS, ...OTHER_ACTIONS, ...EVM_ACTIONS];
|
|
156
|
+
return [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_STDOT_ACTIONS, ...OTHER_ACTIONS, ...CLAIM_AVAIL_BRIDGE, ...EVM_ACTIONS];
|
|
156
157
|
case _types2.AccountChainType.TON:
|
|
157
158
|
return [...BASE_TRANSFER_ACTIONS];
|
|
158
159
|
}
|
|
159
160
|
} else if (signMode === _types2.AccountSignMode.QR) {
|
|
160
161
|
switch (networkType) {
|
|
161
162
|
case _types2.AccountChainType.SUBSTRATE:
|
|
162
|
-
return [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_VDOT_ACTIONS, ...EARN_LDOT_ACTIONS, ...EARN_SDOT_ACTIONS, ...EARN_QDOT_ACTIONS, ...EARN_VMANTA_ACTIONS, ...OTHER_ACTIONS];
|
|
163
|
+
return [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_VDOT_ACTIONS, ...EARN_LDOT_ACTIONS, ...EARN_SDOT_ACTIONS, ...EARN_QDOT_ACTIONS, ...EARN_VMANTA_ACTIONS, ...CLAIM_AVAIL_BRIDGE, ...OTHER_ACTIONS];
|
|
163
164
|
case _types2.AccountChainType.ETHEREUM:
|
|
164
|
-
return [...(_constants.isProductionMode ? [] : [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_STDOT_ACTIONS, ...OTHER_ACTIONS, ...EVM_ACTIONS])];
|
|
165
|
+
return [...(_constants.isProductionMode ? [] : [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_STDOT_ACTIONS, ...CLAIM_AVAIL_BRIDGE, ...OTHER_ACTIONS, ...EVM_ACTIONS])];
|
|
165
166
|
case _types2.AccountChainType.TON:
|
|
166
167
|
return [];
|
|
167
168
|
}
|
|
@@ -174,7 +175,7 @@ const getAccountTransactionActions = (signMode, networkType, type, _meta, _speci
|
|
|
174
175
|
// ...EARN_QDOT_ACTIONS,
|
|
175
176
|
...OTHER_ACTIONS];
|
|
176
177
|
case _types2.AccountChainType.ETHEREUM:
|
|
177
|
-
return [...BASE_TRANSFER_ACTIONS, ...EARN_STDOT_ACTIONS, ...EVM_ACTIONS, _KoniTypes.ExtrinsicType.STAKING_WITHDRAW,
|
|
178
|
+
return [...BASE_TRANSFER_ACTIONS, ...EARN_STDOT_ACTIONS, ...EVM_ACTIONS, ...CLAIM_AVAIL_BRIDGE, _KoniTypes.ExtrinsicType.STAKING_WITHDRAW,
|
|
178
179
|
// For liquid staking
|
|
179
180
|
_KoniTypes.ExtrinsicType.SEND_NFT, _KoniTypes.ExtrinsicType.SWAP];
|
|
180
181
|
case _types2.AccountChainType.TON:
|
|
@@ -212,6 +213,9 @@ const getAccountTransactionActions = (signMode, networkType, type, _meta, _speci
|
|
|
212
213
|
if (['polkadot', 'kusama', 'statemint', 'statemine'].includes(specialNetwork)) {
|
|
213
214
|
result.push(_KoniTypes.ExtrinsicType.TRANSFER_XCM);
|
|
214
215
|
}
|
|
216
|
+
if (['availTuringTest', 'avail_mainnet'].includes(specialNetwork)) {
|
|
217
|
+
result.push(...CLAIM_AVAIL_BRIDGE);
|
|
218
|
+
}
|
|
215
219
|
return result;
|
|
216
220
|
}
|
|
217
221
|
return [];
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.termAndCondition = exports.staticData = exports.marketingCampaigns = exports.currencySymbol = exports.crowdloanFunds = exports.buyTokenConfigs = exports.buyServiceInfos = exports.blockedActionsFeatures = exports.StaticKey = void 0;
|
|
6
|
+
exports.termAndCondition = exports.staticData = exports.remindNotificationTime = exports.marketingCampaigns = exports.currencySymbol = exports.crowdloanFunds = exports.buyTokenConfigs = exports.buyServiceInfos = exports.blockedActionsFeatures = exports.StaticKey = void 0;
|
|
7
7
|
var _chainList = require("@subwallet/chain-list");
|
|
8
8
|
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
9
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -30,7 +30,10 @@ const currencySymbol = require('./currencySymbol.json');
|
|
|
30
30
|
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
|
|
31
31
|
exports.currencySymbol = currencySymbol;
|
|
32
32
|
const blockedActionsFeatures = require('./blockedActionsFeatures.json');
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
|
|
33
34
|
exports.blockedActionsFeatures = blockedActionsFeatures;
|
|
35
|
+
const remindNotificationTime = require('./remindNotificationTime.json');
|
|
36
|
+
exports.remindNotificationTime = remindNotificationTime;
|
|
34
37
|
let StaticKey;
|
|
35
38
|
exports.StaticKey = StaticKey;
|
|
36
39
|
(function (StaticKey) {
|
|
@@ -42,6 +45,7 @@ exports.StaticKey = StaticKey;
|
|
|
42
45
|
StaticKey["TERM_AND_CONDITION"] = "term-and-condition";
|
|
43
46
|
StaticKey["BUY_TOKEN_CONFIGS"] = "buy-token-configs";
|
|
44
47
|
StaticKey["BLOCKED_ACTIONS_FEATURES"] = "blocked-actions-features";
|
|
48
|
+
StaticKey["REMIND_NOTIFICATION_TIME"] = "remind-notification-time";
|
|
45
49
|
})(StaticKey || (exports.StaticKey = StaticKey = {}));
|
|
46
50
|
const staticData = {
|
|
47
51
|
[StaticKey.CHAINS]: Object.values(_chainList.ChainInfoMap),
|
|
@@ -51,6 +55,7 @@ const staticData = {
|
|
|
51
55
|
[StaticKey.MARKETING_CAMPAINGS]: marketingCampaigns,
|
|
52
56
|
[StaticKey.TERM_AND_CONDITION]: termAndCondition.default,
|
|
53
57
|
[StaticKey.BUY_TOKEN_CONFIGS]: buyTokenConfigs,
|
|
54
|
-
[StaticKey.BLOCKED_ACTIONS_FEATURES]: blockedActionsFeatures
|
|
58
|
+
[StaticKey.BLOCKED_ACTIONS_FEATURES]: blockedActionsFeatures,
|
|
59
|
+
[StaticKey.REMIND_NOTIFICATION_TIME]: remindNotificationTime
|
|
55
60
|
};
|
|
56
61
|
exports.staticData = staticData;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { fetchStaticData } from '@subwallet/extension-base/utils';
|
|
5
|
-
const BLOCKED_ACTIONS_AND_FEATURES_PROMISE = fetchStaticData('blocked-actions-features');
|
|
6
5
|
export const fetchLastestBlockedActionsAndFeatures = async () => {
|
|
7
|
-
return await
|
|
6
|
+
return await fetchStaticData('blocked-actions-features');
|
|
8
7
|
};
|
package/constants/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare const MANTA_PAY_BALANCE_INTERVAL = 30000;
|
|
|
21
21
|
export declare const BITTENSOR_REFRESH_STAKE_INFO = 30000;
|
|
22
22
|
export declare const BITTENSOR_REFRESH_STAKE_APY = 300000;
|
|
23
23
|
export declare const CRON_REFRESH_EARNING_REWARD_HISTORY_INTERVAL: number;
|
|
24
|
+
export declare const CRON_LISTEN_AVAIL_BRIDGE_CLAIM = 1800000;
|
|
24
25
|
export declare const ALL_ACCOUNT_KEY = "ALL";
|
|
25
26
|
export declare const ALL_NETWORK_KEY = "all";
|
|
26
27
|
export declare const ALL_GENESIS_HASH: null;
|
|
@@ -39,3 +40,4 @@ export * from './environment';
|
|
|
39
40
|
export * from './signing';
|
|
40
41
|
export * from './staking';
|
|
41
42
|
export * from './storage';
|
|
43
|
+
export * from './remind-notification-time';
|
package/constants/index.js
CHANGED
|
@@ -23,6 +23,7 @@ export const MANTA_PAY_BALANCE_INTERVAL = 30000;
|
|
|
23
23
|
export const BITTENSOR_REFRESH_STAKE_INFO = 30000;
|
|
24
24
|
export const BITTENSOR_REFRESH_STAKE_APY = 300000;
|
|
25
25
|
export const CRON_REFRESH_EARNING_REWARD_HISTORY_INTERVAL = 15 * BASE_MINUTE_INTERVAL;
|
|
26
|
+
export const CRON_LISTEN_AVAIL_BRIDGE_CLAIM = 1800000;
|
|
26
27
|
export const ALL_ACCOUNT_KEY = 'ALL';
|
|
27
28
|
export const ALL_NETWORK_KEY = 'all';
|
|
28
29
|
export const ALL_GENESIS_HASH = null;
|
|
@@ -40,4 +41,5 @@ export * from "./blocked-actions-list.js";
|
|
|
40
41
|
export * from "./environment.js";
|
|
41
42
|
export * from "./signing.js";
|
|
42
43
|
export * from "./staking.js";
|
|
43
|
-
export * from "./storage.js";
|
|
44
|
+
export * from "./storage.js";
|
|
45
|
+
export * from "./remind-notification-time.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { fetchStaticData } from '@subwallet/extension-base/utils';
|
|
5
|
+
export const fetchLastestRemindNotificationTime = async () => {
|
|
6
|
+
return await fetchStaticData('config/remind-notification-time');
|
|
7
|
+
};
|