@subwallet/extension-base 1.3.16-0 → 1.3.18-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.
Files changed (137) hide show
  1. package/background/KoniTypes.d.ts +12 -2
  2. package/cjs/constants/index.js +6 -3
  3. package/cjs/core/logic-validation/request.js +26 -19
  4. package/cjs/core/logic-validation/transfer.js +18 -17
  5. package/cjs/koni/api/contract-handler/evm/web3.js +3 -3
  6. package/cjs/koni/api/staking/bonding/utils.js +1 -1
  7. package/cjs/koni/background/handlers/Extension.js +289 -124
  8. package/cjs/koni/background/handlers/State.js +1 -8
  9. package/cjs/packageInfo.js +1 -1
  10. package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +14 -2
  11. package/cjs/services/balance-service/index.js +13 -0
  12. package/cjs/services/balance-service/transfer/smart-contract.js +47 -33
  13. package/cjs/services/balance-service/transfer/token.js +5 -4
  14. package/cjs/services/balance-service/transfer/xcm/availBridge.js +14 -18
  15. package/cjs/services/balance-service/transfer/xcm/index.js +30 -61
  16. package/cjs/services/balance-service/transfer/xcm/polygonBridge.js +13 -17
  17. package/cjs/services/balance-service/transfer/xcm/posBridge.js +20 -21
  18. package/cjs/services/balance-service/transfer/xcm/snowBridge.js +7 -7
  19. package/cjs/services/balance-service/transfer/xcm/utils.js +2 -2
  20. package/cjs/services/chain-service/constants.js +3 -3
  21. package/cjs/services/chain-service/index.js +22 -0
  22. package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +7 -12
  23. package/cjs/services/earning-service/handlers/native-staking/tao.js +121 -30
  24. package/cjs/services/earning-service/handlers/nomination-pool/index.js +1 -1
  25. package/cjs/services/earning-service/handlers/special.js +34 -14
  26. package/cjs/services/fee-service/interfaces.js +1 -0
  27. package/cjs/services/fee-service/service.js +111 -0
  28. package/cjs/services/fee-service/utils/index.js +99 -113
  29. package/cjs/services/storage-service/db-stores/Balance.js +3 -0
  30. package/cjs/services/swap-service/handler/asset-hub/handler.js +21 -6
  31. package/cjs/services/swap-service/handler/asset-hub/router.js +1 -1
  32. package/cjs/services/swap-service/handler/asset-hub/utils.js +4 -4
  33. package/cjs/services/swap-service/handler/base-handler.js +2 -0
  34. package/cjs/services/swap-service/handler/chainflip-handler.js +25 -4
  35. package/cjs/services/swap-service/handler/hydradx-handler.js +20 -6
  36. package/cjs/services/swap-service/handler/simpleswap-handler.js +23 -3
  37. package/cjs/services/swap-service/index.js +8 -8
  38. package/cjs/services/transaction-service/index.js +23 -3
  39. package/cjs/types/balance/transfer.js +1 -0
  40. package/cjs/types/fee/base.js +1 -0
  41. package/cjs/types/fee/evm.js +16 -1
  42. package/cjs/types/fee/index.js +37 -4
  43. package/cjs/types/fee/option.js +1 -0
  44. package/cjs/types/fee/subscription.js +1 -0
  45. package/cjs/types/fee/substrate.js +1 -0
  46. package/cjs/types/fee/ton.js +1 -0
  47. package/cjs/utils/fee/combine.js +50 -0
  48. package/cjs/utils/fee/index.js +27 -0
  49. package/cjs/utils/fee/transfer.js +374 -0
  50. package/cjs/utils/index.js +12 -0
  51. package/constants/index.d.ts +1 -0
  52. package/constants/index.js +1 -0
  53. package/core/logic-validation/request.js +17 -10
  54. package/core/logic-validation/transfer.d.ts +5 -5
  55. package/core/logic-validation/transfer.js +20 -19
  56. package/core/substrate/xcm-parser.d.ts +1 -1
  57. package/koni/api/contract-handler/evm/web3.js +3 -3
  58. package/koni/api/staking/bonding/utils.js +1 -1
  59. package/koni/background/handlers/Extension.d.ts +4 -3
  60. package/koni/background/handlers/Extension.js +273 -108
  61. package/koni/background/handlers/State.js +1 -8
  62. package/package.json +55 -5
  63. package/packageInfo.js +1 -1
  64. package/services/balance-service/helpers/subscribe/substrate/index.js +14 -2
  65. package/services/balance-service/index.d.ts +1 -0
  66. package/services/balance-service/index.js +13 -0
  67. package/services/balance-service/transfer/smart-contract.d.ts +24 -4
  68. package/services/balance-service/transfer/smart-contract.js +45 -33
  69. package/services/balance-service/transfer/token.js +6 -5
  70. package/services/balance-service/transfer/xcm/availBridge.d.ts +3 -2
  71. package/services/balance-service/transfer/xcm/availBridge.js +11 -15
  72. package/services/balance-service/transfer/xcm/index.d.ts +12 -11
  73. package/services/balance-service/transfer/xcm/index.js +29 -58
  74. package/services/balance-service/transfer/xcm/polygonBridge.d.ts +4 -3
  75. package/services/balance-service/transfer/xcm/polygonBridge.js +13 -17
  76. package/services/balance-service/transfer/xcm/posBridge.d.ts +4 -3
  77. package/services/balance-service/transfer/xcm/posBridge.js +18 -19
  78. package/services/balance-service/transfer/xcm/snowBridge.d.ts +2 -1
  79. package/services/balance-service/transfer/xcm/snowBridge.js +7 -7
  80. package/services/balance-service/transfer/xcm/utils.js +2 -2
  81. package/services/chain-service/constants.js +3 -3
  82. package/services/chain-service/index.d.ts +6 -1
  83. package/services/chain-service/index.js +22 -0
  84. package/services/earning-service/handlers/liquid-staking/stella-swap.js +7 -12
  85. package/services/earning-service/handlers/native-staking/tao.d.ts +7 -2
  86. package/services/earning-service/handlers/native-staking/tao.js +119 -29
  87. package/services/earning-service/handlers/nomination-pool/index.js +1 -1
  88. package/services/earning-service/handlers/special.js +36 -16
  89. package/services/fee-service/interfaces.d.ts +5 -0
  90. package/services/fee-service/interfaces.js +1 -0
  91. package/services/fee-service/service.d.ts +4 -1
  92. package/services/fee-service/service.js +111 -0
  93. package/services/fee-service/utils/index.d.ts +8 -2
  94. package/services/fee-service/utils/index.js +92 -108
  95. package/services/storage-service/db-stores/Balance.d.ts +1 -0
  96. package/services/storage-service/db-stores/Balance.js +3 -0
  97. package/services/swap-service/handler/asset-hub/handler.d.ts +2 -1
  98. package/services/swap-service/handler/asset-hub/handler.js +21 -6
  99. package/services/swap-service/handler/asset-hub/router.js +2 -2
  100. package/services/swap-service/handler/asset-hub/utils.d.ts +1 -1
  101. package/services/swap-service/handler/asset-hub/utils.js +2 -2
  102. package/services/swap-service/handler/base-handler.d.ts +4 -1
  103. package/services/swap-service/handler/base-handler.js +2 -0
  104. package/services/swap-service/handler/chainflip-handler.d.ts +2 -1
  105. package/services/swap-service/handler/chainflip-handler.js +24 -3
  106. package/services/swap-service/handler/hydradx-handler.d.ts +2 -1
  107. package/services/swap-service/handler/hydradx-handler.js +19 -5
  108. package/services/swap-service/handler/simpleswap-handler.d.ts +2 -1
  109. package/services/swap-service/handler/simpleswap-handler.js +23 -3
  110. package/services/swap-service/index.js +8 -8
  111. package/services/transaction-service/index.js +23 -3
  112. package/services/transaction-service/types.d.ts +5 -4
  113. package/types/balance/transfer.d.ts +25 -0
  114. package/types/balance/transfer.js +1 -0
  115. package/types/fee/base.d.ts +8 -0
  116. package/types/fee/base.js +1 -0
  117. package/types/fee/evm.d.ts +46 -16
  118. package/types/fee/evm.js +10 -1
  119. package/types/fee/index.d.ts +4 -1
  120. package/types/fee/index.js +4 -1
  121. package/types/fee/option.d.ts +8 -0
  122. package/types/fee/option.js +1 -0
  123. package/types/fee/subscription.d.ts +12 -0
  124. package/types/fee/subscription.js +1 -0
  125. package/types/fee/substrate.d.ts +15 -0
  126. package/types/fee/substrate.js +1 -0
  127. package/types/fee/ton.d.ts +18 -0
  128. package/types/fee/ton.js +1 -0
  129. package/types/transaction/request.d.ts +13 -3
  130. package/utils/fee/combine.d.ts +12 -0
  131. package/utils/fee/combine.js +42 -0
  132. package/utils/fee/index.d.ts +2 -0
  133. package/utils/fee/index.js +5 -0
  134. package/utils/fee/transfer.d.ts +22 -0
  135. package/utils/fee/transfer.js +363 -0
  136. package/utils/index.d.ts +1 -0
  137. package/utils/index.js +1 -0
