@subwallet/extension-base 1.3.6-1 → 1.3.8-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 +20 -5
- package/background/KoniTypes.js +1 -1
- package/cjs/background/KoniTypes.js +1 -1
- package/cjs/constants/blocked-actions.js +108 -0
- package/cjs/constants/index.js +4 -4
- package/cjs/core/substrate/xcm-parser.js +20 -5
- package/cjs/koni/api/contract-handler/utils/index.js +15 -1
- package/cjs/koni/api/nft/config.js +6 -4
- package/cjs/koni/api/nft/index.js +9 -0
- package/cjs/koni/api/nft/story_odyssey_nft/index.js +126 -0
- package/cjs/koni/background/handlers/Extension.js +64 -4
- package/cjs/koni/background/handlers/State.js +23 -2
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +2 -1
- package/cjs/services/balance-service/transfer/xcm/index.js +31 -1
- package/cjs/services/balance-service/transfer/xcm/polygonBridge.js +108 -0
- package/cjs/services/chain-online-service/constants.js +32 -0
- package/cjs/services/chain-online-service/index.js +190 -0
- package/cjs/services/chain-service/constants.js +2 -1
- package/cjs/services/chain-service/index.js +87 -127
- package/cjs/services/chain-service/utils/index.js +0 -2
- package/cjs/services/chain-service/utils/patch.js +7 -3
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +20 -17
- package/cjs/services/environment-service/stores/Environment.js +19 -0
- package/cjs/services/fee-service/utils/index.js +14 -0
- package/cjs/services/inapp-notification-service/consts.js +6 -4
- package/cjs/services/inapp-notification-service/index.js +110 -6
- package/cjs/services/inapp-notification-service/interfaces.js +9 -1
- package/cjs/services/inapp-notification-service/utils/avail.js +88 -0
- package/cjs/services/inapp-notification-service/{utils.js → utils/common.js} +1 -84
- package/cjs/services/inapp-notification-service/utils/index.js +38 -0
- package/cjs/services/inapp-notification-service/utils/polygon.js +66 -0
- package/cjs/services/migration-service/scripts/MigrateTransactionHistoryBridge.js +37 -0
- package/cjs/services/migration-service/scripts/index.js +3 -1
- package/cjs/services/setting-service/SettingService.js +21 -0
- package/cjs/services/setting-service/constants.js +2 -1
- package/cjs/services/storage-service/DatabaseService.js +3 -0
- package/cjs/services/transaction-service/index.js +13 -7
- package/cjs/services/transaction-service/utils.js +3 -0
- package/cjs/stores/ChainlistStore.js +18 -0
- package/cjs/stores/EnvironmentStore.js +18 -0
- package/cjs/stores/index.js +8 -1
- package/cjs/types/index.js +11 -0
- package/cjs/utils/account/transform.js +1 -1
- package/cjs/utils/environment.js +15 -1
- package/cjs/utils/staticData/index.js +7 -2
- package/constants/blocked-actions.d.ts +29 -0
- package/constants/blocked-actions.js +96 -0
- package/constants/index.d.ts +1 -1
- package/constants/index.js +1 -1
- package/core/substrate/xcm-parser.d.ts +2 -1
- package/core/substrate/xcm-parser.js +19 -5
- package/koni/api/contract-handler/utils/index.d.ts +2 -0
- package/koni/api/contract-handler/utils/index.js +12 -0
- package/koni/api/contract-handler/utils/polygon_bridge_abi.json +1004 -0
- package/koni/api/nft/config.d.ts +1 -1
- package/koni/api/nft/config.js +5 -2
- package/koni/api/nft/index.js +9 -0
- package/koni/api/nft/story_odyssey_nft/index.d.ts +40 -0
- package/koni/api/nft/story_odyssey_nft/index.js +119 -0
- package/koni/background/handlers/Extension.d.ts +5 -0
- package/koni/background/handlers/Extension.js +65 -5
- package/koni/background/handlers/State.d.ts +5 -0
- package/koni/background/handlers/State.js +23 -2
- package/package.json +76 -18
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/subscribe/substrate/index.js +2 -1
- package/services/balance-service/transfer/xcm/index.d.ts +1 -0
- package/services/balance-service/transfer/xcm/index.js +29 -1
- package/services/balance-service/transfer/xcm/polygonBridge.d.ts +22 -0
- package/services/balance-service/transfer/xcm/polygonBridge.js +95 -0
- package/services/chain-online-service/constants.d.ts +4 -0
- package/services/chain-online-service/constants.js +23 -0
- package/services/chain-online-service/index.d.ts +22 -0
- package/services/chain-online-service/index.js +182 -0
- package/services/chain-service/constants.d.ts +1 -0
- package/services/chain-service/constants.js +2 -1
- package/services/chain-service/index.d.ts +6 -7
- package/services/chain-service/index.js +78 -116
- package/services/chain-service/utils/index.js +0 -2
- package/services/chain-service/utils/patch.d.ts +16 -1
- package/services/chain-service/utils/patch.js +7 -3
- package/services/earning-service/handlers/native-staking/para-chain.js +20 -17
- package/services/environment-service/stores/Environment.d.ts +10 -0
- package/services/environment-service/stores/Environment.js +12 -0
- package/services/fee-service/utils/index.js +14 -0
- package/services/inapp-notification-service/consts.d.ts +3 -1
- package/services/inapp-notification-service/consts.js +6 -4
- package/services/inapp-notification-service/index.d.ts +10 -2
- package/services/inapp-notification-service/index.js +111 -7
- package/services/inapp-notification-service/interfaces.d.ts +27 -3
- package/services/inapp-notification-service/interfaces.js +7 -0
- package/services/inapp-notification-service/utils/avail.d.ts +40 -0
- package/services/inapp-notification-service/utils/avail.js +73 -0
- package/services/inapp-notification-service/utils/common.d.ts +11 -0
- package/services/inapp-notification-service/{utils.js → utils/common.js} +1 -72
- package/services/inapp-notification-service/utils/index.d.ts +3 -0
- package/services/inapp-notification-service/utils/index.js +6 -0
- package/services/inapp-notification-service/utils/polygon.d.ts +71 -0
- package/services/inapp-notification-service/utils/polygon.js +54 -0
- package/services/migration-service/scripts/MigrateTransactionHistoryBridge.d.ts +4 -0
- package/services/migration-service/scripts/MigrateTransactionHistoryBridge.js +29 -0
- package/services/migration-service/scripts/index.js +3 -1
- package/services/setting-service/SettingService.d.ts +9 -0
- package/services/setting-service/SettingService.js +21 -0
- package/services/setting-service/constants.js +2 -1
- package/services/storage-service/DatabaseService.d.ts +1 -0
- package/services/storage-service/DatabaseService.js +3 -0
- package/services/transaction-service/index.js +14 -8
- package/services/transaction-service/utils.js +3 -0
- package/stores/ChainlistStore.d.ts +7 -0
- package/stores/ChainlistStore.js +10 -0
- package/stores/EnvironmentStore.d.ts +5 -0
- package/stores/EnvironmentStore.js +10 -0
- package/stores/index.d.ts +1 -0
- package/stores/index.js +2 -1
- package/types/{avail-bridge → bridge}/index.d.ts +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/types/notification/index.d.ts +5 -0
- package/utils/account/transform.js +1 -1
- package/utils/environment.d.ts +6 -0
- package/utils/environment.js +8 -0
- package/utils/staticData/blockedActions.json +1 -0
- package/utils/staticData/index.d.ts +7 -3
- package/utils/staticData/index.js +5 -1
- package/cjs/constants/blocked-actions-list.js +0 -14
- package/constants/blocked-actions-list.d.ts +0 -7
- package/constants/blocked-actions-list.js +0 -7
- package/services/inapp-notification-service/utils.d.ts +0 -55
- /package/cjs/types/{avail-bridge → bridge}/index.js +0 -0
- /package/types/{avail-bridge → bridge}/index.js +0 -0
|
@@ -53,7 +53,8 @@ export const _NFT_CHAIN_GROUP = {
|
|
|
53
53
|
vara: ['vara_network'],
|
|
54
54
|
avail: ['avail_mainnet'],
|
|
55
55
|
ternoa: ['ternoa', 'ternoa_alphanet'],
|
|
56
|
-
rari: ['rari']
|
|
56
|
+
rari: ['rari'],
|
|
57
|
+
story_odyssey: ['storyOdyssey', 'storyOdyssey_testnet']
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
// Staking--------------------------------------------------------------------------------------------------------------
|
|
@@ -8,6 +8,7 @@ import { IMetadataItem } from '@subwallet/extension-base/services/storage-servic
|
|
|
8
8
|
import DatabaseService from '@subwallet/extension-base/services/storage-service/DatabaseService';
|
|
9
9
|
import { BehaviorSubject, Subject } from 'rxjs';
|
|
10
10
|
import { ExtraInfo } from '@polkadot-api/merkleize-metadata';
|
|
11
|
+
export declare const filterAssetInfoMap: (chainInfo: Record<string, _ChainInfo>, assets: Record<string, _ChainAsset>, addedChains?: string[]) => Record<string, _ChainAsset>;
|
|
11
12
|
export declare class ChainService {
|
|
12
13
|
private dataMap;
|
|
13
14
|
private dbService;
|
|
@@ -29,8 +30,6 @@ export declare class ChainService {
|
|
|
29
30
|
private assetLogoMapSubject;
|
|
30
31
|
private chainLogoMapSubject;
|
|
31
32
|
private ledgerGenericAllowChainsSubject;
|
|
32
|
-
private assetMapPatch;
|
|
33
|
-
private assetLogoPatch;
|
|
34
33
|
private store;
|
|
35
34
|
private assetSettingSubject;
|
|
36
35
|
private logger;
|
|
@@ -44,6 +43,8 @@ export declare class ChainService {
|
|
|
44
43
|
subscribeSwapRefMap(): Subject<Record<string, _AssetRef>>;
|
|
45
44
|
get xcmRefMap(): Record<string, _AssetRef>;
|
|
46
45
|
get swapRefMap(): Record<string, _AssetRef>;
|
|
46
|
+
getlockChainInfoMap(): boolean;
|
|
47
|
+
setLockChainInfoMap(isLock: boolean): void;
|
|
47
48
|
getEvmApi(slug: string): import("./handler/EvmApi").EvmApi;
|
|
48
49
|
getEvmApiMap(): Record<string, import("./handler/EvmApi").EvmApi>;
|
|
49
50
|
getSubstrateApi(slug: string): _SubstrateApi;
|
|
@@ -61,16 +62,19 @@ export declare class ChainService {
|
|
|
61
62
|
subscribeChainStateMap(): Subject<Record<string, _ChainState>>;
|
|
62
63
|
subscribeChainStatusMap(): BehaviorSubject<Record<string, _ChainApiStatus>>;
|
|
63
64
|
getAssetRegistry(): Record<string, _ChainAsset>;
|
|
65
|
+
setAssetRegistry(assetRegistry: Record<string, _ChainAsset>): void;
|
|
64
66
|
getMultiChainAssetMap(): Record<string, _MultiChainAsset>;
|
|
65
67
|
getSmartContractTokens(): Record<string, _ChainAsset>;
|
|
66
68
|
getAssetHubToken(): Record<string, _ChainAsset>;
|
|
67
69
|
getChainInfoMap(): Record<string, _ChainInfo>;
|
|
70
|
+
setChainInfoMap(chainInfoMap: Record<string, _ChainInfo>): void;
|
|
68
71
|
getEvmChainInfoMap(): Record<string, _ChainInfo>;
|
|
69
72
|
getSubstrateChainInfoMap(): Record<string, _ChainInfo>;
|
|
70
73
|
getAllPriceIds(): string[];
|
|
71
74
|
getNativeTokenInfo(chainSlug: string): _ChainAsset;
|
|
72
75
|
getAssetRefMap(): Record<string, _AssetRef>;
|
|
73
76
|
getChainStateMap(): Record<string, _ChainState>;
|
|
77
|
+
setChainStateMap(chainStateMap: Record<string, _ChainState>): void;
|
|
74
78
|
getChainStateByKey(key: string): _ChainState;
|
|
75
79
|
getChainStatusMap(): Record<string, _ChainApiStatus>;
|
|
76
80
|
getChainStatusByKey(key: string): _ChainApiStatus;
|
|
@@ -99,9 +103,6 @@ export declare class ChainService {
|
|
|
99
103
|
checkLatestData(): void;
|
|
100
104
|
stopCheckLatestChainData(): void;
|
|
101
105
|
handleLatestChainData(latestChainInfo: _ChainInfo[]): void;
|
|
102
|
-
handleLatestAssetRef(latestBlockedAssetRefList: string[], latestAssetRefMap: Record<string, _AssetRef> | null): void;
|
|
103
|
-
handleLatestPriceId(latestPriceIds: Record<string, string | null>): void;
|
|
104
|
-
handleLatestAssetData(latestAssetInfo: Record<string, _ChainAsset> | null, latestAssetLogoMap: Record<string, string> | null): void;
|
|
105
106
|
autoEnableTokens(): Promise<void>;
|
|
106
107
|
handleLatestLedgerGenericAllowChains(latestledgerGenericAllowChains: string[]): void;
|
|
107
108
|
handleLatestData(): void;
|
|
@@ -115,9 +116,7 @@ export declare class ChainService {
|
|
|
115
116
|
disableChain(chainSlug: string): boolean;
|
|
116
117
|
private checkExistedPredefinedChain;
|
|
117
118
|
private fetchLatestChainData;
|
|
118
|
-
private fetchLatestAssetData;
|
|
119
119
|
private fetchLatestPriceIdsData;
|
|
120
|
-
private fetchLatestAssetRef;
|
|
121
120
|
private fetchLatestLedgerGenericAllowChains;
|
|
122
121
|
private initChains;
|
|
123
122
|
private initAssetRegistry;
|
|
@@ -10,7 +10,7 @@ import { SubstrateChainHandler } from '@subwallet/extension-base/services/chain-
|
|
|
10
10
|
import { TonChainHandler } from '@subwallet/extension-base/services/chain-service/handler/TonChainHandler';
|
|
11
11
|
import { _CHAIN_VALIDATION_ERROR } from '@subwallet/extension-base/services/chain-service/handler/types';
|
|
12
12
|
import { _ChainConnectionStatus, _CUSTOM_PREFIX, _NFT_CONTRACT_STANDARDS, _SMART_CONTRACT_STANDARDS } from '@subwallet/extension-base/services/chain-service/types';
|
|
13
|
-
import { _isAssetAutoEnable, _isAssetCanPayTxFee, _isAssetFungibleToken, _isChainEnabled, _isCustomAsset, _isCustomChain, _isCustomProvider, _isEqualContractAddress, _isEqualSmartContractAsset, _isLocalToken, _isMantaZkAsset, _isPureEvmChain, _isPureSubstrateChain, _parseAssetRefKey,
|
|
13
|
+
import { _isAssetAutoEnable, _isAssetCanPayTxFee, _isAssetFungibleToken, _isChainEnabled, _isCustomAsset, _isCustomChain, _isCustomProvider, _isEqualContractAddress, _isEqualSmartContractAsset, _isLocalToken, _isMantaZkAsset, _isPureEvmChain, _isPureSubstrateChain, _parseAssetRefKey, randomizeProvider, updateLatestChainInfo } from '@subwallet/extension-base/services/chain-service/utils';
|
|
14
14
|
import AssetSettingStore from '@subwallet/extension-base/stores/AssetSetting';
|
|
15
15
|
import { addLazy, calculateMetadataHash, fetchStaticData, filterAssetsByChainAndType, getShortMetadata, MODULE_SUPPORT } from '@subwallet/extension-base/utils';
|
|
16
16
|
import { BehaviorSubject, Subject } from 'rxjs';
|
|
@@ -20,26 +20,9 @@ const filterChainInfoMap = (data, ignoredChains) => {
|
|
|
20
20
|
return Object.fromEntries(Object.entries(data).filter(([slug, info]) => !info.bitcoinInfo && !ignoredChains.includes(slug)));
|
|
21
21
|
};
|
|
22
22
|
const ignoredList = ['bevm', 'bevmTest', 'bevm_testnet', 'layerEdge_testnet', 'merlinEvm', 'botanixEvmTest', 'syscoin_evm', 'syscoin_evm_testnet', 'rollux_evm', 'rollux_testnet', 'boolAlpha', 'boolBeta_testnet', 'core', 'satoshivm', 'satoshivm_testnet', 'storyPartner_testnet'];
|
|
23
|
-
const filterAssetInfoMap = (chainInfo, assets) => {
|
|
24
|
-
return Object.fromEntries(Object.entries(assets).filter(([, info]) => chainInfo[info.originChain]));
|
|
23
|
+
export const filterAssetInfoMap = (chainInfo, assets, addedChains) => {
|
|
24
|
+
return Object.fromEntries(Object.entries(assets).filter(([, info]) => chainInfo[info.originChain] || (addedChains === null || addedChains === void 0 ? void 0 : addedChains.includes(info.originChain))));
|
|
25
25
|
};
|
|
26
|
-
|
|
27
|
-
// const rawAssetRefMap = (assetRefMap: Record<string, _AssetRef>) => {
|
|
28
|
-
// const result: Record<string, _AssetRef> = {};
|
|
29
|
-
//
|
|
30
|
-
// Object.entries(assetRefMap).forEach(([key, assetRef]) => {
|
|
31
|
-
// const originChainInfo = ChainInfoMap[assetRef.srcChain];
|
|
32
|
-
// const destChainInfo = ChainInfoMap[assetRef.destChain];
|
|
33
|
-
// const isSnowBridgeXcm = assetRef.path === _AssetRefPath.XCM && _isSnowBridgeXcm(originChainInfo, destChainInfo);
|
|
34
|
-
//
|
|
35
|
-
// if (!isSnowBridgeXcm) {
|
|
36
|
-
// result[key] = assetRef;
|
|
37
|
-
// }
|
|
38
|
-
// });
|
|
39
|
-
//
|
|
40
|
-
// return result;
|
|
41
|
-
// };
|
|
42
|
-
|
|
43
26
|
export class ChainService {
|
|
44
27
|
dataMap = {
|
|
45
28
|
chainInfoMap: {},
|
|
@@ -64,8 +47,6 @@ export class ChainService {
|
|
|
64
47
|
assetLogoMapSubject = new BehaviorSubject(AssetLogoMap);
|
|
65
48
|
chainLogoMapSubject = new BehaviorSubject(ChainLogoMap);
|
|
66
49
|
ledgerGenericAllowChainsSubject = new BehaviorSubject([]);
|
|
67
|
-
assetMapPatch = JSON.stringify({});
|
|
68
|
-
assetLogoPatch = JSON.stringify({});
|
|
69
50
|
|
|
70
51
|
// Todo: Update to new store indexed DB
|
|
71
52
|
store = new AssetSettingStore();
|
|
@@ -126,6 +107,12 @@ export class ChainService {
|
|
|
126
107
|
});
|
|
127
108
|
return result;
|
|
128
109
|
}
|
|
110
|
+
getlockChainInfoMap() {
|
|
111
|
+
return this.lockChainInfoMap;
|
|
112
|
+
}
|
|
113
|
+
setLockChainInfoMap(isLock) {
|
|
114
|
+
this.lockChainInfoMap = isLock;
|
|
115
|
+
}
|
|
129
116
|
getEvmApi(slug) {
|
|
130
117
|
return this.evmChainHandler.getEvmApiByChain(slug);
|
|
131
118
|
}
|
|
@@ -174,6 +161,9 @@ export class ChainService {
|
|
|
174
161
|
getAssetRegistry() {
|
|
175
162
|
return this.dataMap.assetRegistry;
|
|
176
163
|
}
|
|
164
|
+
setAssetRegistry(assetRegistry) {
|
|
165
|
+
this.dataMap.assetRegistry = assetRegistry;
|
|
166
|
+
}
|
|
177
167
|
getMultiChainAssetMap() {
|
|
178
168
|
return MultiChainAssetMap;
|
|
179
169
|
}
|
|
@@ -198,6 +188,9 @@ export class ChainService {
|
|
|
198
188
|
getChainInfoMap() {
|
|
199
189
|
return this.dataMap.chainInfoMap;
|
|
200
190
|
}
|
|
191
|
+
setChainInfoMap(chainInfoMap) {
|
|
192
|
+
this.dataMap.chainInfoMap = chainInfoMap;
|
|
193
|
+
}
|
|
201
194
|
getEvmChainInfoMap() {
|
|
202
195
|
const result = {};
|
|
203
196
|
Object.values(this.getChainInfoMap()).forEach(chainInfo => {
|
|
@@ -254,6 +247,9 @@ export class ChainService {
|
|
|
254
247
|
getChainStateMap() {
|
|
255
248
|
return this.dataMap.chainStateMap;
|
|
256
249
|
}
|
|
250
|
+
setChainStateMap(chainStateMap) {
|
|
251
|
+
this.dataMap.chainStateMap = chainStateMap;
|
|
252
|
+
}
|
|
257
253
|
getChainStateByKey(key) {
|
|
258
254
|
return this.dataMap.chainStateMap[key];
|
|
259
255
|
}
|
|
@@ -498,10 +494,10 @@ export class ChainService {
|
|
|
498
494
|
await this.initChains();
|
|
499
495
|
this.chainInfoMapSubject.next(this.getChainInfoMap());
|
|
500
496
|
this.assetRegistrySubject.next(this.getAssetRegistry());
|
|
497
|
+
this.initAssetRefMap();
|
|
501
498
|
this.xcmRefMapSubject.next(this.xcmRefMap);
|
|
502
499
|
await this.initApis();
|
|
503
500
|
await this.initAssetSettings();
|
|
504
|
-
this.initAssetRefMap();
|
|
505
501
|
await this.autoEnableTokens();
|
|
506
502
|
}
|
|
507
503
|
initAssetRefMap() {
|
|
@@ -534,79 +530,25 @@ export class ChainService {
|
|
|
534
530
|
console.error('Error fetching latest chain data');
|
|
535
531
|
}
|
|
536
532
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
Object.entries(latestPriceIds).forEach(([slug, priceId]) => {
|
|
557
|
-
if (this.dataMap.assetRegistry[slug] && this.dataMap.assetRegistry[slug].priceId !== priceId) {
|
|
558
|
-
isUpdated = true;
|
|
559
|
-
this.dataMap.assetRegistry[slug].priceId = priceId;
|
|
560
|
-
}
|
|
561
|
-
});
|
|
562
|
-
if (isUpdated) {
|
|
563
|
-
this.assetRegistrySubject.next(this.dataMap.assetRegistry);
|
|
564
|
-
this.eventService.emit('asset.updateState', '');
|
|
565
|
-
}
|
|
566
|
-
this.logger.log('Finished updating latest price IDs');
|
|
567
|
-
}
|
|
568
|
-
handleLatestAssetData(latestAssetInfo, latestAssetLogoMap) {
|
|
569
|
-
try {
|
|
570
|
-
if (latestAssetInfo) {
|
|
571
|
-
const latestAssetPatch = JSON.stringify(latestAssetInfo);
|
|
572
|
-
if (this.assetMapPatch !== latestAssetPatch) {
|
|
573
|
-
const assetRegistry = filterAssetInfoMap(this.getChainInfoMap(), Object.assign({}, this.dataMap.assetRegistry, latestAssetInfo));
|
|
574
|
-
this.assetMapPatch = latestAssetPatch;
|
|
575
|
-
this.dataMap.assetRegistry = assetRegistry;
|
|
576
|
-
this.assetRegistrySubject.next(assetRegistry);
|
|
577
|
-
this.autoEnableTokens().then(() => {
|
|
578
|
-
this.eventService.emit('asset.updateState', '');
|
|
579
|
-
}).catch(console.error);
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
if (latestAssetLogoMap) {
|
|
583
|
-
const latestAssetLogoPatch = JSON.stringify(latestAssetLogoMap);
|
|
584
|
-
if (this.assetLogoPatch !== latestAssetLogoPatch) {
|
|
585
|
-
const logoMap = {
|
|
586
|
-
...AssetLogoMap,
|
|
587
|
-
...latestAssetLogoMap
|
|
588
|
-
};
|
|
589
|
-
this.assetLogoPatch = latestAssetLogoPatch;
|
|
590
|
-
this.assetLogoMapSubject.next(logoMap);
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
if (latestAssetLogoMap) {
|
|
594
|
-
const latestAssetLogoPatch = JSON.stringify(latestAssetLogoMap);
|
|
595
|
-
if (this.assetLogoPatch !== latestAssetLogoPatch) {
|
|
596
|
-
const logoMap = {
|
|
597
|
-
...AssetLogoMap,
|
|
598
|
-
...latestAssetLogoMap
|
|
599
|
-
};
|
|
600
|
-
this.assetLogoPatch = latestAssetLogoPatch;
|
|
601
|
-
this.assetLogoMapSubject.next(logoMap);
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
} catch (e) {
|
|
605
|
-
console.error('Error fetching latest asset data');
|
|
606
|
-
}
|
|
607
|
-
this.eventService.emit('asset.online.ready', true);
|
|
608
|
-
this.logger.log('Finished updating latest asset');
|
|
609
|
-
}
|
|
533
|
+
|
|
534
|
+
// handleLatestPriceId (latestPriceIds: Record<string, string | null>) {
|
|
535
|
+
// let isUpdated = false;
|
|
536
|
+
//
|
|
537
|
+
// Object.entries(latestPriceIds).forEach(([slug, priceId]) => {
|
|
538
|
+
// if (this.dataMap.assetRegistry[slug] && this.dataMap.assetRegistry[slug].priceId !== priceId) {
|
|
539
|
+
// isUpdated = true;
|
|
540
|
+
// this.dataMap.assetRegistry[slug].priceId = priceId;
|
|
541
|
+
// }
|
|
542
|
+
// });
|
|
543
|
+
//
|
|
544
|
+
// if (isUpdated) {
|
|
545
|
+
// this.assetRegistrySubject.next(this.dataMap.assetRegistry);
|
|
546
|
+
// this.eventService.emit('asset.updateState', '');
|
|
547
|
+
// }
|
|
548
|
+
//
|
|
549
|
+
// this.logger.log('Finished updating latest price IDs');
|
|
550
|
+
// }
|
|
551
|
+
|
|
610
552
|
async autoEnableTokens() {
|
|
611
553
|
const autoEnableTokens = Object.values(this.dataMap.assetRegistry).filter(asset => _isAssetAutoEnable(asset));
|
|
612
554
|
const assetSettings = this.assetSettingSubject.value;
|
|
@@ -640,20 +582,19 @@ export class ChainService {
|
|
|
640
582
|
this.logger.log('Finished updating latest ledger generic allow chains');
|
|
641
583
|
}
|
|
642
584
|
handleLatestData() {
|
|
643
|
-
this.fetchLatestAssetData().then(([latestAssetInfo, latestAssetLogoMap]) => {
|
|
644
|
-
this.eventService.waitAssetReady.then(() => {
|
|
645
|
-
this.handleLatestAssetData(latestAssetInfo, latestAssetLogoMap);
|
|
646
|
-
}).catch(console.error);
|
|
647
|
-
}).catch(console.error);
|
|
648
585
|
this.fetchLatestChainData().then(latestChainInfo => {
|
|
586
|
+
this.lockChainInfoMap = true; // do not need to check current lockChainInfoMap because all remains action is fast enough and don't affect this feature.
|
|
649
587
|
this.handleLatestChainData(latestChainInfo);
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
this.
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
588
|
+
this.lockChainInfoMap = false;
|
|
589
|
+
}).catch(e => {
|
|
590
|
+
this.lockChainInfoMap = false;
|
|
591
|
+
console.error('Error update latest chain data', e);
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
// this.fetchLatestPriceIdsData().then((latestPriceIds) => {
|
|
595
|
+
// this.handleLatestPriceId(latestPriceIds);
|
|
596
|
+
// }).catch(console.error);
|
|
597
|
+
|
|
657
598
|
this.fetchLatestLedgerGenericAllowChains().then(latestledgerGenericAllowChains => {
|
|
658
599
|
this.handleLatestLedgerGenericAllowChains(latestledgerGenericAllowChains);
|
|
659
600
|
}).catch(console.error);
|
|
@@ -911,17 +852,10 @@ export class ChainService {
|
|
|
911
852
|
// }
|
|
912
853
|
}
|
|
913
854
|
|
|
914
|
-
async fetchLatestAssetData() {
|
|
915
|
-
return await Promise.all([fetchPatchData('ChainAsset.json'), fetchPatchData('AssetLogoMap.json')]);
|
|
916
|
-
}
|
|
917
|
-
|
|
918
855
|
// @ts-ignore
|
|
919
856
|
async fetchLatestPriceIdsData() {
|
|
920
857
|
return await fetchStaticData('chain-assets/price-map');
|
|
921
858
|
}
|
|
922
|
-
async fetchLatestAssetRef() {
|
|
923
|
-
return await Promise.all([fetchStaticData('chain-assets/disabled-xcm-channels'), fetchPatchData('AssetRef.json')]);
|
|
924
|
-
}
|
|
925
859
|
async fetchLatestLedgerGenericAllowChains() {
|
|
926
860
|
return (await fetchStaticData('chains/ledger-generic-allow-chains')) || [];
|
|
927
861
|
}
|
|
@@ -1069,7 +1003,35 @@ export class ChainService {
|
|
|
1069
1003
|
});
|
|
1070
1004
|
}
|
|
1071
1005
|
} else {
|
|
1072
|
-
|
|
1006
|
+
var _storedChainInfo$bitc2;
|
|
1007
|
+
// added chain from patch
|
|
1008
|
+
this.dataMap.chainStateMap[storedSlug] = {
|
|
1009
|
+
currentProvider: storedChainInfo.currentProvider,
|
|
1010
|
+
slug: storedSlug,
|
|
1011
|
+
active: storedChainInfo.active,
|
|
1012
|
+
manualTurnOff
|
|
1013
|
+
};
|
|
1014
|
+
this.updateChainConnectionStatus(storedSlug, _ChainConnectionStatus.DISCONNECTED);
|
|
1015
|
+
newStorageData.push({
|
|
1016
|
+
...storedChainSettingMap[storedSlug],
|
|
1017
|
+
active: storedChainInfo.active,
|
|
1018
|
+
currentProvider: storedChainInfo.currentProvider,
|
|
1019
|
+
manualTurnOff
|
|
1020
|
+
});
|
|
1021
|
+
mergedChainInfoMap[storedSlug] = {
|
|
1022
|
+
slug: storedSlug,
|
|
1023
|
+
name: storedChainInfo.name,
|
|
1024
|
+
providers: storedChainInfo.providers,
|
|
1025
|
+
evmInfo: storedChainInfo.evmInfo,
|
|
1026
|
+
substrateInfo: storedChainInfo.substrateInfo,
|
|
1027
|
+
bitcoinInfo: (_storedChainInfo$bitc2 = storedChainInfo.bitcoinInfo) !== null && _storedChainInfo$bitc2 !== void 0 ? _storedChainInfo$bitc2 : null,
|
|
1028
|
+
tonInfo: storedChainInfo.tonInfo,
|
|
1029
|
+
isTestnet: storedChainInfo.isTestnet,
|
|
1030
|
+
chainStatus: storedChainInfo.chainStatus,
|
|
1031
|
+
icon: storedChainInfo.icon,
|
|
1032
|
+
extraInfo: storedChainInfo.extraInfo
|
|
1033
|
+
};
|
|
1034
|
+
deprecatedChainMap[storedSlug] = storedSlug; // todo: set a better name
|
|
1073
1035
|
}
|
|
1074
1036
|
}
|
|
1075
1037
|
|
|
@@ -525,8 +525,6 @@ export function updateLatestChainInfo(currentDataMap, latestChainInfoList) {
|
|
|
525
525
|
}
|
|
526
526
|
if (currentChainInfo) {
|
|
527
527
|
needUpdate = true;
|
|
528
|
-
currentChainInfo.extraInfo = latestChainInfo.extraInfo;
|
|
529
|
-
currentChainInfo.chainStatus = latestChainInfo.chainStatus;
|
|
530
528
|
if (Object.keys(currentChainInfo.providers).length === 0) {
|
|
531
529
|
currentChainInfo.chainStatus = _ChainStatus.INACTIVE;
|
|
532
530
|
}
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { _ChainAsset, _ChainInfo, _MultiChainAsset } from '@subwallet/chain-list/types';
|
|
2
|
+
export interface PatchInfo {
|
|
3
|
+
patchVersion: string;
|
|
4
|
+
appliedVersion: string;
|
|
5
|
+
fetchedDate: string;
|
|
6
|
+
ChainInfo: Record<string, _ChainInfo>;
|
|
7
|
+
ChainInfoHashMap: Record<string, string>;
|
|
8
|
+
ChainAsset: Record<string, _ChainAsset>;
|
|
9
|
+
ChainAssetHashMap: Record<string, string>;
|
|
10
|
+
MultiChainAsset: Record<string, _MultiChainAsset>;
|
|
11
|
+
MultiChainAssetHashMap: Record<string, string>;
|
|
12
|
+
ChainLogoMap: Record<string, string>;
|
|
13
|
+
AssetLogoMap: Record<string, string>;
|
|
14
|
+
mAssetLogoMap: Record<string, string>;
|
|
15
|
+
}
|
|
16
|
+
export declare function fetchPatchData<T>(): Promise<T | null>;
|
|
@@ -4,10 +4,14 @@
|
|
|
4
4
|
const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
|
|
5
5
|
const branchName = process.env.BRANCH_NAME || 'subwallet-dev';
|
|
6
6
|
const fetchDomain = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'https://chain-list-assets.subwallet.app' : 'https://dev.sw-chain-list-assets.pages.dev';
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const fetchFile = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'list.json' : 'preview.json';
|
|
8
|
+
const ChainListVersion = '0.2.95'; // update this when build chainlist
|
|
9
|
+
|
|
10
|
+
// todo: move this interface to chainlist
|
|
11
|
+
|
|
12
|
+
export async function fetchPatchData() {
|
|
9
13
|
try {
|
|
10
|
-
const fetchPromise = fetch(`${fetchDomain}/patch/${ChainListVersion}/${
|
|
14
|
+
const fetchPromise = fetch(`${fetchDomain}/patch/${ChainListVersion}/${fetchFile}`);
|
|
11
15
|
const timeout = new Promise(resolve => {
|
|
12
16
|
const id = setTimeout(() => {
|
|
13
17
|
clearTimeout(id);
|
|
@@ -301,7 +301,7 @@ export default class ParaNativeStakingPoolHandler extends BaseParaNativeStakingP
|
|
|
301
301
|
for (const collator of _allCollators) {
|
|
302
302
|
const _collatorAddress = collator[0].toHuman();
|
|
303
303
|
const collatorAddress = _collatorAddress[0];
|
|
304
|
-
if (
|
|
304
|
+
if (selectedCollators.includes(collatorAddress)) {
|
|
305
305
|
const collatorInfo = collator[1].toPrimitive();
|
|
306
306
|
const bnTotalStake = new BN(collatorInfo.totalCounted);
|
|
307
307
|
const bnOwnStake = new BN(collatorInfo.bond);
|
|
@@ -324,7 +324,7 @@ export default class ParaNativeStakingPoolHandler extends BaseParaNativeStakingP
|
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
await Promise.all(allCollators.map(async collator => {
|
|
327
|
-
if (
|
|
327
|
+
if (selectedCollators.includes(collator.address)) {
|
|
328
328
|
// noted: number of blocks = total points / points per block
|
|
329
329
|
const _collatorPoints = await apiProps.api.query.parachainStaking.awardedPts(parseInt(round.current) - 1, collator.address);
|
|
330
330
|
const collatorPoints = _collatorPoints.toPrimitive();
|
|
@@ -355,10 +355,11 @@ export default class ParaNativeStakingPoolHandler extends BaseParaNativeStakingP
|
|
|
355
355
|
async getParachainPoolTargets() {
|
|
356
356
|
const apiProps = await this.substrateApi.isReady;
|
|
357
357
|
const allCollators = [];
|
|
358
|
-
const [_allCollators, _collatorCommission] = await Promise.all([apiProps.api.query.parachainStaking.candidateInfo.entries(), apiProps.api.query.parachainStaking.collatorCommission()]);
|
|
358
|
+
const [_allCollators, _collatorCommission, _selectedCandidates] = await Promise.all([apiProps.api.query.parachainStaking.candidateInfo.entries(), apiProps.api.query.parachainStaking.collatorCommission(), apiProps.api.query.parachainStaking.selectedCandidates()]);
|
|
359
359
|
const maxDelegationPerCollator = apiProps.api.consts.parachainStaking.maxTopDelegationsPerCandidate.toString();
|
|
360
360
|
const rawCollatorCommission = _collatorCommission.toHuman();
|
|
361
361
|
const collatorCommission = parseFloat(rawCollatorCommission.split('%')[0]);
|
|
362
|
+
const selectedCollators = _selectedCandidates.toPrimitive();
|
|
362
363
|
for (const collator of _allCollators) {
|
|
363
364
|
const _collatorAddress = collator[0].toHuman();
|
|
364
365
|
const collatorAddress = _collatorAddress[0];
|
|
@@ -368,20 +369,22 @@ export default class ParaNativeStakingPoolHandler extends BaseParaNativeStakingP
|
|
|
368
369
|
const bnOtherStake = bnTotalStake.sub(bnOwnStake);
|
|
369
370
|
const bnMinBond = new BN(collatorInfo.lowestTopDelegationAmount);
|
|
370
371
|
const maxNominatorRewarded = parseInt(maxDelegationPerCollator);
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
372
|
+
if (selectedCollators.includes(collatorAddress)) {
|
|
373
|
+
allCollators.push({
|
|
374
|
+
commission: 0,
|
|
375
|
+
expectedReturn: 0,
|
|
376
|
+
address: collatorAddress,
|
|
377
|
+
totalStake: bnTotalStake.toString(),
|
|
378
|
+
ownStake: bnOwnStake.toString(),
|
|
379
|
+
otherStake: bnOtherStake.toString(),
|
|
380
|
+
nominatorCount: collatorInfo.delegationCount,
|
|
381
|
+
blocked: false,
|
|
382
|
+
isVerified: false,
|
|
383
|
+
minBond: bnMinBond.toString(),
|
|
384
|
+
chain: this.chain,
|
|
385
|
+
isCrowded: collatorInfo.delegationCount ? collatorInfo.delegationCount >= maxNominatorRewarded : false
|
|
386
|
+
});
|
|
387
|
+
}
|
|
385
388
|
}
|
|
386
389
|
const extraInfoMap = {};
|
|
387
390
|
await Promise.all(allCollators.map(async collator => {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EnvConfig } from '@subwallet/extension-base/constants';
|
|
2
|
+
import { StoreSubject } from '@subwallet/extension-base/services/keyring-service/context/stores/Base';
|
|
3
|
+
import { EnvironmentStore } from '@subwallet/extension-base/stores';
|
|
4
|
+
import { BehaviorSubject } from 'rxjs';
|
|
5
|
+
export declare class EnvironmentStoreSubject extends StoreSubject<EnvConfig> {
|
|
6
|
+
store: EnvironmentStore;
|
|
7
|
+
subject: BehaviorSubject<EnvConfig>;
|
|
8
|
+
key: string;
|
|
9
|
+
defaultValue: {};
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-base
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { StoreSubject } from '@subwallet/extension-base/services/keyring-service/context/stores/Base';
|
|
5
|
+
import { EnvironmentStore } from '@subwallet/extension-base/stores';
|
|
6
|
+
import { BehaviorSubject } from 'rxjs';
|
|
7
|
+
export class EnvironmentStoreSubject extends StoreSubject {
|
|
8
|
+
store = new EnvironmentStore();
|
|
9
|
+
subject = new BehaviorSubject({});
|
|
10
|
+
key = 'Environment';
|
|
11
|
+
defaultValue = {};
|
|
12
|
+
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { GAS_PRICE_RATIO, NETWORK_MULTI_GAS_FEE } from '@subwallet/extension-base/constants';
|
|
5
5
|
import { BN_WEI, BN_ZERO } from '@subwallet/extension-base/utils';
|
|
6
6
|
import BigN from 'bignumber.js';
|
|
7
|
+
import { POLYGON_GAS_INDEXER } from "../../balance-service/transfer/xcm/polygonBridge.js";
|
|
7
8
|
const INFURA_API_KEY = process.env.INFURA_API_KEY || '';
|
|
8
9
|
const INFURA_API_KEY_SECRET = process.env.INFURA_API_KEY_SECRET || '';
|
|
9
10
|
const INFURA_AUTH = 'Basic ' + Buffer.from(INFURA_API_KEY + ':' + INFURA_API_KEY_SECRET).toString('base64');
|
|
@@ -91,6 +92,19 @@ export const calculateGasFeeParams = async (web3, networkKey, useOnline = true,
|
|
|
91
92
|
} catch (e) {}
|
|
92
93
|
}
|
|
93
94
|
try {
|
|
95
|
+
if (networkKey === 'polygonzkEvm_cardona' || networkKey === 'polygonZkEvm') {
|
|
96
|
+
const isTestnet = networkKey === 'polygonzkEvm_cardona';
|
|
97
|
+
const gasDomain = isTestnet ? POLYGON_GAS_INDEXER.TESTNET : POLYGON_GAS_INDEXER.MAINNET;
|
|
98
|
+
const gasResponse = await fetch(`${gasDomain}`).then(res => res.json());
|
|
99
|
+
const gasPriceInWei = gasResponse.standard * 1e9 + 200000;
|
|
100
|
+
return {
|
|
101
|
+
gasPrice: gasPriceInWei.toString(),
|
|
102
|
+
maxFeePerGas: undefined,
|
|
103
|
+
maxPriorityFeePerGas: undefined,
|
|
104
|
+
baseGasFee: undefined,
|
|
105
|
+
busyNetwork: false
|
|
106
|
+
};
|
|
107
|
+
}
|
|
94
108
|
const numBlock = 20;
|
|
95
109
|
const rewardPercent = [];
|
|
96
110
|
for (let i = 0; i <= 100; i = i + 5) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAvailBridgeClaimDescription, getClaimDescription, getReceiveDescription, getSendDescription, getWithdrawDescription } from '
|
|
1
|
+
import { getAvailBridgeClaimDescription, getClaimDescription, getPolygonBridgeClaimDescription, getReceiveDescription, getSendDescription, getWithdrawDescription } from './utils';
|
|
2
2
|
export declare const NotificationTitleMap: {
|
|
3
3
|
WITHDRAW: string;
|
|
4
4
|
CLAIM: string;
|
|
@@ -6,6 +6,7 @@ export declare const NotificationTitleMap: {
|
|
|
6
6
|
RECEIVE: string;
|
|
7
7
|
CLAIM_AVAIL_BRIDGE_ON_AVAIL: string;
|
|
8
8
|
CLAIM_AVAIL_BRIDGE_ON_ETHEREUM: string;
|
|
9
|
+
CLAIM_POLYGON_BRIDGE: string;
|
|
9
10
|
};
|
|
10
11
|
export declare const NotificationDescriptionMap: {
|
|
11
12
|
WITHDRAW: typeof getWithdrawDescription;
|
|
@@ -14,5 +15,6 @@ export declare const NotificationDescriptionMap: {
|
|
|
14
15
|
RECEIVE: typeof getReceiveDescription;
|
|
15
16
|
CLAIM_AVAIL_BRIDGE_ON_AVAIL: typeof getAvailBridgeClaimDescription;
|
|
16
17
|
CLAIM_AVAIL_BRIDGE_ON_ETHEREUM: typeof getAvailBridgeClaimDescription;
|
|
18
|
+
CLAIM_POLYGON_BRIDGE: typeof getPolygonBridgeClaimDescription;
|
|
17
19
|
};
|
|
18
20
|
export declare const ONE_DAY_MILLISECOND: number;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { NotificationActionType } from
|
|
5
|
-
import { getAvailBridgeClaimDescription, getClaimDescription, getReceiveDescription, getSendDescription, getWithdrawDescription } from
|
|
4
|
+
import { NotificationActionType } from "./interfaces.js";
|
|
5
|
+
import { getAvailBridgeClaimDescription, getClaimDescription, getPolygonBridgeClaimDescription, getReceiveDescription, getSendDescription, getWithdrawDescription } from "./utils/index.js";
|
|
6
6
|
export const NotificationTitleMap = {
|
|
7
7
|
[NotificationActionType.WITHDRAW]: '[{{accountName}}] WITHDRAW {{tokenSymbol}}',
|
|
8
8
|
[NotificationActionType.CLAIM]: '[{{accountName}}] CLAIM {{tokenSymbol}}',
|
|
9
9
|
[NotificationActionType.SEND]: '[{{accountName}}] SEND {{tokenSymbol}}',
|
|
10
10
|
[NotificationActionType.RECEIVE]: '[{{accountName}}] RECEIVE {{tokenSymbol}}',
|
|
11
11
|
[NotificationActionType.CLAIM_AVAIL_BRIDGE_ON_AVAIL]: '[{{accountName}}] CLAIM {{tokenSymbol}}',
|
|
12
|
-
[NotificationActionType.CLAIM_AVAIL_BRIDGE_ON_ETHEREUM]: '[{{accountName}}] CLAIM {{tokenSymbol}}'
|
|
12
|
+
[NotificationActionType.CLAIM_AVAIL_BRIDGE_ON_ETHEREUM]: '[{{accountName}}] CLAIM {{tokenSymbol}}',
|
|
13
|
+
[NotificationActionType.CLAIM_POLYGON_BRIDGE]: '[{{accountName}}] CLAIM {{tokenSymbol}}'
|
|
13
14
|
};
|
|
14
15
|
export const NotificationDescriptionMap = {
|
|
15
16
|
[NotificationActionType.WITHDRAW]: getWithdrawDescription,
|
|
@@ -17,6 +18,7 @@ export const NotificationDescriptionMap = {
|
|
|
17
18
|
[NotificationActionType.SEND]: getSendDescription,
|
|
18
19
|
[NotificationActionType.RECEIVE]: getReceiveDescription,
|
|
19
20
|
[NotificationActionType.CLAIM_AVAIL_BRIDGE_ON_AVAIL]: getAvailBridgeClaimDescription,
|
|
20
|
-
[NotificationActionType.CLAIM_AVAIL_BRIDGE_ON_ETHEREUM]: getAvailBridgeClaimDescription
|
|
21
|
+
[NotificationActionType.CLAIM_AVAIL_BRIDGE_ON_ETHEREUM]: getAvailBridgeClaimDescription,
|
|
22
|
+
[NotificationActionType.CLAIM_POLYGON_BRIDGE]: getPolygonBridgeClaimDescription
|
|
21
23
|
};
|
|
22
24
|
export const ONE_DAY_MILLISECOND = 1000 * 24 * 60 * 60;
|
|
@@ -3,7 +3,7 @@ import { CronServiceInterface, ServiceStatus } from '@subwallet/extension-base/s
|
|
|
3
3
|
import { ChainService } from '@subwallet/extension-base/services/chain-service';
|
|
4
4
|
import { EventService } from '@subwallet/extension-base/services/event-service';
|
|
5
5
|
import { _BaseNotificationInfo, _NotificationInfo, NotificationActionType } from '@subwallet/extension-base/services/inapp-notification-service/interfaces';
|
|
6
|
-
import { AvailBridgeTransaction } from '@subwallet/extension-base/services/inapp-notification-service/utils';
|
|
6
|
+
import { AvailBridgeTransaction, PolygonTransaction } from '@subwallet/extension-base/services/inapp-notification-service/utils';
|
|
7
7
|
import { KeyringService } from '@subwallet/extension-base/services/keyring-service';
|
|
8
8
|
import DatabaseService from '@subwallet/extension-base/services/storage-service/DatabaseService';
|
|
9
9
|
import { GetNotificationParams, RequestSwitchStatusParams } from '@subwallet/extension-base/types/notification';
|
|
@@ -25,9 +25,17 @@ export declare class InappNotificationService implements CronServiceInterface {
|
|
|
25
25
|
cleanUpOldNotifications(overdueTime?: number): Promise<number>;
|
|
26
26
|
passValidateNotification(candidateNotification: _BaseNotificationInfo, comparedNotifications: _NotificationInfo[], remindTimeConfigInHrs: Record<NotificationActionType, number>): boolean;
|
|
27
27
|
validateAndWriteNotificationsToDB(notifications: _BaseNotificationInfo[], address: string): Promise<void>;
|
|
28
|
-
|
|
28
|
+
cronCreateBridgeClaimNotification(): void;
|
|
29
|
+
getCategorizedAddresses(): {
|
|
30
|
+
substrate: string[];
|
|
31
|
+
evm: string[];
|
|
32
|
+
ton: string[];
|
|
33
|
+
bitcoin: string[];
|
|
34
|
+
};
|
|
29
35
|
createAvailBridgeClaimNotification(): void;
|
|
30
36
|
processWriteAvailBridgeClaim(address: string, transactions: AvailBridgeTransaction[], token: _ChainAsset): Promise<void>;
|
|
37
|
+
createPolygonClaimableTransactions(): Promise<void>;
|
|
38
|
+
processPolygonClaimNotification(address: string, transactions: PolygonTransaction[], token: _ChainAsset): Promise<void>;
|
|
31
39
|
start(): Promise<void>;
|
|
32
40
|
startCron(): Promise<void>;
|
|
33
41
|
stop(): Promise<void>;
|