@subwallet/extension-base 1.1.58-0 → 1.1.59-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/cjs/koni/api/nft/config.js +6 -4
- package/cjs/koni/api/staking/bonding/utils.js +7 -3
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/constants.js +4 -2
- package/cjs/services/earning-service/constants/chains.js +2 -2
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +4 -4
- package/cjs/services/earning-service/handlers/nomination-pool/index.js +2 -2
- package/koni/api/nft/config.js +6 -4
- package/koni/api/staking/bonding/utils.d.ts +1 -1
- package/koni/api/staking/bonding/utils.js +7 -3
- package/package.json +5 -5
- package/packageInfo.js +1 -1
- package/services/chain-service/constants.js +4 -2
- package/services/earning-service/constants/chains.js +2 -2
- package/services/earning-service/handlers/native-staking/relay-chain.js +4 -4
- package/services/earning-service/handlers/nomination-pool/index.js +2 -2
|
@@ -167,16 +167,18 @@ if (!_utils.RuntimeInfo.protocol || !_utils.RuntimeInfo.protocol.startsWith('htt
|
|
|
167
167
|
provider: PINATA_IPFS_GATEWAY,
|
|
168
168
|
weight: 1 // Rate limit too low
|
|
169
169
|
}, {
|
|
170
|
+
provider: IPFS_IO,
|
|
171
|
+
weight: 5
|
|
172
|
+
});
|
|
173
|
+
} else if (!_utils.RuntimeInfo.protocol.startsWith('https')) {
|
|
174
|
+
RANDOM_IPFS_GATEWAY_SETTING.push({
|
|
170
175
|
provider: NFT_STORAGE_GATEWAY,
|
|
171
176
|
weight: 50
|
|
172
|
-
}, {
|
|
173
|
-
provider: GATEWAY_IPFS_IO,
|
|
174
|
-
weight: 5
|
|
175
177
|
}, {
|
|
176
178
|
provider: DWEB_LINK,
|
|
177
179
|
weight: 5
|
|
178
180
|
}, {
|
|
179
|
-
provider:
|
|
181
|
+
provider: GATEWAY_IPFS_IO,
|
|
180
182
|
weight: 5
|
|
181
183
|
});
|
|
182
184
|
}
|
|
@@ -382,11 +382,15 @@ function getAvgValidatorEraReward(supportedDays, eraRewardHistory) {
|
|
|
382
382
|
}
|
|
383
383
|
return sumEraReward.dividedBy(new _bignumber.default(supportedDays - failEra));
|
|
384
384
|
}
|
|
385
|
-
function getSupportedDaysByHistoryDepth(erasPerDay, maxSupportedEras) {
|
|
386
|
-
|
|
385
|
+
function getSupportedDaysByHistoryDepth(erasPerDay, maxSupportedEras, liveDay) {
|
|
386
|
+
const maxSupportDay = maxSupportedEras / erasPerDay;
|
|
387
|
+
if (liveDay && liveDay <= 30) {
|
|
388
|
+
return Math.min(liveDay - 1, maxSupportDay);
|
|
389
|
+
}
|
|
390
|
+
if (maxSupportDay > 30) {
|
|
387
391
|
return 30;
|
|
388
392
|
} else {
|
|
389
|
-
return
|
|
393
|
+
return maxSupportDay;
|
|
390
394
|
}
|
|
391
395
|
}
|
|
392
396
|
function getValidatorPointsMap(eraRewardMap) {
|
package/cjs/packageInfo.js
CHANGED
|
@@ -103,7 +103,8 @@ const _STAKING_ERA_LENGTH_MAP = {
|
|
|
103
103
|
manta_network: 6,
|
|
104
104
|
krest_network: 4,
|
|
105
105
|
polimec: 6,
|
|
106
|
-
enjin_relaychain: 24
|
|
106
|
+
enjin_relaychain: 24,
|
|
107
|
+
availTuringTest: 24
|
|
107
108
|
};
|
|
108
109
|
exports._STAKING_ERA_LENGTH_MAP = _STAKING_ERA_LENGTH_MAP;
|
|
109
110
|
const _EXPECTED_BLOCK_TIME = {
|
|
@@ -133,7 +134,8 @@ const _EXPECTED_BLOCK_TIME = {
|
|
|
133
134
|
calamari: 12,
|
|
134
135
|
calamari_test: 12,
|
|
135
136
|
manta_network: 12,
|
|
136
|
-
enjin_relaychain: 6
|
|
137
|
+
enjin_relaychain: 6,
|
|
138
|
+
availTuringTest: 20
|
|
137
139
|
};
|
|
138
140
|
exports._EXPECTED_BLOCK_TIME = _EXPECTED_BLOCK_TIME;
|
|
139
141
|
const _PARACHAIN_INFLATION_DISTRIBUTION = {
|
|
@@ -8,13 +8,13 @@ exports._STAKING_CHAIN_GROUP = exports.ST_LIQUID_TOKEN_ABI = exports.MaxEraRewar
|
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
|
|
10
10
|
const _STAKING_CHAIN_GROUP = {
|
|
11
|
-
relay: ['polkadot', 'kusama', 'aleph', 'polkadex', 'ternoa', 'alephTest', 'polkadexTest', 'westend', 'kate', 'edgeware', 'creditcoin', 'vara_network', 'goldberg_testnet'],
|
|
11
|
+
relay: ['polkadot', 'kusama', 'aleph', 'polkadex', 'ternoa', 'alephTest', 'polkadexTest', 'westend', 'kate', 'edgeware', 'creditcoin', 'vara_network', 'goldberg_testnet', 'availTuringTest'],
|
|
12
12
|
para: ['moonbeam', 'moonriver', 'moonbase', 'turing', 'turingStaging', 'bifrost', 'bifrost_testnet', 'calamari_test', 'calamari', 'manta_network', 'polimec'],
|
|
13
13
|
astar: ['astar', 'shiden', 'shibuya'],
|
|
14
14
|
amplitude: ['amplitude', 'amplitude_test', 'kilt', 'kilt_peregrine', 'pendulum', 'krest_network'],
|
|
15
15
|
// amplitude and kilt only share some common logic
|
|
16
16
|
kilt: ['kilt', 'kilt_peregrine'],
|
|
17
|
-
nominationPool: ['polkadot', 'kusama', 'westend', 'alephTest', 'aleph', 'kate', 'vara_network', 'goldberg_testnet'],
|
|
17
|
+
nominationPool: ['polkadot', 'kusama', 'westend', 'alephTest', 'aleph', 'kate', 'vara_network', 'goldberg_testnet', 'availTuringTest'],
|
|
18
18
|
bifrost: ['bifrost', 'bifrost_testnet'],
|
|
19
19
|
aleph: ['aleph', 'alephTest'],
|
|
20
20
|
// A0 has distinct tokenomics
|
|
@@ -64,9 +64,9 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
64
64
|
const maxUnlockingChunks = substrateApi.api.consts.staking.maxUnlockingChunks.toString();
|
|
65
65
|
const unlockingEras = substrateApi.api.consts.staking.bondingDuration.toString();
|
|
66
66
|
const maxSupportedEras = substrateApi.api.consts.staking.historyDepth.toString();
|
|
67
|
-
const erasPerDay = 24 / _constants._STAKING_ERA_LENGTH_MAP[chainInfo.slug]; // Can be exactly calculate from epochDuration
|
|
67
|
+
const erasPerDay = 24 / _constants._STAKING_ERA_LENGTH_MAP[chainInfo.slug]; // Can be exactly calculate from babe.epochDuration * blockTime * staking.sessionsPerEra
|
|
68
68
|
|
|
69
|
-
const supportedDays = (0, _utils.getSupportedDaysByHistoryDepth)(erasPerDay, parseInt(maxSupportedEras));
|
|
69
|
+
const supportedDays = (0, _utils.getSupportedDaysByHistoryDepth)(erasPerDay, parseInt(maxSupportedEras), parseInt(currentEra) / erasPerDay);
|
|
70
70
|
const startEra = parseInt(currentEra) - supportedDays * erasPerDay;
|
|
71
71
|
const [_EraStakeInfo, _totalIssuance, _auctionCounter, _minNominatorBond, _counterForNominators, _minimumActiveStake, ..._eraReward] = await Promise.all([substrateApi.api.query.staking.erasTotalStake.multi([parseInt(currentEra), parseInt(currentEra) - 1]), substrateApi.api.query.balances.totalIssuance(), (_substrateApi$api$que2 = substrateApi.api.query.auctions) === null || _substrateApi$api$que2 === void 0 ? void 0 : _substrateApi$api$que2.auctionCounter(), substrateApi.api.query.staking.minNominatorBond(), substrateApi.api.query.staking.counterForNominators(), ((_substrateApi$api$que3 = substrateApi.api.query) === null || _substrateApi$api$que3 === void 0 ? void 0 : (_substrateApi$api$que4 = _substrateApi$api$que3.staking) === null || _substrateApi$api$que4 === void 0 ? void 0 : _substrateApi$api$que4.minimumActiveStake) && ((_substrateApi$api$que5 = substrateApi.api.query) === null || _substrateApi$api$que5 === void 0 ? void 0 : (_substrateApi$api$que6 = _substrateApi$api$que5.staking) === null || _substrateApi$api$que6 === void 0 ? void 0 : _substrateApi$api$que6.minimumActiveStake()), substrateApi.api.query.staking.erasValidatorReward.multi([...Array(supportedDays).keys()].map(i => i + startEra))]);
|
|
72
72
|
const [_totalEraStake, _lastTotalStaked] = _EraStakeInfo;
|
|
@@ -151,7 +151,7 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
151
151
|
let nominationStatus = _types.EarningStatus.NOT_EARNING;
|
|
152
152
|
let eraStakerOtherList = [];
|
|
153
153
|
let identity;
|
|
154
|
-
if (['kusama', 'polkadot', 'westend'].includes(this.chain)) {
|
|
154
|
+
if (['kusama', 'polkadot', 'westend', 'availTuringTest'].includes(this.chain)) {
|
|
155
155
|
// todo: review all relaychains later
|
|
156
156
|
const [[_identity], _eraStaker] = await Promise.all([(0, _utils3.parseIdentity)(substrateApi, validatorAddress), substrateApi.api.query.staking.erasStakersPaged.entries(currentEra, validatorAddress)]);
|
|
157
157
|
identity = _identity;
|
|
@@ -305,7 +305,7 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
305
305
|
const endEraForPoints = parseInt(activeEra) - 1;
|
|
306
306
|
let startEraForPoints = endEraForPoints - maxEraRewardPointsEras + 1;
|
|
307
307
|
let _eraStakersPromise;
|
|
308
|
-
if (['kusama', 'polkadot', 'westend'].includes(this.chain)) {
|
|
308
|
+
if (['kusama', 'polkadot', 'westend', 'availTuringTest'].includes(this.chain)) {
|
|
309
309
|
// todo: review all relaychains later
|
|
310
310
|
_eraStakersPromise = chainApi.api.query.staking.erasStakersOverview.entries(parseInt(currentEra));
|
|
311
311
|
} else {
|
|
@@ -89,7 +89,7 @@ class NominationPoolHandler extends _base.default {
|
|
|
89
89
|
const maxSupportedEras = substrateApi.api.consts.staking.historyDepth.toString();
|
|
90
90
|
const erasPerDay = 24 / _constants._STAKING_ERA_LENGTH_MAP[chainInfo.slug]; // Can be exactly calculate from epochDuration, blockTime, sessionsPerEra
|
|
91
91
|
|
|
92
|
-
const supportedDays = (0, _utils.getSupportedDaysByHistoryDepth)(erasPerDay, parseInt(maxSupportedEras));
|
|
92
|
+
const supportedDays = (0, _utils.getSupportedDaysByHistoryDepth)(erasPerDay, parseInt(maxSupportedEras), parseInt(currentEra) / erasPerDay);
|
|
93
93
|
const startEra = parseInt(currentEra) - supportedDays * erasPerDay;
|
|
94
94
|
const [_EraStakeInfo, _totalIssuance, _auctionCounter, _minPoolJoin, ..._eraReward] = await Promise.all([substrateApi.api.query.staking.erasTotalStake.multi([parseInt(currentEra), parseInt(currentEra) - 1]), substrateApi.api.query.balances.totalIssuance(), (_substrateApi$api$que2 = substrateApi.api.query.auctions) === null || _substrateApi$api$que2 === void 0 ? void 0 : _substrateApi$api$que2.auctionCounter(), (_substrateApi$api$que3 = substrateApi.api.query) === null || _substrateApi$api$que3 === void 0 ? void 0 : (_substrateApi$api$que4 = _substrateApi$api$que3.nominationPools) === null || _substrateApi$api$que4 === void 0 ? void 0 : _substrateApi$api$que4.minJoinBond(), substrateApi.api.query.staking.erasValidatorReward.multi([...Array(supportedDays).keys()].map(i => i + startEra))]);
|
|
95
95
|
const [_totalEraStake, _lastTotalStaked] = _EraStakeInfo;
|
|
@@ -167,7 +167,7 @@ class NominationPoolHandler extends _base.default {
|
|
|
167
167
|
const validatorList = nominations.targets;
|
|
168
168
|
await Promise.all(validatorList.map(async validatorAddress => {
|
|
169
169
|
let eraStakerOtherList = [];
|
|
170
|
-
if (['kusama', 'polkadot', 'westend'].includes(this.chain)) {
|
|
170
|
+
if (['kusama', 'polkadot', 'westend', 'availTuringTest'].includes(this.chain)) {
|
|
171
171
|
// todo: review all relaychains later
|
|
172
172
|
const _eraStaker = await substrateApi.api.query.staking.erasStakersPaged.entries(currentEra, validatorAddress);
|
|
173
173
|
eraStakerOtherList = _eraStaker.flatMap(paged => paged[1].toPrimitive().others);
|
package/koni/api/nft/config.js
CHANGED
|
@@ -127,16 +127,18 @@ if (!RuntimeInfo.protocol || !RuntimeInfo.protocol.startsWith('http') || Runtime
|
|
|
127
127
|
provider: PINATA_IPFS_GATEWAY,
|
|
128
128
|
weight: 1 // Rate limit too low
|
|
129
129
|
}, {
|
|
130
|
+
provider: IPFS_IO,
|
|
131
|
+
weight: 5
|
|
132
|
+
});
|
|
133
|
+
} else if (!RuntimeInfo.protocol.startsWith('https')) {
|
|
134
|
+
RANDOM_IPFS_GATEWAY_SETTING.push({
|
|
130
135
|
provider: NFT_STORAGE_GATEWAY,
|
|
131
136
|
weight: 50
|
|
132
|
-
}, {
|
|
133
|
-
provider: GATEWAY_IPFS_IO,
|
|
134
|
-
weight: 5
|
|
135
137
|
}, {
|
|
136
138
|
provider: DWEB_LINK,
|
|
137
139
|
weight: 5
|
|
138
140
|
}, {
|
|
139
|
-
provider:
|
|
141
|
+
provider: GATEWAY_IPFS_IO,
|
|
140
142
|
weight: 5
|
|
141
143
|
});
|
|
142
144
|
}
|
|
@@ -157,7 +157,7 @@ export declare function getWithdrawalInfo(nominatorMetadata: NominatorMetadata):
|
|
|
157
157
|
export declare function getEarningStatusByNominations(bnTotalActiveStake: BN, nominationList: NominationInfo[]): EarningStatus;
|
|
158
158
|
export declare function getValidatorLabel(chain: string): "dApp" | "Validator" | "Collator";
|
|
159
159
|
export declare function getAvgValidatorEraReward(supportedDays: number, eraRewardHistory: Codec[]): BigNumber;
|
|
160
|
-
export declare function getSupportedDaysByHistoryDepth(erasPerDay: number, maxSupportedEras: number):
|
|
160
|
+
export declare function getSupportedDaysByHistoryDepth(erasPerDay: number, maxSupportedEras: number, liveDay?: number): number;
|
|
161
161
|
export declare function getValidatorPointsMap(eraRewardMap: Record<string, PalletStakingEraRewardPoints>): Record<string, BigNumber>;
|
|
162
162
|
export declare function getTopValidatorByPoints(validatorPointsList: Record<string, BigNumber>): string[];
|
|
163
163
|
export declare const getMinStakeErrorMessage: (chainInfo: _ChainInfo, bnMinStake: BN) => string;
|
|
@@ -343,11 +343,15 @@ export function getAvgValidatorEraReward(supportedDays, eraRewardHistory) {
|
|
|
343
343
|
}
|
|
344
344
|
return sumEraReward.dividedBy(new BigNumber(supportedDays - failEra));
|
|
345
345
|
}
|
|
346
|
-
export function getSupportedDaysByHistoryDepth(erasPerDay, maxSupportedEras) {
|
|
347
|
-
|
|
346
|
+
export function getSupportedDaysByHistoryDepth(erasPerDay, maxSupportedEras, liveDay) {
|
|
347
|
+
const maxSupportDay = maxSupportedEras / erasPerDay;
|
|
348
|
+
if (liveDay && liveDay <= 30) {
|
|
349
|
+
return Math.min(liveDay - 1, maxSupportDay);
|
|
350
|
+
}
|
|
351
|
+
if (maxSupportDay > 30) {
|
|
348
352
|
return 30;
|
|
349
353
|
} else {
|
|
350
|
-
return
|
|
354
|
+
return maxSupportDay;
|
|
351
355
|
}
|
|
352
356
|
}
|
|
353
357
|
export function getValidatorPointsMap(eraRewardMap) {
|
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.59-0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -1874,10 +1874,10 @@
|
|
|
1874
1874
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
1875
1875
|
"@substrate/connect": "^0.8.9",
|
|
1876
1876
|
"@subwallet/chain-list": "0.2.57",
|
|
1877
|
-
"@subwallet/extension-base": "^1.1.
|
|
1878
|
-
"@subwallet/extension-chains": "^1.1.
|
|
1879
|
-
"@subwallet/extension-dapp": "^1.1.
|
|
1880
|
-
"@subwallet/extension-inject": "^1.1.
|
|
1877
|
+
"@subwallet/extension-base": "^1.1.59-0",
|
|
1878
|
+
"@subwallet/extension-chains": "^1.1.59-0",
|
|
1879
|
+
"@subwallet/extension-dapp": "^1.1.59-0",
|
|
1880
|
+
"@subwallet/extension-inject": "^1.1.59-0",
|
|
1881
1881
|
"@subwallet/keyring": "^0.1.5",
|
|
1882
1882
|
"@subwallet/ui-keyring": "^0.1.5",
|
|
1883
1883
|
"@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.59-0'
|
|
11
11
|
};
|
|
@@ -90,7 +90,8 @@ export const _STAKING_ERA_LENGTH_MAP = {
|
|
|
90
90
|
manta_network: 6,
|
|
91
91
|
krest_network: 4,
|
|
92
92
|
polimec: 6,
|
|
93
|
-
enjin_relaychain: 24
|
|
93
|
+
enjin_relaychain: 24,
|
|
94
|
+
availTuringTest: 24
|
|
94
95
|
};
|
|
95
96
|
export const _EXPECTED_BLOCK_TIME = {
|
|
96
97
|
// in seconds
|
|
@@ -119,7 +120,8 @@ export const _EXPECTED_BLOCK_TIME = {
|
|
|
119
120
|
calamari: 12,
|
|
120
121
|
calamari_test: 12,
|
|
121
122
|
manta_network: 12,
|
|
122
|
-
enjin_relaychain: 6
|
|
123
|
+
enjin_relaychain: 6,
|
|
124
|
+
availTuringTest: 20
|
|
123
125
|
};
|
|
124
126
|
export const _PARACHAIN_INFLATION_DISTRIBUTION = {
|
|
125
127
|
moonbeam: {
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
export const _STAKING_CHAIN_GROUP = {
|
|
5
|
-
relay: ['polkadot', 'kusama', 'aleph', 'polkadex', 'ternoa', 'alephTest', 'polkadexTest', 'westend', 'kate', 'edgeware', 'creditcoin', 'vara_network', 'goldberg_testnet'],
|
|
5
|
+
relay: ['polkadot', 'kusama', 'aleph', 'polkadex', 'ternoa', 'alephTest', 'polkadexTest', 'westend', 'kate', 'edgeware', 'creditcoin', 'vara_network', 'goldberg_testnet', 'availTuringTest'],
|
|
6
6
|
para: ['moonbeam', 'moonriver', 'moonbase', 'turing', 'turingStaging', 'bifrost', 'bifrost_testnet', 'calamari_test', 'calamari', 'manta_network', 'polimec'],
|
|
7
7
|
astar: ['astar', 'shiden', 'shibuya'],
|
|
8
8
|
amplitude: ['amplitude', 'amplitude_test', 'kilt', 'kilt_peregrine', 'pendulum', 'krest_network'],
|
|
9
9
|
// amplitude and kilt only share some common logic
|
|
10
10
|
kilt: ['kilt', 'kilt_peregrine'],
|
|
11
|
-
nominationPool: ['polkadot', 'kusama', 'westend', 'alephTest', 'aleph', 'kate', 'vara_network', 'goldberg_testnet'],
|
|
11
|
+
nominationPool: ['polkadot', 'kusama', 'westend', 'alephTest', 'aleph', 'kate', 'vara_network', 'goldberg_testnet', 'availTuringTest'],
|
|
12
12
|
bifrost: ['bifrost', 'bifrost_testnet'],
|
|
13
13
|
aleph: ['aleph', 'alephTest'],
|
|
14
14
|
// A0 has distinct tokenomics
|
|
@@ -57,9 +57,9 @@ export default class RelayNativeStakingPoolHandler extends BaseNativeStakingPool
|
|
|
57
57
|
const maxUnlockingChunks = substrateApi.api.consts.staking.maxUnlockingChunks.toString();
|
|
58
58
|
const unlockingEras = substrateApi.api.consts.staking.bondingDuration.toString();
|
|
59
59
|
const maxSupportedEras = substrateApi.api.consts.staking.historyDepth.toString();
|
|
60
|
-
const erasPerDay = 24 / _STAKING_ERA_LENGTH_MAP[chainInfo.slug]; // Can be exactly calculate from epochDuration
|
|
60
|
+
const erasPerDay = 24 / _STAKING_ERA_LENGTH_MAP[chainInfo.slug]; // Can be exactly calculate from babe.epochDuration * blockTime * staking.sessionsPerEra
|
|
61
61
|
|
|
62
|
-
const supportedDays = getSupportedDaysByHistoryDepth(erasPerDay, parseInt(maxSupportedEras));
|
|
62
|
+
const supportedDays = getSupportedDaysByHistoryDepth(erasPerDay, parseInt(maxSupportedEras), parseInt(currentEra) / erasPerDay);
|
|
63
63
|
const startEra = parseInt(currentEra) - supportedDays * erasPerDay;
|
|
64
64
|
const [_EraStakeInfo, _totalIssuance, _auctionCounter, _minNominatorBond, _counterForNominators, _minimumActiveStake, ..._eraReward] = await Promise.all([substrateApi.api.query.staking.erasTotalStake.multi([parseInt(currentEra), parseInt(currentEra) - 1]), substrateApi.api.query.balances.totalIssuance(), (_substrateApi$api$que2 = substrateApi.api.query.auctions) === null || _substrateApi$api$que2 === void 0 ? void 0 : _substrateApi$api$que2.auctionCounter(), substrateApi.api.query.staking.minNominatorBond(), substrateApi.api.query.staking.counterForNominators(), ((_substrateApi$api$que3 = substrateApi.api.query) === null || _substrateApi$api$que3 === void 0 ? void 0 : (_substrateApi$api$que4 = _substrateApi$api$que3.staking) === null || _substrateApi$api$que4 === void 0 ? void 0 : _substrateApi$api$que4.minimumActiveStake) && ((_substrateApi$api$que5 = substrateApi.api.query) === null || _substrateApi$api$que5 === void 0 ? void 0 : (_substrateApi$api$que6 = _substrateApi$api$que5.staking) === null || _substrateApi$api$que6 === void 0 ? void 0 : _substrateApi$api$que6.minimumActiveStake()), substrateApi.api.query.staking.erasValidatorReward.multi([...Array(supportedDays).keys()].map(i => i + startEra))]);
|
|
65
65
|
const [_totalEraStake, _lastTotalStaked] = _EraStakeInfo;
|
|
@@ -144,7 +144,7 @@ export default class RelayNativeStakingPoolHandler extends BaseNativeStakingPool
|
|
|
144
144
|
let nominationStatus = EarningStatus.NOT_EARNING;
|
|
145
145
|
let eraStakerOtherList = [];
|
|
146
146
|
let identity;
|
|
147
|
-
if (['kusama', 'polkadot', 'westend'].includes(this.chain)) {
|
|
147
|
+
if (['kusama', 'polkadot', 'westend', 'availTuringTest'].includes(this.chain)) {
|
|
148
148
|
// todo: review all relaychains later
|
|
149
149
|
const [[_identity], _eraStaker] = await Promise.all([parseIdentity(substrateApi, validatorAddress), substrateApi.api.query.staking.erasStakersPaged.entries(currentEra, validatorAddress)]);
|
|
150
150
|
identity = _identity;
|
|
@@ -298,7 +298,7 @@ export default class RelayNativeStakingPoolHandler extends BaseNativeStakingPool
|
|
|
298
298
|
const endEraForPoints = parseInt(activeEra) - 1;
|
|
299
299
|
let startEraForPoints = endEraForPoints - maxEraRewardPointsEras + 1;
|
|
300
300
|
let _eraStakersPromise;
|
|
301
|
-
if (['kusama', 'polkadot', 'westend'].includes(this.chain)) {
|
|
301
|
+
if (['kusama', 'polkadot', 'westend', 'availTuringTest'].includes(this.chain)) {
|
|
302
302
|
// todo: review all relaychains later
|
|
303
303
|
_eraStakersPromise = chainApi.api.query.staking.erasStakersOverview.entries(parseInt(currentEra));
|
|
304
304
|
} else {
|
|
@@ -81,7 +81,7 @@ export default class NominationPoolHandler extends BasePoolHandler {
|
|
|
81
81
|
const maxSupportedEras = substrateApi.api.consts.staking.historyDepth.toString();
|
|
82
82
|
const erasPerDay = 24 / _STAKING_ERA_LENGTH_MAP[chainInfo.slug]; // Can be exactly calculate from epochDuration, blockTime, sessionsPerEra
|
|
83
83
|
|
|
84
|
-
const supportedDays = getSupportedDaysByHistoryDepth(erasPerDay, parseInt(maxSupportedEras));
|
|
84
|
+
const supportedDays = getSupportedDaysByHistoryDepth(erasPerDay, parseInt(maxSupportedEras), parseInt(currentEra) / erasPerDay);
|
|
85
85
|
const startEra = parseInt(currentEra) - supportedDays * erasPerDay;
|
|
86
86
|
const [_EraStakeInfo, _totalIssuance, _auctionCounter, _minPoolJoin, ..._eraReward] = await Promise.all([substrateApi.api.query.staking.erasTotalStake.multi([parseInt(currentEra), parseInt(currentEra) - 1]), substrateApi.api.query.balances.totalIssuance(), (_substrateApi$api$que2 = substrateApi.api.query.auctions) === null || _substrateApi$api$que2 === void 0 ? void 0 : _substrateApi$api$que2.auctionCounter(), (_substrateApi$api$que3 = substrateApi.api.query) === null || _substrateApi$api$que3 === void 0 ? void 0 : (_substrateApi$api$que4 = _substrateApi$api$que3.nominationPools) === null || _substrateApi$api$que4 === void 0 ? void 0 : _substrateApi$api$que4.minJoinBond(), substrateApi.api.query.staking.erasValidatorReward.multi([...Array(supportedDays).keys()].map(i => i + startEra))]);
|
|
87
87
|
const [_totalEraStake, _lastTotalStaked] = _EraStakeInfo;
|
|
@@ -159,7 +159,7 @@ export default class NominationPoolHandler extends BasePoolHandler {
|
|
|
159
159
|
const validatorList = nominations.targets;
|
|
160
160
|
await Promise.all(validatorList.map(async validatorAddress => {
|
|
161
161
|
let eraStakerOtherList = [];
|
|
162
|
-
if (['kusama', 'polkadot', 'westend'].includes(this.chain)) {
|
|
162
|
+
if (['kusama', 'polkadot', 'westend', 'availTuringTest'].includes(this.chain)) {
|
|
163
163
|
// todo: review all relaychains later
|
|
164
164
|
const _eraStaker = await substrateApi.api.query.staking.erasStakersPaged.entries(currentEra, validatorAddress);
|
|
165
165
|
eraStakerOtherList = _eraStaker.flatMap(paged => paged[1].toPrimitive().others);
|