@subwallet/extension-base 1.0.13-0 → 1.0.13-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/background/KoniTypes.d.ts +37 -0
- package/background/KoniTypes.js +8 -1
- package/background/handlers/Extension.js +17 -2
- package/background/types.d.ts +6 -1
- package/cjs/background/KoniTypes.js +10 -2
- package/cjs/background/handlers/Extension.js +22 -6
- package/cjs/constants/index.js +7 -1
- package/cjs/defaults.js +1 -1
- package/cjs/koni/api/dotsama/balance.js +5 -0
- package/cjs/koni/api/dotsama/transfer.js +6 -0
- package/cjs/koni/background/cron.js +12 -1
- package/cjs/koni/background/handlers/Extension.js +324 -147
- package/cjs/koni/background/handlers/State.js +222 -50
- package/cjs/koni/background/subscription.js +3 -0
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/constants.js +10 -4
- package/cjs/services/chain-service/handler/SubstrateApi.js +2 -1
- package/cjs/services/chain-service/handler/SubstrateChainHandler.js +3 -1
- package/cjs/services/chain-service/handler/manta/MantaPrivateHandler.js +147 -0
- package/cjs/services/chain-service/index.js +54 -5
- package/cjs/services/chain-service/utils.js +6 -1
- package/cjs/services/event-service/types.js +3 -1
- package/cjs/services/storage-service/DatabaseService.js +31 -1
- package/cjs/services/storage-service/databases/index.js +3 -0
- package/cjs/services/storage-service/db-stores/MantaPay.js +40 -0
- package/cjs/utils/index.js +12 -0
- package/cjs/utils/lazy.js +52 -0
- package/constants/index.d.ts +2 -0
- package/constants/index.js +2 -0
- package/defaults.d.ts +1 -1
- package/defaults.js +1 -1
- package/koni/api/dotsama/balance.js +6 -1
- package/koni/api/dotsama/transfer.js +7 -1
- package/koni/background/cron.d.ts +1 -0
- package/koni/background/cron.js +13 -2
- package/koni/background/handlers/Extension.d.ts +5 -0
- package/koni/background/handlers/Extension.js +186 -11
- package/koni/background/handlers/State.d.ts +15 -3
- package/koni/background/handlers/State.js +224 -49
- package/koni/background/subscription.js +3 -0
- package/package.json +22 -5
- package/packageInfo.js +1 -1
- package/services/chain-service/constants.d.ts +3 -0
- package/services/chain-service/constants.js +5 -2
- package/services/chain-service/handler/SubstrateApi.d.ts +1 -1
- package/services/chain-service/handler/SubstrateApi.js +2 -1
- package/services/chain-service/handler/SubstrateChainHandler.d.ts +1 -1
- package/services/chain-service/handler/SubstrateChainHandler.js +3 -1
- package/services/chain-service/handler/manta/MantaPrivateHandler.d.ts +30 -0
- package/services/chain-service/handler/manta/MantaPrivateHandler.js +140 -0
- package/services/chain-service/handler/types.d.ts +2 -0
- package/services/chain-service/index.d.ts +7 -3
- package/services/chain-service/index.js +56 -7
- package/services/chain-service/utils.d.ts +1 -0
- package/services/chain-service/utils.js +5 -1
- package/services/event-service/types.d.ts +3 -0
- package/services/event-service/types.js +3 -1
- package/services/storage-service/DatabaseService.d.ts +10 -1
- package/services/storage-service/DatabaseService.js +31 -1
- 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/MantaPay.d.ts +9 -0
- package/services/storage-service/db-stores/MantaPay.js +32 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +2 -1
- package/utils/lazy.d.ts +2 -0
- package/utils/lazy.js +43 -0
|
@@ -1451,6 +1451,37 @@ export interface RequestReconnectConnectWalletSession {
|
|
|
1451
1451
|
export interface RequestDisconnectWalletConnectSession {
|
|
1452
1452
|
topic: string;
|
|
1453
1453
|
}
|
|
1454
|
+
export interface MantaPayConfig {
|
|
1455
|
+
address: string;
|
|
1456
|
+
zkAddress: string;
|
|
1457
|
+
enabled: boolean;
|
|
1458
|
+
chain: string;
|
|
1459
|
+
isInitialSync: boolean;
|
|
1460
|
+
}
|
|
1461
|
+
export interface MantaAuthorizationContext {
|
|
1462
|
+
address: string;
|
|
1463
|
+
chain: string;
|
|
1464
|
+
data: unknown;
|
|
1465
|
+
}
|
|
1466
|
+
export interface MantaPaySyncState {
|
|
1467
|
+
isSyncing: boolean;
|
|
1468
|
+
progress: number;
|
|
1469
|
+
needManualSync?: boolean;
|
|
1470
|
+
}
|
|
1471
|
+
export interface MantaPayEnableParams {
|
|
1472
|
+
password: string;
|
|
1473
|
+
address: string;
|
|
1474
|
+
}
|
|
1475
|
+
export declare enum MantaPayEnableMessage {
|
|
1476
|
+
WRONG_PASSWORD = "WRONG_PASSWORD",
|
|
1477
|
+
CHAIN_DISCONNECTED = "CHAIN_DISCONNECTED",
|
|
1478
|
+
UNKNOWN_ERROR = "UNKNOWN_ERROR",
|
|
1479
|
+
SUCCESS = "SUCCESS"
|
|
1480
|
+
}
|
|
1481
|
+
export interface MantaPayEnableResponse {
|
|
1482
|
+
success: boolean;
|
|
1483
|
+
message: MantaPayEnableMessage;
|
|
1484
|
+
}
|
|
1454
1485
|
export interface KoniRequestSignatures {
|
|
1455
1486
|
'pri(staking.submitTuringCancelCompound)': [RequestTuringCancelStakeCompound, SWTransactionResponse];
|
|
1456
1487
|
'pri(staking.submitTuringCompound)': [RequestTuringStakeCompound, SWTransactionResponse];
|
|
@@ -1505,6 +1536,12 @@ export interface KoniRequestSignatures {
|
|
|
1505
1536
|
'pri(crowdloan.getCrowdloan)': [RequestCrowdloan, CrowdloanJson];
|
|
1506
1537
|
'pri(crowdloan.getSubscription)': [RequestSubscribeCrowdloan, CrowdloanJson, CrowdloanJson];
|
|
1507
1538
|
'pri(phishing.pass)': [RequestPassPhishingPage, boolean];
|
|
1539
|
+
'pri(mantaPay.enable)': [MantaPayEnableParams, MantaPayEnableResponse];
|
|
1540
|
+
'pri(mantaPay.disable)': [string, boolean];
|
|
1541
|
+
'pri(mantaPay.getZkBalance)': [null, null];
|
|
1542
|
+
'pri(mantaPay.subscribeConfig)': [null, MantaPayConfig[], MantaPayConfig[]];
|
|
1543
|
+
'pri(mantaPay.subscribeSyncingState)': [null, MantaPaySyncState, MantaPaySyncState];
|
|
1544
|
+
'pri(mantaPay.initSyncMantaPay)': [string, null];
|
|
1508
1545
|
'pri(authorize.listV2)': [null, ResponseAuthorizeList];
|
|
1509
1546
|
'pri(authorize.requestsV2)': [RequestAuthorizeSubscribe, boolean, AuthorizeRequest[]];
|
|
1510
1547
|
'pri(authorize.approveV2)': [RequestAuthorizeApproveV2, boolean];
|
package/background/KoniTypes.js
CHANGED
|
@@ -223,4 +223,11 @@ export let NotificationType;
|
|
|
223
223
|
NotificationType["SUCCESS"] = "success";
|
|
224
224
|
NotificationType["WARNING"] = "warning";
|
|
225
225
|
NotificationType["ERROR"] = "error";
|
|
226
|
-
})(NotificationType || (NotificationType = {}));
|
|
226
|
+
})(NotificationType || (NotificationType = {}));
|
|
227
|
+
export let MantaPayEnableMessage;
|
|
228
|
+
(function (MantaPayEnableMessage) {
|
|
229
|
+
MantaPayEnableMessage["WRONG_PASSWORD"] = "WRONG_PASSWORD";
|
|
230
|
+
MantaPayEnableMessage["CHAIN_DISCONNECTED"] = "CHAIN_DISCONNECTED";
|
|
231
|
+
MantaPayEnableMessage["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
|
|
232
|
+
MantaPayEnableMessage["SUCCESS"] = "SUCCESS";
|
|
233
|
+
})(MantaPayEnableMessage || (MantaPayEnableMessage = {}));
|
|
@@ -446,8 +446,23 @@ export default class Extension {
|
|
|
446
446
|
});
|
|
447
447
|
return true;
|
|
448
448
|
}
|
|
449
|
-
windowOpen(
|
|
450
|
-
|
|
449
|
+
windowOpen({
|
|
450
|
+
allowedPath: path,
|
|
451
|
+
params,
|
|
452
|
+
subPath
|
|
453
|
+
}) {
|
|
454
|
+
let paramString = '';
|
|
455
|
+
if (params) {
|
|
456
|
+
paramString += '?';
|
|
457
|
+
for (let i = 0; i < Object.keys(params).length; i++) {
|
|
458
|
+
const [key, value] = Object.entries(params)[i];
|
|
459
|
+
paramString += `${key}=${value}`;
|
|
460
|
+
if (i !== Object.keys(params).length - 1) {
|
|
461
|
+
paramString += '&';
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
const url = `${chrome.extension.getURL('index.html')}#${path}${subPath || ''}${paramString}`;
|
|
451
466
|
if (!ALLOWED_PATH.includes(path)) {
|
|
452
467
|
console.error('Not allowed to open the url:', url);
|
|
453
468
|
return false;
|
package/background/types.d.ts
CHANGED
|
@@ -124,7 +124,7 @@ export interface RequestSignatures extends KoniRequestSignatures {
|
|
|
124
124
|
'pri(signing.cancel)': [RequestSigningCancel, boolean];
|
|
125
125
|
'pri(signing.isLocked)': [RequestSigningIsLocked, ResponseSigningIsLocked];
|
|
126
126
|
'pri(signing.requests)': [RequestSigningSubscribe, boolean, SigningRequest[]];
|
|
127
|
-
'pri(window.open)': [
|
|
127
|
+
'pri(window.open)': [WindowOpenParams, boolean];
|
|
128
128
|
'pub(accounts.list)': [RequestAccountList, InjectedAccount[]];
|
|
129
129
|
'pub(accounts.subscribe)': [RequestAccountSubscribe, boolean, InjectedAccount[]];
|
|
130
130
|
'pub(authorize.tab)': [RequestAuthorizeTab, null];
|
|
@@ -361,6 +361,11 @@ export interface ResponseJsonRestore {
|
|
|
361
361
|
error: string | null;
|
|
362
362
|
}
|
|
363
363
|
export declare type AllowedPath = typeof ALLOWED_PATH[number];
|
|
364
|
+
export declare type WindowOpenParams = {
|
|
365
|
+
allowedPath: AllowedPath;
|
|
366
|
+
subPath?: string;
|
|
367
|
+
params?: Record<string, string>;
|
|
368
|
+
};
|
|
364
369
|
export interface ResponseJsonGetAccountInfo {
|
|
365
370
|
address: string;
|
|
366
371
|
name: string;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.UnstakingStatus = exports.TransferTxErrorType = exports.TransactionDirection = exports.ThemeNames = exports.StakingType = exports.StakingTxErrorType = exports.StakingStatus = exports.RuntimeEnvironment = exports.RMRK_VER = exports.ProviderErrorType = exports.NotificationType = exports.NETWORK_STATUS = exports.NETWORK_ERROR = exports.ExtrinsicType = exports.ExtrinsicStatus = exports.ExternalRequestPromiseStatus = exports.EvmProviderErrorType = exports.CrowdloanParaState = exports.ContractType = exports.ChainType = exports.ChainEditStandard = exports.BasicTxWarningCode = exports.BasicTxErrorType = exports.BalanceErrorType = exports.AccountExternalErrorCode = exports.APIItemState = void 0;
|
|
6
|
+
exports.UnstakingStatus = exports.TransferTxErrorType = exports.TransactionDirection = exports.ThemeNames = exports.StakingType = exports.StakingTxErrorType = exports.StakingStatus = exports.RuntimeEnvironment = exports.RMRK_VER = exports.ProviderErrorType = exports.NotificationType = exports.NETWORK_STATUS = exports.NETWORK_ERROR = exports.MantaPayEnableMessage = exports.ExtrinsicType = exports.ExtrinsicStatus = exports.ExternalRequestPromiseStatus = exports.EvmProviderErrorType = exports.CrowdloanParaState = exports.ContractType = exports.ChainType = exports.ChainEditStandard = exports.BasicTxWarningCode = exports.BasicTxErrorType = exports.BalanceErrorType = exports.AccountExternalErrorCode = exports.APIItemState = void 0;
|
|
7
7
|
// Copyright 2019-2022 @polkadot/extension-koni authors & contributors
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
let RuntimeEnvironment;
|
|
@@ -241,4 +241,12 @@ exports.NotificationType = NotificationType;
|
|
|
241
241
|
NotificationType["SUCCESS"] = "success";
|
|
242
242
|
NotificationType["WARNING"] = "warning";
|
|
243
243
|
NotificationType["ERROR"] = "error";
|
|
244
|
-
})(NotificationType || (exports.NotificationType = NotificationType = {}));
|
|
244
|
+
})(NotificationType || (exports.NotificationType = NotificationType = {}));
|
|
245
|
+
let MantaPayEnableMessage;
|
|
246
|
+
exports.MantaPayEnableMessage = MantaPayEnableMessage;
|
|
247
|
+
(function (MantaPayEnableMessage) {
|
|
248
|
+
MantaPayEnableMessage["WRONG_PASSWORD"] = "WRONG_PASSWORD";
|
|
249
|
+
MantaPayEnableMessage["CHAIN_DISCONNECTED"] = "CHAIN_DISCONNECTED";
|
|
250
|
+
MantaPayEnableMessage["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
|
|
251
|
+
MantaPayEnableMessage["SUCCESS"] = "SUCCESS";
|
|
252
|
+
})(MantaPayEnableMessage || (exports.MantaPayEnableMessage = MantaPayEnableMessage = {}));
|
|
@@ -483,8 +483,24 @@ class Extension {
|
|
|
483
483
|
});
|
|
484
484
|
return true;
|
|
485
485
|
}
|
|
486
|
-
windowOpen(
|
|
487
|
-
|
|
486
|
+
windowOpen(_ref24) {
|
|
487
|
+
let {
|
|
488
|
+
allowedPath: path,
|
|
489
|
+
params,
|
|
490
|
+
subPath
|
|
491
|
+
} = _ref24;
|
|
492
|
+
let paramString = '';
|
|
493
|
+
if (params) {
|
|
494
|
+
paramString += '?';
|
|
495
|
+
for (let i = 0; i < Object.keys(params).length; i++) {
|
|
496
|
+
const [key, value] = Object.entries(params)[i];
|
|
497
|
+
paramString += `${key}=${value}`;
|
|
498
|
+
if (i !== Object.keys(params).length - 1) {
|
|
499
|
+
paramString += '&';
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
const url = `${chrome.extension.getURL('index.html')}#${path}${subPath || ''}${paramString}`;
|
|
488
504
|
if (!_defaults.ALLOWED_PATH.includes(path)) {
|
|
489
505
|
console.error('Not allowed to open the url:', url);
|
|
490
506
|
return false;
|
|
@@ -507,26 +523,26 @@ class Extension {
|
|
|
507
523
|
throw new Error(`"${suri}" is not a valid derivation path`);
|
|
508
524
|
}
|
|
509
525
|
}
|
|
510
|
-
derivationValidate(
|
|
526
|
+
derivationValidate(_ref25) {
|
|
511
527
|
let {
|
|
512
528
|
parentAddress,
|
|
513
529
|
parentPassword,
|
|
514
530
|
suri
|
|
515
|
-
} =
|
|
531
|
+
} = _ref25;
|
|
516
532
|
const childPair = this.derive(parentAddress, suri, parentPassword, {});
|
|
517
533
|
return {
|
|
518
534
|
address: childPair.address,
|
|
519
535
|
suri
|
|
520
536
|
};
|
|
521
537
|
}
|
|
522
|
-
derivationCreate(
|
|
538
|
+
derivationCreate(_ref26) {
|
|
523
539
|
let {
|
|
524
540
|
genesisHash,
|
|
525
541
|
name,
|
|
526
542
|
parentAddress,
|
|
527
543
|
parentPassword,
|
|
528
544
|
suri
|
|
529
|
-
} =
|
|
545
|
+
} = _ref26;
|
|
530
546
|
const childPair = this.derive(parentAddress, suri, parentPassword, {
|
|
531
547
|
genesisHash,
|
|
532
548
|
name,
|
package/cjs/constants/index.js
CHANGED
|
@@ -18,6 +18,8 @@ var _exportNames = {
|
|
|
18
18
|
CRON_REFRESH_CHAIN_STAKING_METADATA: true,
|
|
19
19
|
CRON_REFRESH_CHAIN_NOMINATOR_METADATA: true,
|
|
20
20
|
CRON_RECOVER_HISTORY_INTERVAL: true,
|
|
21
|
+
CRON_SYNC_MANTA_PAY: true,
|
|
22
|
+
MANTA_PAY_BALANCE_INTERVAL: true,
|
|
21
23
|
ALL_ACCOUNT_KEY: true,
|
|
22
24
|
ALL_NETWORK_KEY: true,
|
|
23
25
|
ALL_GENESIS_HASH: true,
|
|
@@ -25,7 +27,7 @@ var _exportNames = {
|
|
|
25
27
|
IGNORE_QR_SIGNER: true,
|
|
26
28
|
XCM_MIN_AMOUNT_RATIO: true
|
|
27
29
|
};
|
|
28
|
-
exports.XCM_MIN_AMOUNT_RATIO = exports.SUB_TOKEN_REFRESH_BALANCE_INTERVAL = exports.IGNORE_QR_SIGNER = exports.IGNORE_GET_SUBSTRATE_FEATURES_LIST = exports.CRON_REFRESH_STAKING_REWARD_INTERVAL = exports.CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL = exports.CRON_REFRESH_PRICE_INTERVAL = exports.CRON_REFRESH_NFT_INTERVAL = exports.CRON_REFRESH_HISTORY_INTERVAL = exports.CRON_REFRESH_CHAIN_STAKING_METADATA = exports.CRON_REFRESH_CHAIN_NOMINATOR_METADATA = exports.CRON_RECOVER_HISTORY_INTERVAL = exports.CRON_GET_API_MAP_STATUS = exports.CRON_AUTO_RECOVER_WEB3_INTERVAL = exports.CRON_AUTO_RECOVER_DOTSAMA_INTERVAL = exports.ASTAR_REFRESH_BALANCE_INTERVAL = exports.ALL_NETWORK_KEY = exports.ALL_GENESIS_HASH = exports.ALL_ACCOUNT_KEY = exports.ACALA_REFRESH_CROWDLOAN_INTERVAL = void 0;
|
|
30
|
+
exports.XCM_MIN_AMOUNT_RATIO = exports.SUB_TOKEN_REFRESH_BALANCE_INTERVAL = exports.MANTA_PAY_BALANCE_INTERVAL = exports.IGNORE_QR_SIGNER = exports.IGNORE_GET_SUBSTRATE_FEATURES_LIST = exports.CRON_SYNC_MANTA_PAY = exports.CRON_REFRESH_STAKING_REWARD_INTERVAL = exports.CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL = exports.CRON_REFRESH_PRICE_INTERVAL = exports.CRON_REFRESH_NFT_INTERVAL = exports.CRON_REFRESH_HISTORY_INTERVAL = exports.CRON_REFRESH_CHAIN_STAKING_METADATA = exports.CRON_REFRESH_CHAIN_NOMINATOR_METADATA = exports.CRON_RECOVER_HISTORY_INTERVAL = exports.CRON_GET_API_MAP_STATUS = exports.CRON_AUTO_RECOVER_WEB3_INTERVAL = exports.CRON_AUTO_RECOVER_DOTSAMA_INTERVAL = exports.ASTAR_REFRESH_BALANCE_INTERVAL = exports.ALL_NETWORK_KEY = exports.ALL_GENESIS_HASH = exports.ALL_ACCOUNT_KEY = exports.ACALA_REFRESH_CROWDLOAN_INTERVAL = void 0;
|
|
29
31
|
var _staking = require("./staking");
|
|
30
32
|
Object.keys(_staking).forEach(function (key) {
|
|
31
33
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -69,6 +71,10 @@ const CRON_REFRESH_CHAIN_NOMINATOR_METADATA = 1800000;
|
|
|
69
71
|
exports.CRON_REFRESH_CHAIN_NOMINATOR_METADATA = CRON_REFRESH_CHAIN_NOMINATOR_METADATA;
|
|
70
72
|
const CRON_RECOVER_HISTORY_INTERVAL = 30000;
|
|
71
73
|
exports.CRON_RECOVER_HISTORY_INTERVAL = CRON_RECOVER_HISTORY_INTERVAL;
|
|
74
|
+
const CRON_SYNC_MANTA_PAY = 300000;
|
|
75
|
+
exports.CRON_SYNC_MANTA_PAY = CRON_SYNC_MANTA_PAY;
|
|
76
|
+
const MANTA_PAY_BALANCE_INTERVAL = 30000;
|
|
77
|
+
exports.MANTA_PAY_BALANCE_INTERVAL = MANTA_PAY_BALANCE_INTERVAL;
|
|
72
78
|
const ALL_ACCOUNT_KEY = 'ALL';
|
|
73
79
|
exports.ALL_ACCOUNT_KEY = ALL_ACCOUNT_KEY;
|
|
74
80
|
const ALL_NETWORK_KEY = 'all';
|
package/cjs/defaults.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.PORT_MOBILE = exports.PORT_EXTENSION = exports.PORT_CONTENT = exports.PH
|
|
|
7
7
|
// Copyright 2019-2022 @polkadot/extension-base authors & contributors
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
|
|
10
|
-
const ALLOWED_PATH = ['/', '/settings/security', '/accounts/connect-ledger', '/accounts/restore-json', '/accounts/new-seed-phrase'];
|
|
10
|
+
const ALLOWED_PATH = ['/', '/settings/security', '/accounts/connect-ledger', '/accounts/restore-json', '/accounts/detail', '/accounts/new-seed-phrase'];
|
|
11
11
|
exports.ALLOWED_PATH = ALLOWED_PATH;
|
|
12
12
|
const PHISHING_PAGE_REDIRECT = '/phishing-page-detected';
|
|
13
13
|
exports.PHISHING_PAGE_REDIRECT = PHISHING_PAGE_REDIRECT;
|
|
@@ -337,6 +337,11 @@ async function subscribeTokensAccountsPallet(addresses, chain, api, callBack, in
|
|
|
337
337
|
}
|
|
338
338
|
async function subscribeAssetsAccountPallet(addresses, chain, api, callBack) {
|
|
339
339
|
const tokenMap = _handlers.state.getAssetByChainAndAsset(chain, [_types._AssetType.LOCAL]);
|
|
340
|
+
Object.values(tokenMap).forEach(token => {
|
|
341
|
+
if (_constants2._MANTA_ZK_CHAIN_GROUP.includes(token.originChain) && token.symbol.startsWith(_constants2._ZK_ASSET_PREFIX)) {
|
|
342
|
+
delete tokenMap[token.slug];
|
|
343
|
+
}
|
|
344
|
+
});
|
|
340
345
|
const unsubList = await Promise.all(Object.values(tokenMap).map(async tokenInfo => {
|
|
341
346
|
try {
|
|
342
347
|
const assetIndex = (0, _utils2._getTokenOnChainAssetId)(tokenInfo);
|
|
@@ -42,6 +42,12 @@ async function checkSupportTransfer(networkKey, tokenInfo, substrateApiMap, chai
|
|
|
42
42
|
supportTransferAll: true
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
+
if (tokenInfo.symbol.startsWith(_constants._ZK_ASSET_PREFIX) && _constants._MANTA_ZK_CHAIN_GROUP.includes(tokenInfo.originChain)) {
|
|
46
|
+
return {
|
|
47
|
+
supportTransfer: false,
|
|
48
|
+
supportTransferAll: false
|
|
49
|
+
};
|
|
50
|
+
}
|
|
45
51
|
if (_constants._TRANSFER_NOT_SUPPORTED_CHAINS.includes(networkKey)) {
|
|
46
52
|
return {
|
|
47
53
|
supportTransfer: false,
|
|
@@ -73,6 +73,7 @@ class KoniCron {
|
|
|
73
73
|
const commonReload = eventTypes.some(eventType => commonReloadEvents.includes(eventType));
|
|
74
74
|
const chainUpdated = eventTypes.includes('chain.updateState');
|
|
75
75
|
const stakingSubmitted = eventTypes.includes('transaction.submitStaking');
|
|
76
|
+
const reloadMantaPay = eventTypes.includes('mantaPay.submitTransaction') || eventTypes.includes('mantaPay.enable');
|
|
76
77
|
const updatedChains = [];
|
|
77
78
|
if (chainUpdated) {
|
|
78
79
|
events.forEach(event => {
|
|
@@ -82,7 +83,7 @@ class KoniCron {
|
|
|
82
83
|
}
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
|
-
if (!commonReload && !chainUpdated && !stakingSubmitted) {
|
|
86
|
+
if (!commonReload && !chainUpdated && !stakingSubmitted && !reloadMantaPay) {
|
|
86
87
|
return;
|
|
87
88
|
}
|
|
88
89
|
const address = (_serviceInfo$currentA = serviceInfo.currentAccountInfo) === null || _serviceInfo$currentA === void 0 ? void 0 : _serviceInfo$currentA.address;
|
|
@@ -93,6 +94,9 @@ class KoniCron {
|
|
|
93
94
|
const needUpdateNft = this.needUpdateNft(chainInfoMap, updatedChains);
|
|
94
95
|
const needUpdateStaking = this.needUpdateStaking(chainInfoMap, updatedChains);
|
|
95
96
|
|
|
97
|
+
// MantaPay
|
|
98
|
+
reloadMantaPay && this.removeCron('syncMantaPay');
|
|
99
|
+
|
|
96
100
|
// NFT
|
|
97
101
|
(commonReload || needUpdateNft) && this.resetNft(address);
|
|
98
102
|
(commonReload || needUpdateNft) && this.removeCron('refreshNft');
|
|
@@ -110,6 +114,7 @@ class KoniCron {
|
|
|
110
114
|
(commonReload || needUpdateStaking || stakingSubmitted) && this.addCron('refreshStakingReward', this.refreshStakingReward(address), _constants.CRON_REFRESH_STAKING_REWARD_INTERVAL);
|
|
111
115
|
(commonReload || needUpdateStaking || stakingSubmitted) && this.addCron('refreshPoolingStakingReward', this.refreshStakingRewardFastInterval(address), _constants.CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL);
|
|
112
116
|
needUpdateStaking && this.addCron('updateChainStakingMetadata', this.updateChainStakingMetadata(serviceInfo.chainInfoMap, serviceInfo.chainStateMap, serviceInfo.chainApiMap.substrate), _constants.CRON_REFRESH_CHAIN_STAKING_METADATA);
|
|
117
|
+
reloadMantaPay && this.addCron('syncMantaPay', this.syncMantaPay, _constants.CRON_SYNC_MANTA_PAY);
|
|
113
118
|
} else {
|
|
114
119
|
this.setStakingRewardReady();
|
|
115
120
|
}
|
|
@@ -124,6 +129,7 @@ class KoniCron {
|
|
|
124
129
|
this.addCron('refreshStakingReward', this.refreshStakingReward(currentAccountInfo.address), _constants.CRON_REFRESH_STAKING_REWARD_INTERVAL);
|
|
125
130
|
this.addCron('refreshPoolingStakingReward', this.refreshStakingRewardFastInterval(currentAccountInfo.address), _constants.CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL);
|
|
126
131
|
this.addCron('updateChainStakingMetadata', this.updateChainStakingMetadata(this.state.getChainInfoMap(), this.state.getChainStateMap(), this.state.getSubstrateApiMap()), _constants.CRON_REFRESH_CHAIN_STAKING_METADATA);
|
|
132
|
+
this.addCron('syncMantaPay', this.syncMantaPay, _constants.CRON_SYNC_MANTA_PAY);
|
|
127
133
|
} else {
|
|
128
134
|
this.setStakingRewardReady();
|
|
129
135
|
}
|
|
@@ -147,6 +153,11 @@ class KoniCron {
|
|
|
147
153
|
this.status = 'stopped';
|
|
148
154
|
return Promise.resolve();
|
|
149
155
|
};
|
|
156
|
+
syncMantaPay = () => {
|
|
157
|
+
if (this.state.isMantaPayEnabled) {
|
|
158
|
+
this.state.syncMantaPay().catch(console.warn);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
150
161
|
refreshNft = (address, apiMap, smartContractNfts, chainInfoMap) => {
|
|
151
162
|
return () => {
|
|
152
163
|
this.subscriptions.subscribeNft(address, apiMap.substrate, apiMap.evm, smartContractNfts, chainInfoMap);
|