@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
|
@@ -6,7 +6,7 @@ import { BasicTxErrorType, ExtrinsicType, StakingTxErrorType } from '@subwallet/
|
|
|
6
6
|
import { calculateAlephZeroValidatorReturn, calculateChainStakedReturnV2, calculateInflation, calculateTernoaValidatorReturn, calculateValidatorStakedReturn, getAvgValidatorEraReward, getCommission, getMaxValidatorErrorMessage, getMinStakeErrorMessage, getRelayBlockedValidatorList, getRelayEraRewardMap, getRelayMaxNominations, getRelayTopValidatorByPoints, getRelayValidatorPointsMap, getRelayWaitingValidatorList, getSupportedDaysByHistoryDepth } from '@subwallet/extension-base/koni/api/staking/bonding/utils';
|
|
7
7
|
import { _STAKING_ERA_LENGTH_MAP } from '@subwallet/extension-base/services/chain-service/constants';
|
|
8
8
|
import { _getChainSubstrateAddressPrefix } from '@subwallet/extension-base/services/chain-service/utils';
|
|
9
|
-
import { _STAKING_CHAIN_GROUP,
|
|
9
|
+
import { _STAKING_CHAIN_GROUP, MaxEraRewardPointsEras } from '@subwallet/extension-base/services/earning-service/constants';
|
|
10
10
|
import { applyDecimal, parseIdentity } from '@subwallet/extension-base/services/earning-service/utils';
|
|
11
11
|
import { EarningStatus, UnstakingStatus } from '@subwallet/extension-base/types';
|
|
12
12
|
import { balanceFormatter, formatNumber, reformatAddress } from '@subwallet/extension-base/utils';
|
|
@@ -192,7 +192,7 @@ export default class RelayNativeStakingPoolHandler extends BaseNativeStakingPool
|
|
|
192
192
|
let nominationStatus = EarningStatus.NOT_EARNING;
|
|
193
193
|
let eraStakerOtherList = [];
|
|
194
194
|
let identity;
|
|
195
|
-
if (
|
|
195
|
+
if (substrateApi.api.query.staking.erasStakersPaged) {
|
|
196
196
|
// todo: review all relaychains later
|
|
197
197
|
const [[_identity], _eraStaker] = await Promise.all([parseIdentity(substrateApi, validatorAddress), substrateApi.api.query.staking.erasStakersPaged.entries(currentEra, validatorAddress)]);
|
|
198
198
|
identity = _identity;
|
|
@@ -300,20 +300,19 @@ export default class RelayNativeStakingPoolHandler extends BaseNativeStakingPool
|
|
|
300
300
|
const maxEraRewardPointsEras = MaxEraRewardPointsEras;
|
|
301
301
|
const endEraForPoints = parseInt(activeEra) - 1;
|
|
302
302
|
const startEraForPoints = Math.max(endEraForPoints - maxEraRewardPointsEras + 1, 0);
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
// todo: review all relaychains later
|
|
306
|
-
_eraStakersPromise = chainApi.api.query.staking.erasStakersOverview.entries(parseInt(currentEra));
|
|
307
|
-
} else {
|
|
308
|
-
_eraStakersPromise = chainApi.api.query.staking.erasStakers.entries(parseInt(currentEra));
|
|
309
|
-
}
|
|
303
|
+
const _eraStakersPromise = chainApi.api.query.staking.erasStakersOverview // todo: review all relaychains later
|
|
304
|
+
? chainApi.api.query.staking.erasStakersOverview.entries(parseInt(currentEra)) : chainApi.api.query.staking.erasStakers.entries(parseInt(currentEra));
|
|
310
305
|
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))]);
|
|
311
306
|
const eraRewardMap = getRelayEraRewardMap(_eraRewardPoints[0], startEraForPoints);
|
|
312
307
|
const validatorPointsMap = getRelayValidatorPointsMap(eraRewardMap);
|
|
313
308
|
const topValidatorList = getRelayTopValidatorByPoints(validatorPointsMap);
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
309
|
+
const allValidatorList = _validators;
|
|
310
|
+
|
|
311
|
+
// todo: optimize naming for all filtered validatorList: all, block, waiting, selected, waiting but is not selected, waiting but is not blocked, ...
|
|
312
|
+
const blockedValidatorList = getRelayBlockedValidatorList(allValidatorList);
|
|
313
|
+
const waitingValidatorList = getRelayWaitingValidatorList(allValidatorList); // all validators that are not blocked
|
|
314
|
+
|
|
315
|
+
// todo: improve handle waitingValidatorLedger
|
|
317
316
|
const _waitingValidatorLedger = await chainApi.api.query.staking.ledger.multi(waitingValidatorList);
|
|
318
317
|
const waitingValidatorLedger = {};
|
|
319
318
|
if (_waitingValidatorLedger) {
|
|
@@ -327,7 +326,9 @@ export default class RelayNativeStakingPoolHandler extends BaseNativeStakingPool
|
|
|
327
326
|
const maxNominatorRewarded = (chainApi.api.consts.staking.maxNominatorRewardedPerValidator || 0).toString();
|
|
328
327
|
const bnTotalEraStake = new BN(_totalEraStake.toString());
|
|
329
328
|
const minBond = _minBond.toPrimitive();
|
|
330
|
-
const [totalStakeMap, allValidatorAddresses,
|
|
329
|
+
const [totalStakeMap, allValidatorAddresses, allValidatorInfo] = this.parseEraStakerData(_eraStakers, blockedValidatorList, waitingValidatorLedger, topValidatorList, validatorPointsMap, minBond, maxNominatorRewarded, unlimitedNominatorRewarded);
|
|
330
|
+
const currentSelectedValidatorList = allValidatorInfo.currentSelectedValidatorList;
|
|
331
|
+
const allValidatorInfoList = [...currentSelectedValidatorList, ...allValidatorInfo.waitingValidatorList];
|
|
331
332
|
const extraInfoMap = {};
|
|
332
333
|
await Promise.all(allValidatorAddresses.map(async address => {
|
|
333
334
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
@@ -341,17 +342,19 @@ export default class RelayNativeStakingPoolHandler extends BaseNativeStakingPool
|
|
|
341
342
|
};
|
|
342
343
|
}));
|
|
343
344
|
const decimals = this.nativeToken.decimals || 0;
|
|
344
|
-
const bnAvgStake = applyDecimal(bnTotalEraStake.divn(
|
|
345
|
-
for (const validator of
|
|
345
|
+
const bnAvgStake = applyDecimal(bnTotalEraStake.divn(currentSelectedValidatorList.length), decimals);
|
|
346
|
+
for (const validator of allValidatorInfoList) {
|
|
346
347
|
const commissionString = extraInfoMap[validator.address].commission;
|
|
347
348
|
const commission = getCommission(commissionString);
|
|
348
|
-
|
|
349
|
+
|
|
350
|
+
// the waiting validator is missing info for calculating APY
|
|
351
|
+
validator.expectedReturn = currentSelectedValidatorList.includes(validator) ? this.getValidatorExpectedReturn(this.chain, validator, poolInfo.statistic.totalApy, commission, _stakingRewards, allValidatorAddresses, decimals, totalStakeMap, bnAvgStake) : 0;
|
|
349
352
|
validator.commission = commission;
|
|
350
353
|
validator.blocked = extraInfoMap[validator.address].blocked;
|
|
351
354
|
validator.identity = extraInfoMap[validator.address].identity;
|
|
352
355
|
validator.isVerified = extraInfoMap[validator.address].isVerified;
|
|
353
356
|
}
|
|
354
|
-
return
|
|
357
|
+
return allValidatorInfoList;
|
|
355
358
|
}
|
|
356
359
|
getValidatorExpectedReturn(chain, validator, totalApy, commission, _stakingRewards, allValidatorAddresses, decimals, totalStakeMap, bnAvgStake) {
|
|
357
360
|
if (_STAKING_CHAIN_GROUP.aleph.includes(chain)) {
|
|
@@ -370,10 +373,13 @@ export default class RelayNativeStakingPoolHandler extends BaseNativeStakingPool
|
|
|
370
373
|
}
|
|
371
374
|
}
|
|
372
375
|
}
|
|
373
|
-
parseEraStakerData(_eraStakers, blockedValidatorList,
|
|
376
|
+
parseEraStakerData(_eraStakers, blockedValidatorList, waitingValidatorLedger, topValidatorList, validatorPointsMap, minBond, maxNominatorRewarded, unlimitedNominatorRewarded) {
|
|
374
377
|
const totalStakeMap = {};
|
|
375
378
|
const allValidatorAddresses = [];
|
|
376
|
-
const
|
|
379
|
+
const allValidatorInfo = {
|
|
380
|
+
currentSelectedValidatorList: [],
|
|
381
|
+
waitingValidatorList: []
|
|
382
|
+
};
|
|
377
383
|
for (const item of _eraStakers) {
|
|
378
384
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
|
379
385
|
const rawValidatorInfo = item[0].toHuman();
|
|
@@ -391,7 +397,7 @@ export default class RelayNativeStakingPoolHandler extends BaseNativeStakingPool
|
|
|
391
397
|
const otherStake = bnTotalStake.sub(bnOwnStake);
|
|
392
398
|
totalStakeMap[validatorAddress] = bnTotalStake;
|
|
393
399
|
let nominatorCount = 0;
|
|
394
|
-
if (
|
|
400
|
+
if (rawValidatorStat.nominatorCount) {
|
|
395
401
|
nominatorCount = rawValidatorStat.nominatorCount;
|
|
396
402
|
} else {
|
|
397
403
|
if ('others' in rawValidatorStat) {
|
|
@@ -402,7 +408,7 @@ export default class RelayNativeStakingPoolHandler extends BaseNativeStakingPool
|
|
|
402
408
|
}
|
|
403
409
|
}
|
|
404
410
|
allValidatorAddresses.push(validatorAddress);
|
|
405
|
-
|
|
411
|
+
allValidatorInfo.currentSelectedValidatorList.push({
|
|
406
412
|
address: validatorAddress,
|
|
407
413
|
totalStake: bnTotalStake.toString(),
|
|
408
414
|
ownStake: bnOwnStake.toString(),
|
|
@@ -420,13 +426,13 @@ export default class RelayNativeStakingPoolHandler extends BaseNativeStakingPool
|
|
|
420
426
|
});
|
|
421
427
|
}
|
|
422
428
|
}
|
|
423
|
-
for (const waitingValidator of Object.keys(
|
|
429
|
+
for (const waitingValidator of Object.keys(waitingValidatorLedger)) {
|
|
424
430
|
if (!allValidatorAddresses.includes(waitingValidator)) {
|
|
425
431
|
allValidatorAddresses.push(waitingValidator);
|
|
426
|
-
|
|
432
|
+
allValidatorInfo.waitingValidatorList.push({
|
|
427
433
|
address: waitingValidator,
|
|
428
|
-
totalStake:
|
|
429
|
-
ownStake:
|
|
434
|
+
totalStake: waitingValidatorLedger[waitingValidator],
|
|
435
|
+
ownStake: waitingValidatorLedger[waitingValidator],
|
|
430
436
|
otherStake: '0',
|
|
431
437
|
nominatorCount: 0,
|
|
432
438
|
// to be added later
|
|
@@ -441,7 +447,7 @@ export default class RelayNativeStakingPoolHandler extends BaseNativeStakingPool
|
|
|
441
447
|
});
|
|
442
448
|
}
|
|
443
449
|
}
|
|
444
|
-
return [totalStakeMap, allValidatorAddresses,
|
|
450
|
+
return [totalStakeMap, allValidatorAddresses, allValidatorInfo];
|
|
445
451
|
}
|
|
446
452
|
/* Get pool targets */
|
|
447
453
|
|
|
@@ -6,7 +6,6 @@ import { APIItemState, BasicTxErrorType, ChainType, ExtrinsicType, StakingTxErro
|
|
|
6
6
|
import { calculateChainStakedReturnV2, calculateInflation, getAvgValidatorEraReward, getExistUnstakeErrorMessage, getMinStakeErrorMessage, getSupportedDaysByHistoryDepth, parsePoolStashAddress } from '@subwallet/extension-base/koni/api/staking/bonding/utils';
|
|
7
7
|
import { _STAKING_ERA_LENGTH_MAP } from '@subwallet/extension-base/services/chain-service/constants';
|
|
8
8
|
import { _getChainSubstrateAddressPrefix } from '@subwallet/extension-base/services/chain-service/utils';
|
|
9
|
-
import { _UPDATED_RUNTIME_STAKING_GROUP } from '@subwallet/extension-base/services/earning-service/constants';
|
|
10
9
|
import { EarningStatus, UnstakingStatus, YieldPoolType, YieldStepType } from '@subwallet/extension-base/types';
|
|
11
10
|
import { balanceFormatter, formatNumber, reformatAddress } from '@subwallet/extension-base/utils';
|
|
12
11
|
import BigN from 'bignumber.js';
|
|
@@ -162,7 +161,7 @@ export default class NominationPoolHandler extends BasePoolHandler {
|
|
|
162
161
|
const validatorList = nominations.targets;
|
|
163
162
|
await Promise.all(validatorList.map(async validatorAddress => {
|
|
164
163
|
let eraStakerOtherList = [];
|
|
165
|
-
if (
|
|
164
|
+
if (substrateApi.api.query.staking.erasStakersPaged) {
|
|
166
165
|
// todo: review all relaychains later
|
|
167
166
|
const _eraStaker = await substrateApi.api.query.staking.erasStakersPaged.entries(currentEra, validatorAddress);
|
|
168
167
|
eraStakerOtherList = _eraStaker.flatMap(paged => paged[1].toPrimitive().others);
|
|
@@ -7,8 +7,8 @@ export default class MigrateTransactionHistoryBySymbol extends BaseMigrationJob
|
|
|
7
7
|
const state = this.state;
|
|
8
8
|
try {
|
|
9
9
|
const changeSlugsMap = {
|
|
10
|
-
'
|
|
11
|
-
'
|
|
10
|
+
'polygon-NATIVE-MATIC': 'polygon-NATIVE-POL',
|
|
11
|
+
'5irechain_mainnet-NATIVE-5IRE': '5irechain_mainnet-NATIVE-5ire'
|
|
12
12
|
};
|
|
13
13
|
const allTxs = [];
|
|
14
14
|
await Promise.all(Object.entries(changeSlugsMap).map(async ([oldSlug, newSlug], i) => {
|
|
@@ -6,8 +6,8 @@ export default class MigrateAssetSetting extends BaseMigrationJob {
|
|
|
6
6
|
async run() {
|
|
7
7
|
try {
|
|
8
8
|
const changeSlugsMap = {
|
|
9
|
-
'
|
|
10
|
-
'
|
|
9
|
+
'polygon-NATIVE-MATIC': 'polygon-NATIVE-POL',
|
|
10
|
+
'5irechain_mainnet-NATIVE-5IRE': '5irechain_mainnet-NATIVE-5ire'
|
|
11
11
|
};
|
|
12
12
|
const assetSetting = await this.state.chainService.getAssetSettings();
|
|
13
13
|
const migratedAssetSetting = {};
|
|
@@ -53,8 +53,8 @@ export default {
|
|
|
53
53
|
'1.1.33-01': MigrateLedgerAccountV2,
|
|
54
54
|
'1.1.41-01': DeleteChainStaking,
|
|
55
55
|
'1.1.46-01': AutoEnableSomeTokens,
|
|
56
|
-
'1.
|
|
57
|
-
'1.
|
|
56
|
+
'1.2.28-01': MigrateAssetSetting,
|
|
57
|
+
'1.2.28-02': MigrateTransactionHistoryBySymbol,
|
|
58
58
|
'1.2.69-01': MigrateRemoveGenesisHash,
|
|
59
59
|
'1.2.13-01': ReloadMetadata,
|
|
60
60
|
'1.2.14-01': ClearMetadataDatabase
|
|
@@ -239,35 +239,59 @@ export default class MktCampaignService {
|
|
|
239
239
|
const isValidArr = conditionBalance.map(condition => {
|
|
240
240
|
return conditionMap[JSON.stringify(condition)];
|
|
241
241
|
});
|
|
242
|
-
|
|
242
|
+
if (item.comparison_operator === 'AND') {
|
|
243
|
+
isPassValidation.push(isValidArr.every(i => i));
|
|
244
|
+
} else {
|
|
245
|
+
isPassValidation.push(isValidArr.some(i => i));
|
|
246
|
+
}
|
|
243
247
|
}
|
|
244
248
|
if (conditionEarning && conditionEarning.length) {
|
|
245
249
|
const isValidArr = conditionEarning.map(condition => {
|
|
246
250
|
return conditionMap[JSON.stringify(condition)];
|
|
247
251
|
});
|
|
248
|
-
|
|
252
|
+
if (item.comparison_operator === 'AND') {
|
|
253
|
+
isPassValidation.push(isValidArr.every(i => i));
|
|
254
|
+
} else {
|
|
255
|
+
isPassValidation.push(isValidArr.some(i => i));
|
|
256
|
+
}
|
|
249
257
|
}
|
|
250
258
|
if (conditionNft && conditionNft.length) {
|
|
251
259
|
const isValidArr = conditionNft.map(condition => {
|
|
252
260
|
return conditionMap[JSON.stringify(condition)];
|
|
253
261
|
});
|
|
254
|
-
|
|
262
|
+
if (item.comparison_operator === 'AND') {
|
|
263
|
+
isPassValidation.push(isValidArr.every(i => i));
|
|
264
|
+
} else {
|
|
265
|
+
isPassValidation.push(isValidArr.some(i => i));
|
|
266
|
+
}
|
|
255
267
|
}
|
|
256
268
|
if (conditionCrowdloan && conditionCrowdloan.length) {
|
|
257
269
|
const isValidArr = conditionCrowdloan.map(condition => {
|
|
258
270
|
return conditionMap[JSON.stringify(condition)];
|
|
259
271
|
});
|
|
260
|
-
|
|
272
|
+
if (item.comparison_operator === 'AND') {
|
|
273
|
+
isPassValidation.push(isValidArr.every(i => i));
|
|
274
|
+
} else {
|
|
275
|
+
isPassValidation.push(isValidArr.some(i => i));
|
|
276
|
+
}
|
|
261
277
|
}
|
|
262
278
|
if (conditionHasMoney && conditionHasMoney.length) {
|
|
263
279
|
const isValidArr = conditionHasMoney.map(condition => {
|
|
264
280
|
return conditionMap[JSON.stringify(condition)];
|
|
265
281
|
});
|
|
266
|
-
|
|
282
|
+
if (item.comparison_operator === 'AND') {
|
|
283
|
+
isPassValidation.push(isValidArr.every(i => i));
|
|
284
|
+
} else {
|
|
285
|
+
isPassValidation.push(isValidArr.some(i => i));
|
|
286
|
+
}
|
|
267
287
|
}
|
|
268
288
|
}
|
|
269
289
|
if (isPassValidation && isPassValidation.length) {
|
|
270
|
-
|
|
290
|
+
if (item.comparison_operator === 'AND') {
|
|
291
|
+
return isPassValidation.every(_i => _i);
|
|
292
|
+
} else {
|
|
293
|
+
return isPassValidation.some(_i => _i);
|
|
294
|
+
}
|
|
271
295
|
} else {
|
|
272
296
|
return true;
|
|
273
297
|
}
|
|
@@ -82,6 +82,8 @@ export interface AppCommonData {
|
|
|
82
82
|
position_params: PositionParam[];
|
|
83
83
|
conditions: MktCampaignCondition;
|
|
84
84
|
info?: AppBasicInfoData;
|
|
85
|
+
comparison_operator: 'AND' | 'OR';
|
|
86
|
+
locations: string[];
|
|
85
87
|
}
|
|
86
88
|
export interface AppPopupData extends AppCommonData {
|
|
87
89
|
priority: number;
|
|
@@ -19,7 +19,6 @@ export default class EvmRequestHandler {
|
|
|
19
19
|
confirmationsQueueSubject = new BehaviorSubject({
|
|
20
20
|
addNetworkRequest: {},
|
|
21
21
|
addTokenRequest: {},
|
|
22
|
-
switchNetworkRequest: {},
|
|
23
22
|
evmSignatureRequest: {},
|
|
24
23
|
evmSendTransactionRequest: {},
|
|
25
24
|
evmWatchTransactionRequest: {},
|
|
@@ -248,7 +248,7 @@ export class HydradxHandler {
|
|
|
248
248
|
|
|
249
249
|
switch (defaultError) {
|
|
250
250
|
case PoolError.InsufficientTradingAmount:
|
|
251
|
-
return new SwapError(SwapErrorType.
|
|
251
|
+
return new SwapError(SwapErrorType.NOT_MEET_MIN_SWAP);
|
|
252
252
|
case PoolError.TradeNotAllowed:
|
|
253
253
|
return new SwapError(SwapErrorType.ERROR_FETCHING_QUOTE);
|
|
254
254
|
case PoolError.MaxInRatioExceeded:
|
|
@@ -44,6 +44,7 @@ var _option = /*#__PURE__*/_classPrivateFieldLooseKey("option");
|
|
|
44
44
|
var _updateSessions = /*#__PURE__*/_classPrivateFieldLooseKey("updateSessions");
|
|
45
45
|
var _onSessionProposal = /*#__PURE__*/_classPrivateFieldLooseKey("onSessionProposal");
|
|
46
46
|
var _onSessionRequest = /*#__PURE__*/_classPrivateFieldLooseKey("onSessionRequest");
|
|
47
|
+
var _onPingReply = /*#__PURE__*/_classPrivateFieldLooseKey("onPingReply");
|
|
47
48
|
var _createListener = /*#__PURE__*/_classPrivateFieldLooseKey("createListener");
|
|
48
49
|
var _removeListener = /*#__PURE__*/_classPrivateFieldLooseKey("removeListener");
|
|
49
50
|
var _checkClient = /*#__PURE__*/_classPrivateFieldLooseKey("checkClient");
|
|
@@ -58,6 +59,9 @@ export default class WalletConnectService {
|
|
|
58
59
|
Object.defineProperty(this, _createListener, {
|
|
59
60
|
value: _createListener2
|
|
60
61
|
});
|
|
62
|
+
Object.defineProperty(this, _onPingReply, {
|
|
63
|
+
value: _onPingReply2
|
|
64
|
+
});
|
|
61
65
|
Object.defineProperty(this, _onSessionRequest, {
|
|
62
66
|
value: _onSessionRequest2
|
|
63
67
|
});
|
|
@@ -302,11 +306,30 @@ function _onSessionRequest2(requestEvent) {
|
|
|
302
306
|
}).catch(console.error);
|
|
303
307
|
}
|
|
304
308
|
}
|
|
309
|
+
async function _onPingReply2({
|
|
310
|
+
topic
|
|
311
|
+
}) {
|
|
312
|
+
// Doc: https://specs.walletconnect.com/2.0/specs/clients/sign/session-events#session_ping
|
|
313
|
+
|
|
314
|
+
_classPrivateFieldLooseBase(this, _checkClient)[_checkClient]();
|
|
315
|
+
try {
|
|
316
|
+
var _requestSession$names, _requestSession$names2;
|
|
317
|
+
const requestSession = this.getSession(topic);
|
|
318
|
+
const sessionAccounts = (((_requestSession$names = requestSession.namespaces.eip155) === null || _requestSession$names === void 0 ? void 0 : _requestSession$names.accounts) || []).concat(((_requestSession$names2 = requestSession.namespaces.polkadot) === null || _requestSession$names2 === void 0 ? void 0 : _requestSession$names2.accounts) || []);
|
|
319
|
+
if (sessionAccounts.length > 0 && _classPrivateFieldLooseBase(this, _client)[_client]) {
|
|
320
|
+
await _classPrivateFieldLooseBase(this, _client)[_client].ping({
|
|
321
|
+
topic
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
} catch (e) {
|
|
325
|
+
console.error(e);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
305
328
|
function _createListener2() {
|
|
306
329
|
var _classPrivateFieldLoo14, _classPrivateFieldLoo15, _classPrivateFieldLoo16, _classPrivateFieldLoo17, _classPrivateFieldLoo18, _classPrivateFieldLoo19;
|
|
307
330
|
(_classPrivateFieldLoo14 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo14 === void 0 ? void 0 : _classPrivateFieldLoo14.on('session_proposal', _classPrivateFieldLooseBase(this, _onSessionProposal)[_onSessionProposal].bind(this));
|
|
308
331
|
(_classPrivateFieldLoo15 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo15 === void 0 ? void 0 : _classPrivateFieldLoo15.on('session_request', _classPrivateFieldLooseBase(this, _onSessionRequest)[_onSessionRequest].bind(this));
|
|
309
|
-
(_classPrivateFieldLoo16 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo16 === void 0 ? void 0 : _classPrivateFieldLoo16.on('session_ping',
|
|
332
|
+
(_classPrivateFieldLoo16 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo16 === void 0 ? void 0 : _classPrivateFieldLoo16.on('session_ping', _classPrivateFieldLooseBase(this, _onPingReply)[_onPingReply].bind(this));
|
|
310
333
|
(_classPrivateFieldLoo17 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo17 === void 0 ? void 0 : _classPrivateFieldLoo17.on('session_event', data => console.log('event', data));
|
|
311
334
|
(_classPrivateFieldLoo18 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo18 === void 0 ? void 0 : _classPrivateFieldLoo18.on('session_update', data => console.log('update', data));
|
|
312
335
|
(_classPrivateFieldLoo19 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo19 === void 0 ? void 0 : _classPrivateFieldLoo19.on('session_delete', _classPrivateFieldLooseBase(this, _updateSessions)[_updateSessions].bind(this));
|
|
@@ -25,6 +25,10 @@ export interface ValidatorInfo {
|
|
|
25
25
|
eraRewardPoint?: string;
|
|
26
26
|
topQuartile?: boolean;
|
|
27
27
|
}
|
|
28
|
+
export interface AllValidatorInfo {
|
|
29
|
+
currentSelectedValidatorList: ValidatorInfo[];
|
|
30
|
+
waitingValidatorList: ValidatorInfo[];
|
|
31
|
+
}
|
|
28
32
|
export declare type YieldPoolTarget = NominationPoolInfo | ValidatorInfo;
|
|
29
33
|
export interface RequestGetYieldPoolTargets {
|
|
30
34
|
slug: string;
|