@subwallet/extension-base 1.1.53-0 → 1.1.53-beta.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 +9 -1
- package/background/KoniTypes.js +1 -0
- package/background/errors/SwapError.d.ts +6 -0
- package/background/errors/SwapError.js +57 -0
- package/background/errors/TransactionError.js +9 -0
- package/cjs/background/KoniTypes.js +1 -0
- package/cjs/background/errors/SwapError.js +64 -0
- package/cjs/background/errors/TransactionError.js +9 -0
- package/cjs/koni/api/dotsama/balance.js +464 -0
- package/cjs/koni/api/nft/ordinal_nft/utils.js +41 -0
- package/cjs/koni/api/staking/bonding/utils.js +35 -6
- package/cjs/koni/background/handlers/Extension.js +85 -0
- package/cjs/koni/background/handlers/State.js +25 -5
- package/cjs/services/balance-service/helpers/subscribe/balance.js +140 -0
- package/cjs/services/balance-service/index.js +6 -3
- package/cjs/services/chain-service/constants.js +1 -1
- package/cjs/services/chain-service/index.js +43 -18
- package/cjs/services/chain-service/utils/index.js +7 -2
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/chain-service/utils.js +506 -0
- package/cjs/services/earning-service/constants/chains.js +4 -2
- package/cjs/services/earning-service/handlers/native-staking/astar.js +4 -3
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +22 -3
- package/cjs/services/migration-service/scripts/MigrateEthProvider.js +17 -0
- package/cjs/services/migration-service/scripts/MigratePioneerProvider.js +17 -0
- package/cjs/services/migration-service/scripts/MigrateProvider.js +29 -0
- package/cjs/services/storage-service/index.js +241 -0
- package/cjs/services/swap-service/handler/base-handler.js +171 -0
- package/cjs/services/swap-service/handler/chainflip-handler.js +407 -0
- package/cjs/services/swap-service/handler/hydradx-handler.js +444 -0
- package/cjs/services/swap-service/index.js +249 -0
- package/cjs/services/swap-service/utils.js +126 -0
- package/cjs/services/transaction-service/index.js +20 -0
- package/cjs/services/transaction-service/utils.js +6 -0
- package/cjs/types/balance.js +1 -0
- package/cjs/types/fee/evm.js +1 -0
- package/cjs/types/fee/fee.js +70 -0
- package/cjs/types/fee/index.js +27 -1
- package/cjs/types/service-base.js +1 -0
- package/cjs/types/swap/index.js +50 -0
- package/cjs/types.js +1 -0
- package/cjs/utils/address.js +34 -0
- package/cjs/utils/index.js +12 -0
- package/cjs/utils/keyring.js +57 -0
- package/cjs/utils/swap.js +78 -0
- package/koni/api/staking/bonding/utils.d.ts +3 -1
- package/koni/api/staking/bonding/utils.js +32 -6
- package/koni/background/handlers/Extension.d.ts +5 -0
- package/koni/background/handlers/Extension.js +85 -0
- package/koni/background/handlers/State.d.ts +2 -0
- package/koni/background/handlers/State.js +26 -6
- package/package.json +60 -3
- package/services/balance-service/index.js +6 -3
- package/services/base/types.d.ts +4 -0
- package/services/chain-service/constants.js +1 -1
- package/services/chain-service/index.d.ts +4 -0
- package/services/chain-service/index.js +24 -0
- package/services/chain-service/utils/index.d.ts +6 -5
- package/services/chain-service/utils/index.js +5 -2
- package/services/chain-service/utils/patch.js +1 -1
- package/services/earning-service/constants/chains.d.ts +1 -0
- package/services/earning-service/constants/chains.js +1 -0
- package/services/earning-service/handlers/native-staking/astar.js +4 -3
- package/services/earning-service/handlers/native-staking/relay-chain.js +24 -5
- package/services/event-service/types.d.ts +1 -0
- package/services/swap-service/handler/base-handler.d.ts +38 -0
- package/services/swap-service/handler/base-handler.js +162 -0
- package/services/swap-service/handler/chainflip-handler.d.ts +30 -0
- package/services/swap-service/handler/chainflip-handler.js +399 -0
- package/services/swap-service/handler/hydradx-handler.d.ts +36 -0
- package/services/swap-service/handler/hydradx-handler.js +435 -0
- package/services/swap-service/index.d.ts +32 -0
- package/services/swap-service/index.js +240 -0
- package/services/swap-service/utils.d.ts +18 -0
- package/services/swap-service/utils.js +105 -0
- package/services/transaction-service/index.js +20 -0
- package/services/transaction-service/utils.d.ts +2 -0
- package/services/transaction-service/utils.js +6 -2
- package/types/fee/evm.d.ts +49 -0
- package/types/fee/evm.js +1 -0
- package/types/fee/fee.d.ts +32 -0
- package/types/fee/fee.js +63 -0
- package/types/fee/index.d.ts +2 -49
- package/types/fee/index.js +5 -1
- package/types/service-base.d.ts +10 -0
- package/types/service-base.js +1 -0
- package/types/swap/index.d.ts +166 -0
- package/types/swap/index.js +41 -0
- package/types/yield/info/chain/target.d.ts +2 -0
- package/types/yield/info/pallet.d.ts +4 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +2 -1
- package/utils/swap.d.ts +3 -0
- package/utils/swap.js +70 -0
|
@@ -3943,6 +3943,78 @@ export default class KoniExtension {
|
|
|
3943
3943
|
|
|
3944
3944
|
/* Buy service */
|
|
3945
3945
|
|
|
3946
|
+
/* Swap service */
|
|
3947
|
+
async subscribeSwapPairs(id, port) {
|
|
3948
|
+
const cb = createSubscription(id, port);
|
|
3949
|
+
let ready = false;
|
|
3950
|
+
await this.#koniState.swapService.waitForStarted();
|
|
3951
|
+
const callback = rs => {
|
|
3952
|
+
if (ready) {
|
|
3953
|
+
cb(rs);
|
|
3954
|
+
}
|
|
3955
|
+
};
|
|
3956
|
+
const subscription = this.#koniState.swapService.subscribeSwapPairs(callback);
|
|
3957
|
+
this.createUnsubscriptionHandle(id, subscription.unsubscribe);
|
|
3958
|
+
port.onDisconnect.addListener(() => {
|
|
3959
|
+
this.cancelSubscription(id);
|
|
3960
|
+
});
|
|
3961
|
+
ready = true;
|
|
3962
|
+
return this.#koniState.swapService.getSwapPairs();
|
|
3963
|
+
}
|
|
3964
|
+
async handleSwapRequest(request) {
|
|
3965
|
+
return this.#koniState.swapService.handleSwapRequest(request);
|
|
3966
|
+
}
|
|
3967
|
+
async getLatestSwapQuote(swapRequest) {
|
|
3968
|
+
return this.#koniState.swapService.getLatestQuotes(swapRequest);
|
|
3969
|
+
}
|
|
3970
|
+
async validateSwapProcess(params) {
|
|
3971
|
+
return this.#koniState.swapService.validateSwapProcess(params);
|
|
3972
|
+
}
|
|
3973
|
+
async handleSwapStep(inputData) {
|
|
3974
|
+
const {
|
|
3975
|
+
address,
|
|
3976
|
+
process,
|
|
3977
|
+
quote,
|
|
3978
|
+
recipient
|
|
3979
|
+
} = inputData;
|
|
3980
|
+
if (!quote || !address || !process) {
|
|
3981
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors([new TransactionError(BasicTxErrorType.INTERNAL_ERROR)]);
|
|
3982
|
+
}
|
|
3983
|
+
const isLastStep = inputData.currentStep + 1 === process.steps.length;
|
|
3984
|
+
const swapValidations = await this.#koniState.swapService.validateSwapProcess({
|
|
3985
|
+
address,
|
|
3986
|
+
process,
|
|
3987
|
+
selectedQuote: quote,
|
|
3988
|
+
recipient
|
|
3989
|
+
});
|
|
3990
|
+
if (swapValidations.length > 0) {
|
|
3991
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(swapValidations);
|
|
3992
|
+
}
|
|
3993
|
+
|
|
3994
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3995
|
+
const {
|
|
3996
|
+
chainType,
|
|
3997
|
+
extrinsic,
|
|
3998
|
+
extrinsicType,
|
|
3999
|
+
transferNativeAmount,
|
|
4000
|
+
txChain,
|
|
4001
|
+
txData
|
|
4002
|
+
} = await this.#koniState.swapService.handleSwapProcess(inputData);
|
|
4003
|
+
return await this.#koniState.transactionService.handleTransaction({
|
|
4004
|
+
address,
|
|
4005
|
+
chain: txChain,
|
|
4006
|
+
transaction: extrinsic,
|
|
4007
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
4008
|
+
data: txData,
|
|
4009
|
+
extrinsicType,
|
|
4010
|
+
// change this depends on step
|
|
4011
|
+
chainType,
|
|
4012
|
+
resolveOnDone: !isLastStep,
|
|
4013
|
+
transferNativeAmount
|
|
4014
|
+
});
|
|
4015
|
+
}
|
|
4016
|
+
/* Swap service */
|
|
4017
|
+
|
|
3946
4018
|
// --------------------------------------------------------------
|
|
3947
4019
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
3948
4020
|
async handle(id, type, request, port) {
|
|
@@ -4472,6 +4544,19 @@ export default class KoniExtension {
|
|
|
4472
4544
|
case 'pri(database.exportJson)':
|
|
4473
4545
|
return this.#koniState.dbService.getExportJson();
|
|
4474
4546
|
/* Database */
|
|
4547
|
+
|
|
4548
|
+
/* Swap service */
|
|
4549
|
+
case 'pri(swapService.subscribePairs)':
|
|
4550
|
+
return this.subscribeSwapPairs(id, port);
|
|
4551
|
+
case 'pri(swapService.handleSwapRequest)':
|
|
4552
|
+
return this.handleSwapRequest(request);
|
|
4553
|
+
case 'pri(swapService.getLatestQuote)':
|
|
4554
|
+
return this.getLatestSwapQuote(request);
|
|
4555
|
+
case 'pri(swapService.validateSwapProcess)':
|
|
4556
|
+
return this.validateSwapProcess(request);
|
|
4557
|
+
case 'pri(swapService.handleSwapStep)':
|
|
4558
|
+
return this.handleSwapStep(request);
|
|
4559
|
+
/* Swap service */
|
|
4475
4560
|
// Default
|
|
4476
4561
|
default:
|
|
4477
4562
|
throw new Error(`Unable to handle message of type ${type}`);
|
|
@@ -21,6 +21,7 @@ import { AuthUrls, MetaRequest, SignRequest } from '@subwallet/extension-base/se
|
|
|
21
21
|
import SettingService from '@subwallet/extension-base/services/setting-service/SettingService';
|
|
22
22
|
import DatabaseService from '@subwallet/extension-base/services/storage-service/DatabaseService';
|
|
23
23
|
import { SubscanService } from '@subwallet/extension-base/services/subscan-service';
|
|
24
|
+
import { SwapService } from '@subwallet/extension-base/services/swap-service';
|
|
24
25
|
import TransactionService from '@subwallet/extension-base/services/transaction-service';
|
|
25
26
|
import WalletConnectService from '@subwallet/extension-base/services/wallet-connect-service';
|
|
26
27
|
import { BalanceMap, EvmFeeInfo } from '@subwallet/extension-base/types';
|
|
@@ -71,6 +72,7 @@ export default class KoniState {
|
|
|
71
72
|
readonly buyService: BuyService;
|
|
72
73
|
readonly earningService: EarningService;
|
|
73
74
|
readonly feeService: FeeService;
|
|
75
|
+
readonly swapService: SwapService;
|
|
74
76
|
private generalStatus;
|
|
75
77
|
private waitSleeping;
|
|
76
78
|
private waitStarting;
|
|
@@ -28,10 +28,11 @@ import SettingService from '@subwallet/extension-base/services/setting-service/S
|
|
|
28
28
|
import DatabaseService from '@subwallet/extension-base/services/storage-service/DatabaseService';
|
|
29
29
|
import { SubscanService } from '@subwallet/extension-base/services/subscan-service';
|
|
30
30
|
import { SUBSCAN_API_CHAIN_MAP } from '@subwallet/extension-base/services/subscan-service/subscan-chain-map';
|
|
31
|
+
import { SwapService } from '@subwallet/extension-base/services/swap-service';
|
|
31
32
|
import TransactionService from '@subwallet/extension-base/services/transaction-service';
|
|
32
33
|
import WalletConnectService from '@subwallet/extension-base/services/wallet-connect-service';
|
|
33
34
|
import AccountRefStore from '@subwallet/extension-base/stores/AccountRef';
|
|
34
|
-
import { isAccountAll, stripUrl, TARGET_ENV } from '@subwallet/extension-base/utils';
|
|
35
|
+
import { isAccountAll, stripUrl, TARGET_ENV, wait } from '@subwallet/extension-base/utils';
|
|
35
36
|
import { isContractAddress, parseContractInput } from '@subwallet/extension-base/utils/eth/parseTransaction';
|
|
36
37
|
import { createPromiseHandler } from '@subwallet/extension-base/utils/promise';
|
|
37
38
|
import { decodePair } from '@subwallet/keyring/pair/decode';
|
|
@@ -104,6 +105,7 @@ export default class KoniState {
|
|
|
104
105
|
this.transactionService = new TransactionService(this);
|
|
105
106
|
this.earningService = new EarningService(this);
|
|
106
107
|
this.feeService = new FeeService(this);
|
|
108
|
+
this.swapService = new SwapService(this);
|
|
107
109
|
this.subscription = new KoniSubscription(this, this.dbService);
|
|
108
110
|
this.cron = new KoniCron(this, this.subscription, this.dbService);
|
|
109
111
|
this.logger = createLogger('State');
|
|
@@ -226,6 +228,7 @@ export default class KoniState {
|
|
|
226
228
|
this.eventService.emit('chain.ready', true);
|
|
227
229
|
await this.balanceService.init();
|
|
228
230
|
await this.earningService.init();
|
|
231
|
+
await this.swapService.init();
|
|
229
232
|
this.onReady();
|
|
230
233
|
this.onAccountAdd();
|
|
231
234
|
this.onAccountRemove();
|
|
@@ -1201,17 +1204,34 @@ export default class KoniState {
|
|
|
1201
1204
|
maxFeePerGas: autoFormatNumber(transactionParams.maxFeePerGas),
|
|
1202
1205
|
data: transactionParams.data
|
|
1203
1206
|
};
|
|
1207
|
+
const getTransactionGas = async () => {
|
|
1208
|
+
try {
|
|
1209
|
+
transaction.gas = await web3.eth.estimateGas({
|
|
1210
|
+
...transaction
|
|
1211
|
+
});
|
|
1212
|
+
} catch (e) {
|
|
1213
|
+
// @ts-ignore
|
|
1214
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
1215
|
+
throw new EvmProviderError(EvmProviderErrorType.INVALID_PARAMS, e === null || e === void 0 ? void 0 : e.message);
|
|
1216
|
+
}
|
|
1217
|
+
};
|
|
1204
1218
|
|
|
1205
1219
|
// Calculate transaction data
|
|
1206
1220
|
try {
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1221
|
+
await Promise.race([getTransactionGas(), wait(3000).then(async () => {
|
|
1222
|
+
if (!transaction.gas) {
|
|
1223
|
+
await this.chainService.initSingleApi(networkKey);
|
|
1224
|
+
await getTransactionGas();
|
|
1225
|
+
}
|
|
1226
|
+
})]);
|
|
1210
1227
|
} catch (e) {
|
|
1211
1228
|
// @ts-ignore
|
|
1212
1229
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
1213
1230
|
throw new EvmProviderError(EvmProviderErrorType.INVALID_PARAMS, e === null || e === void 0 ? void 0 : e.message);
|
|
1214
1231
|
}
|
|
1232
|
+
if (!transaction.gas) {
|
|
1233
|
+
throw new EvmProviderError(EvmProviderErrorType.INVALID_PARAMS);
|
|
1234
|
+
}
|
|
1215
1235
|
let estimateGas;
|
|
1216
1236
|
|
|
1217
1237
|
// TODO: Review, If not override, transaction maybe fail because fee too low
|
|
@@ -1396,7 +1416,7 @@ export default class KoniState {
|
|
|
1396
1416
|
// Stopping services
|
|
1397
1417
|
await Promise.all([this.cron.stop(), this.subscription.stop()]);
|
|
1398
1418
|
await this.pauseAllNetworks(undefined, 'IDLE mode');
|
|
1399
|
-
await Promise.all([this.historyService.stop(), this.priceService.stop(), this.balanceService.stop(), this.earningService.stop()]);
|
|
1419
|
+
await Promise.all([this.historyService.stop(), this.priceService.stop(), this.balanceService.stop(), this.earningService.stop(), this.swapService.stop()]);
|
|
1400
1420
|
|
|
1401
1421
|
// Complete sleeping
|
|
1402
1422
|
sleeping.resolve();
|
|
@@ -1428,7 +1448,7 @@ export default class KoniState {
|
|
|
1428
1448
|
}
|
|
1429
1449
|
|
|
1430
1450
|
// Start services
|
|
1431
|
-
await Promise.all([this.cron.start(), this.subscription.start(), this.historyService.start(), this.priceService.start(), this.balanceService.start(), this.earningService.start()]);
|
|
1451
|
+
await Promise.all([this.cron.start(), this.subscription.start(), this.historyService.start(), this.priceService.start(), this.balanceService.start(), this.earningService.start(), this.swapService.start()]);
|
|
1432
1452
|
|
|
1433
1453
|
// Complete starting
|
|
1434
1454
|
starting.resolve();
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.1.53-0",
|
|
20
|
+
"version": "1.1.53-beta.0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -44,6 +44,11 @@
|
|
|
44
44
|
"require": "./cjs/background/errors/ProviderError.js",
|
|
45
45
|
"default": "./background/errors/ProviderError.js"
|
|
46
46
|
},
|
|
47
|
+
"./background/errors/SwapError": {
|
|
48
|
+
"types": "./background/errors/SwapError.d.ts",
|
|
49
|
+
"require": "./cjs/background/errors/SwapError.js",
|
|
50
|
+
"default": "./background/errors/SwapError.js"
|
|
51
|
+
},
|
|
47
52
|
"./background/errors/SWError": {
|
|
48
53
|
"types": "./background/errors/SWError.d.ts",
|
|
49
54
|
"require": "./cjs/background/errors/SWError.js",
|
|
@@ -1355,6 +1360,31 @@
|
|
|
1355
1360
|
"require": "./cjs/services/subscan-service/types.js",
|
|
1356
1361
|
"default": "./services/subscan-service/types.js"
|
|
1357
1362
|
},
|
|
1363
|
+
"./services/swap-service": {
|
|
1364
|
+
"types": "./services/swap-service/index.d.ts",
|
|
1365
|
+
"require": "./cjs/services/swap-service/index.js",
|
|
1366
|
+
"default": "./services/swap-service/index.js"
|
|
1367
|
+
},
|
|
1368
|
+
"./services/swap-service/handler/base-handler": {
|
|
1369
|
+
"types": "./services/swap-service/handler/base-handler.d.ts",
|
|
1370
|
+
"require": "./cjs/services/swap-service/handler/base-handler.js",
|
|
1371
|
+
"default": "./services/swap-service/handler/base-handler.js"
|
|
1372
|
+
},
|
|
1373
|
+
"./services/swap-service/handler/chainflip-handler": {
|
|
1374
|
+
"types": "./services/swap-service/handler/chainflip-handler.d.ts",
|
|
1375
|
+
"require": "./cjs/services/swap-service/handler/chainflip-handler.js",
|
|
1376
|
+
"default": "./services/swap-service/handler/chainflip-handler.js"
|
|
1377
|
+
},
|
|
1378
|
+
"./services/swap-service/handler/hydradx-handler": {
|
|
1379
|
+
"types": "./services/swap-service/handler/hydradx-handler.d.ts",
|
|
1380
|
+
"require": "./cjs/services/swap-service/handler/hydradx-handler.js",
|
|
1381
|
+
"default": "./services/swap-service/handler/hydradx-handler.js"
|
|
1382
|
+
},
|
|
1383
|
+
"./services/swap-service/utils": {
|
|
1384
|
+
"types": "./services/swap-service/utils.d.ts",
|
|
1385
|
+
"require": "./cjs/services/swap-service/utils.js",
|
|
1386
|
+
"default": "./services/swap-service/utils.js"
|
|
1387
|
+
},
|
|
1358
1388
|
"./services/transaction-service": {
|
|
1359
1389
|
"types": "./services/transaction-service/index.d.ts",
|
|
1360
1390
|
"require": "./cjs/services/transaction-service/index.js",
|
|
@@ -1560,11 +1590,31 @@
|
|
|
1560
1590
|
"require": "./cjs/types/fee/index.js",
|
|
1561
1591
|
"default": "./types/fee/index.js"
|
|
1562
1592
|
},
|
|
1593
|
+
"./types/fee/evm": {
|
|
1594
|
+
"types": "./types/fee/evm.d.ts",
|
|
1595
|
+
"require": "./cjs/types/fee/evm.js",
|
|
1596
|
+
"default": "./types/fee/evm.js"
|
|
1597
|
+
},
|
|
1598
|
+
"./types/fee/fee": {
|
|
1599
|
+
"types": "./types/fee/fee.d.ts",
|
|
1600
|
+
"require": "./cjs/types/fee/fee.js",
|
|
1601
|
+
"default": "./types/fee/fee.js"
|
|
1602
|
+
},
|
|
1563
1603
|
"./types/ordinal": {
|
|
1564
1604
|
"types": "./types/ordinal.d.ts",
|
|
1565
1605
|
"require": "./cjs/types/ordinal.js",
|
|
1566
1606
|
"default": "./types/ordinal.js"
|
|
1567
1607
|
},
|
|
1608
|
+
"./types/service-base": {
|
|
1609
|
+
"types": "./types/service-base.d.ts",
|
|
1610
|
+
"require": "./cjs/types/service-base.js",
|
|
1611
|
+
"default": "./types/service-base.js"
|
|
1612
|
+
},
|
|
1613
|
+
"./types/swap": {
|
|
1614
|
+
"types": "./types/swap/index.d.ts",
|
|
1615
|
+
"require": "./cjs/types/swap/index.js",
|
|
1616
|
+
"default": "./types/swap/index.js"
|
|
1617
|
+
},
|
|
1568
1618
|
"./types/transaction": {
|
|
1569
1619
|
"types": "./types/transaction.d.ts",
|
|
1570
1620
|
"require": "./cjs/types/transaction.js",
|
|
@@ -1781,6 +1831,11 @@
|
|
|
1781
1831
|
"./utils/staticData/crowdloanFunds.json": "./utils/staticData/crowdloanFunds.json",
|
|
1782
1832
|
"./utils/staticData/marketingCampaigns.json": "./utils/staticData/marketingCampaigns.json",
|
|
1783
1833
|
"./utils/staticData/termAndCondition.json": "./utils/staticData/termAndCondition.json",
|
|
1834
|
+
"./utils/swap": {
|
|
1835
|
+
"types": "./utils/swap.d.ts",
|
|
1836
|
+
"require": "./cjs/utils/swap.js",
|
|
1837
|
+
"default": "./utils/swap.js"
|
|
1838
|
+
},
|
|
1784
1839
|
"./utils/translate": {
|
|
1785
1840
|
"types": "./utils/translate.d.ts",
|
|
1786
1841
|
"require": "./cjs/utils/translate.js",
|
|
@@ -1791,10 +1846,12 @@
|
|
|
1791
1846
|
"@acala-network/api": "^5.0.2",
|
|
1792
1847
|
"@apollo/client": "^3.7.14",
|
|
1793
1848
|
"@azns/resolver-core": "^1.4.0",
|
|
1849
|
+
"@chainflip/sdk": "^1.3.0",
|
|
1794
1850
|
"@equilab/api": "~1.14.25",
|
|
1795
1851
|
"@ethereumjs/common": "^4.1.0",
|
|
1796
1852
|
"@ethereumjs/tx": "^5.1.0",
|
|
1797
1853
|
"@ethersproject/abi": "^5.7.0",
|
|
1854
|
+
"@galacticcouncil/sdk": "^1.2.1",
|
|
1798
1855
|
"@json-rpc-tools/utils": "^1.7.6",
|
|
1799
1856
|
"@metamask/safe-event-emitter": "^2.0.0",
|
|
1800
1857
|
"@metaverse-network-sdk/type-definitions": "^0.0.1-13",
|
|
@@ -1816,7 +1873,7 @@
|
|
|
1816
1873
|
"@reduxjs/toolkit": "^1.9.1",
|
|
1817
1874
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
1818
1875
|
"@substrate/connect": "^0.7.26",
|
|
1819
|
-
"@subwallet/chain-list": "0.2.
|
|
1876
|
+
"@subwallet/chain-list": "0.2.55-beta.3",
|
|
1820
1877
|
"@subwallet/extension-base": "^1.1.53-0",
|
|
1821
1878
|
"@subwallet/extension-chains": "^1.1.53-0",
|
|
1822
1879
|
"@subwallet/extension-dapp": "^1.1.53-0",
|
|
@@ -1857,4 +1914,4 @@
|
|
|
1857
1914
|
"web3-eth-contract": "^1.10.0",
|
|
1858
1915
|
"web3-utils": "^1.10.0"
|
|
1859
1916
|
}
|
|
1860
|
-
}
|
|
1917
|
+
}
|
|
@@ -185,7 +185,8 @@ export class BalanceService {
|
|
|
185
185
|
const chainInfoMap = this.state.chainService.getChainInfoMap();
|
|
186
186
|
const evmApiMap = this.state.chainService.getEvmApiMap();
|
|
187
187
|
const substrateApiMap = this.state.chainService.getSubstrateApiMap();
|
|
188
|
-
|
|
188
|
+
let unsub = noop;
|
|
189
|
+
unsub = subscribeBalance([address], [chain], [tSlug], assetMap, chainInfoMap, substrateApiMap, evmApiMap, result => {
|
|
189
190
|
const rs = result[0];
|
|
190
191
|
if (rs.tokenSlug === tSlug) {
|
|
191
192
|
hasError = false;
|
|
@@ -197,15 +198,17 @@ export class BalanceService {
|
|
|
197
198
|
if (callback) {
|
|
198
199
|
callback(balance);
|
|
199
200
|
} else {
|
|
201
|
+
var _unsub;
|
|
200
202
|
// Auto unsubscribe if no callback
|
|
201
|
-
unsub();
|
|
203
|
+
(_unsub = unsub) === null || _unsub === void 0 ? void 0 : _unsub();
|
|
202
204
|
}
|
|
203
205
|
resolve([unsub, balance]);
|
|
204
206
|
}
|
|
205
207
|
});
|
|
206
208
|
setTimeout(() => {
|
|
207
209
|
if (hasError) {
|
|
208
|
-
|
|
210
|
+
var _unsub2;
|
|
211
|
+
(_unsub2 = unsub) === null || _unsub2 === void 0 ? void 0 : _unsub2();
|
|
209
212
|
reject(new Error(t('Failed to get balance. Please check your internet connection or change your network endpoint')));
|
|
210
213
|
}
|
|
211
214
|
}, 9999);
|
package/services/base/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OptimalProcessParams, OptimalProcessResult } from '@subwallet/extension-base/types/service-base';
|
|
1
2
|
import { PromiseHandler } from '@subwallet/extension-base/utils/promise';
|
|
2
3
|
export declare enum ServiceStatus {
|
|
3
4
|
NOT_INITIALIZED = "not_initialized",
|
|
@@ -32,3 +33,6 @@ export interface CronServiceInterface {
|
|
|
32
33
|
startCron: () => Promise<void>;
|
|
33
34
|
stopCron: () => Promise<void>;
|
|
34
35
|
}
|
|
36
|
+
export interface ServiceWithProcessInterface {
|
|
37
|
+
generateOptimalProcess(params: OptimalProcessParams): Promise<OptimalProcessResult>;
|
|
38
|
+
}
|
|
@@ -28,7 +28,7 @@ export const _BALANCE_CHAIN_GROUP = {
|
|
|
28
28
|
kintsugi: ['kintsugi', 'interlay', 'kintsugi_test', 'mangatax_para'],
|
|
29
29
|
genshiro: ['genshiro_testnet', 'genshiro'],
|
|
30
30
|
equilibrium_parachain: ['equilibrium_parachain'],
|
|
31
|
-
bifrost: ['bifrost', 'acala', 'karura', 'acala_testnet', 'pioneer', 'bitcountry', 'bifrost_dot', 'hydradx_main', 'pendulum', 'amplitude', 'continuum_network'],
|
|
31
|
+
bifrost: ['bifrost', 'acala', 'karura', 'acala_testnet', 'pioneer', 'bitcountry', 'bifrost_dot', 'hydradx_main', 'hydradx_rococo', 'pendulum', 'amplitude', 'continuum_network'],
|
|
32
32
|
statemine: ['statemine', 'astar', 'shiden', 'statemint', 'moonbeam', 'moonbase', 'moonriver', 'crabParachain', 'darwinia2', 'parallel', 'calamari', 'manta_network', 'rococo_assethub', 'liberlandTest', 'liberland', 'dentnet', 'pangolin', 'crust', 'phala', 'shibuya'],
|
|
33
33
|
kusama: ['kusama', 'kintsugi', 'kintsugi_test', 'interlay', 'acala', 'statemint', 'karura', 'bifrost'],
|
|
34
34
|
// perhaps there are some runtime updates
|
|
@@ -23,6 +23,7 @@ export declare class ChainService {
|
|
|
23
23
|
private assetRegistrySubject;
|
|
24
24
|
private multiChainAssetMapSubject;
|
|
25
25
|
private xcmRefMapSubject;
|
|
26
|
+
private swapRefMapSubject;
|
|
26
27
|
private assetLogoMapSubject;
|
|
27
28
|
private chainLogoMapSubject;
|
|
28
29
|
private assetMapPatch;
|
|
@@ -31,7 +32,9 @@ export declare class ChainService {
|
|
|
31
32
|
private assetSettingSubject;
|
|
32
33
|
private logger;
|
|
33
34
|
constructor(dbService: DatabaseService, eventService: EventService);
|
|
35
|
+
subscribeSwapRefMap(): Subject<Record<string, _AssetRef>>;
|
|
34
36
|
get xcmRefMap(): Record<string, _AssetRef>;
|
|
37
|
+
get swapRefMap(): Record<string, _AssetRef>;
|
|
35
38
|
getEvmApi(slug: string): import("./handler/EvmApi").EvmApi;
|
|
36
39
|
getEvmApiMap(): Record<string, import("./handler/EvmApi").EvmApi>;
|
|
37
40
|
getSubstrateApiMap(): Record<string, import("./handler/SubstrateApi").SubstrateApi>;
|
|
@@ -90,6 +93,7 @@ export declare class ChainService {
|
|
|
90
93
|
autoEnableTokens(): Promise<void>;
|
|
91
94
|
handleLatestData(): void;
|
|
92
95
|
private initApis;
|
|
96
|
+
initSingleApi(slug: string): Promise<boolean>;
|
|
93
97
|
private initApiForChain;
|
|
94
98
|
private destroyApiForChain;
|
|
95
99
|
enableChain(chainSlug: string): Promise<boolean>;
|
|
@@ -35,6 +35,7 @@ export class ChainService {
|
|
|
35
35
|
assetRegistrySubject = new Subject();
|
|
36
36
|
multiChainAssetMapSubject = new Subject();
|
|
37
37
|
xcmRefMapSubject = new Subject();
|
|
38
|
+
swapRefMapSubject = new Subject();
|
|
38
39
|
assetLogoMapSubject = new BehaviorSubject(AssetLogoMap);
|
|
39
40
|
chainLogoMapSubject = new BehaviorSubject(ChainLogoMap);
|
|
40
41
|
assetMapPatch = JSON.stringify({});
|
|
@@ -50,6 +51,7 @@ export class ChainService {
|
|
|
50
51
|
this.chainStateMapSubject.next(this.dataMap.chainStateMap);
|
|
51
52
|
this.assetRegistrySubject.next(this.dataMap.assetRegistry);
|
|
52
53
|
this.xcmRefMapSubject.next(this.xcmRefMap);
|
|
54
|
+
this.swapRefMapSubject.next(this.swapRefMap);
|
|
53
55
|
if (MODULE_SUPPORT.MANTA_ZK) {
|
|
54
56
|
console.log('Init Manta ZK');
|
|
55
57
|
this.mantaChainHandler = new MantaPrivateHandler(dbService);
|
|
@@ -58,6 +60,9 @@ export class ChainService {
|
|
|
58
60
|
this.evmChainHandler = new EvmChainHandler(this);
|
|
59
61
|
this.logger = createLogger('chain-service');
|
|
60
62
|
}
|
|
63
|
+
subscribeSwapRefMap() {
|
|
64
|
+
return this.swapRefMapSubject;
|
|
65
|
+
}
|
|
61
66
|
|
|
62
67
|
// Getter
|
|
63
68
|
get xcmRefMap() {
|
|
@@ -69,6 +74,15 @@ export class ChainService {
|
|
|
69
74
|
});
|
|
70
75
|
return result;
|
|
71
76
|
}
|
|
77
|
+
get swapRefMap() {
|
|
78
|
+
const result = {};
|
|
79
|
+
Object.entries(this.dataMap.assetRefMap).forEach(([key, assetRef]) => {
|
|
80
|
+
if (assetRef.path === _AssetRefPath.SWAP) {
|
|
81
|
+
result[key] = assetRef;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
72
86
|
getEvmApi(slug) {
|
|
73
87
|
return this.evmChainHandler.getEvmApiByChain(slug);
|
|
74
88
|
}
|
|
@@ -481,6 +495,7 @@ export class ChainService {
|
|
|
481
495
|
});
|
|
482
496
|
this.dataMap.assetRefMap = updatedAssetRefMap;
|
|
483
497
|
this.xcmRefMapSubject.next(this.xcmRefMap);
|
|
498
|
+
this.swapRefMapSubject.next(this.swapRefMap);
|
|
484
499
|
this.logger.log('Finished updating latest asset ref');
|
|
485
500
|
}
|
|
486
501
|
handleLatestPriceId(latestPriceIds) {
|
|
@@ -594,6 +609,15 @@ export class ChainService {
|
|
|
594
609
|
}
|
|
595
610
|
}));
|
|
596
611
|
}
|
|
612
|
+
async initSingleApi(slug) {
|
|
613
|
+
const chainInfoMap = this.getChainInfoMap();
|
|
614
|
+
const chainStateMap = this.getChainStateMap();
|
|
615
|
+
if (!chainStateMap[slug].active) {
|
|
616
|
+
return false;
|
|
617
|
+
}
|
|
618
|
+
await this.initApiForChain(chainInfoMap[slug]);
|
|
619
|
+
return true;
|
|
620
|
+
}
|
|
597
621
|
async initApiForChain(chainInfo) {
|
|
598
622
|
const {
|
|
599
623
|
endpoint,
|
|
@@ -51,14 +51,15 @@ export declare function _isSubstrateRelayChain(chainInfo: _ChainInfo): boolean;
|
|
|
51
51
|
export declare function _isSubstrateParaChain(chainInfo: _ChainInfo): boolean;
|
|
52
52
|
export declare function _getEvmAbiExplorer(chainInfo: _ChainInfo): string;
|
|
53
53
|
export declare function _isAssetValuable(assetInfo: _ChainAsset): boolean;
|
|
54
|
-
export declare function _getMultiChainAsset(assetInfo
|
|
55
|
-
export declare function _getAssetPriceId(assetInfo
|
|
54
|
+
export declare function _getMultiChainAsset(assetInfo?: _ChainAsset): string;
|
|
55
|
+
export declare function _getAssetPriceId(assetInfo?: _ChainAsset): string;
|
|
56
|
+
export declare function _getAssetName(assetInfo?: _ChainAsset): string;
|
|
56
57
|
export declare function _getMultiChainAssetPriceId(multiChainAsset: _MultiChainAsset): string;
|
|
57
|
-
export declare function _getAssetSymbol(assetInfo
|
|
58
|
+
export declare function _getAssetSymbol(assetInfo?: _ChainAsset): string;
|
|
58
59
|
export declare function _getMultiChainAssetSymbol(multiChainAsset: _MultiChainAsset): string;
|
|
59
|
-
export declare function _getAssetOriginChain(assetInfo
|
|
60
|
+
export declare function _getAssetOriginChain(assetInfo?: _ChainAsset): string;
|
|
60
61
|
export declare function _getChainName(chainInfo: _ChainInfo): string;
|
|
61
|
-
export declare function _getAssetDecimals(assetInfo
|
|
62
|
+
export declare function _getAssetDecimals(assetInfo?: _ChainAsset): number;
|
|
62
63
|
export declare function _getBlockExplorerFromChain(chainInfo: _ChainInfo): string | undefined;
|
|
63
64
|
export declare function _parseMetadataForSmartContractAsset(contractAddress: string): Record<string, string>;
|
|
64
65
|
export declare function _isChainTestNet(chainInfo: _ChainInfo): boolean;
|
|
@@ -280,6 +280,9 @@ export function _getMultiChainAsset(assetInfo) {
|
|
|
280
280
|
export function _getAssetPriceId(assetInfo) {
|
|
281
281
|
return (assetInfo === null || assetInfo === void 0 ? void 0 : assetInfo.priceId) || '';
|
|
282
282
|
}
|
|
283
|
+
export function _getAssetName(assetInfo) {
|
|
284
|
+
return (assetInfo === null || assetInfo === void 0 ? void 0 : assetInfo.name) || '';
|
|
285
|
+
}
|
|
283
286
|
export function _getMultiChainAssetPriceId(multiChainAsset) {
|
|
284
287
|
return (multiChainAsset === null || multiChainAsset === void 0 ? void 0 : multiChainAsset.priceId) || '';
|
|
285
288
|
}
|
|
@@ -290,13 +293,13 @@ export function _getMultiChainAssetSymbol(multiChainAsset) {
|
|
|
290
293
|
return multiChainAsset.symbol;
|
|
291
294
|
}
|
|
292
295
|
export function _getAssetOriginChain(assetInfo) {
|
|
293
|
-
return assetInfo.originChain;
|
|
296
|
+
return (assetInfo === null || assetInfo === void 0 ? void 0 : assetInfo.originChain) || '';
|
|
294
297
|
}
|
|
295
298
|
export function _getChainName(chainInfo) {
|
|
296
299
|
return chainInfo.name;
|
|
297
300
|
}
|
|
298
301
|
export function _getAssetDecimals(assetInfo) {
|
|
299
|
-
return assetInfo.decimals || 0;
|
|
302
|
+
return (assetInfo === null || assetInfo === void 0 ? void 0 : assetInfo.decimals) || 0;
|
|
300
303
|
}
|
|
301
304
|
export function _getBlockExplorerFromChain(chainInfo) {
|
|
302
305
|
let blockExplorer;
|
|
@@ -5,7 +5,7 @@ import fetch from 'cross-fetch';
|
|
|
5
5
|
const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
|
|
6
6
|
const branchName = process.env.BRANCH_NAME || 'subwallet-dev';
|
|
7
7
|
const fetchDomain = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'https://chain-list-assets.subwallet.app' : 'https://dev.sw-chain-list-assets.pages.dev';
|
|
8
|
-
const ChainListVersion = '0.2.
|
|
8
|
+
const ChainListVersion = '0.2.55-beta.3';
|
|
9
9
|
export async function fetchPatchData(slug) {
|
|
10
10
|
try {
|
|
11
11
|
const fetchPromise = fetch(`${fetchDomain}/patch/${ChainListVersion}/${slug}`);
|
|
@@ -13,6 +13,7 @@ export declare const _STAKING_CHAIN_GROUP: {
|
|
|
13
13
|
krest_network: string[];
|
|
14
14
|
manta: string[];
|
|
15
15
|
};
|
|
16
|
+
export declare const MaxEraRewardPointsEras = 14;
|
|
16
17
|
export declare const ST_LIQUID_TOKEN_ABI: Record<string, any>;
|
|
17
18
|
export declare const MANTA_VALIDATOR_POINTS_PER_BLOCK = 20;
|
|
18
19
|
export declare const MANTA_MIN_DELEGATION = 500;
|
|
@@ -18,6 +18,7 @@ export const _STAKING_CHAIN_GROUP = {
|
|
|
18
18
|
krest_network: ['krest_network'],
|
|
19
19
|
manta: ['manta_network']
|
|
20
20
|
};
|
|
21
|
+
export const MaxEraRewardPointsEras = 14;
|
|
21
22
|
|
|
22
23
|
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
|
|
23
24
|
export const ST_LIQUID_TOKEN_ABI = require("./abis/st_liquid_token_abi.json");
|
|
@@ -242,11 +242,12 @@ export default class AstarNativeStakingPoolHandler extends BaseParaNativeStaking
|
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
244
|
async subscribePoolPosition(useAddresses, resultCallback) {
|
|
245
|
+
var _substrateApi$api$que;
|
|
245
246
|
let cancel = false;
|
|
246
247
|
const substrateApi = await this.substrateApi.isReady;
|
|
247
248
|
const defaultInfo = this.baseInfo;
|
|
248
249
|
const chainInfo = this.chainInfo;
|
|
249
|
-
const unsub = await substrateApi.api.query.dappsStaking.ledger.multi(useAddresses, async ledgers => {
|
|
250
|
+
const unsub = await ((_substrateApi$api$que = substrateApi.api.query.dappsStaking) === null || _substrateApi$api$que === void 0 ? void 0 : _substrateApi$api$que.ledger.multi(useAddresses, async ledgers => {
|
|
250
251
|
if (cancel) {
|
|
251
252
|
unsub();
|
|
252
253
|
return;
|
|
@@ -280,10 +281,10 @@ export default class AstarNativeStakingPoolHandler extends BaseParaNativeStaking
|
|
|
280
281
|
}
|
|
281
282
|
}));
|
|
282
283
|
}
|
|
283
|
-
});
|
|
284
|
+
}));
|
|
284
285
|
return () => {
|
|
285
286
|
cancel = true;
|
|
286
|
-
unsub();
|
|
287
|
+
unsub && unsub();
|
|
287
288
|
};
|
|
288
289
|
}
|
|
289
290
|
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
|
|
5
5
|
import { BasicTxErrorType, ExtrinsicType, StakingTxErrorType } from '@subwallet/extension-base/background/KoniTypes';
|
|
6
|
-
import { calculateAlephZeroValidatorReturn, calculateChainStakedReturnV2, calculateInflation, calculateTernoaValidatorReturn, calculateValidatorStakedReturn, getAvgValidatorEraReward, getCommission, getMaxValidatorErrorMessage, getMinStakeErrorMessage, getSupportedDaysByHistoryDepth } from '@subwallet/extension-base/koni/api/staking/bonding/utils';
|
|
6
|
+
import { calculateAlephZeroValidatorReturn, calculateChainStakedReturnV2, calculateInflation, calculateTernoaValidatorReturn, calculateValidatorStakedReturn, getAvgValidatorEraReward, getCommission, getMaxValidatorErrorMessage, getMinStakeErrorMessage, getSupportedDaysByHistoryDepth, getTopValidatorByPoints, getValidatorPointsMap } 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 } from '@subwallet/extension-base/services/earning-service/constants';
|
|
9
|
+
import { _STAKING_CHAIN_GROUP, MaxEraRewardPointsEras } from '@subwallet/extension-base/services/earning-service/constants';
|
|
10
10
|
import { 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';
|
|
@@ -274,11 +274,23 @@ export default class RelayNativeStakingPoolHandler extends BaseNativeStakingPool
|
|
|
274
274
|
if (!poolInfo || !poolInfo.statistic) {
|
|
275
275
|
return Promise.reject(new TransactionError(BasicTxErrorType.INTERNAL_ERROR));
|
|
276
276
|
}
|
|
277
|
-
const _era = await chainApi.api.query.staking.currentEra();
|
|
277
|
+
const [_era, _activeEraInfo] = await Promise.all([chainApi.api.query.staking.currentEra(), chainApi.api.query.staking.activeEra()]);
|
|
278
278
|
const currentEra = _era.toString();
|
|
279
|
+
const activeEraInfo = _activeEraInfo.toPrimitive();
|
|
280
|
+
const activeEra = activeEraInfo.index;
|
|
279
281
|
const allValidators = [];
|
|
280
282
|
const validatorInfoList = [];
|
|
281
|
-
const
|
|
283
|
+
const maxEraRewardPointsEras = MaxEraRewardPointsEras;
|
|
284
|
+
const endEraForPoints = parseInt(activeEra) - 1;
|
|
285
|
+
let startEraForPoints = endEraForPoints - maxEraRewardPointsEras + 1;
|
|
286
|
+
const [_totalEraStake, _eraStakers, _minBond, _stakingRewards, _validators, ..._eraRewardPoints] = await Promise.all([chainApi.api.query.staking.erasTotalStake(parseInt(currentEra)), chainApi.api.query.staking.erasStakers.entries(parseInt(currentEra)), 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))]);
|
|
287
|
+
const eraRewardMap = {};
|
|
288
|
+
for (const item of _eraRewardPoints[0]) {
|
|
289
|
+
eraRewardMap[startEraForPoints] = item.toHuman();
|
|
290
|
+
startEraForPoints++;
|
|
291
|
+
}
|
|
292
|
+
const validatorPointsMap = getValidatorPointsMap(eraRewardMap);
|
|
293
|
+
const topValidatorList = getTopValidatorByPoints(validatorPointsMap);
|
|
282
294
|
|
|
283
295
|
// filter blocked validators
|
|
284
296
|
const validators = _validators;
|
|
@@ -309,6 +321,11 @@ export default class RelayNativeStakingPoolHandler extends BaseNativeStakingPool
|
|
|
309
321
|
const rawValidatorStat = item[1].toHuman();
|
|
310
322
|
const validatorAddress = rawValidatorInfo[1];
|
|
311
323
|
if (!blockValidatorList.includes(validatorAddress)) {
|
|
324
|
+
var _validatorPointsMap$v;
|
|
325
|
+
let isTopQuartile = false;
|
|
326
|
+
if (topValidatorList.includes(validatorAddress)) {
|
|
327
|
+
isTopQuartile = true;
|
|
328
|
+
}
|
|
312
329
|
const rawTotalStake = rawValidatorStat.total;
|
|
313
330
|
const rawOwnStake = rawValidatorStat.own;
|
|
314
331
|
const bnTotalStake = new BN(rawTotalStake.replaceAll(',', ''));
|
|
@@ -333,7 +350,9 @@ export default class RelayNativeStakingPoolHandler extends BaseNativeStakingPool
|
|
|
333
350
|
blocked: false,
|
|
334
351
|
isVerified: false,
|
|
335
352
|
minBond,
|
|
336
|
-
isCrowded: unlimitedNominatorRewarded ? false : nominatorCount > parseInt(maxNominatorRewarded)
|
|
353
|
+
isCrowded: unlimitedNominatorRewarded ? false : nominatorCount > parseInt(maxNominatorRewarded),
|
|
354
|
+
eraRewardPoint: ((_validatorPointsMap$v = validatorPointsMap[validatorAddress]) !== null && _validatorPointsMap$v !== void 0 ? _validatorPointsMap$v : BN_ZERO).toString(),
|
|
355
|
+
topQuartile: isTopQuartile
|
|
337
356
|
});
|
|
338
357
|
}
|
|
339
358
|
}
|
|
@@ -38,6 +38,7 @@ export interface EventRegistry {
|
|
|
38
38
|
'buy.tokens.ready': [boolean];
|
|
39
39
|
'buy.services.ready': [boolean];
|
|
40
40
|
'earning.ready': [boolean];
|
|
41
|
+
'swap.ready': [boolean];
|
|
41
42
|
}
|
|
42
43
|
export declare type EventType = keyof EventRegistry;
|
|
43
44
|
export declare const COMMON_RELOAD_EVENTS: EventType[];
|