@@ -13,9 +13,9 @@ exports.isClaimedPosBridge = isClaimedPosBridge;
13
13
  var _chainList = require("@subwallet/chain-list");
14
14
  var _web = require("@subwallet/extension-base/koni/api/contract-handler/evm/web3");
15
15
  var _utils = require("@subwallet/extension-base/koni/api/contract-handler/utils");
16
- var _utils2 = require("@subwallet/extension-base/services/fee-service/utils");
17
- var _utils3 = require("@subwallet/extension-base/services/inapp-notification-service/utils");
16
+ var _utils2 = require("@subwallet/extension-base/services/inapp-notification-service/utils");
18
17
  var _types = require("@subwallet/extension-base/types");
18
+ var _utils3 = require("@subwallet/extension-base/utils");
19
19
  // Copyright 2019-2022 @subwallet/extension-base
20
20
  // SPDX-License-Identifier: Apache-2.0
21
21
 
@@ -24,52 +24,53 @@ const POS_EXIT_PAYLOAD_INDEXER = {
24
24
  TESTNET: 'https://proof-generator.polygon.technology/api/v1/amoy/exit-payload'
25
25
  };
26
26
  exports.POS_EXIT_PAYLOAD_INDEXER = POS_EXIT_PAYLOAD_INDEXER;
