@subwallet/extension-base 1.2.27-0 → 1.2.29-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 +7 -8
- package/cjs/constants/index.js +6 -3
- package/cjs/core/logic-validation/request.js +160 -23
- package/cjs/core/substrate/xcm-parser.js +16 -6
- package/cjs/koni/api/staking/bonding/utils.js +1 -0
- package/cjs/koni/background/handlers/Extension.js +3 -3
- package/cjs/koni/background/handlers/State.js +35 -66
- package/cjs/koni/background/handlers/Tabs.js +96 -23
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/subscribe/index.js +19 -13
- package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +14 -2
- package/cjs/services/balance-service/transfer/xcm/index.js +8 -13
- package/cjs/services/chain-service/constants.js +2 -1
- package/cjs/services/chain-service/index.js +1 -1
- package/cjs/services/earning-service/constants/chains.js +1 -3
- package/cjs/services/earning-service/handlers/lending/interlay.js +0 -2
- package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +1 -12
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +31 -25
- package/cjs/services/earning-service/handlers/nomination-pool/index.js +1 -2
- package/cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol.js +2 -2
- package/cjs/services/migration-service/scripts/databases/MigrateAssetSetting.js +2 -2
- package/cjs/services/migration-service/scripts/index.js +2 -2
- package/cjs/services/mkt-campaign-service/index.js +30 -6
- package/cjs/services/request-service/handler/EvmRequestHandler.js +0 -1
- package/cjs/services/swap-service/handler/hydradx-handler.js +1 -1
- package/cjs/services/wallet-connect-service/index.js +25 -1
- package/constants/index.d.ts +1 -0
- package/constants/index.js +1 -0
- package/core/logic-validation/request.d.ts +22 -1
- package/core/logic-validation/request.js +154 -23
- package/core/substrate/xcm-parser.d.ts +3 -2
- package/core/substrate/xcm-parser.js +15 -6
- package/koni/api/staking/bonding/utils.js +1 -0
- package/koni/background/handlers/Extension.js +3 -3
- package/koni/background/handlers/State.d.ts +0 -1
- package/koni/background/handlers/State.js +19 -49
- package/koni/background/handlers/Tabs.d.ts +1 -0
- package/koni/background/handlers/Tabs.js +77 -6
- package/package.json +14 -12
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/subscribe/index.js +19 -13
- package/services/balance-service/helpers/subscribe/substrate/index.js +14 -2
- package/services/balance-service/transfer/xcm/index.js +8 -13
- package/services/chain-service/constants.d.ts +1 -0
- package/services/chain-service/constants.js +2 -1
- package/services/chain-service/index.js +1 -1
- package/services/earning-service/constants/chains.d.ts +0 -1
- package/services/earning-service/constants/chains.js +0 -1
- package/services/earning-service/handlers/lending/interlay.js +0 -2
- package/services/earning-service/handlers/liquid-staking/parallel.js +1 -12
- package/services/earning-service/handlers/native-staking/relay-chain.js +32 -26
- package/services/earning-service/handlers/nomination-pool/index.js +1 -2
- package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol.js +2 -2
- package/services/migration-service/scripts/databases/MigrateAssetSetting.js +2 -2
- package/services/migration-service/scripts/index.js +2 -2
- package/services/mkt-campaign-service/index.js +30 -6
- package/services/mkt-campaign-service/types.d.ts +2 -0
- package/services/request-service/handler/EvmRequestHandler.js +0 -1
- package/services/swap-service/handler/hydradx-handler.js +1 -1
- package/services/wallet-connect-service/index.js +24 -1
- package/types/yield/info/chain/target.d.ts +4 -0
|
@@ -22,6 +22,7 @@ var _utils2 = require("@subwallet/extension-base/utils");
|
|
|
22
22
|
var _web = _interopRequireDefault(require("web3"));
|
|
23
23
|
var _phishing = require("@polkadot/phishing");
|
|
24
24
|
var _util = require("@polkadot/util");
|
|
25
|
+
var _utilCrypto = require("@polkadot/util-crypto");
|
|
25
26
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
26
27
|
// SPDX-License-Identifier: Apache-2.0
|
|
27
28
|
|
|
@@ -286,8 +287,6 @@ class KoniTabs {
|
|
|
286
287
|
} = _ref11;
|
|
287
288
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
288
289
|
const authInfoSubject = this.#koniState.requestService.subscribeAuthorizeUrlSubject;
|
|
289
|
-
|
|
290
|
-
// Update unsubscribe from @polkadot/extension-base
|
|
291
290
|
this.#accountSubs[id] = {
|
|
292
291
|
subscription: authInfoSubject.subscribe(infos => {
|
|
293
292
|
this.getAuthInfo(url, infos).then(authInfo => {
|
|
@@ -298,6 +297,8 @@ class KoniTabs {
|
|
|
298
297
|
}),
|
|
299
298
|
url
|
|
300
299
|
};
|
|
300
|
+
|
|
301
|
+
// Update unsubscribe from @polkadot/extension-base
|
|
301
302
|
port.onDisconnect.addListener(() => {
|
|
302
303
|
this.accountsUnsubscribe(url, {
|
|
303
304
|
id
|
|
@@ -421,10 +422,80 @@ class KoniTabs {
|
|
|
421
422
|
date: new Date().getTime()
|
|
422
423
|
}];
|
|
423
424
|
}
|
|
424
|
-
async
|
|
425
|
+
async revokePermissions(url, id, _ref13) {
|
|
425
426
|
let {
|
|
426
427
|
params
|
|
427
428
|
} = _ref13;
|
|
429
|
+
if (!params || !(0, _util.isArray)(params) || params.length === 0) {
|
|
430
|
+
throw new _EvmProviderError.EvmProviderError(_KoniTypes.EvmProviderErrorType.INVALID_PARAMS, 'No list of permissions found to revoke in the parameters.');
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// Example of a request in MetaMask wallet
|
|
434
|
+
// await window.ethereum.request({
|
|
435
|
+
// "method": "wallet_revokePermissions",
|
|
436
|
+
// "params": [
|
|
437
|
+
// {
|
|
438
|
+
// "eth_accounts": {}
|
|
439
|
+
// }
|
|
440
|
+
// ]
|
|
441
|
+
// });
|
|
442
|
+
// Doc: https://docs.metamask.io/wallet/reference/wallet_revokepermissions/
|
|
443
|
+
|
|
444
|
+
const permissions = new Set(Object.keys(params[0]).filter(permission => _constants.PERMISSIONS_TO_REVOKE.includes(permission)));
|
|
445
|
+
const permissionPromise = async permission => {
|
|
446
|
+
if (permission === 'eth_accounts') {
|
|
447
|
+
return new Promise(resolve => {
|
|
448
|
+
this.#koniState.getAuthorize(value => {
|
|
449
|
+
const urlStripped = (0, _utils2.stripUrl)(url);
|
|
450
|
+
if (value && value[urlStripped]) {
|
|
451
|
+
const {
|
|
452
|
+
accountAuthType,
|
|
453
|
+
isAllowedMap
|
|
454
|
+
} = {
|
|
455
|
+
...value[urlStripped]
|
|
456
|
+
};
|
|
457
|
+
if (!accountAuthType) {
|
|
458
|
+
resolve();
|
|
459
|
+
}
|
|
460
|
+
switch (accountAuthType) {
|
|
461
|
+
case 'substrate':
|
|
462
|
+
resolve();
|
|
463
|
+
break;
|
|
464
|
+
case 'evm':
|
|
465
|
+
delete value[urlStripped];
|
|
466
|
+
break;
|
|
467
|
+
case 'both':
|
|
468
|
+
{
|
|
469
|
+
value[urlStripped].isAllowedMap = Object.entries(isAllowedMap).reduce((allowedMap, _ref14) => {
|
|
470
|
+
let [address, value] = _ref14;
|
|
471
|
+
if ((0, _utilCrypto.isEthereumAddress)(address)) {
|
|
472
|
+
allowedMap[address] = false;
|
|
473
|
+
} else {
|
|
474
|
+
allowedMap[address] = value;
|
|
475
|
+
}
|
|
476
|
+
return allowedMap;
|
|
477
|
+
}, {});
|
|
478
|
+
value[urlStripped].accountAuthType = 'substrate';
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
this.#koniState.setAuthorize(value, () => {
|
|
483
|
+
resolve();
|
|
484
|
+
});
|
|
485
|
+
} else {
|
|
486
|
+
resolve();
|
|
487
|
+
}
|
|
488
|
+
});
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
await Promise.all(Array.from(permissions).map(permissionPromise));
|
|
493
|
+
return null;
|
|
494
|
+
}
|
|
495
|
+
async switchEvmChain(id, url, _ref15) {
|
|
496
|
+
let {
|
|
497
|
+
params
|
|
498
|
+
} = _ref15;
|
|
428
499
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
429
500
|
const chainId = params[0].chainId;
|
|
430
501
|
const chainIdDec = parseInt(chainId, 16);
|
|
@@ -456,11 +527,11 @@ class KoniTabs {
|
|
|
456
527
|
}
|
|
457
528
|
return null;
|
|
458
529
|
}
|
|
459
|
-
async addEvmToken(id, url,
|
|
530
|
+
async addEvmToken(id, url, _ref16) {
|
|
460
531
|
var _input$type, _input$options, _input$options2, _input$options3, _input$options4, _input$options5;
|
|
461
532
|
let {
|
|
462
533
|
params
|
|
463
|
-
} =
|
|
534
|
+
} = _ref16;
|
|
464
535
|
const input = params;
|
|
465
536
|
const _tokenType = (input === null || input === void 0 ? void 0 : (_input$type = input.type) === null || _input$type === void 0 ? void 0 : _input$type.toLowerCase()) || '';
|
|
466
537
|
if (_tokenType !== 'erc20' && _tokenType !== 'erc721') {
|
|
@@ -513,10 +584,10 @@ class KoniTabs {
|
|
|
513
584
|
|
|
514
585
|
return await this.#koniState.addTokenConfirm(id, url, tokenInfo);
|
|
515
586
|
}
|
|
516
|
-
async addEvmChain(id, url,
|
|
587
|
+
async addEvmChain(id, url, _ref17) {
|
|
517
588
|
let {
|
|
518
589
|
params
|
|
519
|
-
} =
|
|
590
|
+
} = _ref17;
|
|
520
591
|
const input = params;
|
|
521
592
|
if (input && input.length > 0) {
|
|
522
593
|
const {
|
|
@@ -719,11 +790,11 @@ class KoniTabs {
|
|
|
719
790
|
const networkCheckInterval = setInterval(networkCheck, _constants.CRON_GET_API_MAP_STATUS);
|
|
720
791
|
const provider = await this.getEvmProvider(url);
|
|
721
792
|
const eventMap = {};
|
|
722
|
-
eventMap.data =
|
|
793
|
+
eventMap.data = _ref18 => {
|
|
723
794
|
let {
|
|
724
795
|
method,
|
|
725
796
|
params
|
|
726
|
-
} =
|
|
797
|
+
} = _ref18;
|
|
727
798
|
emitEvent('message', {
|
|
728
799
|
type: method,
|
|
729
800
|
data: params
|
|
@@ -732,8 +803,8 @@ class KoniTabs {
|
|
|
732
803
|
eventMap.error = rs => {
|
|
733
804
|
emitEvent('error', rs);
|
|
734
805
|
};
|
|
735
|
-
Object.entries(eventMap).forEach(
|
|
736
|
-
let [event, callback] =
|
|
806
|
+
Object.entries(eventMap).forEach(_ref19 => {
|
|
807
|
+
let [event, callback] = _ref19;
|
|
737
808
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
738
809
|
(provider === null || provider === void 0 ? void 0 : provider.on) && (provider === null || provider === void 0 ? void 0 : provider.on(event, callback));
|
|
739
810
|
});
|
|
@@ -747,8 +818,8 @@ class KoniTabs {
|
|
|
747
818
|
if (this.evmEventEmitterMap[url][id]) {
|
|
748
819
|
delete this.evmEventEmitterMap[url][id];
|
|
749
820
|
}
|
|
750
|
-
Object.entries(eventMap).forEach(
|
|
751
|
-
let [event, callback] =
|
|
821
|
+
Object.entries(eventMap).forEach(_ref20 => {
|
|
822
|
+
let [event, callback] = _ref20;
|
|
752
823
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
753
824
|
(provider === null || provider === void 0 ? void 0 : provider.removeListener) && (provider === null || provider === void 0 ? void 0 : provider.removeListener(event, callback));
|
|
754
825
|
});
|
|
@@ -783,11 +854,11 @@ class KoniTabs {
|
|
|
783
854
|
}
|
|
784
855
|
return provider;
|
|
785
856
|
}
|
|
786
|
-
async performWeb3Method(id, url,
|
|
857
|
+
async performWeb3Method(id, url, _ref21, callback) {
|
|
787
858
|
let {
|
|
788
859
|
method,
|
|
789
860
|
params
|
|
790
|
-
} =
|
|
861
|
+
} = _ref21;
|
|
791
862
|
const provider = await this.getEvmProvider(url);
|
|
792
863
|
this.checkAndHandleProviderStatus(provider);
|
|
793
864
|
return new Promise((resolve, reject) => {
|
|
@@ -823,11 +894,11 @@ class KoniTabs {
|
|
|
823
894
|
const allowedAccounts = await this.getEvmCurrentAccount(url);
|
|
824
895
|
return !!allowedAccounts.find(acc => acc.toLowerCase() === address.toLowerCase());
|
|
825
896
|
}
|
|
826
|
-
async evmSign(id, url,
|
|
897
|
+
async evmSign(id, url, _ref22) {
|
|
827
898
|
let {
|
|
828
899
|
method,
|
|
829
900
|
params
|
|
830
|
-
} =
|
|
901
|
+
} = _ref22;
|
|
831
902
|
const signResult = await this.#koniState.evmSign(id, url, method, params);
|
|
832
903
|
if (signResult) {
|
|
833
904
|
return signResult;
|
|
@@ -835,10 +906,10 @@ class KoniTabs {
|
|
|
835
906
|
throw new _EvmProviderError.EvmProviderError(_KoniTypes.EvmProviderErrorType.INVALID_PARAMS, 'Failed to sign message');
|
|
836
907
|
}
|
|
837
908
|
}
|
|
838
|
-
async evmSendTransaction(id, url,
|
|
909
|
+
async evmSendTransaction(id, url, _ref23) {
|
|
839
910
|
let {
|
|
840
911
|
params
|
|
841
|
-
} =
|
|
912
|
+
} = _ref23;
|
|
842
913
|
const transactionParams = params[0];
|
|
843
914
|
const transactionHash = await this.#koniState.evmSendTransaction(id, url, transactionParams);
|
|
844
915
|
if (!transactionHash) {
|
|
@@ -881,6 +952,8 @@ class KoniTabs {
|
|
|
881
952
|
return await this.getEvmPermission(url, id);
|
|
882
953
|
case 'wallet_getPermissions':
|
|
883
954
|
return await this.getEvmPermission(url, id);
|
|
955
|
+
case 'wallet_revokePermissions':
|
|
956
|
+
return await this.revokePermissions(url, id, request);
|
|
884
957
|
case 'wallet_addEthereumChain':
|
|
885
958
|
return await this.addEvmChain(id, url, request);
|
|
886
959
|
case 'wallet_switchEthereumChain':
|
|
@@ -920,13 +993,13 @@ class KoniTabs {
|
|
|
920
993
|
return true;
|
|
921
994
|
}
|
|
922
995
|
isEvmPublicRequest(type, request) {
|
|
923
|
-
return type === 'evm(request)' && ['eth_chainId', 'net_version'].includes(request === null || request === void 0 ? void 0 : request.method);
|
|
996
|
+
return type === 'evm(request)' && ['eth_chainId', 'net_version', 'wallet_requestPermissions', 'wallet_getPermissions'].includes(request === null || request === void 0 ? void 0 : request.method) || type === 'evm(events.subscribe)';
|
|
924
997
|
}
|
|
925
|
-
async addPspToken(id, url,
|
|
998
|
+
async addPspToken(id, url, _ref24) {
|
|
926
999
|
let {
|
|
927
1000
|
genesisHash,
|
|
928
1001
|
tokenInfo: input
|
|
929
|
-
} =
|
|
1002
|
+
} = _ref24;
|
|
930
1003
|
const _tokenType = input.type;
|
|
931
1004
|
if (_tokenType !== 'psp22' && _tokenType !== 'psp34') {
|
|
932
1005
|
throw new _EvmProviderError.EvmProviderError(_KoniTypes.EvmProviderErrorType.INVALID_PARAMS, 'Assets type {{tokenType}} is not supported'.replace('{{tokenType}}', _tokenType));
|
|
@@ -987,7 +1060,7 @@ class KoniTabs {
|
|
|
987
1060
|
|
|
988
1061
|
// Wait for account ready and chain ready
|
|
989
1062
|
await Promise.all([this.#koniState.eventService.waitAccountReady, this.#koniState.eventService.waitChainReady]);
|
|
990
|
-
if (
|
|
1063
|
+
if (!['pub(authorize.tabV2)', 'pub(accounts.subscribeV2)'].includes(type) && !this.isEvmPublicRequest(type, request)) {
|
|
991
1064
|
await this.#koniState.ensureUrlAuthorizedV2(url).catch(e => {
|
|
992
1065
|
if (type.startsWith('evm')) {
|
|
993
1066
|
throw new _EvmProviderError.EvmProviderError(_KoniTypes.EvmProviderErrorType.INTERNAL_ERROR, e.message);
|
package/cjs/packageInfo.js
CHANGED
|
@@ -78,6 +78,21 @@ const filterAddress = (addresses, chainInfo) => {
|
|
|
78
78
|
return [fetchList, [...unfetchList, ...evmAddresses]];
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
+
const handleUnsupportedOrPendingAddresses = (addresses, chainSlug, chainAssetMap, state, callback) => {
|
|
82
|
+
const tokens = (0, _utils2.filterAssetsByChainAndType)(chainAssetMap, chainSlug, [_types._AssetType.NATIVE, _types._AssetType.ERC20, _types._AssetType.PSP22, _types._AssetType.LOCAL, _types._AssetType.GRC20, _types._AssetType.VFT]);
|
|
83
|
+
const now = new Date().getTime();
|
|
84
|
+
Object.values(tokens).forEach(token => {
|
|
85
|
+
const items = addresses.map(address => ({
|
|
86
|
+
address,
|
|
87
|
+
tokenSlug: token.slug,
|
|
88
|
+
free: '0',
|
|
89
|
+
locked: '0',
|
|
90
|
+
state,
|
|
91
|
+
timestamp: now
|
|
92
|
+
}));
|
|
93
|
+
callback(items);
|
|
94
|
+
});
|
|
95
|
+
};
|
|
81
96
|
|
|
82
97
|
// main subscription, use for multiple chains, multiple addresses and multiple tokens
|
|
83
98
|
function subscribeBalance(addresses, chains, tokens, _chainAssetMap, _chainInfoMap, substrateApiMap, evmApiMap, callback, extrinsicType) {
|
|
@@ -96,19 +111,7 @@ function subscribeBalance(addresses, chains, tokens, _chainAssetMap, _chainInfoM
|
|
|
96
111
|
const chainSlug = chainInfo.slug;
|
|
97
112
|
const [useAddresses, notSupportAddresses] = filterAddress(addresses, chainInfo);
|
|
98
113
|
if (notSupportAddresses.length) {
|
|
99
|
-
|
|
100
|
-
const now = new Date().getTime();
|
|
101
|
-
Object.values(tokens).forEach(token => {
|
|
102
|
-
const items = notSupportAddresses.map(address => ({
|
|
103
|
-
address,
|
|
104
|
-
tokenSlug: token.slug,
|
|
105
|
-
free: '0',
|
|
106
|
-
locked: '0',
|
|
107
|
-
state: _KoniTypes.APIItemState.NOT_SUPPORT,
|
|
108
|
-
timestamp: now
|
|
109
|
-
}));
|
|
110
|
-
callback(items);
|
|
111
|
-
});
|
|
114
|
+
handleUnsupportedOrPendingAddresses(notSupportAddresses, chainSlug, chainAssetMap, _KoniTypes.APIItemState.NOT_SUPPORT, callback);
|
|
112
115
|
}
|
|
113
116
|
const evmApi = evmApiMap[chainSlug];
|
|
114
117
|
if ((0, _utils._isPureEvmChain)(chainInfo)) {
|
|
@@ -120,6 +123,9 @@ function subscribeBalance(addresses, chains, tokens, _chainAssetMap, _chainInfoM
|
|
|
120
123
|
evmApi
|
|
121
124
|
});
|
|
122
125
|
}
|
|
126
|
+
if (!substrateApiMap[chainSlug].isApiReady) {
|
|
127
|
+
handleUnsupportedOrPendingAddresses(useAddresses, chainSlug, chainAssetMap, _KoniTypes.APIItemState.PENDING, callback);
|
|
128
|
+
}
|
|
123
129
|
const substrateApi = await substrateApiMap[chainSlug].isReady;
|
|
124
130
|
return (0, _substrate.subscribeSubstrateBalance)(useAddresses, chainInfo, chainAssetMap, substrateApi, evmApi, callback, extrinsicType);
|
|
125
131
|
});
|
|
@@ -114,7 +114,6 @@ const subscribeSubstrateBalance = async (addresses, chainInfo, assetMap, substra
|
|
|
114
114
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
115
115
|
exports.subscribeSubstrateBalance = subscribeSubstrateBalance;
|
|
116
116
|
const subscribeWithSystemAccountPallet = async _ref => {
|
|
117
|
-
var _substrateApi$api$tx, _substrateApi$api$tx$;
|
|
118
117
|
let {
|
|
119
118
|
addresses,
|
|
120
119
|
callback,
|
|
@@ -124,7 +123,7 @@ const subscribeWithSystemAccountPallet = async _ref => {
|
|
|
124
123
|
} = _ref;
|
|
125
124
|
const systemAccountKey = 'query_system_account';
|
|
126
125
|
const poolMembersKey = 'query_nominationPools_poolMembers';
|
|
127
|
-
const isNominationPoolMigrated =
|
|
126
|
+
const isNominationPoolMigrated = await checkNominationPoolCompleteMigrated(substrateApi);
|
|
128
127
|
const params = [{
|
|
129
128
|
section: 'query',
|
|
130
129
|
module: systemAccountKey.split('_')[1],
|
|
@@ -167,6 +166,19 @@ const subscribeWithSystemAccountPallet = async _ref => {
|
|
|
167
166
|
subscription.unsubscribe();
|
|
168
167
|
};
|
|
169
168
|
};
|
|
169
|
+
const checkNominationPoolCompleteMigrated = async substrateApi => {
|
|
170
|
+
if (!substrateApi.api.tx.nominationPools || !substrateApi.api.query.staking) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
const isNominationPoolMigrated = !!substrateApi.api.tx.nominationPools.migrateDelegation && !!substrateApi.api.query.staking.counterForVirtualStakers && !!substrateApi.api.query.staking.virtualStakers;
|
|
174
|
+
if (!isNominationPoolMigrated) {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
const [nominationPoolCounterRaw, nominationPoolInfoRaw] = await Promise.all([substrateApi.api.query.staking.counterForVirtualStakers(), substrateApi.api.query.staking.virtualStakers.entries()]);
|
|
178
|
+
const nominationPoolCounter = nominationPoolCounterRaw.toPrimitive();
|
|
179
|
+
const nominationPoolInfoLength = nominationPoolInfoRaw.length;
|
|
180
|
+
return nominationPoolCounter !== 0 && nominationPoolInfoLength !== 0;
|
|
181
|
+
};
|
|
170
182
|
const subscribeForeignAssetBalance = async _ref2 => {
|
|
171
183
|
let {
|
|
172
184
|
addresses,
|
|
@@ -49,19 +49,14 @@ const createXcmExtrinsic = async _ref2 => {
|
|
|
49
49
|
const destinationChainInfo = chainInfoMap[destinationTokenInfo.originChain];
|
|
50
50
|
const chainApi = await substrateApi.isReady;
|
|
51
51
|
const api = chainApi.api;
|
|
52
|
-
|
|
53
|
-
if (_constants._XCM_CHAIN_GROUP.polkadotXcm.includes(originTokenInfo.originChain)) {
|
|
54
|
-
|
|
55
|
-
extrinsic = (0, _xTokens.getExtrinsicByXtokensPallet)(originTokenInfo, originChainInfo, destinationChainInfo, recipient, sendingValue, api);
|
|
56
|
-
} else {
|
|
57
|
-
extrinsic = (0, _polkadotXcm.getExtrinsicByPolkadotXcmPallet)(originTokenInfo, originChainInfo, destinationChainInfo, recipient, sendingValue, api);
|
|
58
|
-
}
|
|
59
|
-
} else if (_constants._XCM_CHAIN_GROUP.xcmPallet.includes(originTokenInfo.originChain)) {
|
|
60
|
-
extrinsic = (0, _xcmPallet.getExtrinsicByXcmPalletPallet)(originTokenInfo, originChainInfo, destinationChainInfo, recipient, sendingValue, api);
|
|
61
|
-
} else {
|
|
62
|
-
extrinsic = (0, _xTokens.getExtrinsicByXtokensPallet)(originTokenInfo, originChainInfo, destinationChainInfo, recipient, sendingValue, api);
|
|
52
|
+
const polkadotXcmSpecialCases = _constants._XCM_CHAIN_GROUP.polkadotXcmSpecialCases.includes(originChainInfo.slug) && (0, _utils._isNativeToken)(originTokenInfo);
|
|
53
|
+
if (_constants._XCM_CHAIN_GROUP.polkadotXcm.includes(originTokenInfo.originChain) || polkadotXcmSpecialCases) {
|
|
54
|
+
return (0, _polkadotXcm.getExtrinsicByPolkadotXcmPallet)(originTokenInfo, originChainInfo, destinationChainInfo, recipient, sendingValue, api);
|
|
63
55
|
}
|
|
64
|
-
|
|
56
|
+
if (_constants._XCM_CHAIN_GROUP.xcmPallet.includes(originTokenInfo.originChain)) {
|
|
57
|
+
return (0, _xcmPallet.getExtrinsicByXcmPalletPallet)(originTokenInfo, originChainInfo, destinationChainInfo, recipient, sendingValue, api);
|
|
58
|
+
}
|
|
59
|
+
return (0, _xTokens.getExtrinsicByXtokensPallet)(originTokenInfo, originChainInfo, destinationChainInfo, recipient, sendingValue, api);
|
|
65
60
|
};
|
|
66
61
|
exports.createXcmExtrinsic = createXcmExtrinsic;
|
|
67
62
|
const getXcmMockTxFee = async (substrateApi, chainInfoMap, originTokenInfo, destinationTokenInfo) => {
|
|
@@ -69,7 +64,7 @@ const getXcmMockTxFee = async (substrateApi, chainInfoMap, originTokenInfo, dest
|
|
|
69
64
|
var _paymentInfo$partialF;
|
|
70
65
|
const destChainInfo = chainInfoMap[destinationTokenInfo.originChain];
|
|
71
66
|
const originChainInfo = chainInfoMap[originTokenInfo.originChain];
|
|
72
|
-
const address = '5DRewsYzhJqZXU3SRaWy1FSt5iDr875ao91aw5fjrJmDG4Ap';
|
|
67
|
+
const address = '5DRewsYzhJqZXU3SRaWy1FSt5iDr875ao91aw5fjrJmDG4Ap'; // todo: move this
|
|
73
68
|
|
|
74
69
|
// mock receiving account from sender
|
|
75
70
|
const recipient = !(0, _utilCrypto.isEthereumAddress)(address) && (0, _utils._isChainEvmCompatible)(destChainInfo) && !(0, _utils._isChainEvmCompatible)(originChainInfo) ? (0, _util.u8aToHex)((0, _utilCrypto.addressToEvm)(address)) : address;
|
|
@@ -283,7 +283,8 @@ const _DEFAULT_MANTA_ZK_CHAIN = 'calamari';
|
|
|
283
283
|
// XCM------------------------------------------------------------------------------------------------------------------
|
|
284
284
|
exports._DEFAULT_MANTA_ZK_CHAIN = _DEFAULT_MANTA_ZK_CHAIN;
|
|
285
285
|
const _XCM_CHAIN_GROUP = {
|
|
286
|
-
polkadotXcm: ['
|
|
286
|
+
polkadotXcm: ['statemine', 'statemint', 'equilibrium_parachain', 'rococo_assethub', 'mythos'],
|
|
287
|
+
polkadotXcmSpecialCases: ['astar', 'shiden'],
|
|
287
288
|
xcmPallet: ['polkadot', 'kusama', 'rococo']
|
|
288
289
|
// default is xTokens pallet
|
|
289
290
|
};
|
|
@@ -28,7 +28,7 @@ const filterChainInfoMap = (data, ignoredChains) => {
|
|
|
28
28
|
return !info.bitcoinInfo && !ignoredChains.includes(slug);
|
|
29
29
|
}));
|
|
30
30
|
};
|
|
31
|
-
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', 'ton', 'ton_testnet'];
|
|
31
|
+
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', 'ton', 'ton_testnet', 'storyPartner_testnet'];
|
|
32
32
|
const filterAssetInfoMap = (chainInfo, assets) => {
|
|
33
33
|
return Object.fromEntries(Object.entries(assets).filter(_ref2 => {
|
|
34
34
|
let [, info] = _ref2;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports._STAKING_CHAIN_GROUP = exports.ST_LIQUID_TOKEN_ABI = exports.MaxEraRewardPointsEras = exports.MANTA_VALIDATOR_POINTS_PER_BLOCK = exports.MANTA_MIN_DELEGATION = void 0;
|
|
7
7
|
// Copyright 2019-2022 @subwallet/extension-base
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
|
|
@@ -25,8 +25,6 @@ const _STAKING_CHAIN_GROUP = {
|
|
|
25
25
|
manta: ['manta_network']
|
|
26
26
|
};
|
|
27
27
|
exports._STAKING_CHAIN_GROUP = _STAKING_CHAIN_GROUP;
|
|
28
|
-
const _UPDATED_RUNTIME_STAKING_GROUP = ['kusama', 'polkadot', 'westend', 'availTuringTest', 'avail_mainnet', 'dentnet'];
|
|
29
|
-
exports._UPDATED_RUNTIME_STAKING_GROUP = _UPDATED_RUNTIME_STAKING_GROUP;
|
|
30
28
|
const MaxEraRewardPointsEras = 14;
|
|
31
29
|
|
|
32
30
|
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
|
|
@@ -61,7 +61,6 @@ class InterlayLendingPoolHandler extends _base.default {
|
|
|
61
61
|
statistic: {
|
|
62
62
|
assetEarning: [{
|
|
63
63
|
slug: this.rewardAssets[0],
|
|
64
|
-
apr: 1.29,
|
|
65
64
|
exchangeRate: exchangeRate / decimals
|
|
66
65
|
}],
|
|
67
66
|
maxCandidatePerFarmer: 1,
|
|
@@ -71,7 +70,6 @@ class InterlayLendingPoolHandler extends _base.default {
|
|
|
71
70
|
defaultUnstake: '0',
|
|
72
71
|
fastUnstake: '0'
|
|
73
72
|
},
|
|
74
|
-
totalApr: 1.29,
|
|
75
73
|
tvl: '291890000000000'
|
|
76
74
|
}
|
|
77
75
|
};
|
|
@@ -46,7 +46,7 @@ class ParallelLiquidStakingPoolHandler extends _base.default {
|
|
|
46
46
|
|
|
47
47
|
async getPoolStat() {
|
|
48
48
|
const substrateApi = await this.substrateApi.isReady;
|
|
49
|
-
const [_exchangeRate,
|
|
49
|
+
const [_exchangeRate, _stakingLedgers] = await Promise.all([substrateApi.api.query.liquidStaking.exchangeRate(), substrateApi.api.query.liquidStaking.stakingLedgers.entries()]);
|
|
50
50
|
let tvl = _util.BN_ZERO;
|
|
51
51
|
for (const _stakingLedger of _stakingLedgers) {
|
|
52
52
|
const _ledger = _stakingLedger[1];
|
|
@@ -54,16 +54,7 @@ class ParallelLiquidStakingPoolHandler extends _base.default {
|
|
|
54
54
|
tvl = tvl.add(new _util.BN(ledger.total.toString()));
|
|
55
55
|
}
|
|
56
56
|
const exchangeRate = _exchangeRate.toPrimitive();
|
|
57
|
-
const currentBlockHeader = _currentBlockHeader.toPrimitive();
|
|
58
|
-
const currentTimestamp = _currentTimestamp.toPrimitive();
|
|
59
|
-
const beginBlock = currentBlockHeader.number - 24 * 60 * 60 / 6 * 14;
|
|
60
|
-
const _beginBlockHash = await substrateApi.api.rpc.chain.getBlockHash(beginBlock);
|
|
61
|
-
const beginBlockHash = _beginBlockHash.toString();
|
|
62
|
-
const [_beginTimestamp, _beginExchangeRate] = await Promise.all([substrateApi.api.query.timestamp.now.at(beginBlockHash), substrateApi.api.query.liquidStaking.exchangeRate.at(beginBlockHash)]);
|
|
63
|
-
const beginTimestamp = _beginTimestamp.toPrimitive();
|
|
64
|
-
const beginExchangeRate = _beginExchangeRate.toPrimitive();
|
|
65
57
|
const decimals = 10 ** this.rateDecimals;
|
|
66
|
-
const apy = (exchangeRate / beginExchangeRate) ** (365 * 24 * 60 * 60000 / (currentTimestamp - beginTimestamp)) - 1;
|
|
67
58
|
const minStake = substrateApi.api.consts.liquidStaking.minStake.toString();
|
|
68
59
|
const minUnstake = substrateApi.api.consts.liquidStaking.minUnstake.toString();
|
|
69
60
|
this.updateExchangeRate(exchangeRate);
|
|
@@ -77,7 +68,6 @@ class ParallelLiquidStakingPoolHandler extends _base.default {
|
|
|
77
68
|
statistic: {
|
|
78
69
|
assetEarning: [{
|
|
79
70
|
slug: this.rewardAssets[0],
|
|
80
|
-
apy: apy * 100,
|
|
81
71
|
exchangeRate: exchangeRate / decimals
|
|
82
72
|
}],
|
|
83
73
|
unstakingPeriod: 24 * 28,
|
|
@@ -88,7 +78,6 @@ class ParallelLiquidStakingPoolHandler extends _base.default {
|
|
|
88
78
|
defaultUnstake: minUnstake,
|
|
89
79
|
fastUnstake: '0'
|
|
90
80
|
},
|
|
91
|
-
totalApy: apy * 100,
|
|
92
81
|
tvl: tvl.toString()
|
|
93
82
|
}
|
|
94
83
|
};
|
|
@@ -199,7 +199,7 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
199
199
|
let nominationStatus = _types.EarningStatus.NOT_EARNING;
|
|
200
200
|
let eraStakerOtherList = [];
|
|
201
201
|
let identity;
|
|
202
|
-
if (
|
|
202
|
+
if (substrateApi.api.query.staking.erasStakersPaged) {
|
|
203
203
|
// todo: review all relaychains later
|
|
204
204
|
const [[_identity], _eraStaker] = await Promise.all([(0, _utils3.parseIdentity)(substrateApi, validatorAddress), substrateApi.api.query.staking.erasStakersPaged.entries(currentEra, validatorAddress)]);
|
|
205
205
|
identity = _identity;
|
|
@@ -307,20 +307,19 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
307
307
|
const maxEraRewardPointsEras = _constants2.MaxEraRewardPointsEras;
|
|
308
308
|
const endEraForPoints = parseInt(activeEra) - 1;
|
|
309
309
|
const startEraForPoints = Math.max(endEraForPoints - maxEraRewardPointsEras + 1, 0);
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
// todo: review all relaychains later
|
|
313
|
-
_eraStakersPromise = chainApi.api.query.staking.erasStakersOverview.entries(parseInt(currentEra));
|
|
314
|
-
} else {
|
|
315
|
-
_eraStakersPromise = chainApi.api.query.staking.erasStakers.entries(parseInt(currentEra));
|
|
316
|
-
}
|
|
310
|
+
const _eraStakersPromise = chainApi.api.query.staking.erasStakersOverview // todo: review all relaychains later
|
|
311
|
+
? chainApi.api.query.staking.erasStakersOverview.entries(parseInt(currentEra)) : chainApi.api.query.staking.erasStakers.entries(parseInt(currentEra));
|
|
317
312
|
const [_totalEraStake, _eraStakers, _minBond, _stakingRewards, _validators, ..._eraRewardPoints] = await Promise.all([chainApi.api.query.staking.erasTotalStake(parseInt(currentEra)), _eraStakersPromise, chainApi.api.query.staking.minNominatorBond(), ((_chainApi$api$query$s = chainApi.api.query.stakingRewards) === null || _chainApi$api$query$s === void 0 ? void 0 : _chainApi$api$query$s.data) && chainApi.api.query.stakingRewards.data(), chainApi.api.query.staking.validators.entries(), chainApi.api.query.staking.erasRewardPoints.multi([...Array(maxEraRewardPointsEras).keys()].map(i => i + startEraForPoints))]);
|
|
318
313
|
const eraRewardMap = (0, _utils.getRelayEraRewardMap)(_eraRewardPoints[0], startEraForPoints);
|
|
319
314
|
const validatorPointsMap = (0, _utils.getRelayValidatorPointsMap)(eraRewardMap);
|
|
320
315
|
const topValidatorList = (0, _utils.getRelayTopValidatorByPoints)(validatorPointsMap);
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
|
|
316
|
+
const allValidatorList = _validators;
|
|
317
|
+
|
|
318
|
+
// todo: optimize naming for all filtered validatorList: all, block, waiting, selected, waiting but is not selected, waiting but is not blocked, ...
|
|
319
|
+
const blockedValidatorList = (0, _utils.getRelayBlockedValidatorList)(allValidatorList);
|
|
320
|
+
const waitingValidatorList = (0, _utils.getRelayWaitingValidatorList)(allValidatorList); // all validators that are not blocked
|
|
321
|
+
|
|
322
|
+
// todo: improve handle waitingValidatorLedger
|
|
324
323
|
const _waitingValidatorLedger = await chainApi.api.query.staking.ledger.multi(waitingValidatorList);
|
|
325
324
|
const waitingValidatorLedger = {};
|
|
326
325
|
if (_waitingValidatorLedger) {
|
|
@@ -334,7 +333,9 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
334
333
|
const maxNominatorRewarded = (chainApi.api.consts.staking.maxNominatorRewardedPerValidator || 0).toString();
|
|
335
334
|
const bnTotalEraStake = new _util.BN(_totalEraStake.toString());
|
|
336
335
|
const minBond = _minBond.toPrimitive();
|
|
337
|
-
const [totalStakeMap, allValidatorAddresses,
|
|
336
|
+
const [totalStakeMap, allValidatorAddresses, allValidatorInfo] = this.parseEraStakerData(_eraStakers, blockedValidatorList, waitingValidatorLedger, topValidatorList, validatorPointsMap, minBond, maxNominatorRewarded, unlimitedNominatorRewarded);
|
|
337
|
+
const currentSelectedValidatorList = allValidatorInfo.currentSelectedValidatorList;
|
|
338
|
+
const allValidatorInfoList = [...currentSelectedValidatorList, ...allValidatorInfo.waitingValidatorList];
|
|
338
339
|
const extraInfoMap = {};
|
|
339
340
|
await Promise.all(allValidatorAddresses.map(async address => {
|
|
340
341
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
@@ -348,17 +349,19 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
348
349
|
};
|
|
349
350
|
}));
|
|
350
351
|
const decimals = this.nativeToken.decimals || 0;
|
|
351
|
-
const bnAvgStake = (0, _utils3.applyDecimal)(bnTotalEraStake.divn(
|
|
352
|
-
for (const validator of
|
|
352
|
+
const bnAvgStake = (0, _utils3.applyDecimal)(bnTotalEraStake.divn(currentSelectedValidatorList.length), decimals);
|
|
353
|
+
for (const validator of allValidatorInfoList) {
|
|
353
354
|
const commissionString = extraInfoMap[validator.address].commission;
|
|
354
355
|
const commission = (0, _utils.getCommission)(commissionString);
|
|
355
|
-
|
|
356
|
+
|
|
357
|
+
// the waiting validator is missing info for calculating APY
|
|
358
|
+
validator.expectedReturn = currentSelectedValidatorList.includes(validator) ? this.getValidatorExpectedReturn(this.chain, validator, poolInfo.statistic.totalApy, commission, _stakingRewards, allValidatorAddresses, decimals, totalStakeMap, bnAvgStake) : 0;
|
|
356
359
|
validator.commission = commission;
|
|
357
360
|
validator.blocked = extraInfoMap[validator.address].blocked;
|
|
358
361
|
validator.identity = extraInfoMap[validator.address].identity;
|
|
359
362
|
validator.isVerified = extraInfoMap[validator.address].isVerified;
|
|
360
363
|
}
|
|
361
|
-
return
|
|
364
|
+
return allValidatorInfoList;
|
|
362
365
|
}
|
|
363
366
|
getValidatorExpectedReturn(chain, validator, totalApy, commission, _stakingRewards, allValidatorAddresses, decimals, totalStakeMap, bnAvgStake) {
|
|
364
367
|
if (_constants2._STAKING_CHAIN_GROUP.aleph.includes(chain)) {
|
|
@@ -377,10 +380,13 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
377
380
|
}
|
|
378
381
|
}
|
|
379
382
|
}
|
|
380
|
-
parseEraStakerData(_eraStakers, blockedValidatorList,
|
|
383
|
+
parseEraStakerData(_eraStakers, blockedValidatorList, waitingValidatorLedger, topValidatorList, validatorPointsMap, minBond, maxNominatorRewarded, unlimitedNominatorRewarded) {
|
|
381
384
|
const totalStakeMap = {};
|
|
382
385
|
const allValidatorAddresses = [];
|
|
383
|
-
const
|
|
386
|
+
const allValidatorInfo = {
|
|
387
|
+
currentSelectedValidatorList: [],
|
|
388
|
+
waitingValidatorList: []
|
|
389
|
+
};
|
|
384
390
|
for (const item of _eraStakers) {
|
|
385
391
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
|
386
392
|
const rawValidatorInfo = item[0].toHuman();
|
|
@@ -398,7 +404,7 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
398
404
|
const otherStake = bnTotalStake.sub(bnOwnStake);
|
|
399
405
|
totalStakeMap[validatorAddress] = bnTotalStake;
|
|
400
406
|
let nominatorCount = 0;
|
|
401
|
-
if (
|
|
407
|
+
if (rawValidatorStat.nominatorCount) {
|
|
402
408
|
nominatorCount = rawValidatorStat.nominatorCount;
|
|
403
409
|
} else {
|
|
404
410
|
if ('others' in rawValidatorStat) {
|
|
@@ -409,7 +415,7 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
409
415
|
}
|
|
410
416
|
}
|
|
411
417
|
allValidatorAddresses.push(validatorAddress);
|
|
412
|
-
|
|
418
|
+
allValidatorInfo.currentSelectedValidatorList.push({
|
|
413
419
|
address: validatorAddress,
|
|
414
420
|
totalStake: bnTotalStake.toString(),
|
|
415
421
|
ownStake: bnOwnStake.toString(),
|
|
@@ -427,13 +433,13 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
427
433
|
});
|
|
428
434
|
}
|
|
429
435
|
}
|
|
430
|
-
for (const waitingValidator of Object.keys(
|
|
436
|
+
for (const waitingValidator of Object.keys(waitingValidatorLedger)) {
|
|
431
437
|
if (!allValidatorAddresses.includes(waitingValidator)) {
|
|
432
438
|
allValidatorAddresses.push(waitingValidator);
|
|
433
|
-
|
|
439
|
+
allValidatorInfo.waitingValidatorList.push({
|
|
434
440
|
address: waitingValidator,
|
|
435
|
-
totalStake:
|
|
436
|
-
ownStake:
|
|
441
|
+
totalStake: waitingValidatorLedger[waitingValidator],
|
|
442
|
+
ownStake: waitingValidatorLedger[waitingValidator],
|
|
437
443
|
otherStake: '0',
|
|
438
444
|
nominatorCount: 0,
|
|
439
445
|
// to be added later
|
|
@@ -448,7 +454,7 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
448
454
|
});
|
|
449
455
|
}
|
|
450
456
|
}
|
|
451
|
-
return [totalStakeMap, allValidatorAddresses,
|
|
457
|
+
return [totalStakeMap, allValidatorAddresses, allValidatorInfo];
|
|
452
458
|
}
|
|
453
459
|
/* Get pool targets */
|
|
454
460
|
|
|
@@ -10,7 +10,6 @@ var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
|
|
|
10
10
|
var _utils = require("@subwallet/extension-base/koni/api/staking/bonding/utils");
|
|
11
11
|
var _constants = require("@subwallet/extension-base/services/chain-service/constants");
|
|
12
12
|
var _utils2 = require("@subwallet/extension-base/services/chain-service/utils");
|
|
13
|
-
var _constants2 = require("@subwallet/extension-base/services/earning-service/constants");
|
|
14
13
|
var _types = require("@subwallet/extension-base/types");
|
|
15
14
|
var _utils3 = require("@subwallet/extension-base/utils");
|
|
16
15
|
var _bignumber = _interopRequireDefault(require("bignumber.js"));
|
|
@@ -170,7 +169,7 @@ class NominationPoolHandler extends _base.default {
|
|
|
170
169
|
const validatorList = nominations.targets;
|
|
171
170
|
await Promise.all(validatorList.map(async validatorAddress => {
|
|
172
171
|
let eraStakerOtherList = [];
|
|
173
|
-
if (
|
|
172
|
+
if (substrateApi.api.query.staking.erasStakersPaged) {
|
|
174
173
|
// todo: review all relaychains later
|
|
175
174
|
const _eraStaker = await substrateApi.api.query.staking.erasStakersPaged.entries(currentEra, validatorAddress);
|
|
176
175
|
eraStakerOtherList = _eraStaker.flatMap(paged => paged[1].toPrimitive().others);
|
|
@@ -14,8 +14,8 @@ class MigrateTransactionHistoryBySymbol extends _Base.default {
|
|
|
14
14
|
const state = this.state;
|
|
15
15
|
try {
|
|
16
16
|
const changeSlugsMap = {
|
|
17
|
-
'
|
|
18
|
-
'
|
|
17
|
+
'polygon-NATIVE-MATIC': 'polygon-NATIVE-POL',
|
|
18
|
+
'5irechain_mainnet-NATIVE-5IRE': '5irechain_mainnet-NATIVE-5ire'
|
|
19
19
|
};
|
|
20
20
|
const allTxs = [];
|
|
21
21
|
await Promise.all(Object.entries(changeSlugsMap).map(async (_ref, i) => {
|