@subwallet/extension-base 1.3.53-0 → 1.3.54-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/background/KoniTypes.d.ts +10 -3
- package/cjs/koni/background/handlers/Extension.js +4 -4
- package/cjs/koni/background/handlers/State.js +1 -0
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/transfer/xcm/snowBridge.js +21 -10
- package/cjs/services/chain-online-service/index.js +168 -15
- package/cjs/services/chain-service/index.js +39 -10
- package/cjs/services/chain-service/utils/patch.js +2 -2
- package/cjs/services/earning-service/constants/chains.js +2 -4
- package/cjs/services/earning-service/handlers/base.js +1 -1
- package/cjs/services/earning-service/handlers/native-staking/base.js +4 -2
- package/cjs/services/earning-service/handlers/native-staking/dtao.js +9 -3
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +1 -10
- package/cjs/services/earning-service/handlers/native-staking/tao.js +24 -14
- package/cjs/services/earning-service/service.js +2 -2
- package/cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol.js +6 -2
- package/cjs/services/migration-service/scripts/databases/MigrateAssetSetting.js +6 -2
- package/cjs/services/migration-service/scripts/index.js +2 -2
- package/cjs/services/swap-service/index.js +24 -18
- package/cjs/services/transaction-service/utils.js +25 -16
- package/koni/background/handlers/Extension.d.ts +1 -1
- package/koni/background/handlers/Extension.js +4 -4
- package/koni/background/handlers/State.js +1 -0
- package/package.json +8 -6
- package/packageInfo.js +1 -1
- package/services/balance-service/transfer/xcm/snowBridge.js +21 -10
- package/services/chain-online-service/index.d.ts +4 -1
- package/services/chain-online-service/index.js +168 -15
- package/services/chain-service/index.js +39 -10
- package/services/chain-service/utils/patch.d.ts +1 -1
- package/services/chain-service/utils/patch.js +2 -2
- package/services/earning-service/constants/chains.d.ts +0 -1
- package/services/earning-service/constants/chains.js +1 -2
- package/services/earning-service/handlers/base.d.ts +3 -3
- package/services/earning-service/handlers/base.js +1 -1
- package/services/earning-service/handlers/native-staking/base.js +4 -2
- package/services/earning-service/handlers/native-staking/dtao.d.ts +4 -3
- package/services/earning-service/handlers/native-staking/dtao.js +9 -3
- package/services/earning-service/handlers/native-staking/relay-chain.d.ts +0 -2
- package/services/earning-service/handlers/native-staking/relay-chain.js +2 -11
- package/services/earning-service/handlers/native-staking/tao.d.ts +1 -0
- package/services/earning-service/handlers/native-staking/tao.js +24 -14
- package/services/earning-service/service.d.ts +3 -3
- package/services/earning-service/service.js +2 -2
- package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol.js +6 -2
- package/services/migration-service/scripts/databases/MigrateAssetSetting.js +6 -2
- package/services/migration-service/scripts/index.js +2 -2
- package/services/swap-service/index.js +24 -18
- package/services/transaction-service/utils.js +25 -16
- package/types/yield/actions/join/submit.d.ts +5 -0
- package/types/yield/actions/others.d.ts +7 -2
- package/types/yield/info/account/info.d.ts +1 -0
|
@@ -16,7 +16,7 @@ import { AuthUrls } from '@subwallet/extension-base/services/request-service/typ
|
|
|
16
16
|
import { CrowdloanContributionsResponse } from '@subwallet/extension-base/services/subscan-service/types';
|
|
17
17
|
import { BitcoinTransactionData, SWTransactionResponse, SWTransactionResult } from '@subwallet/extension-base/services/transaction-service/types';
|
|
18
18
|
import { WalletConnectNotSupportRequest, WalletConnectSessionRequest } from '@subwallet/extension-base/services/wallet-connect-service/types';
|
|
19
|
-
import { AccountChainType, AccountJson, AccountsWithCurrentAddress, AddressJson, BalanceJson, BaseRequestSign, BuyServiceInfo, BuyTokenInfo, CommonOptimalTransferPath, CurrentAccountInfo, EarningRewardHistoryItem, EarningRewardJson, EarningStatus, HandleYieldStepParams, InternalRequestSign, LeavePoolAdditionalData, NominationPoolInfo, OptimalYieldPath, OptimalYieldPathParams, RequestAccountBatchExportV2, RequestAccountCreateSuriV2, RequestAccountNameValidate, RequestAccountProxyEdit, RequestAccountProxyForget, RequestBatchJsonGetAccountInfo, RequestBatchRestoreV2, RequestBounceableValidate, RequestChangeAllowOneSign, RequestChangeTonWalletContractVersion, RequestCheckCrossChainTransfer, RequestCheckPublicAndSecretKey, RequestCheckTransfer, RequestCrossChainTransfer, RequestDeriveCreateMultiple, RequestDeriveCreateV3, RequestDeriveValidateV2, RequestEarlyValidateYield,
|
|
19
|
+
import { AccountChainType, AccountJson, AccountsWithCurrentAddress, AddressJson, BalanceJson, BaseRequestSign, BuyServiceInfo, BuyTokenInfo, CommonOptimalTransferPath, CurrentAccountInfo, EarningRewardHistoryItem, EarningRewardJson, EarningStatus, HandleYieldStepParams, InternalRequestSign, LeavePoolAdditionalData, NominationPoolInfo, OptimalYieldPath, OptimalYieldPathParams, RequestAccountBatchExportV2, RequestAccountCreateSuriV2, RequestAccountNameValidate, RequestAccountProxyEdit, RequestAccountProxyForget, RequestBatchJsonGetAccountInfo, RequestBatchRestoreV2, RequestBounceableValidate, RequestChangeAllowOneSign, RequestChangeTonWalletContractVersion, RequestCheckCrossChainTransfer, RequestCheckPublicAndSecretKey, RequestCheckTransfer, RequestCrossChainTransfer, RequestDeriveCreateMultiple, RequestDeriveCreateV3, RequestDeriveValidateV2, RequestEarlyValidateYield, RequestEarningImpact, RequestExportAccountProxyMnemonic, RequestGetAllTonWalletContractVersion, RequestGetAmountForPair, RequestGetDeriveAccounts, RequestGetDeriveSuggestion, RequestGetTokensCanPayFee, RequestGetYieldPoolTargets, RequestInputAccountSubscribe, RequestJsonGetAccountInfo, RequestJsonRestoreV2, RequestMetadataHash, RequestMnemonicCreateV2, RequestMnemonicValidateV2, RequestPrivateKeyValidateV2, RequestShortenMetadata, RequestStakeCancelWithdrawal, RequestStakeClaimReward, RequestSubmitProcessTransaction, RequestSubscribeProcessById, RequestTransfer, RequestUnlockDotCheckCanMint, RequestUnlockDotSubscribeMintedData, RequestYieldLeave, RequestYieldStepSubmit, RequestYieldWithdrawal, ResponseAccountBatchExportV2, ResponseAccountCreateSuriV2, ResponseAccountNameValidate, ResponseBatchJsonGetAccountInfo, ResponseCheckPublicAndSecretKey, ResponseDeriveValidateV2, ResponseEarlyValidateYield, ResponseExportAccountProxyMnemonic, ResponseGetAllTonWalletContractVersion, ResponseGetDeriveAccounts, ResponseGetDeriveSuggestion, ResponseGetYieldPoolTargets, ResponseInputAccountSubscribe, ResponseJsonGetAccountInfo, ResponseMetadataHash, ResponseMnemonicCreateV2, ResponseMnemonicValidateV2, ResponsePrivateKeyValidateV2, ResponseShortenMetadata, ResponseSubscribeProcessAlive, ResponseSubscribeProcessById, StorageDataInterface, SubmitChangeValidatorStaking, SubmitYieldJoinData, SubmitYieldStepData, SubnetYieldPositionInfo, SwapPair, SwapQuoteResponse, SwapRequest, SwapRequestResult, SwapRequestV2, SwapSubmitParams, SwapTxData, TokenSpendingApprovalParams, UnlockDotTransactionNft, UnstakingStatus, ValidateSwapProcessParams, ValidateYieldProcessParams, YieldPoolInfo, YieldPoolType, YieldPositionInfo } from '@subwallet/extension-base/types';
|
|
20
20
|
import { RequestSubmitSignPsbtTransfer, RequestSubmitTransfer, RequestSubmitTransferWithId, RequestSubscribeTransfer, ResponseSubscribeTransfer, ResponseSubscribeTransferConfirmation } from '@subwallet/extension-base/types/balance/transfer';
|
|
21
21
|
import { RequestClaimBridge } from '@subwallet/extension-base/types/bridge';
|
|
22
22
|
import { GetNotificationParams, RequestIsClaimedPolygonBridge, RequestSwitchStatusParams } from '@subwallet/extension-base/types/notification';
|
|
@@ -33,7 +33,7 @@ import { JsonRpcPayload, JsonRpcResponse } from 'web3-core-helpers';
|
|
|
33
33
|
import { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
|
|
34
34
|
import { SignerResult } from '@polkadot/types/types/extrinsic';
|
|
35
35
|
import { HexString } from '@polkadot/util/types';
|
|
36
|
-
import {
|
|
36
|
+
import { EarningImpactResult } from '../services/earning-service/handlers/native-staking/dtao';
|
|
37
37
|
import { TransactionWarning } from './warnings/TransactionWarning';
|
|
38
38
|
export declare enum RuntimeEnvironment {
|
|
39
39
|
Web = "Web",
|
|
@@ -1388,9 +1388,15 @@ export interface BondingSubmitParams extends BaseRequestSign {
|
|
|
1388
1388
|
metadata: SubnetYieldPositionInfo;
|
|
1389
1389
|
type: YieldPoolType;
|
|
1390
1390
|
chain: string;
|
|
1391
|
+
slug: string;
|
|
1391
1392
|
};
|
|
1392
1393
|
poolPosition?: {
|
|
1393
1394
|
chain: string;
|
|
1395
|
+
slug: string;
|
|
1396
|
+
};
|
|
1397
|
+
subnetData?: {
|
|
1398
|
+
netuid: number;
|
|
1399
|
+
stakingFee?: string;
|
|
1394
1400
|
};
|
|
1395
1401
|
}
|
|
1396
1402
|
export declare type RequestBondingSubmit = InternalRequestSign<BondingSubmitParams>;
|
|
@@ -1407,6 +1413,7 @@ export interface UnbondingSubmitParams extends BaseRequestSign {
|
|
|
1407
1413
|
poolInfo?: {
|
|
1408
1414
|
metadata: SubnetYieldPositionInfo;
|
|
1409
1415
|
};
|
|
1416
|
+
stakingFee?: string;
|
|
1410
1417
|
}
|
|
1411
1418
|
export declare type RequestUnbondingSubmit = InternalRequestSign<UnbondingSubmitParams>;
|
|
1412
1419
|
export interface StakePoolingBondingParams extends BaseRequestSign {
|
|
@@ -1935,7 +1942,7 @@ export interface KoniRequestSignatures {
|
|
|
1935
1942
|
'pri(yield.withdraw.submit)': [RequestYieldWithdrawal, SWTransactionResponse];
|
|
1936
1943
|
'pri(yield.cancelWithdrawal.submit)': [RequestStakeCancelWithdrawal, SWTransactionResponse];
|
|
1937
1944
|
'pri(yield.claimReward.submit)': [RequestStakeClaimReward, SWTransactionResponse];
|
|
1938
|
-
'pri(yield.
|
|
1945
|
+
'pri(yield.getEarningImpact)': [RequestEarningImpact, EarningImpactResult];
|
|
1939
1946
|
'pri(yield.changeValidator.submit)': [SubmitYieldJoinData, SWTransactionResponse];
|
|
1940
1947
|
'pri(transaction.history.getSubscription)': [null, TransactionHistoryItem[], TransactionHistoryItem[]];
|
|
1941
1948
|
'pri(transaction.history.subscribe)': [RequestSubscribeHistory, ResponseSubscribeHistory, TransactionHistoryItem[]];
|
|
@@ -4051,7 +4051,7 @@ class KoniExtension {
|
|
|
4051
4051
|
chainType: (poolHandler === null || poolHandler === void 0 ? void 0 : poolHandler.transactionChainType) || _KoniTypes.ChainType.SUBSTRATE
|
|
4052
4052
|
});
|
|
4053
4053
|
}
|
|
4054
|
-
async
|
|
4054
|
+
async yieldGetEarningImpact(params) {
|
|
4055
4055
|
const {
|
|
4056
4056
|
slug
|
|
4057
4057
|
} = params;
|
|
@@ -4059,7 +4059,7 @@ class KoniExtension {
|
|
|
4059
4059
|
if (!poolHandler) {
|
|
4060
4060
|
return this.#koniState.transactionService.generateBeforeHandleResponseErrors([new _TransactionError.TransactionError(_types4.BasicTxErrorType.INVALID_PARAMS)]);
|
|
4061
4061
|
}
|
|
4062
|
-
const slippage = await this.#koniState.earningService.
|
|
4062
|
+
const slippage = await this.#koniState.earningService.yieldGetEarningImpact(params);
|
|
4063
4063
|
return slippage;
|
|
4064
4064
|
}
|
|
4065
4065
|
async handleYieldChangeValidator(params) {
|
|
@@ -4953,8 +4953,8 @@ class KoniExtension {
|
|
|
4953
4953
|
return await this.yieldSubmitCancelWithdrawal(request);
|
|
4954
4954
|
case 'pri(yield.claimReward.submit)':
|
|
4955
4955
|
return await this.yieldSubmitClaimReward(request);
|
|
4956
|
-
case 'pri(yield.
|
|
4957
|
-
return await this.
|
|
4956
|
+
case 'pri(yield.getEarningImpact)':
|
|
4957
|
+
return await this.yieldGetEarningImpact(request);
|
|
4958
4958
|
case 'pri(yield.changeValidator.submit)':
|
|
4959
4959
|
return await this.handleYieldChangeValidator(request);
|
|
4960
4960
|
/* Others */
|
|
@@ -1836,6 +1836,7 @@ class KoniState {
|
|
|
1836
1836
|
this.chainService.resetWallet(resetAll);
|
|
1837
1837
|
await this.walletConnectService.resetWallet(resetAll);
|
|
1838
1838
|
await this.chainService.init();
|
|
1839
|
+
this.chainOnlineService.resetFirstApplied();
|
|
1839
1840
|
this.chainOnlineService.checkLatestData();
|
|
1840
1841
|
this.chainService.checkLatestData();
|
|
1841
1842
|
this.chainService.subscribeChainInfoMap().subscribe(() => {
|
package/cjs/packageInfo.js
CHANGED
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getSnowBridgeEvmTransfer = getSnowBridgeEvmTransfer;
|
|
7
|
+
var _api = require("@snowbridge/api");
|
|
8
|
+
var _registry = require("@snowbridge/registry");
|
|
7
9
|
var _web = require("@subwallet/extension-base/koni/api/contract-handler/evm/web3");
|
|
8
10
|
var _utils = require("@subwallet/extension-base/koni/api/contract-handler/utils");
|
|
9
11
|
var _utils2 = require("@subwallet/extension-base/services/chain-service/utils");
|
|
@@ -13,13 +15,6 @@ var _utilCrypto = require("@polkadot/util-crypto");
|
|
|
13
15
|
// Copyright 2019-2022 @subwallet/extension-base
|
|
14
16
|
// SPDX-License-Identifier: Apache-2.0
|
|
15
17
|
|
|
16
|
-
async function getSendFeeToken(contract, tokenContract, destChainParaId, destinationFee) {
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
|
|
18
|
-
const quoteSendTokenFee = contract.methods.quoteSendTokenFee(tokenContract, destChainParaId, destinationFee);
|
|
19
|
-
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
|
21
|
-
return await quoteSendTokenFee.call();
|
|
22
|
-
}
|
|
23
18
|
async function getSnowBridgeEvmTransfer(tokenInfo, originChainInfo, destinationChainInfo, sender, recipientAddress, value, evmApi, _feeInfo, feeCustom, feeOption) {
|
|
24
19
|
const snowBridgeContractAddress = (0, _utils.getSnowBridgeGatewayContract)(originChainInfo.slug);
|
|
25
20
|
const snowBridgeContract = (0, _web.getWeb3Contract)(snowBridgeContractAddress, evmApi, _utils._SNOWBRIDGE_GATEWAY_ABI);
|
|
@@ -29,7 +24,24 @@ async function getSnowBridgeEvmTransfer(tokenInfo, originChainInfo, destinationC
|
|
|
29
24
|
kind: 1,
|
|
30
25
|
data: (0, _utils2._isChainEvmCompatible)(destinationChainInfo) ? recipientAddress : (0, _util.u8aToHex)((0, _utilCrypto.decodeAddress)(recipientAddress))
|
|
31
26
|
};
|
|
32
|
-
|
|
27
|
+
let destinationFee;
|
|
28
|
+
let totalFee;
|
|
29
|
+
try {
|
|
30
|
+
const environment = 'polkadot_mainnet';
|
|
31
|
+
const context = new _api.Context((0, _api.contextConfigFor)(environment));
|
|
32
|
+
const registry = (0, _registry.assetRegistryFor)(environment);
|
|
33
|
+
const deliveryFee = await _api.toPolkadotV2.getDeliveryFee(context, registry, tokenContract, destinationChainParaId);
|
|
34
|
+
console.log('deliveryFee', deliveryFee);
|
|
35
|
+
totalFee = deliveryFee.totalFeeInWei.toString();
|
|
36
|
+
destinationFee = (deliveryFee.destinationDeliveryFeeDOT + deliveryFee.destinationExecutionFeeDOT).toString();
|
|
37
|
+
|
|
38
|
+
// Clean up all open connections
|
|
39
|
+
await context.destroyContext();
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.error('Cannot get snow-bridge delivery fees with error:', error);
|
|
42
|
+
totalFee = '0';
|
|
43
|
+
destinationFee = '0';
|
|
44
|
+
}
|
|
33
45
|
|
|
34
46
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
|
|
35
47
|
const transferCall = snowBridgeContract.methods.sendToken(tokenContract, destinationChainParaId, recipient, destinationFee, value);
|
|
@@ -38,11 +50,10 @@ async function getSnowBridgeEvmTransfer(tokenInfo, originChainInfo, destinationC
|
|
|
38
50
|
const feeInfo = _feeInfo;
|
|
39
51
|
const _feeCustom = feeCustom;
|
|
40
52
|
const feeCombine = (0, _utils3.combineEthFee)(feeInfo, feeOption, _feeCustom);
|
|
41
|
-
const sendTokenFee = await getSendFeeToken(snowBridgeContract, tokenContract, destinationChainParaId, destinationFee);
|
|
42
53
|
const transactionConfig = {
|
|
43
54
|
from: sender,
|
|
44
55
|
to: snowBridgeContractAddress,
|
|
45
|
-
value:
|
|
56
|
+
value: totalFee,
|
|
46
57
|
data: transferEncodedCall,
|
|
47
58
|
...feeCombine
|
|
48
59
|
};
|
|
@@ -5,9 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ChainOnlineService = void 0;
|
|
7
7
|
var _chainList = require("@subwallet/chain-list");
|
|
8
|
+
var _types = require("@subwallet/chain-list/types");
|
|
8
9
|
var _constants = require("@subwallet/extension-base/services/chain-online-service/constants");
|
|
9
10
|
var _chainService = require("@subwallet/extension-base/services/chain-service");
|
|
10
|
-
var
|
|
11
|
+
var _types2 = require("@subwallet/extension-base/services/chain-service/types");
|
|
11
12
|
var _utils = require("@subwallet/extension-base/services/chain-service/utils");
|
|
12
13
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
13
14
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -20,6 +21,9 @@ class ChainOnlineService {
|
|
|
20
21
|
this.dbService = dbService;
|
|
21
22
|
this.firstApplied = false;
|
|
22
23
|
}
|
|
24
|
+
resetFirstApplied() {
|
|
25
|
+
this.firstApplied = false;
|
|
26
|
+
}
|
|
23
27
|
validatePatchWithHash(latestPatch) {
|
|
24
28
|
const {
|
|
25
29
|
ChainAsset,
|
|
@@ -67,7 +71,7 @@ class ChainOnlineService {
|
|
|
67
71
|
providers: _providers,
|
|
68
72
|
...info
|
|
69
73
|
} = _info;
|
|
70
|
-
const providers =
|
|
74
|
+
const providers = rs[slug] ? (_rs$slug = rs[slug]) === null || _rs$slug === void 0 ? void 0 : _rs$slug.providers : _providers;
|
|
71
75
|
rs[slug] = {
|
|
72
76
|
...info,
|
|
73
77
|
providers
|
|
@@ -75,6 +79,26 @@ class ChainOnlineService {
|
|
|
75
79
|
}
|
|
76
80
|
return rs;
|
|
77
81
|
}
|
|
82
|
+
checkExistedPredefinedChain(latestChainInfoMap, genesisHash, evmChainId) {
|
|
83
|
+
let duplicatedSlug = '';
|
|
84
|
+
if (genesisHash) {
|
|
85
|
+
for (const chainInfo of Object.values(latestChainInfoMap)) {
|
|
86
|
+
if (chainInfo.substrateInfo && chainInfo.substrateInfo.genesisHash === genesisHash) {
|
|
87
|
+
duplicatedSlug = chainInfo.slug;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
} else if (evmChainId) {
|
|
91
|
+
for (const chainInfo of Object.values(latestChainInfoMap)) {
|
|
92
|
+
if (chainInfo.evmInfo && chainInfo.evmInfo.evmChainId === evmChainId) {
|
|
93
|
+
duplicatedSlug = chainInfo.slug;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return duplicatedSlug;
|
|
98
|
+
}
|
|
99
|
+
generateSlugForSmartContractAsset(originChain, assetType, symbol, contractAddress) {
|
|
100
|
+
return `${originChain}-${assetType}-${symbol}-${contractAddress}`;
|
|
101
|
+
}
|
|
78
102
|
async handleLatestPatch(latestPatch) {
|
|
79
103
|
try {
|
|
80
104
|
var _await$this$settingSe;
|
|
@@ -94,31 +118,151 @@ class ChainOnlineService {
|
|
|
94
118
|
let assetRegistry = structuredClone(this.chainService.getAssetRegistry());
|
|
95
119
|
const currentChainStateMap = structuredClone(this.chainService.getChainStateMap());
|
|
96
120
|
const currentChainStatusMap = structuredClone(this.chainService.getChainStatusMap());
|
|
121
|
+
const assetSetting = structuredClone(await this.chainService.getAssetSettings());
|
|
122
|
+
const migratedAssetSetting = {};
|
|
97
123
|
let addedChain = [];
|
|
124
|
+
const customChains = [];
|
|
125
|
+
const deprecatedChains = [];
|
|
126
|
+
const deprecatedChainMap = {};
|
|
127
|
+
const deprecatedAssets = [];
|
|
98
128
|
if (isSafePatch && (!this.firstApplied || currentPatchVersion !== latestPatchVersion)) {
|
|
99
129
|
this.firstApplied = true;
|
|
100
130
|
|
|
101
131
|
// 2. merge data map
|
|
102
132
|
if (latestChainInfo && Object.keys(latestChainInfo).length > 0) {
|
|
133
|
+
const storedChainSettings = await this.dbService.getAllChainStore();
|
|
134
|
+
const storedChainSettingMap = {};
|
|
135
|
+
storedChainSettings.forEach(chainStoredSetting => {
|
|
136
|
+
storedChainSettingMap[chainStoredSetting.slug] = chainStoredSetting;
|
|
137
|
+
});
|
|
138
|
+
if (storedChainSettings.length > 0) {
|
|
139
|
+
for (const [storedSlug, storedChainInfo] of Object.entries(storedChainSettingMap)) {
|
|
140
|
+
if ((0, _utils._isCustomChain)(storedSlug)) {
|
|
141
|
+
var _storedChainInfo$subs, _storedChainInfo$evmI;
|
|
142
|
+
// Check if this custom chain duplicates any of the latest chainInfo from patch based on genesisHash (for Substrate) or EVM chain ID.
|
|
143
|
+
const duplicatedDefaultSlug = this.checkExistedPredefinedChain(latestChainInfo, (_storedChainInfo$subs = storedChainInfo.substrateInfo) === null || _storedChainInfo$subs === void 0 ? void 0 : _storedChainInfo$subs.genesisHash, (_storedChainInfo$evmI = storedChainInfo.evmInfo) === null || _storedChainInfo$evmI === void 0 ? void 0 : _storedChainInfo$evmI.evmChainId);
|
|
144
|
+
if (duplicatedDefaultSlug.length > 0) {
|
|
145
|
+
// Add the old custom chain slug to the list of deprecated chains.
|
|
146
|
+
deprecatedChainMap[storedSlug] = duplicatedDefaultSlug;
|
|
147
|
+
deprecatedChains.push(storedSlug);
|
|
148
|
+
const storedChainState = currentChainStateMap[storedSlug];
|
|
149
|
+
const storedChainStatus = currentChainStatusMap[storedSlug];
|
|
150
|
+
|
|
151
|
+
// Update the current chain state to use the new chain slug, inheriting the active/inactive status from custom chain and randomly assigning a provider
|
|
152
|
+
currentChainStateMap[duplicatedDefaultSlug] = {
|
|
153
|
+
slug: duplicatedDefaultSlug,
|
|
154
|
+
active: storedChainState.active,
|
|
155
|
+
currentProvider: (0, _utils.randomizeProvider)(latestChainInfo[duplicatedDefaultSlug].providers).providerKey,
|
|
156
|
+
manualTurnOff: storedChainState.manualTurnOff
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// Update the current chain status to use the new chain slug, inheriting the connection status from custom chain and updating the last updated timestamp
|
|
160
|
+
currentChainStatusMap[duplicatedDefaultSlug] = {
|
|
161
|
+
slug: duplicatedDefaultSlug,
|
|
162
|
+
connectionStatus: storedChainStatus.connectionStatus,
|
|
163
|
+
lastUpdated: Date.now()
|
|
164
|
+
};
|
|
165
|
+
customChains.push(duplicatedDefaultSlug);
|
|
166
|
+
|
|
167
|
+
// Remove the deprecated custom chain's info from the old chain info map and the current state/status maps.
|
|
168
|
+
delete oldChainInfoMap[storedSlug];
|
|
169
|
+
delete currentChainStateMap[storedSlug];
|
|
170
|
+
delete currentChainStatusMap[storedSlug];
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
103
175
|
chainInfoMap = this.mergeChainList(oldChainInfoMap, latestChainInfo);
|
|
104
176
|
const [currentChainStateKey, newChainKey] = [Object.keys(currentChainStateMap), Object.keys(chainInfoMap)];
|
|
105
|
-
addedChain = newChainKey.filter(chain => !currentChainStateKey.includes(chain));
|
|
177
|
+
addedChain = newChainKey.filter(chain => !currentChainStateKey.includes(chain) || customChains.includes(chain));
|
|
106
178
|
addedChain.forEach(key => {
|
|
107
|
-
currentChainStateMap[key]
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
179
|
+
if (!currentChainStateMap[key] && !currentChainStatusMap[key]) {
|
|
180
|
+
currentChainStateMap[key] = {
|
|
181
|
+
active: false,
|
|
182
|
+
currentProvider: (0, _utils.randomizeProvider)(chainInfoMap[key].providers).providerKey,
|
|
183
|
+
manualTurnOff: false,
|
|
184
|
+
slug: key
|
|
185
|
+
};
|
|
186
|
+
currentChainStatusMap[key] = {
|
|
187
|
+
slug: key,
|
|
188
|
+
connectionStatus: _types2._ChainConnectionStatus.DISCONNECTED,
|
|
189
|
+
lastUpdated: Date.now()
|
|
190
|
+
};
|
|
191
|
+
}
|
|
118
192
|
});
|
|
119
193
|
}
|
|
120
194
|
if (latestAssetInfo && Object.keys(latestAssetInfo).length > 0) {
|
|
121
|
-
|
|
195
|
+
// Get all previously stored asset registry entries from the database.
|
|
196
|
+
const storedAssetRegistry = await this.dbService.getAllAssetStore();
|
|
197
|
+
const availableChains = Object.values(chainInfoMap).filter(info => info.chainStatus === _types._ChainStatus.ACTIVE).map(chainInfo => chainInfo.slug);
|
|
198
|
+
let finalAssetRegistry;
|
|
199
|
+
if (storedAssetRegistry.length === 0) {
|
|
200
|
+
finalAssetRegistry = oldAssetRegistry;
|
|
201
|
+
} else {
|
|
202
|
+
const mergedAssetRegistry = oldAssetRegistry;
|
|
203
|
+
const parsedStoredAssetRegistry = {};
|
|
204
|
+
|
|
205
|
+
// Update custom assets of merged custom chains
|
|
206
|
+
for (const storedAsset of Object.values(storedAssetRegistry)) {
|
|
207
|
+
var _storedAsset$metadata;
|
|
208
|
+
// If the stored asset is a custom asset and its origin chain is marked as deprecated, and its assetType is ERC20
|
|
209
|
+
if ((0, _utils._isCustomAsset)(storedAsset.slug) && Object.keys(deprecatedChainMap).includes(storedAsset.originChain) && (_storedAsset$metadata = storedAsset.metadata) !== null && _storedAsset$metadata !== void 0 && _storedAsset$metadata.contractAddress) {
|
|
210
|
+
const newOriginChain = deprecatedChainMap[storedAsset.originChain];
|
|
211
|
+
// const newSlug = this.generateSlugForSmartContractAsset(newOriginChain, storedAsset.assetType, storedAsset.symbol, storedAsset.metadata?.contractAddress);
|
|
212
|
+
|
|
213
|
+
// Mark the old custom asset slug as deprecated.
|
|
214
|
+
deprecatedAssets.push(storedAsset.slug);
|
|
215
|
+
parsedStoredAssetRegistry[storedAsset.slug] = {
|
|
216
|
+
...storedAsset,
|
|
217
|
+
originChain: newOriginChain
|
|
218
|
+
};
|
|
219
|
+
} else {
|
|
220
|
+
parsedStoredAssetRegistry[storedAsset.slug] = storedAsset;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
for (const storedAssetInfo of Object.values(parsedStoredAssetRegistry)) {
|
|
224
|
+
let duplicated = false;
|
|
225
|
+
let deprecated = false;
|
|
226
|
+
let defaultSlugForMigration;
|
|
227
|
+
for (const defaultChainAsset of Object.values(latestAssetInfo)) {
|
|
228
|
+
// case: the stored asset is the same to a smart contract asset from patch
|
|
229
|
+
if ((0, _utils._isEqualSmartContractAsset)(storedAssetInfo, defaultChainAsset)) {
|
|
230
|
+
duplicated = true;
|
|
231
|
+
defaultSlugForMigration = defaultChainAsset.slug;
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// case: the origin chain of the stored asset is no longer active (Exp: custom chain is deprecated)
|
|
236
|
+
if (availableChains.indexOf(storedAssetInfo.originChain) === -1) {
|
|
237
|
+
deprecated = true;
|
|
238
|
+
defaultSlugForMigration = defaultChainAsset.slug;
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// If the stored asset is a duplicate of a default asset or its origin chain is deprecated.
|
|
244
|
+
if (duplicated || deprecated) {
|
|
245
|
+
if (Object.keys(assetSetting).includes(storedAssetInfo.slug)) {
|
|
246
|
+
const isVisible = assetSetting[storedAssetInfo.slug].visible;
|
|
247
|
+
|
|
248
|
+
// Migrate assetSetting from custom token to token from patch
|
|
249
|
+
if (defaultSlugForMigration) {
|
|
250
|
+
migratedAssetSetting[defaultSlugForMigration] = {
|
|
251
|
+
visible: isVisible
|
|
252
|
+
};
|
|
253
|
+
delete assetSetting[storedAssetInfo.slug];
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
delete mergedAssetRegistry[storedAssetInfo.slug];
|
|
257
|
+
deprecatedAssets.push(storedAssetInfo.slug);
|
|
258
|
+
} else {
|
|
259
|
+
// If the stored asset is not a duplicate and its origin chain is active, keep it in the merged registry.
|
|
260
|
+
mergedAssetRegistry[storedAssetInfo.slug] = storedAssetInfo;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
finalAssetRegistry = mergedAssetRegistry;
|
|
264
|
+
}
|
|
265
|
+
assetRegistry = (0, _chainService.filterAssetInfoMap)(oldChainInfoMap, Object.assign({}, finalAssetRegistry, latestAssetInfo), addedChain);
|
|
122
266
|
}
|
|
123
267
|
|
|
124
268
|
// 3. validate data before write
|
|
@@ -136,6 +280,15 @@ class ChainOnlineService {
|
|
|
136
280
|
this.chainService.setChainStateMap(currentChainStateMap);
|
|
137
281
|
this.chainService.subscribeChainStateMap().next(currentChainStateMap);
|
|
138
282
|
this.chainService.subscribeChainStatusMap().next(currentChainStatusMap);
|
|
283
|
+
// Migrate assetSetting
|
|
284
|
+
this.chainService.setAssetSettings({
|
|
285
|
+
...assetSetting,
|
|
286
|
+
...migratedAssetSetting
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
// Remove all custom chains and custom tokens that is duplicated from chains or tokens in patch
|
|
290
|
+
await this.dbService.removeFromChainStore(deprecatedChains);
|
|
291
|
+
await this.dbService.removeFromAssetStore(deprecatedAssets);
|
|
139
292
|
const storedChainInfoList = Object.keys(chainInfoMap).map(chainSlug => {
|
|
140
293
|
return {
|
|
141
294
|
...chainInfoMap[chainSlug],
|
|
@@ -1256,8 +1256,11 @@ class ChainService {
|
|
|
1256
1256
|
async initAssetRegistry(deprecatedCustomChainMap) {
|
|
1257
1257
|
const storedAssetRegistry = await this.dbService.getAllAssetStore();
|
|
1258
1258
|
const latestAssetRegistry = filterAssetInfoMap(this.getChainInfoMap(), _chainList.ChainAssetMap);
|
|
1259
|
+
const assetSetting = await this.getAssetSettings();
|
|
1259
1260
|
const availableChains = Object.values(this.dataMap.chainInfoMap).filter(info => info.chainStatus === _types._ChainStatus.ACTIVE).map(chainInfo => chainInfo.slug);
|
|
1261
|
+
const customChains = Object.keys(deprecatedCustomChainMap).filter(chain => (0, _utils._isCustomChain)(chain));
|
|
1260
1262
|
let finalAssetRegistry = {};
|
|
1263
|
+
const migratedAssetSetting = {};
|
|
1261
1264
|
if (storedAssetRegistry.length === 0) {
|
|
1262
1265
|
finalAssetRegistry = latestAssetRegistry;
|
|
1263
1266
|
} else {
|
|
@@ -1267,15 +1270,18 @@ class ChainService {
|
|
|
1267
1270
|
|
|
1268
1271
|
// Update custom assets of merged custom chains
|
|
1269
1272
|
Object.values(storedAssetRegistry).forEach(storedAsset => {
|
|
1270
|
-
|
|
1271
|
-
|
|
1273
|
+
var _storedAsset$metadata;
|
|
1274
|
+
const isFromCustomChain = customChains ? customChains.includes(storedAsset.originChain) : false;
|
|
1275
|
+
|
|
1276
|
+
// If the stored asset is a custom asset, from a deprecated custom chain, and has a contract address.
|
|
1277
|
+
if ((0, _utils._isCustomAsset)(storedAsset.slug) && isFromCustomChain && (_storedAsset$metadata = storedAsset.metadata) !== null && _storedAsset$metadata !== void 0 && _storedAsset$metadata.contractAddress) {
|
|
1272
1278
|
const newOriginChain = deprecatedCustomChainMap[storedAsset.originChain];
|
|
1273
|
-
const newSlug = this.generateSlugForSmartContractAsset(newOriginChain, storedAsset.assetType, storedAsset.symbol,
|
|
1279
|
+
// const newSlug = this.generateSlugForSmartContractAsset(newOriginChain, storedAsset.assetType, storedAsset.symbol, storedAsset.metadata?.contractAddress);
|
|
1280
|
+
|
|
1274
1281
|
deprecatedAssets.push(storedAsset.slug);
|
|
1275
|
-
parsedStoredAssetRegistry[
|
|
1282
|
+
parsedStoredAssetRegistry[storedAsset.slug] = {
|
|
1276
1283
|
...storedAsset,
|
|
1277
|
-
originChain: newOriginChain
|
|
1278
|
-
slug: newSlug
|
|
1284
|
+
originChain: newOriginChain
|
|
1279
1285
|
};
|
|
1280
1286
|
} else {
|
|
1281
1287
|
parsedStoredAssetRegistry[storedAsset.slug] = storedAsset;
|
|
@@ -1284,25 +1290,48 @@ class ChainService {
|
|
|
1284
1290
|
for (const storedAssetInfo of Object.values(parsedStoredAssetRegistry)) {
|
|
1285
1291
|
let duplicated = false;
|
|
1286
1292
|
let deprecated = false;
|
|
1293
|
+
let defaultSlugForMigration;
|
|
1287
1294
|
for (const defaultChainAsset of Object.values(latestAssetRegistry)) {
|
|
1288
|
-
//
|
|
1295
|
+
// Case: The stored asset is the same to a smart contract asset from new stable chainlist
|
|
1289
1296
|
if ((0, _utils._isEqualSmartContractAsset)(storedAssetInfo, defaultChainAsset)) {
|
|
1290
1297
|
duplicated = true;
|
|
1298
|
+
defaultSlugForMigration = defaultChainAsset.slug;
|
|
1291
1299
|
break;
|
|
1292
1300
|
}
|
|
1301
|
+
|
|
1302
|
+
// Case: If the origin chain of the stored asset is no longer active. (custom chain is deprecated)
|
|
1293
1303
|
if (availableChains.indexOf(storedAssetInfo.originChain) === -1) {
|
|
1294
1304
|
deprecated = true;
|
|
1305
|
+
defaultSlugForMigration = defaultChainAsset.slug;
|
|
1295
1306
|
break;
|
|
1296
1307
|
}
|
|
1308
|
+
|
|
1309
|
+
// Case: If a default asset already exists with the same slug as the stored asset (from patch)
|
|
1297
1310
|
if (defaultChainAsset.slug === storedAssetInfo.slug) {
|
|
1298
1311
|
duplicated = true;
|
|
1312
|
+
defaultSlugForMigration = defaultChainAsset.slug;
|
|
1299
1313
|
break;
|
|
1300
1314
|
}
|
|
1301
1315
|
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1316
|
+
|
|
1317
|
+
// If the stored asset is a duplicate of a default asset or its origin chain is deprecated.
|
|
1318
|
+
if (duplicated || deprecated) {
|
|
1319
|
+
if (Object.keys(assetSetting).includes(storedAssetInfo.slug)) {
|
|
1320
|
+
const isVisible = assetSetting[storedAssetInfo.slug].visible;
|
|
1321
|
+
|
|
1322
|
+
// Migrate assetSetting from custom token to new default token
|
|
1323
|
+
if (defaultSlugForMigration) {
|
|
1324
|
+
migratedAssetSetting[defaultSlugForMigration] = {
|
|
1325
|
+
visible: isVisible
|
|
1326
|
+
};
|
|
1327
|
+
delete assetSetting[storedAssetInfo.slug];
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
delete mergedAssetRegistry[storedAssetInfo.slug];
|
|
1305
1331
|
deprecatedAssets.push(storedAssetInfo.slug);
|
|
1332
|
+
} else {
|
|
1333
|
+
// If the stored asset is not a duplicate and its origin chain is active, keep it in the merged registry.
|
|
1334
|
+
mergedAssetRegistry[storedAssetInfo.slug] = storedAssetInfo;
|
|
1306
1335
|
}
|
|
1307
1336
|
}
|
|
1308
1337
|
finalAssetRegistry = mergedAssetRegistry;
|
|
@@ -10,9 +10,9 @@ exports.fetchPatchData = fetchPatchData;
|
|
|
10
10
|
|
|
11
11
|
const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
|
|
12
12
|
const branchName = process.env.BRANCH_NAME || 'subwallet-dev';
|
|
13
|
-
const fetchDomain = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'https://chain-list-assets.subwallet.app' : 'https://dev.sw-chain-list-assets.pages.dev';
|
|
13
|
+
const fetchDomain = process.env.PATCH_CHAIN_LIST_URL || (PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'https://chain-list-assets.subwallet.app' : 'https://dev.sw-chain-list-assets.pages.dev');
|
|
14
14
|
const fetchFile = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'list.json' : 'preview.json';
|
|
15
|
-
const ChainListVersion = '0.2.
|
|
15
|
+
const ChainListVersion = '0.2.112'; // update this when build chain-list
|
|
16
16
|
|
|
17
17
|
// todo: move this interface to chainlist
|
|
18
18
|
exports.ChainListVersion = ChainListVersion;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports._STAKING_CHAIN_GROUP = exports.TON_CHAINS = exports.ST_LIQUID_TOKEN_ABI = exports.STAKING_IDENTITY_API_SLUG = exports.MaxEraRewardPointsEras = exports.MANTA_VALIDATOR_POINTS_PER_BLOCK = exports.MANTA_MIN_DELEGATION = exports.CHANNEL_ID = void 0;
|
|
7
7
|
// Copyright 2019-2022 @subwallet/extension-base
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
|
|
@@ -46,6 +46,4 @@ const STAKING_IDENTITY_API_SLUG = {
|
|
|
46
46
|
polkadot: 'polkadot_people',
|
|
47
47
|
kusama: 'peopleKusama'
|
|
48
48
|
};
|
|
49
|
-
exports.STAKING_IDENTITY_API_SLUG = STAKING_IDENTITY_API_SLUG;
|
|
50
|
-
const _SUPPORT_CHANGE_VALIDATOR_CHAIN = ['polkadot', 'kusama'];
|
|
51
|
-
exports._SUPPORT_CHANGE_VALIDATOR_CHAIN = _SUPPORT_CHANGE_VALIDATOR_CHAIN;
|
|
49
|
+
exports.STAKING_IDENTITY_API_SLUG = STAKING_IDENTITY_API_SLUG;
|
|
@@ -139,7 +139,8 @@ class BaseNativeStakingPoolHandler extends _base.default {
|
|
|
139
139
|
address,
|
|
140
140
|
amount,
|
|
141
141
|
selectedValidators,
|
|
142
|
-
slug
|
|
142
|
+
slug,
|
|
143
|
+
subnetData
|
|
143
144
|
} = data;
|
|
144
145
|
const positionInfo = await this.getPoolPosition(address, slug);
|
|
145
146
|
const [extrinsic] = await this.createJoinExtrinsic(data, positionInfo);
|
|
@@ -148,7 +149,8 @@ class BaseNativeStakingPoolHandler extends _base.default {
|
|
|
148
149
|
slug: this.slug,
|
|
149
150
|
amount,
|
|
150
151
|
address,
|
|
151
|
-
selectedValidators
|
|
152
|
+
selectedValidators,
|
|
153
|
+
subnetData
|
|
152
154
|
};
|
|
153
155
|
return {
|
|
154
156
|
txChain: this.chain,
|
|
@@ -50,7 +50,7 @@ class SubnetTaoStakingPoolHandler extends _tao.default {
|
|
|
50
50
|
canHandleSlug(slug) {
|
|
51
51
|
return slug.startsWith(`${this.slug}__`);
|
|
52
52
|
}
|
|
53
|
-
async
|
|
53
|
+
async getEarningImpact(params) {
|
|
54
54
|
const substrateApi = await this.substrateApi.isReady;
|
|
55
55
|
const subnetInfo = (await substrateApi.api.call.subnetInfoRuntimeApi.getDynamicInfo(params.netuid)).toJSON();
|
|
56
56
|
const alphaIn = new _bignumber.default((subnetInfo === null || subnetInfo === void 0 ? void 0 : subnetInfo.alphaIn) || 0);
|
|
@@ -58,15 +58,18 @@ class SubnetTaoStakingPoolHandler extends _tao.default {
|
|
|
58
58
|
const k = alphaIn.multipliedBy(taoIn);
|
|
59
59
|
const value = new _bignumber.default(params.value);
|
|
60
60
|
const rate = taoIn.dividedBy(alphaIn);
|
|
61
|
+
const feeRate = await this.bittensorCache.fetchSubnetFeeRate(params.netuid);
|
|
61
62
|
if (params.type === _KoniTypes.ExtrinsicType.STAKING_BOND) {
|
|
62
63
|
const newTaoIn = taoIn.plus(value);
|
|
63
64
|
const newAlphaIn = k.dividedBy(newTaoIn);
|
|
64
65
|
const alphaReturned = alphaIn.minus(newAlphaIn);
|
|
65
66
|
const alphaIdeal = value.multipliedBy(alphaIn).dividedBy(taoIn);
|
|
66
67
|
const slippage = alphaIdeal.minus(alphaReturned).dividedBy(alphaIdeal);
|
|
68
|
+
const bnStakingTaoFee = value.multipliedBy(feeRate);
|
|
67
69
|
return {
|
|
68
70
|
slippage: slippage.plus(0.0001).toNumber(),
|
|
69
|
-
rate: rate.toNumber()
|
|
71
|
+
rate: rate.toNumber(),
|
|
72
|
+
stakingTaoFee: bnStakingTaoFee.toString()
|
|
70
73
|
};
|
|
71
74
|
} else if (params.type === _KoniTypes.ExtrinsicType.STAKING_UNBOND) {
|
|
72
75
|
const newAlphaIn = alphaIn.plus(value);
|
|
@@ -74,9 +77,12 @@ class SubnetTaoStakingPoolHandler extends _tao.default {
|
|
|
74
77
|
const taoReturned = taoIn.minus(newTaoReserve);
|
|
75
78
|
const taoIdeal = value.multipliedBy(taoIn).dividedBy(alphaIn);
|
|
76
79
|
const slippage = taoIdeal.minus(taoReturned).dividedBy(taoIdeal);
|
|
80
|
+
const taoAmount = value.multipliedBy(rate);
|
|
81
|
+
const bnStakingTaoFee = taoAmount.multipliedBy(feeRate);
|
|
77
82
|
return {
|
|
78
83
|
slippage: slippage.plus(0.0001).toNumber(),
|
|
79
|
-
rate: rate.toNumber()
|
|
84
|
+
rate: rate.toNumber(),
|
|
85
|
+
stakingTaoFee: bnStakingTaoFee.toString()
|
|
80
86
|
};
|
|
81
87
|
}
|
|
82
88
|
return {
|
|
@@ -29,17 +29,8 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
29
29
|
cancelUnstake: true,
|
|
30
30
|
withdraw: true,
|
|
31
31
|
claimReward: false,
|
|
32
|
-
changeValidator:
|
|
32
|
+
changeValidator: true
|
|
33
33
|
};
|
|
34
|
-
constructor(state, chain) {
|
|
35
|
-
super(state, chain);
|
|
36
|
-
if (_constants2._SUPPORT_CHANGE_VALIDATOR_CHAIN.includes(chain)) {
|
|
37
|
-
this.availableMethod = {
|
|
38
|
-
...this.availableMethod,
|
|
39
|
-
changeValidator: true
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
34
|
/* Subscribe pool info */
|
|
44
35
|
|
|
45
36
|
async subscribePoolInfo(callback) {
|