27
- async function _createPosBridgeL1toL2Extrinsic(tokenInfo, originChainInfo, sender, recipientAddress, value, evmApi) {
28
- var _priority$maxFeePerGa, _priority$maxPriority;
27
+ async function _createPosBridgeL1toL2Extrinsic(tokenInfo, originChainInfo, sender, recipientAddress, value, evmApi, _feeInfo, feeCustom, feeOption) {
29
28
  const posBridgeContractAddress = (0, _utils.getPosL1BridgeContract)(originChainInfo.slug);
30
29
  const posBridgeContract = (0, _web.getWeb3Contract)(posBridgeContractAddress, evmApi, _utils._POS_BRIDGE_ABI);
30
+ const _feeCustom = feeCustom;
31
+ const feeInfo = _feeInfo;
32
+ const feeCombine = (0, _utils3.combineEthFee)(feeInfo, feeOption, _feeCustom);
31
33
 
32
34
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
33
35
  const transferCall = posBridgeContract.methods.depositEtherFor(recipientAddress);
34
36
  const transferEncodedCall = transferCall.encodeABI();
35
- const priority = await (0, _utils2.calculateGasFeeParams)(evmApi, evmApi.chainSlug);
37
+
38
+ // const priority = await calculateGasFeeParams(evmApi, evmApi.chainSlug);
39
+
36
40
  const transactionConfig = {
37
41
  from: sender,
38
42
  to: posBridgeContractAddress,
39
43
  value: value,
40
44
  data: transferEncodedCall,
41
- gasPrice: priority.gasPrice,
42
- maxFeePerGas: priority === null || priority === void 0 ? void 0 : (_priority$maxFeePerGa = priority.maxFeePerGas) === null || _priority$maxFeePerGa === void 0 ? void 0 : _priority$maxFeePerGa.toString(),
43
- maxPriorityFeePerGas: priority === null || priority === void 0 ? void 0 : (_priority$maxPriority = priority.maxPriorityFeePerGas) === null || _priority$maxPriority === void 0 ? void 0 : _priority$maxPriority.toString()
45
+ ...feeCombine
44
46
  };
45
47
  const gasLimit = await evmApi.api.eth.estimateGas(transactionConfig).catch(() => 200000);
46
48
  transactionConfig.gas = gasLimit.toString();
47
49
  return transactionConfig;
48
50
  }
49
- async function _createPosBridgeL2toL1Extrinsic(tokenInfo, originChainInfo, sender, recipientAddress, value, evmApi) {
50
- var _priority$maxFeePerGa2, _priority$maxPriority2;
51
+ async function _createPosBridgeL2toL1Extrinsic(tokenInfo, originChainInfo, sender, recipientAddress, value, evmApi, _feeInfo, feeCustom, feeOption) {
51
52
  const posBridgeContractAddress = (0, _utils.getPosL2BridgeContract)(originChainInfo.slug);
52
53
  const posBridgeContract = (0, _web.getWeb3Contract)(posBridgeContractAddress, evmApi, _utils._POS_BRIDGE_L2_ABI);
53
54
 
54
55
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
55
56
  const transferCall = posBridgeContract.methods.withdraw(value);
56
57
  const transferEncodedCall = transferCall.encodeABI();
57
- const priority = await (0, _utils2.calculateGasFeeParams)(evmApi, evmApi.chainSlug);
58
+ const _feeCustom = feeCustom;
59
+ const feeInfo = _feeInfo;
60
+ const feeCombine = (0, _utils3.combineEthFee)(feeInfo, feeOption, _feeCustom);
58
61
  const transactionConfig = {
59
62
  from: sender,
60
63
  to: posBridgeContractAddress,
61
64
  value: undefined,
62
65
  data: transferEncodedCall,
63
- gasPrice: priority.gasPrice,
64
- maxFeePerGas: priority === null || priority === void 0 ? void 0 : (_priority$maxFeePerGa2 = priority.maxFeePerGas) === null || _priority$maxFeePerGa2 === void 0 ? void 0 : _priority$maxFeePerGa2.toString(),
65
- maxPriorityFeePerGas: priority === null || priority === void 0 ? void 0 : (_priority$maxPriority2 = priority.maxPriorityFeePerGas) === null || _priority$maxPriority2 === void 0 ? void 0 : _priority$maxPriority2.toString()
66
+ ...feeCombine
66
67
  };
67
68
  const gasLimit = await evmApi.api.eth.estimateGas(transactionConfig).catch(() => 200000);
68
69
  transactionConfig.gas = gasLimit.toString();
69
70
  return transactionConfig;
70
71
  }
71
- async function getClaimPosBridge(chainSlug, notification, evmApi) {
72
- var _event$arguments, _event$arguments$, _event$arguments$$top, _priority$maxFeePerGa3, _priority$maxPriority3;
72
+ async function getClaimPosBridge(chainSlug, notification, evmApi, feeInfo) {
73
+ var _event$arguments, _event$arguments$, _event$arguments$$top;
73
74
  const posBridgeContractAddress = (0, _utils.getPosL2BridgeContract)(chainSlug);
74
75
  const posBridgeContract = (0, _web.getWeb3Contract)(posBridgeContractAddress, evmApi, _utils._POS_BRIDGE_L2_ABI);
75
76
  const metadata = notification.metadata;
@@ -96,15 +97,13 @@ async function getClaimPosBridge(chainSlug, notification, evmApi) {
96
97
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
97
98
  const transferCall = posClaimContract.methods.exit(inputData.result);
98
99
  const transferEncodedCall = transferCall.encodeABI();
99
- const priority = await (0, _utils2.calculateGasFeeParams)(evmApi, evmApi.chainSlug);
100
+ const feeCombine = (0, _utils3.combineEthFee)(feeInfo);
100
101
  const transactionConfig = {
101
102
  from: metadata.userAddress,
102
103
  to: posClaimContractAddress,
103
104
  value: '0',
104
105
  data: transferEncodedCall,
105
- gasPrice: priority.gasPrice,
106
- maxFeePerGas: (_priority$maxFeePerGa3 = priority.maxFeePerGas) === null || _priority$maxFeePerGa3 === void 0 ? void 0 : _priority$maxFeePerGa3.toString(),
107
- maxPriorityFeePerGas: (_priority$maxPriority3 = priority.maxPriorityFeePerGas) === null || _priority$maxPriority3 === void 0 ? void 0 : _priority$maxPriority3.toString()
106
+ ...feeCombine
108
107
  };
109
108
  const gasLimit = await evmApi.api.eth.estimateGas(transactionConfig).catch(() => 200000);
110
109
  transactionConfig.gas = gasLimit.toString();
@@ -112,7 +111,7 @@ async function getClaimPosBridge(chainSlug, notification, evmApi) {
112
111
  }
113
112
  async function isClaimedPosBridge(id, address, isTestnet) {
114
113
  try {
115
- const isClaimableBridge = await (0, _utils3.fetchPolygonBridgeTransactions)(address, isTestnet);
114
+ const isClaimableBridge = await (0, _utils2.fetchPolygonBridgeTransactions)(address, isTestnet);
116
115
  if (isClaimableBridge && isClaimableBridge.success) {
117
116
  const isIdClaimable = isClaimableBridge.result.some(transaction => transaction._id === id);
118
117
  return !isIdClaimable;
@@ -7,7 +7,7 @@ exports.getSnowBridgeEvmTransfer = getSnowBridgeEvmTransfer;
7
7
  var _web = require("@subwallet/extension-base/koni/api/contract-handler/evm/web3");
8
8
  var _utils = require("@subwallet/extension-base/koni/api/contract-handler/utils");
9
9
  var _utils2 = require("@subwallet/extension-base/services/chain-service/utils");
10
- var _utils3 = require("@subwallet/extension-base/services/fee-service/utils");
10
+ var _utils3 = require("@subwallet/extension-base/utils");
11
11
  var _util = require("@polkadot/util");
12
12
  var _utilCrypto = require("@polkadot/util-crypto");
13
13
  // Copyright 2019-2022 @subwallet/extension-base
@@ -20,8 +20,7 @@ async function getSendFeeToken(contract, tokenContract, destChainParaId, destina
20
20
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
21
21
  return await quoteSendTokenFee.call();
22
22
  }
23
- async function getSnowBridgeEvmTransfer(tokenInfo, originChainInfo, destinationChainInfo, sender, recipientAddress, value, evmApi) {
24
- var _priority$maxFeePerGa, _priority$maxPriority;
23
+ async function getSnowBridgeEvmTransfer(tokenInfo, originChainInfo, destinationChainInfo, sender, recipientAddress, value, evmApi, _feeInfo, feeCustom, feeOption) {
25
24
  const snowBridgeContractAddress = (0, _utils.getSnowBridgeGatewayContract)(originChainInfo.slug);
26
25
  const snowBridgeContract = (0, _web.getWeb3Contract)(snowBridgeContractAddress, evmApi, _utils._SNOWBRIDGE_GATEWAY_ABI);
27
26
  const tokenContract = (0, _utils2._getContractAddressOfToken)(tokenInfo);
@@ -36,15 +35,16 @@ async function getSnowBridgeEvmTransfer(tokenInfo, originChainInfo, destinationC
36
35
  const transferCall = snowBridgeContract.methods.sendToken(tokenContract, destinationChainParaId, recipient, destinationFee, value);
37
36
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
38
37
  const transferEncodedCall = transferCall.encodeABI();
39
- const [priority, sendTokenFee] = await Promise.all([(0, _utils3.calculateGasFeeParams)(evmApi, evmApi.chainSlug), getSendFeeToken(snowBridgeContract, tokenContract, destinationChainParaId, destinationFee)]);
38
+ const feeInfo = _feeInfo;
39
+ const _feeCustom = feeCustom;
40
+ const feeCombine = (0, _utils3.combineEthFee)(feeInfo, feeOption, _feeCustom);
41
+ const sendTokenFee = await getSendFeeToken(snowBridgeContract, tokenContract, destinationChainParaId, destinationFee);
40
42
  const transactionConfig = {
41
43
  from: sender,
42
44
  to: snowBridgeContractAddress,
43
45
  value: sendTokenFee,
44
46
  data: transferEncodedCall,
45
- gasPrice: priority.gasPrice,
46
- maxFeePerGas: (_priority$maxFeePerGa = priority.maxFeePerGas) === null || _priority$maxFeePerGa === void 0 ? void 0 : _priority$maxFeePerGa.toString(),
47
- maxPriorityFeePerGas: (_priority$maxPriority = priority.maxPriorityFeePerGas) === null || _priority$maxPriority === void 0 ? void 0 : _priority$maxPriority.toString()
47
+ ...feeCombine
48
48
  };
49
49
  let gasLimit;
50
50
  try {
@@ -11,8 +11,8 @@ exports.isUseTeleportProtocol = isUseTeleportProtocol;
11
11
  const STABLE_XCM_VERSION = 3;
12
12
  exports.STABLE_XCM_VERSION = STABLE_XCM_VERSION;
13
13
  function isUseTeleportProtocol(originChainInfo, destChainInfo, tokenSlug) {
14
- const relayChainToSystemChain = ['polkadot'].includes(originChainInfo.slug) && ['statemint'].includes(destChainInfo.slug) || ['kusama'].includes(originChainInfo.slug) && ['statemine'].includes(destChainInfo.slug) || ['rococo'].includes(originChainInfo.slug) && ['rococo_assethub'].includes(destChainInfo.slug);
15
- const systemChainToRelayChain = ['polkadot'].includes(destChainInfo.slug) && ['statemint'].includes(originChainInfo.slug) || ['kusama'].includes(destChainInfo.slug) && ['statemine'].includes(originChainInfo.slug) || ['rococo'].includes(destChainInfo.slug) && ['rococo_assethub'].includes(originChainInfo.slug);
14
+ const relayChainToSystemChain = ['polkadot'].includes(originChainInfo.slug) && ['statemint'].includes(destChainInfo.slug) || ['kusama'].includes(originChainInfo.slug) && ['statemine'].includes(destChainInfo.slug) || ['rococo'].includes(originChainInfo.slug) && ['rococo_assethub'].includes(destChainInfo.slug) || ['westend'].includes(originChainInfo.slug) && ['westend_assethub'].includes(destChainInfo.slug);
15
+ const systemChainToRelayChain = ['polkadot'].includes(destChainInfo.slug) && ['statemint'].includes(originChainInfo.slug) || ['kusama'].includes(destChainInfo.slug) && ['statemine'].includes(originChainInfo.slug) || ['rococo'].includes(destChainInfo.slug) && ['rococo_assethub'].includes(originChainInfo.slug) || ['westend'].includes(destChainInfo.slug) && ['westend_assethub'].includes(originChainInfo.slug);
16
16
  const isXcmMythos = originChainInfo.slug === 'mythos' && destChainInfo.slug === 'statemint' && tokenSlug === 'mythos-NATIVE-MYTH' || originChainInfo.slug === 'statemint' && destChainInfo.slug === 'mythos' && tokenSlug === 'statemint-LOCAL-MYTH';
17
17
  return relayChainToSystemChain || systemChainToRelayChain || isXcmMythos;
18
18
  }
@@ -41,7 +41,7 @@ const _BALANCE_CHAIN_GROUP = {
41
41
  genshiro: ['genshiro_testnet', 'genshiro'],
42
42
  equilibrium_parachain: ['equilibrium_parachain'],
43
43
  bifrost: ['bifrost', 'acala', 'karura', 'acala_testnet', 'pioneer', 'bitcountry', 'bifrost_dot', 'hydradx_main', 'hydradx_rococo', 'pendulum', 'amplitude', 'continuum_network'],
44
- statemine: ['statemine', 'astar', 'shiden', 'statemint', 'moonbeam', 'moonbase', 'moonriver', 'crabParachain', 'darwinia2', 'parallel', 'calamari', 'manta_network', 'rococo_assethub', 'liberlandTest', 'liberland', 'dentnet', 'pangolin', 'crust', 'phala', 'shibuya', 'dbcchain'],
44
+ statemine: ['statemine', 'astar', 'shiden', 'statemint', 'moonbeam', 'moonbase', 'moonriver', 'crabParachain', 'darwinia2', 'parallel', 'calamari', 'manta_network', 'rococo_assethub', 'liberlandTest', 'liberland', 'dentnet', 'pangolin', 'crust', 'phala', 'shibuya', 'dbcchain', 'westend_assethub'],
45
45
  kusama: ['kusama', 'kintsugi', 'kintsugi_test', 'interlay', 'acala', 'statemint', 'karura', 'bifrost'],
46
46
  // perhaps there are some runtime updates
47
47
  centrifuge: ['centrifuge'],
@@ -288,9 +288,9 @@ const _DEFAULT_MANTA_ZK_CHAIN = 'calamari';
288
288
  // XCM------------------------------------------------------------------------------------------------------------------
289
289
  exports._DEFAULT_MANTA_ZK_CHAIN = _DEFAULT_MANTA_ZK_CHAIN;
290
290
  const _XCM_CHAIN_GROUP = {
291
- polkadotXcm: ['statemine', 'statemint', 'equilibrium_parachain', 'rococo_assethub', 'mythos'],
291
+ polkadotXcm: ['statemine', 'statemint', 'equilibrium_parachain', 'rococo_assethub', 'mythos', 'westend_assethub'],
292
292
  polkadotXcmSpecialCases: ['astar', 'shiden'],
293
- xcmPallet: ['polkadot', 'kusama', 'rococo']
293
+ xcmPallet: ['polkadot', 'kusama', 'rococo', 'westend']
294
294
  // default is xTokens pallet
295
295
  };
296
296
  exports._XCM_CHAIN_GROUP = _XCM_CHAIN_GROUP;
@@ -61,6 +61,7 @@ class ChainService {
61
61
  assetLogoMapSubject = new _rxjs.BehaviorSubject(_chainList.AssetLogoMap);
62
62
  chainLogoMapSubject = new _rxjs.BehaviorSubject(_chainList.ChainLogoMap);
63
63
  ledgerGenericAllowChainsSubject = new _rxjs.BehaviorSubject([]);
64
+ priorityTokensSubject = new _rxjs.BehaviorSubject({});
64
65
 
65
66
  // Todo: Update to new store indexed DB
66
67
  store = new _AssetSetting.default();
@@ -84,17 +85,25 @@ class ChainService {
84
85
  }
85
86
  get value() {
86
87
  const ledgerGenericAllowChains = this.ledgerGenericAllowChainsSubject;
88
+ const priorityTokens = this.priorityTokensSubject;
87
89
  return {
88
90
  get ledgerGenericAllowChains() {
89
91
  return ledgerGenericAllowChains.value;
92
+ },
93
+ get priorityTokens() {
94
+ return priorityTokens.value;
90
95
  }
91
96
  };
92
97
  }
93
98
  get observable() {
94
99
  const ledgerGenericAllowChains = this.ledgerGenericAllowChainsSubject;
100
+ const priorityTokens = this.priorityTokensSubject;
95
101
  return {
96
102
  get ledgerGenericAllowChains() {
97
103
  return ledgerGenericAllowChains.asObservable();
104
+ },
105
+ get priorityTokens() {
106
+ return priorityTokens.asObservable();
98
107
  }
99
108
  };
100
109
  }
@@ -605,6 +614,10 @@ class ChainService {
605
614
  this.eventService.emit('ledger.ready', true);
606
615
  this.logger.log('Finished updating latest ledger generic allow chains');
607
616
  }
617
+ handleLatestPriorityTokens(latestPriorityTokens) {
618
+ this.priorityTokensSubject.next(latestPriorityTokens);
619
+ this.logger.log('Finished updating latest popular tokens');
620
+ }
608
621
  handleLatestData() {
609
622
  this.fetchLatestChainData().then(latestChainInfo => {
610
623
  this.lockChainInfoMap = true; // do not need to check current lockChainInfoMap because all remains action is fast enough and don't affect this feature.
@@ -622,6 +635,9 @@ class ChainService {
622
635
  this.fetchLatestLedgerGenericAllowChains().then(latestledgerGenericAllowChains => {
623
636
  this.handleLatestLedgerGenericAllowChains(latestledgerGenericAllowChains);
624
637
  }).catch(console.error);
638
+ this.fetchLatestPriorityTokens().then(latestPriorityTokens => {
639
+ this.handleLatestPriorityTokens(latestPriorityTokens);
640
+ }).catch(console.error);
625
641
  }
626
642
  async initApis() {
627
643
  const chainInfoMap = this.getChainInfoMap();
@@ -885,6 +901,12 @@ class ChainService {
885
901
  async fetchLatestLedgerGenericAllowChains() {
886
902
  return (await (0, _utils2.fetchStaticData)('chains/ledger-generic-allow-chains')) || [];
887
903
  }
904
+ async fetchLatestPriorityTokens() {
905
+ return (await (0, _utils2.fetchStaticData)('chain-assets/priority-tokens')) || {
906
+ tokenGroup: {},
907
+ token: {}
908
+ };
909
+ }
888
910
  async initChains() {
889
911
  const storedChainSettings = await this.dbService.getAllChainStore();
890
912
  const defaultChainInfoMap = filterChainInfoMap(_chainList.ChainInfoMap, ignoredList);
@@ -11,6 +11,7 @@ var _web = require("@subwallet/extension-base/koni/api/contract-handler/evm/web3
11
11
  var _utils = require("@subwallet/extension-base/services/chain-service/utils");
12
12
  var _utils2 = require("@subwallet/extension-base/services/fee-service/utils");
13
13
  var _types = require("@subwallet/extension-base/types");
14
+ var _utils3 = require("@subwallet/extension-base/utils");
14
15
  var _util = require("@polkadot/util");
15
16
  var _constants = require("../../constants");
16
17
  var _base = _interopRequireDefault(require("./base"));
@@ -280,7 +281,6 @@ class StellaSwapLiquidStakingPoolHandler extends _base.default {
280
281
  });
281
282
  }
282
283
  async handleSubmitStep(data, path) {
283
- var _priority$maxFeePerGa, _priority$maxPriority;
284
284
  const {
285
285
  address,
286
286
  amount
@@ -300,14 +300,13 @@ class StellaSwapLiquidStakingPoolHandler extends _base.default {
300
300
  from: address
301
301
  });
302
302
  const priority = await (0, _utils2.calculateGasFeeParams)(evmApi, this.chain);
303
+ const feeCombine = (0, _utils3.combineEthFee)(priority);
303
304
  const transactionObject = {
304
305
  from: address,
305
306
  to: (0, _utils._getContractAddressOfToken)(derivativeTokenInfo),
306
307
  data: depositEncodedCall,
307
308
  gas: gasLimit,
308
- gasPrice: priority.gasPrice,
309
- maxFeePerGas: (_priority$maxFeePerGa = priority.maxFeePerGas) === null || _priority$maxFeePerGa === void 0 ? void 0 : _priority$maxFeePerGa.toString(),
310
- maxPriorityFeePerGas: (_priority$maxPriority = priority.maxPriorityFeePerGas) === null || _priority$maxPriority === void 0 ? void 0 : _priority$maxPriority.toString()
309
+ ...feeCombine
311
310
  };
312
311
  return {
313
312
  txChain: this.chain,
@@ -327,7 +326,6 @@ class StellaSwapLiquidStakingPoolHandler extends _base.default {
327
326
  return Promise.reject(new _TransactionError.TransactionError(_types.BasicTxErrorType.UNSUPPORTED));
328
327
  }
329
328
  async handleYieldUnstake(amount, address, selectedTarget) {
330
- var _priority$maxFeePerGa2, _priority$maxPriority2;
331
329
  const evmApi = this.evmApi;
332
330
  const derivativeTokenSlug = this.derivativeAssets[0];
333
331
  const derivativeTokenInfo = this.state.getAssetBySlug(derivativeTokenSlug);
@@ -343,14 +341,13 @@ class StellaSwapLiquidStakingPoolHandler extends _base.default {
343
341
  from: address
344
342
  });
345
343
  const priority = await (0, _utils2.calculateGasFeeParams)(evmApi, this.chain);
344
+ const feeCombine = (0, _utils3.combineEthFee)(priority);
346
345
  const transaction = {
347
346
  from: address,
348
347
  to: (0, _utils._getContractAddressOfToken)(derivativeTokenInfo),
349
348
  data: redeemEncodedCall,
350
349
  gas: gasLimit,
351
- gasPrice: priority.gasPrice,
352
- maxFeePerGas: (_priority$maxFeePerGa2 = priority.maxFeePerGas) === null || _priority$maxFeePerGa2 === void 0 ? void 0 : _priority$maxFeePerGa2.toString(),
353
- maxPriorityFeePerGas: (_priority$maxPriority2 = priority.maxPriorityFeePerGas) === null || _priority$maxPriority2 === void 0 ? void 0 : _priority$maxPriority2.toString()
350
+ ...feeCombine
354
351
  };
355
352
  return [_KoniTypes.ExtrinsicType.UNSTAKE_STDOT, transaction];
356
353
  }
@@ -360,7 +357,6 @@ class StellaSwapLiquidStakingPoolHandler extends _base.default {
360
357
  /* Other actions */
361
358
 
362
359
  async handleYieldWithdraw(address, unstakingInfo) {
363
- var _priority$maxFeePerGa3, _priority$maxPriority3;
364
360
  const evmApi = this.evmApi;
365
361
  const derivativeTokenSlug = this.derivativeAssets[0];
366
362
  const derivativeTokenInfo = this.state.getAssetBySlug(derivativeTokenSlug);
@@ -376,14 +372,13 @@ class StellaSwapLiquidStakingPoolHandler extends _base.default {
376
372
  from: address
377
373
  });
378
374
  const priority = await (0, _utils2.calculateGasFeeParams)(evmApi, this.chain);
375
+ const feeCombine = (0, _utils3.combineEthFee)(priority);
379
376
  return {
380
377
  from: address,
381
378
  to: (0, _utils._getContractAddressOfToken)(derivativeTokenInfo),
382
379
  data: withdrawEncodedCall,
383
380
  gas: gasLimit,
384
- gasPrice: priority.gasPrice,
385
- maxFeePerGas: (_priority$maxFeePerGa3 = priority.maxFeePerGas) === null || _priority$maxFeePerGa3 === void 0 ? void 0 : _priority$maxFeePerGa3.toString(),
386
- maxPriorityFeePerGas: (_priority$maxPriority3 = priority.maxPriorityFeePerGas) === null || _priority$maxPriority3 === void 0 ? void 0 : _priority$maxPriority3.toString()
381
+ ...feeCombine
387
382
  }; // TODO: check tx history parsing
388
383
  }
389
384
 
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = exports.bittensorApiKey = exports.BITTENSOR_API_KEY_9 = exports.BITTENSOR_API_KEY_8 = exports.BITTENSOR_API_KEY_7 = exports.BITTENSOR_API_KEY_6 = exports.BITTENSOR_API_KEY_5 = exports.BITTENSOR_API_KEY_4 = exports.BITTENSOR_API_KEY_3 = exports.BITTENSOR_API_KEY_2 = exports.BITTENSOR_API_KEY_10 = exports.BITTENSOR_API_KEY_1 = void 0;
8
8
  exports.fetchDelegates = fetchDelegates;
9
- exports.fetchTaoDelegateState = fetchTaoDelegateState;
9
+ exports.getTaoToAlphaMapping = void 0;
10
10
  var _TransactionError = require("@subwallet/extension-base/background/errors/TransactionError");
11
11
  var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
12
12
  var _constants = require("@subwallet/extension-base/constants");
@@ -20,6 +20,26 @@ var _utils3 = require("../../utils");
20
20
  // Copyright 2019-2022 @subwallet/extension-base
21
21
  // SPDX-License-Identifier: Apache-2.0
22
22
 
23
+ const getTaoToAlphaMapping = async substrateApi => {
24
+ const allSubnets = (await substrateApi.api.call.subnetInfoRuntimeApi.getAllDynamicInfo()).toJSON();
25
+ if (!allSubnets) {
26
+ return {};
27
+ }
28
+ return allSubnets.reduce((acc, subnet) => {
29
+ const netuid = subnet === null || subnet === void 0 ? void 0 : subnet.netuid;
30
+ const taoIn = subnet !== null && subnet !== void 0 && subnet.taoIn ? new _bignumber.default(subnet.taoIn) : new _bignumber.default(0);
31
+ const alphaIn = subnet !== null && subnet !== void 0 && subnet.alphaIn ? new _bignumber.default(subnet.alphaIn) : new _bignumber.default(0);
32
+ if (netuid === 0) {
33
+ acc[netuid] = '1';
34
+ } else if (alphaIn.gt(0)) {
35
+ acc[netuid] = taoIn.dividedBy(alphaIn).toString();
36
+ } else {
37
+ acc[netuid] = '1';
38
+ }
39
+ return acc;
40
+ }, {});
41
+ };
42
+ exports.getTaoToAlphaMapping = getTaoToAlphaMapping;
23
43
  const BITTENSOR_API_KEY_1 = process.env.BITTENSOR_API_KEY_1 || '';
24
44
  exports.BITTENSOR_API_KEY_1 = BITTENSOR_API_KEY_1;
25
45
  const BITTENSOR_API_KEY_2 = process.env.BITTENSOR_API_KEY_2 || '';
@@ -49,7 +69,7 @@ function random() {
49
69
  return validKeys[randomIndex];
50
70
  }
51
71
  const bittensorApiKey = () => {
52
- return random(BITTENSOR_API_KEY_1, BITTENSOR_API_KEY_2, BITTENSOR_API_KEY_3, BITTENSOR_API_KEY_4, BITTENSOR_API_KEY_5, BITTENSOR_API_KEY_6);
72
+ return random(BITTENSOR_API_KEY_1, BITTENSOR_API_KEY_2, BITTENSOR_API_KEY_3, BITTENSOR_API_KEY_4, BITTENSOR_API_KEY_5, BITTENSOR_API_KEY_6, BITTENSOR_API_KEY_7, BITTENSOR_API_KEY_8, BITTENSOR_API_KEY_9, BITTENSOR_API_KEY_10);
53
73
  };
54
74
 
55
75
  /* Fetch data */
@@ -68,20 +88,22 @@ async function fetchDelegates() {
68
88
  }).catch(console.error);
69
89
  });
70
90
  }
71
- async function fetchTaoDelegateState(address) {
72
- const apiKey = bittensorApiKey();
73
- return new Promise(function (resolve) {
74
- fetch(`https://api.taostats.io/api/stake_balance/latest/v1?coldkey=${address}`, {
75
- method: 'GET',
76
- headers: {
77
- 'Content-Type': 'application/json',
78
- Authorization: `${apiKey}`
79
- }
80
- }).then(resp => {
81
- resolve(resp.json());
82
- }).catch(console.error);
83
- });
84
- }
91
+
92
+ // export async function fetchTaoDelegateState (address: string): Promise<RawDelegateState> {
93
+ // const apiKey = bittensorApiKey();
94
+
95
+ // return new Promise(function (resolve) {
96
+ // fetch(`https://api.taostats.io/api/stake_balance/latest/v1?coldkey=${address}`, {
97
+ // method: 'GET',
98
+ // headers: {
99
+ // 'Content-Type': 'application/json',
100
+ // Authorization: `${apiKey}`
101
+ // }
102
+ // }).then((resp) => {
103
+ // resolve(resp.json());
104
+ // }).catch(console.error);
105
+ // });
106
+ // }
85
107
 
86
108
  /* Fetch data */
87
109
 
@@ -182,11 +204,12 @@ class TaoNativeStakingPoolHandler extends _basePara.default {
182
204
  chain: chainInfo.slug,
183
205
  validatorAddress: delegate.owner,
184
206
  activeStake: activeStake,
185
- validatorMinStake: minDelegatorStake,
186
- validatorIdentity: delegate.identity
207
+ validatorMinStake: minDelegatorStake
208
+ // validatorIdentity: delegate.identity
187
209
  });
188
210
  }
189
211
  }
212
+
190
213
  const stakingStatus = (0, _utils.getEarningStatusByNominations)(allActiveStake, nominationList);
191
214
  return {
192
215
  status: stakingStatus,
@@ -214,9 +237,10 @@ class TaoNativeStakingPoolHandler extends _basePara.default {
214
237
  bnTotalBalance = bnTotalBalance.add(bnStakeAmount);
215
238
  delegatorState.push({
216
239
  owner: testnetAddress,
217
- amount: bnStakeAmount.toString(),
218
- identity: testnetAddress
240
+ amount: bnStakeAmount.toString()
241
+ // identity: testnetAddress
219
242
  });
243
+
220
244
  rsCallback({
221
245
  ...defaultInfo,
222
246
  type: this.type,
@@ -239,20 +263,32 @@ class TaoNativeStakingPoolHandler extends _basePara.default {
239
263
  await Promise.all(stakePromises);
240
264
  };
241
265
  const getMainnetPoolPosition = async () => {
242
- const rawDelegateStateInfos = await Promise.all(useAddresses.map(address => fetchTaoDelegateState(address)));
243
- if (rawDelegateStateInfos.length > 0) {
266
+ const rawDelegateStateInfos = await Promise.all(useAddresses.map(async address => (await substrateApi.api.call.stakeInfoRuntimeApi.getStakeInfoForColdkey(address)).toJSON()));
267
+ const price = await getTaoToAlphaMapping(this.substrateApi);
268
+ if (rawDelegateStateInfos && rawDelegateStateInfos.length > 0) {
244
269
  rawDelegateStateInfos.forEach((rawDelegateStateInfo, i) => {
245
270
  const owner = (0, _utils2.reformatAddress)(useAddresses[i], 42);
246
271
  const delegatorState = [];
247
272
  let bnTotalBalance = _util.BN_ZERO;
248
- const delegateStateInfo = rawDelegateStateInfo.data;
273
+ const delegateStateInfo = rawDelegateStateInfo;
274
+ const totalDelegate = {};
249
275
  for (const delegate of delegateStateInfo) {
250
- const name = delegate.hotkey_name || delegate.hotkey.ss58;
251
- bnTotalBalance = bnTotalBalance.add(new _util.BN(delegate.stake));
276
+ const hotkey = delegate.hotkey;
277
+ const netuid = delegate.netuid;
278
+ const stake = new _bignumber.default(delegate.stake);
279
+ const taoToAlphaPrice = price[netuid] ? new _bignumber.default(price[netuid]) : new _bignumber.default(1);
280
+ const taoStake = stake.multipliedBy(taoToAlphaPrice).toFixed(0).toString();
281
+ if (totalDelegate[hotkey]) {
282
+ totalDelegate[hotkey] = new _bignumber.default(totalDelegate[hotkey]).plus(taoStake).toString();
283
+ } else {
284
+ totalDelegate[hotkey] = taoStake;
285
+ }
286
+ }
287
+ for (const hotkey in totalDelegate) {
288
+ bnTotalBalance = bnTotalBalance.add(new _util.BN(totalDelegate[hotkey]));
252
289
  delegatorState.push({
253
- owner: delegate.hotkey.ss58,
254
- amount: delegate.stake,
255
- identity: name
290
+ owner: hotkey,
291
+ amount: totalDelegate[hotkey]
256
292
  });
257
293
  }
258
294
  if (delegateStateInfo && delegateStateInfo.length > 0) {
@@ -282,6 +318,61 @@ class TaoNativeStakingPoolHandler extends _basePara.default {
282
318
  });
283
319
  }
284
320
  };
321
+
322
+ // const getMainnetPoolPosition = async () => {
323
+ // const rawDelegateStateInfos = await Promise.all(
324
+ // useAddresses.map((address) => fetchTaoDelegateState(address))
325
+ // );
326
+
327
+ // if (rawDelegateStateInfos.length > 0) {
328
+ // rawDelegateStateInfos.forEach((rawDelegateStateInfo, i) => {
329
+ // const owner = reformatAddress(useAddresses[i], 42);
330
+ // const delegatorState: TaoStakingStakeOption[] = [];
331
+ // let bnTotalBalance = BN_ZERO;
332
+ // const delegateStateInfo = rawDelegateStateInfo.data;
333
+
334
+ // for (const delegate of delegateStateInfo) {
335
+ // const name = delegate.hotkey_name || delegate.hotkey.ss58;
336
+
337
+ // bnTotalBalance = bnTotalBalance.add(new BN(delegate.stake));
338
+
339
+ // delegatorState.push({
340
+ // owner: delegate.hotkey.ss58,
341
+ // amount: delegate.stake,
342
+ // identity: name
343
+ // });
344
+ // }
345
+
346
+ // if (delegateStateInfo && delegateStateInfo.length > 0) {
347
+ // this.parseNominatorMetadata(chainInfo, owner, delegatorState)
348
+ // .then((nominatorMetadata) => {
349
+ // rsCallback({
350
+ // ...defaultInfo,
351
+ // ...nominatorMetadata,
352
+ // address: owner,
353
+ // type: this.type
354
+ // });
355
+ // })
356
+ // .catch(console.error);
357
+ // } else {
358
+ // rsCallback({
359
+ // ...defaultInfo,
360
+ // type: this.type,
361
+ // address: owner,
362
+ // balanceToken: this.nativeToken.slug,
363
+ // totalStake: '0',
364
+ // activeStake: '0',
365
+ // unstakeBalance: '0',
366
+ // status: EarningStatus.NOT_STAKING,
367
+ // isBondedBefore: false,
368
+ // nominations: [],
369
+ // unstakings: []
370
+ // });
371
+ // }
372
+ // });
373
+ // }
374
+ // };
375
+
285
376
  const getStakingPositionInterval = async () => {
286
377
  if (cancel) {
287
378
  return;
@@ -387,7 +478,7 @@ class TaoNativeStakingPoolHandler extends _basePara.default {
387
478
  const binaryAmount = new _util.BN(amount);
388
479
  const selectedValidatorInfo = targetValidators[0];
389
480
  const hotkey = selectedValidatorInfo.address;
390
- const extrinsic = chainApi.api.tx.subtensorModule.addStake(hotkey, binaryAmount);
481
+ const extrinsic = chainApi.api.tx.subtensorModule.addStake(hotkey, 0, binaryAmount);
391
482
  return [extrinsic, {
392
483
  slug: this.nativeToken.slug,
393
484
  amount: '0'
@@ -405,7 +496,7 @@ class TaoNativeStakingPoolHandler extends _basePara.default {
405
496
  if (!selectedTarget || !poolPosition) {
406
497
  return Promise.reject(new _TransactionError.TransactionError(_types.BasicTxErrorType.INVALID_PARAMS));
407
498
  }
408
- const extrinsic = apiPromise.api.tx.subtensorModule.removeStake(selectedTarget, binaryAmount);
499
+ const extrinsic = apiPromise.api.tx.subtensorModule.removeStake(selectedTarget, 0, binaryAmount);
409
500
  return [_KoniTypes.ExtrinsicType.STAKING_UNBOND, extrinsic];
410
501
  }
411
502
 
@@ -91,7 +91,7 @@ class NominationPoolHandler extends _base.default {
91
91
 
92
92
  const supportedDays = (0, _utils.getSupportedDaysByHistoryDepth)(erasPerDay, parseInt(maxSupportedEras), parseInt(currentEra) / erasPerDay);
93
93
  const startEra = parseInt(currentEra) - supportedDays * erasPerDay;
94
- const [_maxPoolMember, _EraStakeInfo, _totalIssuance, _auctionCounter, _minPoolJoin, ..._eraReward] = await Promise.all([(_substrateApi$api$que2 = substrateApi.api.query.nominationPools) === null || _substrateApi$api$que2 === void 0 ? void 0 : _substrateApi$api$que2.maxPoolMembersPerPool(), substrateApi.api.query.staking.erasTotalStake.multi([parseInt(currentEra), parseInt(currentEra) - 1]), substrateApi.api.query.balances.totalIssuance(), (_substrateApi$api$que3 = substrateApi.api.query.auctions) === null || _substrateApi$api$que3 === void 0 ? void 0 : _substrateApi$api$que3.auctionCounter(), (_substrateApi$api$que4 = substrateApi.api.query.nominationPools) === null || _substrateApi$api$que4 === void 0 ? void 0 : _substrateApi$api$que4.minJoinBond(), substrateApi.api.query.staking.erasValidatorReward.multi([...Array(supportedDays.toString()).keys()].map(i => i + startEra))]);
94
+ const [_maxPoolMember, _EraStakeInfo, _totalIssuance, _auctionCounter, _minPoolJoin, ..._eraReward] = await Promise.all([(_substrateApi$api$que2 = substrateApi.api.query.nominationPools) === null || _substrateApi$api$que2 === void 0 ? void 0 : _substrateApi$api$que2.maxPoolMembersPerPool(), substrateApi.api.query.staking.erasTotalStake.multi([parseInt(currentEra), parseInt(currentEra) - 1]), substrateApi.api.query.balances.totalIssuance(), (_substrateApi$api$que3 = substrateApi.api.query.auctions) === null || _substrateApi$api$que3 === void 0 ? void 0 : _substrateApi$api$que3.auctionCounter(), (_substrateApi$api$que4 = substrateApi.api.query.nominationPools) === null || _substrateApi$api$que4 === void 0 ? void 0 : _substrateApi$api$que4.minJoinBond(), substrateApi.api.query.staking.erasValidatorReward.multi([...Array(supportedDays).keys()].map(i => i + startEra))]);
95
95
  const maxPoolMembers = _maxPoolMember ? parseInt(_maxPoolMember.toString()) : undefined;
96
96
  const [_totalEraStake, _lastTotalStaked] = _EraStakeInfo;
97
97
  const validatorEraReward = (0, _utils.getAvgValidatorEraReward)(supportedDays, _eraReward[0]);