@subwallet/extension-base 1.1.66-0 → 1.1.67-1
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/cjs/koni/background/cron.js +13 -0
- package/cjs/koni/background/handlers/State.js +2 -0
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/index.js +0 -1
- package/cjs/services/earning-service/service.js +2 -2
- package/koni/background/cron.d.ts +2 -0
- package/koni/background/cron.js +14 -1
- package/koni/background/handlers/State.js +2 -0
- package/package.json +6 -6
- package/packageInfo.js +1 -1
- package/services/chain-service/index.js +0 -1
- package/services/earning-service/service.js +2 -2
|
@@ -98,6 +98,11 @@ class KoniCron {
|
|
|
98
98
|
(commonReload || needUpdateNft) && this.resetNft(address);
|
|
99
99
|
(commonReload || needUpdateNft) && this.removeCron('refreshNft');
|
|
100
100
|
commonReload && this.removeCron('refreshPoolingStakingReward');
|
|
101
|
+
if (chainUpdated) {
|
|
102
|
+
this.stopPoolInfo();
|
|
103
|
+
this.removeCron('fetchPoolInfo');
|
|
104
|
+
this.addCron('fetchPoolInfo', this.fetchPoolInfo, _constants.CRON_REFRESH_CHAIN_STAKING_METADATA);
|
|
105
|
+
}
|
|
101
106
|
|
|
102
107
|
// Chains
|
|
103
108
|
if (this.checkNetworkAvailable(serviceInfo)) {
|
|
@@ -107,6 +112,7 @@ class KoniCron {
|
|
|
107
112
|
}
|
|
108
113
|
};
|
|
109
114
|
this.state.eventService.onLazy(this.eventHandler);
|
|
115
|
+
this.addCron('fetchPoolInfo', this.fetchPoolInfo, _constants.CRON_REFRESH_CHAIN_STAKING_METADATA);
|
|
110
116
|
if (!(currentAccountInfo !== null && currentAccountInfo !== void 0 && currentAccountInfo.address)) {
|
|
111
117
|
return;
|
|
112
118
|
}
|
|
@@ -133,6 +139,7 @@ class KoniCron {
|
|
|
133
139
|
this.serviceSubscription = undefined;
|
|
134
140
|
}
|
|
135
141
|
this.removeAllCrons();
|
|
142
|
+
this.stopPoolInfo();
|
|
136
143
|
this.status = 'stopped';
|
|
137
144
|
return Promise.resolve();
|
|
138
145
|
};
|
|
@@ -141,6 +148,12 @@ class KoniCron {
|
|
|
141
148
|
this.state.syncMantaPay().catch(console.warn);
|
|
142
149
|
}
|
|
143
150
|
};
|
|
151
|
+
fetchPoolInfo = () => {
|
|
152
|
+
this.state.earningService.runSubscribePoolsInfo().catch(console.error);
|
|
153
|
+
};
|
|
154
|
+
stopPoolInfo = () => {
|
|
155
|
+
this.state.earningService.runUnsubscribePoolsInfo();
|
|
156
|
+
};
|
|
144
157
|
refreshNft = (address, apiMap, smartContractNfts, chainInfoMap) => {
|
|
145
158
|
return () => {
|
|
146
159
|
this.subscriptions.subscribeNft(address, apiMap.substrate, apiMap.evm, smartContractNfts, chainInfoMap);
|
|
@@ -245,6 +245,7 @@ class KoniState {
|
|
|
245
245
|
// TODO: consider moving this to a separate service
|
|
246
246
|
await this.dbService.stores.crowdloan.removeEndedCrowdloans();
|
|
247
247
|
await this.startSubscription();
|
|
248
|
+
this.chainService.checkLatestData();
|
|
248
249
|
}
|
|
249
250
|
async initMantaPay(password) {
|
|
250
251
|
var _this$chainService, _this$chainService$ma;
|
|
@@ -1577,6 +1578,7 @@ class KoniState {
|
|
|
1577
1578
|
await this.walletConnectService.resetWallet(resetAll);
|
|
1578
1579
|
await this.chainService.init();
|
|
1579
1580
|
this.afterChainServiceInit();
|
|
1581
|
+
this.chainService.checkLatestData();
|
|
1580
1582
|
}
|
|
1581
1583
|
async enableMantaPay(updateStore, address, password, seedPhrase) {
|
|
1582
1584
|
var _this$chainService3, _this$chainService3$m, _this$chainService4, _this$chainService4$m, _this$chainService4$m2, _this$chainService11, _this$chainService11$, _this$chainService11$2;
|
package/cjs/packageInfo.js
CHANGED
|
@@ -197,7 +197,7 @@ class EarningService {
|
|
|
197
197
|
this.status = _types.ServiceStatus.STARTING;
|
|
198
198
|
|
|
199
199
|
// Start subscribe pools' info
|
|
200
|
-
await this.runSubscribePoolsInfo();
|
|
200
|
+
// await this.runSubscribePoolsInfo();
|
|
201
201
|
|
|
202
202
|
// Start subscribe pools' position
|
|
203
203
|
await this.runSubscribePoolsPosition();
|
|
@@ -224,7 +224,7 @@ class EarningService {
|
|
|
224
224
|
await this.persistData();
|
|
225
225
|
|
|
226
226
|
// Stop subscribe pools' info
|
|
227
|
-
this.runUnsubscribePoolsInfo();
|
|
227
|
+
// this.runUnsubscribePoolsInfo();
|
|
228
228
|
|
|
229
229
|
// Stop subscribe pools' position
|
|
230
230
|
this.runUnsubscribePoolsPosition();
|
|
@@ -23,6 +23,8 @@ export declare class KoniCron {
|
|
|
23
23
|
start: () => Promise<void>;
|
|
24
24
|
stop: () => Promise<void>;
|
|
25
25
|
syncMantaPay: () => void;
|
|
26
|
+
fetchPoolInfo: () => void;
|
|
27
|
+
stopPoolInfo: () => void;
|
|
26
28
|
refreshNft: (address: string, apiMap: ApiMap, smartContractNfts: _ChainAsset[], chainInfoMap: Record<string, _ChainInfo>) => () => void;
|
|
27
29
|
resetNft: (newAddress: string) => void;
|
|
28
30
|
checkNetworkAvailable: (serviceInfo: ServiceInfo) => boolean;
|
package/koni/background/cron.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { CRON_REFRESH_NFT_INTERVAL, CRON_SYNC_MANTA_PAY } from '@subwallet/extension-base/constants';
|
|
4
|
+
import { CRON_REFRESH_CHAIN_STAKING_METADATA, CRON_REFRESH_NFT_INTERVAL, CRON_SYNC_MANTA_PAY } from '@subwallet/extension-base/constants';
|
|
5
5
|
import { _isChainSupportEvmNft, _isChainSupportNativeNft, _isChainSupportWasmNft } from '@subwallet/extension-base/services/chain-service/utils';
|
|
6
6
|
import { waitTimeout } from '@subwallet/extension-base/utils';
|
|
7
7
|
import { Subject } from 'rxjs';
|
|
@@ -87,6 +87,11 @@ export class KoniCron {
|
|
|
87
87
|
(commonReload || needUpdateNft) && this.resetNft(address);
|
|
88
88
|
(commonReload || needUpdateNft) && this.removeCron('refreshNft');
|
|
89
89
|
commonReload && this.removeCron('refreshPoolingStakingReward');
|
|
90
|
+
if (chainUpdated) {
|
|
91
|
+
this.stopPoolInfo();
|
|
92
|
+
this.removeCron('fetchPoolInfo');
|
|
93
|
+
this.addCron('fetchPoolInfo', this.fetchPoolInfo, CRON_REFRESH_CHAIN_STAKING_METADATA);
|
|
94
|
+
}
|
|
90
95
|
|
|
91
96
|
// Chains
|
|
92
97
|
if (this.checkNetworkAvailable(serviceInfo)) {
|
|
@@ -96,6 +101,7 @@ export class KoniCron {
|
|
|
96
101
|
}
|
|
97
102
|
};
|
|
98
103
|
this.state.eventService.onLazy(this.eventHandler);
|
|
104
|
+
this.addCron('fetchPoolInfo', this.fetchPoolInfo, CRON_REFRESH_CHAIN_STAKING_METADATA);
|
|
99
105
|
if (!(currentAccountInfo !== null && currentAccountInfo !== void 0 && currentAccountInfo.address)) {
|
|
100
106
|
return;
|
|
101
107
|
}
|
|
@@ -122,6 +128,7 @@ export class KoniCron {
|
|
|
122
128
|
this.serviceSubscription = undefined;
|
|
123
129
|
}
|
|
124
130
|
this.removeAllCrons();
|
|
131
|
+
this.stopPoolInfo();
|
|
125
132
|
this.status = 'stopped';
|
|
126
133
|
return Promise.resolve();
|
|
127
134
|
};
|
|
@@ -130,6 +137,12 @@ export class KoniCron {
|
|
|
130
137
|
this.state.syncMantaPay().catch(console.warn);
|
|
131
138
|
}
|
|
132
139
|
};
|
|
140
|
+
fetchPoolInfo = () => {
|
|
141
|
+
this.state.earningService.runSubscribePoolsInfo().catch(console.error);
|
|
142
|
+
};
|
|
143
|
+
stopPoolInfo = () => {
|
|
144
|
+
this.state.earningService.runUnsubscribePoolsInfo();
|
|
145
|
+
};
|
|
133
146
|
refreshNft = (address, apiMap, smartContractNfts, chainInfoMap) => {
|
|
134
147
|
return () => {
|
|
135
148
|
this.subscriptions.subscribeNft(address, apiMap.substrate, apiMap.evm, smartContractNfts, chainInfoMap);
|
|
@@ -237,6 +237,7 @@ export default class KoniState {
|
|
|
237
237
|
// TODO: consider moving this to a separate service
|
|
238
238
|
await this.dbService.stores.crowdloan.removeEndedCrowdloans();
|
|
239
239
|
await this.startSubscription();
|
|
240
|
+
this.chainService.checkLatestData();
|
|
240
241
|
}
|
|
241
242
|
async initMantaPay(password) {
|
|
242
243
|
var _this$chainService, _this$chainService$ma;
|
|
@@ -1553,6 +1554,7 @@ export default class KoniState {
|
|
|
1553
1554
|
await this.walletConnectService.resetWallet(resetAll);
|
|
1554
1555
|
await this.chainService.init();
|
|
1555
1556
|
this.afterChainServiceInit();
|
|
1557
|
+
this.chainService.checkLatestData();
|
|
1556
1558
|
}
|
|
1557
1559
|
async enableMantaPay(updateStore, address, password, seedPhrase) {
|
|
1558
1560
|
var _this$chainService3, _this$chainService3$m, _this$chainService4, _this$chainService4$m, _this$chainService4$m2, _this$chainService11, _this$chainService11$, _this$chainService11$2;
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.1.
|
|
20
|
+
"version": "1.1.67-1",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -1885,11 +1885,11 @@
|
|
|
1885
1885
|
"@reduxjs/toolkit": "^1.9.1",
|
|
1886
1886
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
1887
1887
|
"@substrate/connect": "^0.8.9",
|
|
1888
|
-
"@subwallet/chain-list": "0.2.
|
|
1889
|
-
"@subwallet/extension-base": "^1.1.
|
|
1890
|
-
"@subwallet/extension-chains": "^1.1.
|
|
1891
|
-
"@subwallet/extension-dapp": "^1.1.
|
|
1892
|
-
"@subwallet/extension-inject": "^1.1.
|
|
1888
|
+
"@subwallet/chain-list": "0.2.63",
|
|
1889
|
+
"@subwallet/extension-base": "^1.1.67-1",
|
|
1890
|
+
"@subwallet/extension-chains": "^1.1.67-1",
|
|
1891
|
+
"@subwallet/extension-dapp": "^1.1.67-1",
|
|
1892
|
+
"@subwallet/extension-inject": "^1.1.67-1",
|
|
1893
1893
|
"@subwallet/keyring": "^0.1.5",
|
|
1894
1894
|
"@subwallet/ui-keyring": "^0.1.5",
|
|
1895
1895
|
"@walletconnect/sign-client": "^2.8.4",
|
package/packageInfo.js
CHANGED
|
@@ -7,5 +7,5 @@ export const packageInfo = {
|
|
|
7
7
|
name: '@subwallet/extension-base',
|
|
8
8
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
9
9
|
type: 'esm',
|
|
10
|
-
version: '1.1.
|
|
10
|
+
version: '1.1.67-1'
|
|
11
11
|
};
|
|
@@ -190,7 +190,7 @@ export default class EarningService {
|
|
|
190
190
|
this.status = ServiceStatus.STARTING;
|
|
191
191
|
|
|
192
192
|
// Start subscribe pools' info
|
|
193
|
-
await this.runSubscribePoolsInfo();
|
|
193
|
+
// await this.runSubscribePoolsInfo();
|
|
194
194
|
|
|
195
195
|
// Start subscribe pools' position
|
|
196
196
|
await this.runSubscribePoolsPosition();
|
|
@@ -217,7 +217,7 @@ export default class EarningService {
|
|
|
217
217
|
await this.persistData();
|
|
218
218
|
|
|
219
219
|
// Stop subscribe pools' info
|
|
220
|
-
this.runUnsubscribePoolsInfo();
|
|
220
|
+
// this.runUnsubscribePoolsInfo();
|
|
221
221
|
|
|
222
222
|
// Stop subscribe pools' position
|
|
223
223
|
this.runUnsubscribePoolsPosition();
|