@subwallet/extension-base 1.1.31-1 → 1.1.31-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.
Files changed (305) hide show
  1. package/background/KoniTypes.d.ts +111 -69
  2. package/background/KoniTypes.js +19 -13
  3. package/background/errors/TransactionError.js +9 -0
  4. package/cjs/background/KoniTypes.js +20 -16
  5. package/cjs/background/errors/TransactionError.js +9 -0
  6. package/cjs/constants/index.js +19 -4
  7. package/cjs/koni/api/dotsama/balance.js +464 -0
  8. package/cjs/koni/api/nft/config.js +33 -23
  9. package/cjs/koni/api/nft/index.js +14 -0
  10. package/cjs/koni/api/nft/nft.js +1 -22
  11. package/cjs/koni/api/nft/ordinal_nft/constants.js +21 -0
  12. package/cjs/koni/api/nft/ordinal_nft/index.js +121 -0
  13. package/cjs/koni/api/nft/ordinal_nft/utils.js +41 -0
  14. package/cjs/koni/api/staking/bonding/amplitude.js +17 -15
  15. package/cjs/koni/api/staking/bonding/astar.js +11 -10
  16. package/cjs/koni/api/staking/bonding/index.js +4 -1
  17. package/cjs/koni/api/staking/bonding/paraChain.js +25 -23
  18. package/cjs/koni/api/staking/bonding/relayChain.js +48 -45
  19. package/cjs/koni/api/staking/bonding/utils.js +104 -86
  20. package/cjs/koni/api/staking/index.js +6 -5
  21. package/cjs/koni/api/staking/paraChain.js +6 -5
  22. package/cjs/koni/api/staking/relayChain.js +3 -2
  23. package/cjs/koni/api/yield/helper/utils.js +46 -0
  24. package/cjs/koni/background/cron.js +11 -1
  25. package/cjs/koni/background/handlers/Extension.js +362 -69
  26. package/cjs/koni/background/handlers/State.js +51 -3
  27. package/cjs/koni/background/handlers/index.js +4 -2
  28. package/cjs/koni/background/subscription.js +95 -37
  29. package/cjs/services/campaign-service/index.js +9 -6
  30. package/cjs/services/chain-service/constants.js +2 -16
  31. package/cjs/services/chain-service/index.js +3 -2
  32. package/cjs/services/chain-service/utils.js +7 -1
  33. package/cjs/services/earning-service/constants/chains.js +29 -0
  34. package/cjs/services/earning-service/constants/index.js +27 -0
  35. package/cjs/services/earning-service/constants/step.js +18 -0
  36. package/cjs/services/earning-service/handlers/base.js +259 -0
  37. package/cjs/services/earning-service/handlers/index.js +60 -0
  38. package/cjs/services/earning-service/handlers/lending/base.js +20 -0
  39. package/cjs/services/earning-service/handlers/lending/index.js +13 -0
  40. package/cjs/services/earning-service/handlers/lending/interlay.js +191 -0
  41. package/cjs/services/earning-service/handlers/liquid-staking/acala.js +239 -0
  42. package/cjs/services/earning-service/handlers/liquid-staking/base.js +43 -0
  43. package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +297 -0
  44. package/cjs/services/earning-service/handlers/liquid-staking/index.js +34 -0
  45. package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +226 -0
  46. package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +395 -0
  47. package/cjs/services/earning-service/handlers/native-staking/amplitude.js +384 -0
  48. package/cjs/services/earning-service/handlers/native-staking/astar.js +461 -0
  49. package/cjs/services/earning-service/handlers/native-staking/base-para.js +146 -0
  50. package/cjs/services/earning-service/handlers/native-staking/base.js +159 -0
  51. package/cjs/services/earning-service/handlers/native-staking/index.js +34 -0
  52. package/cjs/services/earning-service/handlers/native-staking/para-chain.js +385 -0
  53. package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +558 -0
  54. package/cjs/services/earning-service/handlers/nomination-pool/index.js +560 -0
  55. package/cjs/services/earning-service/handlers/special.js +503 -0
  56. package/cjs/services/earning-service/service.js +387 -0
  57. package/cjs/services/earning-service/utils/index.js +128 -0
  58. package/cjs/services/event-service/index.js +4 -0
  59. package/cjs/services/keyring-service/index.js +14 -2
  60. package/cjs/services/migration-service/scripts/DeleteEarningData.js +21 -0
  61. package/cjs/services/migration-service/scripts/EnableEarningChains.js +21 -0
  62. package/cjs/services/migration-service/scripts/MigrateEthProvider.js +17 -0
  63. package/cjs/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
  64. package/cjs/services/migration-service/scripts/MigratePioneerProvider.js +17 -0
  65. package/cjs/services/migration-service/scripts/MigrateProvider.js +29 -0
  66. package/cjs/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
  67. package/cjs/services/migration-service/scripts/databases/MigrateEarningHistory.js +21 -0
  68. package/cjs/services/migration-service/scripts/databases/MigrateEarningVersion.js +21 -0
  69. package/cjs/services/migration-service/scripts/index.js +7 -1
  70. package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +149 -0
  71. package/cjs/services/mint-campaign-service/campaigns/index.js +13 -0
  72. package/cjs/services/mint-campaign-service/constants.js +11 -0
  73. package/cjs/services/mint-campaign-service/index.js +18 -0
  74. package/cjs/services/notification-service/NotificationService.js +1 -1
  75. package/cjs/services/storage-service/DatabaseService.js +51 -0
  76. package/cjs/services/storage-service/databases/index.js +4 -0
  77. package/cjs/services/storage-service/db-stores/NominatorMetadata.js +3 -3
  78. package/cjs/services/storage-service/db-stores/YieldPoolStore.js +36 -0
  79. package/cjs/services/storage-service/db-stores/YieldPositionStore.js +65 -0
  80. package/cjs/services/storage-service/index.js +241 -0
  81. package/cjs/services/subscan-service/index.js +16 -0
  82. package/cjs/services/transaction-service/event-parser/index.js +58 -0
  83. package/cjs/services/transaction-service/helpers/index.js +3 -1
  84. package/cjs/services/transaction-service/index.js +231 -75
  85. package/cjs/services/transaction-service/utils.js +1 -0
  86. package/cjs/types/campaigns/index.js +16 -0
  87. package/cjs/types/campaigns/unlock-dot.js +1 -0
  88. package/cjs/types/index.js +44 -0
  89. package/cjs/types/ordinal.js +1 -0
  90. package/cjs/types/transaction.js +1 -0
  91. package/cjs/types/yield/actions/index.js +27 -0
  92. package/cjs/types/yield/actions/join/index.js +38 -0
  93. package/cjs/types/yield/actions/join/step.js +47 -0
  94. package/cjs/types/yield/actions/join/submit.js +1 -0
  95. package/cjs/types/yield/actions/join/validate.js +16 -0
  96. package/cjs/types/yield/actions/others.js +1 -0
  97. package/cjs/types/yield/index.js +27 -0
  98. package/cjs/types/yield/info/account/index.js +49 -0
  99. package/cjs/types/yield/info/account/info.js +1 -0
  100. package/cjs/types/yield/info/account/reward.js +1 -0
  101. package/cjs/types/yield/info/account/target.js +32 -0
  102. package/cjs/types/yield/info/account/unstake.js +27 -0
  103. package/cjs/types/yield/info/base.js +41 -0
  104. package/cjs/types/yield/info/chain/index.js +27 -0
  105. package/cjs/types/yield/info/chain/info.js +1 -0
  106. package/cjs/types/yield/info/chain/target.js +1 -0
  107. package/cjs/types/yield/info/index.js +49 -0
  108. package/cjs/types/yield/info/pallet.js +15 -0
  109. package/cjs/types.js +1 -0
  110. package/cjs/utils/address.js +34 -0
  111. package/cjs/utils/fetchStaticData.js +2 -1
  112. package/cjs/utils/index.js +89 -1
  113. package/cjs/utils/keyring.js +57 -0
  114. package/cjs/utils/number.js +3 -1
  115. package/cjs/utils/object.js +12 -0
  116. package/constants/index.d.ts +6 -1
  117. package/constants/index.js +6 -1
  118. package/koni/api/nft/config.js +33 -23
  119. package/koni/api/nft/index.js +15 -1
  120. package/koni/api/nft/nft.js +2 -23
  121. package/koni/api/nft/ordinal_nft/constants.d.ts +9 -0
  122. package/koni/api/nft/ordinal_nft/constants.js +12 -0
  123. package/koni/api/nft/ordinal_nft/index.d.ts +8 -0
  124. package/koni/api/nft/ordinal_nft/index.js +114 -0
  125. package/koni/api/nft/ordinal_nft/utils.d.ts +2 -0
  126. package/koni/api/nft/ordinal_nft/utils.js +33 -0
  127. package/koni/api/staking/bonding/amplitude.js +11 -9
  128. package/koni/api/staking/bonding/astar.js +9 -8
  129. package/koni/api/staking/bonding/index.d.ts +1 -1
  130. package/koni/api/staking/bonding/index.js +5 -1
  131. package/koni/api/staking/bonding/paraChain.js +12 -10
  132. package/koni/api/staking/bonding/relayChain.d.ts +2 -2
  133. package/koni/api/staking/bonding/relayChain.js +33 -30
  134. package/koni/api/staking/bonding/utils.d.ts +15 -38
  135. package/koni/api/staking/bonding/utils.js +85 -69
  136. package/koni/api/staking/index.js +2 -1
  137. package/koni/api/staking/paraChain.js +7 -6
  138. package/koni/api/staking/relayChain.js +4 -3
  139. package/koni/api/yield/helper/utils.d.ts +10 -0
  140. package/koni/api/yield/helper/utils.js +32 -0
  141. package/koni/background/cron.d.ts +1 -0
  142. package/koni/background/cron.js +12 -2
  143. package/koni/background/handlers/Extension.d.ts +17 -1
  144. package/koni/background/handlers/Extension.js +321 -30
  145. package/koni/background/handlers/State.d.ts +18 -2
  146. package/koni/background/handlers/State.js +50 -3
  147. package/koni/background/handlers/index.js +4 -2
  148. package/koni/background/subscription.d.ts +6 -1
  149. package/koni/background/subscription.js +97 -38
  150. package/package.json +316 -3
  151. package/services/campaign-service/index.js +9 -6
  152. package/services/chain-service/constants.d.ts +0 -11
  153. package/services/chain-service/constants.js +1 -14
  154. package/services/chain-service/index.js +3 -2
  155. package/services/chain-service/utils.d.ts +1 -0
  156. package/services/chain-service/utils.js +5 -1
  157. package/services/earning-service/constants/abis/compound_finance_v2_abi.json +1235 -0
  158. package/services/earning-service/constants/abis/st_liquid_token_abi.json +1355 -0
  159. package/services/earning-service/constants/chains.d.ts +14 -0
  160. package/services/earning-service/constants/chains.js +21 -0
  161. package/services/earning-service/constants/index.d.ts +2 -0
  162. package/services/earning-service/constants/index.js +5 -0
  163. package/services/earning-service/constants/step.d.ts +3 -0
  164. package/services/earning-service/constants/step.js +10 -0
  165. package/services/earning-service/handlers/base.d.ts +112 -0
  166. package/services/earning-service/handlers/base.js +253 -0
  167. package/services/earning-service/handlers/index.d.ts +5 -0
  168. package/services/earning-service/handlers/index.js +8 -0
  169. package/services/earning-service/handlers/lending/base.d.ts +6 -0
  170. package/services/earning-service/handlers/lending/base.js +12 -0
  171. package/services/earning-service/handlers/lending/index.d.ts +1 -0
  172. package/services/earning-service/handlers/lending/index.js +4 -0
  173. package/services/earning-service/handlers/lending/interlay.d.ts +24 -0
  174. package/services/earning-service/handlers/lending/interlay.js +183 -0
  175. package/services/earning-service/handlers/liquid-staking/acala.d.ts +27 -0
  176. package/services/earning-service/handlers/liquid-staking/acala.js +231 -0
  177. package/services/earning-service/handlers/liquid-staking/base.d.ts +9 -0
  178. package/services/earning-service/handlers/liquid-staking/base.js +35 -0
  179. package/services/earning-service/handlers/liquid-staking/bifrost.d.ts +46 -0
  180. package/services/earning-service/handlers/liquid-staking/bifrost.js +286 -0
  181. package/services/earning-service/handlers/liquid-staking/index.d.ts +4 -0
  182. package/services/earning-service/handlers/liquid-staking/index.js +7 -0
  183. package/services/earning-service/handlers/liquid-staking/parallel.d.ts +26 -0
  184. package/services/earning-service/handlers/liquid-staking/parallel.js +218 -0
  185. package/services/earning-service/handlers/liquid-staking/stella-swap.d.ts +34 -0
  186. package/services/earning-service/handlers/liquid-staking/stella-swap.js +385 -0
  187. package/services/earning-service/handlers/native-staking/amplitude.d.ts +22 -0
  188. package/services/earning-service/handlers/native-staking/amplitude.js +375 -0
  189. package/services/earning-service/handlers/native-staking/astar.d.ts +19 -0
  190. package/services/earning-service/handlers/native-staking/astar.js +451 -0
  191. package/services/earning-service/handlers/native-staking/base-para.d.ts +11 -0
  192. package/services/earning-service/handlers/native-staking/base-para.js +138 -0
  193. package/services/earning-service/handlers/native-staking/base.d.ts +21 -0
  194. package/services/earning-service/handlers/native-staking/base.js +150 -0
  195. package/services/earning-service/handlers/native-staking/index.d.ts +4 -0
  196. package/services/earning-service/handlers/native-staking/index.js +7 -0
  197. package/services/earning-service/handlers/native-staking/para-chain.d.ts +15 -0
  198. package/services/earning-service/handlers/native-staking/para-chain.js +377 -0
  199. package/services/earning-service/handlers/native-staking/relay-chain.d.ts +21 -0
  200. package/services/earning-service/handlers/native-staking/relay-chain.js +549 -0
  201. package/services/earning-service/handlers/nomination-pool/index.d.ts +36 -0
  202. package/services/earning-service/handlers/nomination-pool/index.js +550 -0
  203. package/services/earning-service/handlers/special.d.ts +65 -0
  204. package/services/earning-service/handlers/special.js +495 -0
  205. package/services/earning-service/service.d.ts +45 -0
  206. package/services/earning-service/service.js +379 -0
  207. package/services/earning-service/utils/index.d.ts +18 -0
  208. package/services/earning-service/utils/index.js +112 -0
  209. package/services/event-service/index.d.ts +1 -0
  210. package/services/event-service/index.js +4 -0
  211. package/services/event-service/types.d.ts +8 -0
  212. package/services/keyring-service/index.d.ts +2 -1
  213. package/services/keyring-service/index.js +14 -2
  214. package/services/migration-service/scripts/DeleteEarningData.d.ts +4 -0
  215. package/services/migration-service/scripts/DeleteEarningData.js +13 -0
  216. package/services/migration-service/scripts/EnableEarningChains.d.ts +4 -0
  217. package/services/migration-service/scripts/EnableEarningChains.js +13 -0
  218. package/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
  219. package/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
  220. package/services/migration-service/scripts/databases/MigrateEarningHistory.d.ts +4 -0
  221. package/services/migration-service/scripts/databases/MigrateEarningHistory.js +13 -0
  222. package/services/migration-service/scripts/databases/MigrateEarningVersion.d.ts +4 -0
  223. package/services/migration-service/scripts/databases/MigrateEarningVersion.js +13 -0
  224. package/services/migration-service/scripts/index.js +7 -1
  225. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.d.ts +13 -0
  226. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +139 -0
  227. package/services/mint-campaign-service/campaigns/index.d.ts +1 -0
  228. package/services/mint-campaign-service/campaigns/index.js +4 -0
  229. package/services/mint-campaign-service/constants.d.ts +1 -0
  230. package/services/mint-campaign-service/constants.js +4 -0
  231. package/services/mint-campaign-service/index.d.ts +7 -0
  232. package/services/mint-campaign-service/index.js +11 -0
  233. package/services/notification-service/NotificationService.js +1 -1
  234. package/services/storage-service/DatabaseService.d.ts +18 -1
  235. package/services/storage-service/DatabaseService.js +51 -0
  236. package/services/storage-service/databases/index.d.ts +3 -1
  237. package/services/storage-service/databases/index.js +4 -0
  238. package/services/storage-service/db-stores/NominatorMetadata.js +3 -3
  239. package/services/storage-service/db-stores/YieldPoolStore.d.ts +10 -0
  240. package/services/storage-service/db-stores/YieldPoolStore.js +28 -0
  241. package/services/storage-service/db-stores/YieldPositionStore.d.ts +9 -0
  242. package/services/storage-service/db-stores/YieldPositionStore.js +57 -0
  243. package/services/subscan-service/index.d.ts +3 -2
  244. package/services/subscan-service/index.js +15 -0
  245. package/services/subscan-service/types.d.ts +20 -0
  246. package/services/transaction-service/event-parser/index.d.ts +3 -1
  247. package/services/transaction-service/event-parser/index.js +57 -1
  248. package/services/transaction-service/helpers/index.js +3 -1
  249. package/services/transaction-service/index.d.ts +4 -15
  250. package/services/transaction-service/index.js +229 -73
  251. package/services/transaction-service/types.d.ts +2 -0
  252. package/services/transaction-service/utils.js +1 -0
  253. package/types/campaigns/index.d.ts +1 -0
  254. package/types/campaigns/index.js +4 -0
  255. package/types/campaigns/unlock-dot.d.ts +71 -0
  256. package/types/campaigns/unlock-dot.js +1 -0
  257. package/types/index.d.ts +5 -0
  258. package/types/index.js +5 -1
  259. package/types/ordinal.d.ts +69 -0
  260. package/types/ordinal.js +1 -0
  261. package/types/transaction.d.ts +3 -0
  262. package/types/transaction.js +1 -0
  263. package/types/yield/actions/index.d.ts +2 -0
  264. package/types/yield/actions/index.js +5 -0
  265. package/types/yield/actions/join/index.d.ts +3 -0
  266. package/types/yield/actions/join/index.js +6 -0
  267. package/types/yield/actions/join/step.d.ts +95 -0
  268. package/types/yield/actions/join/step.js +46 -0
  269. package/types/yield/actions/join/submit.d.ts +57 -0
  270. package/types/yield/actions/join/submit.js +1 -0
  271. package/types/yield/actions/join/validate.d.ts +18 -0
  272. package/types/yield/actions/join/validate.js +10 -0
  273. package/types/yield/actions/others.d.ts +85 -0
  274. package/types/yield/actions/others.js +1 -0
  275. package/types/yield/index.d.ts +2 -0
  276. package/types/yield/index.js +5 -0
  277. package/types/yield/info/account/index.d.ts +4 -0
  278. package/types/yield/info/account/index.js +7 -0
  279. package/types/yield/info/account/info.d.ts +92 -0
  280. package/types/yield/info/account/info.js +1 -0
  281. package/types/yield/info/account/reward.d.ts +45 -0
  282. package/types/yield/info/account/reward.js +1 -0
  283. package/types/yield/info/account/target.d.ts +43 -0
  284. package/types/yield/info/account/target.js +27 -0
  285. package/types/yield/info/account/unstake.d.ts +31 -0
  286. package/types/yield/info/account/unstake.js +22 -0
  287. package/types/yield/info/base.d.ts +45 -0
  288. package/types/yield/info/base.js +36 -0
  289. package/types/yield/info/chain/index.d.ts +2 -0
  290. package/types/yield/info/chain/index.js +5 -0
  291. package/types/yield/info/chain/info.d.ts +251 -0
  292. package/types/yield/info/chain/info.js +1 -0
  293. package/types/yield/info/chain/target.d.ts +37 -0
  294. package/types/yield/info/chain/target.js +1 -0
  295. package/types/yield/info/index.d.ts +4 -0
  296. package/types/yield/info/index.js +7 -0
  297. package/types/yield/info/pallet.d.ts +143 -0
  298. package/types/yield/info/pallet.js +9 -0
  299. package/utils/fetchStaticData.js +2 -1
  300. package/utils/index.d.ts +5 -0
  301. package/utils/index.js +53 -1
  302. package/utils/number.d.ts +1 -1
  303. package/utils/number.js +1 -1
  304. package/utils/object.d.ts +1 -0
  305. package/utils/object.js +6 -0
@@ -0,0 +1,495 @@
1
+ // Copyright 2019-2022 @subwallet/extension-base
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { COMMON_CHAIN_SLUGS } from '@subwallet/chain-list';
5
+ import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
6
+ import { BasicTxErrorType, ExtrinsicType, StakingTxErrorType } from '@subwallet/extension-base/background/KoniTypes';
7
+ import { ALL_ACCOUNT_KEY } from '@subwallet/extension-base/constants';
8
+ import { createXcmExtrinsic } from '@subwallet/extension-base/koni/api/xcm';
9
+ import { YIELD_POOL_STAT_REFRESH_INTERVAL } from '@subwallet/extension-base/koni/api/yield/helper/utils';
10
+ import { _getChainNativeTokenSlug } from '@subwallet/extension-base/services/chain-service/utils';
11
+ import { YieldStepType, YieldValidationStatus } from '@subwallet/extension-base/types';
12
+ import { createPromiseHandler, formatNumber } from '@subwallet/extension-base/utils';
13
+ import { t } from 'i18next';
14
+ import { BN, BN_TEN, BN_ZERO, noop } from '@polkadot/util';
15
+ import BasePoolHandler from "./base.js";
16
+ export default class BaseSpecialStakingPoolHandler extends BasePoolHandler {
17
+ /** Pool's type */
18
+
19
+ /** Exchange rate before divine with decimals */
20
+ rate = 0;
21
+ constructor(state, chain) {
22
+ super(state, chain);
23
+ this.exchangeRatePromise = createPromiseHandler();
24
+ }
25
+ get metadataInfo() {
26
+ return {
27
+ altInputAssets: this.altInputAsset,
28
+ derivativeAssets: this.derivativeAssets,
29
+ inputAsset: this.inputAsset,
30
+ rewardAssets: this.rewardAssets,
31
+ feeAssets: this.feeAssets,
32
+ logo: this.logo,
33
+ shortName: this.shortName,
34
+ name: this.name,
35
+ isAvailable: true,
36
+ maintainAsset: this.nativeToken.slug,
37
+ maintainBalance: this.maintainBalance,
38
+ availableMethod: this.availableMethod
39
+ };
40
+ }
41
+ updateExchangeRate(rate) {
42
+ this.rate = rate;
43
+ this.exchangeRatePromise.resolve(true);
44
+ }
45
+ async getExchangeRate() {
46
+ await this.exchangeRatePromise.promise;
47
+ return this.rate;
48
+ }
49
+ get isPoolSupportAlternativeFee() {
50
+ return this.feeAssets.length > 1;
51
+ }
52
+ async earlyValidate(request) {
53
+ var _poolInfo$statistic;
54
+ const poolInfo = await this.getPoolInfo();
55
+ if (!poolInfo || !((_poolInfo$statistic = poolInfo.statistic) !== null && _poolInfo$statistic !== void 0 && _poolInfo$statistic.earningThreshold.join)) {
56
+ return {
57
+ passed: false,
58
+ errorMessage: 'There\'s a trouble fetching data, please check your internet connection and try again'
59
+ };
60
+ }
61
+ if (request.address === ALL_ACCOUNT_KEY) {
62
+ return {
63
+ passed: true
64
+ };
65
+ }
66
+ const feeAssetInfo = this.state.chainService.getAssetBySlug(this.feeAssets[0]);
67
+ const altInputAssetInfo = this.state.chainService.getAssetBySlug(this.altInputAsset);
68
+ const inputAssetInfo = this.state.chainService.getAssetBySlug(this.inputAsset);
69
+ const [inputAssetBalance, altInputAssetBalance, feeAssetBalance] = await Promise.all([this.state.balanceService.getTokenFreeBalance(request.address, inputAssetInfo.originChain, inputAssetInfo.slug), altInputAssetInfo ? this.state.balanceService.getTokenFreeBalance(request.address, altInputAssetInfo.originChain, altInputAssetInfo.slug) : Promise.resolve({
70
+ symbol: '',
71
+ decimals: 0,
72
+ value: '0'
73
+ }), this.state.balanceService.getTokenFreeBalance(request.address, feeAssetInfo.originChain, feeAssetInfo.slug)]);
74
+ const bnInputAssetBalance = new BN(inputAssetBalance.value);
75
+ const bnAltInputAssetBalance = new BN(altInputAssetBalance.value);
76
+ const bnMinJoinPool = new BN(poolInfo.statistic.earningThreshold.join);
77
+ const inputTokenInfo = this.state.chainService.getAssetBySlug(this.inputAsset);
78
+ const altInputTokenInfo = this.state.chainService.getAssetBySlug(this.altInputAsset);
79
+ const minJoinDiv = BN_TEN.pow(new BN(inputAssetInfo.decimals || 0));
80
+ const parsedMinJoinPool = bnMinJoinPool.div(minJoinDiv);
81
+ if (bnInputAssetBalance.add(bnAltInputAssetBalance).lt(bnMinJoinPool)) {
82
+ const originChain = this.state.getChainInfo(inputTokenInfo.originChain);
83
+ const altChain = this.state.getChainInfo(altInputTokenInfo.originChain);
84
+ return {
85
+ passed: false,
86
+ errorMessage: `You need at least ${parsedMinJoinPool.toString()} ${inputTokenInfo.symbol} (${originChain.name}) or ${altInputTokenInfo.symbol} (${altChain.name}) to start earning`
87
+ };
88
+ }
89
+ if (this.feeAssets.length === 1) {
90
+ const bnFeeAssetBalance = new BN(feeAssetBalance.value);
91
+ const minFeeAssetBalance = new BN(this.maintainBalance || '0');
92
+ const feeAssetDiv = BN_TEN.pow(new BN(feeAssetInfo.decimals || 0));
93
+ const parsedMinFeeAssetBalance = minFeeAssetBalance.div(feeAssetDiv).mul(new BN(12)).div(BN_TEN);
94
+ if (bnFeeAssetBalance.lte(BN_ZERO)) {
95
+ const feeChain = this.state.getChainInfo(feeAssetInfo.originChain);
96
+ return {
97
+ passed: false,
98
+ errorMessage: `You need at least ${parsedMinFeeAssetBalance.toString()} ${feeAssetInfo.symbol} (${feeChain.name}) to start earning`
99
+ };
100
+ }
101
+ }
102
+ return {
103
+ passed: true
104
+ };
105
+ }
106
+ get group() {
107
+ const inputAsset = this.state.getAssetBySlug(this.inputAsset);
108
+ const groupSlug = inputAsset.multiChainAsset;
109
+ return groupSlug || this.inputAsset;
110
+ }
111
+
112
+ /* Subscribe pool info */
113
+
114
+ async subscribePoolInfo(callback) {
115
+ let cancel = false;
116
+ const getStatInterval = () => {
117
+ if (!this.isActive) {
118
+ if (!cancel) {
119
+ const rs = {
120
+ ...this.baseInfo,
121
+ type: this.type,
122
+ metadata: {
123
+ ...this.metadataInfo,
124
+ description: this.getDescription()
125
+ }
126
+ };
127
+ callback(rs);
128
+ }
129
+ } else {
130
+ this.getPoolStat().then(rs => {
131
+ if (!cancel) {
132
+ callback(rs);
133
+ }
134
+ }).catch(console.error);
135
+ }
136
+ };
137
+ getStatInterval();
138
+ const interval = setInterval(() => {
139
+ if (cancel) {
140
+ clearInterval(interval);
141
+ } else {
142
+ getStatInterval();
143
+ }
144
+ }, YIELD_POOL_STAT_REFRESH_INTERVAL);
145
+ return new Promise(resolve => {
146
+ const rs = () => {
147
+ cancel = true;
148
+ clearInterval(interval);
149
+ };
150
+ resolve(rs);
151
+ });
152
+ }
153
+
154
+ /* Subscribe pool info */
155
+
156
+ /* Get pool reward */
157
+
158
+ async getPoolReward() {
159
+ return new Promise(resolve => resolve(noop));
160
+ }
161
+ async getPoolRewardHistory() {
162
+ return new Promise(resolve => resolve(noop));
163
+ }
164
+
165
+ /* Get pool reward */
166
+
167
+ /* Get pool targets */
168
+
169
+ async getPoolTargets() {
170
+ return new Promise(resolve => resolve([]));
171
+ }
172
+
173
+ /* Get pool targets */
174
+
175
+ /* Join pool action */
176
+
177
+ /* Generate steps */
178
+
179
+ /**
180
+ * @async
181
+ * @function getXcmStep
182
+ * */
183
+ async getXcmStep(params) {
184
+ const {
185
+ address,
186
+ amount
187
+ } = params;
188
+ const bnAmount = new BN(amount);
189
+ const inputTokenSlug = this.inputAsset; // assume that the pool only has 1 input token, will update later
190
+ const inputTokenInfo = this.state.getAssetBySlug(inputTokenSlug);
191
+ const inputTokenBalance = await this.state.balanceService.getTokenFreeBalance(address, inputTokenInfo.originChain, inputTokenSlug);
192
+ const bnInputTokenBalance = new BN(inputTokenBalance.value);
193
+ if (!bnInputTokenBalance.gte(bnAmount)) {
194
+ if (this.altInputAsset) {
195
+ const altInputTokenSlug = this.altInputAsset;
196
+ const altInputTokenInfo = this.state.getAssetBySlug(altInputTokenSlug);
197
+ const altInputTokenBalance = await this.state.balanceService.getTokenFreeBalance(address, altInputTokenInfo.originChain, altInputTokenSlug);
198
+ const bnAltInputTokenBalance = new BN(altInputTokenBalance.value || '0');
199
+ if (bnAltInputTokenBalance.gt(BN_ZERO)) {
200
+ const step = {
201
+ metadata: {
202
+ sendingValue: bnAmount.toString(),
203
+ originTokenInfo: altInputTokenInfo,
204
+ destinationTokenInfo: inputTokenInfo
205
+ },
206
+ name: 'Transfer DOT from Polkadot',
207
+ type: YieldStepType.XCM
208
+ };
209
+ const xcmOriginSubstrateApi = await this.state.getSubstrateApi(altInputTokenInfo.originChain).isReady;
210
+ const xcmTransfer = await createXcmExtrinsic({
211
+ originTokenInfo: altInputTokenInfo,
212
+ destinationTokenInfo: inputTokenInfo,
213
+ sendingValue: bnAmount.toString(),
214
+ recipient: address,
215
+ chainInfoMap: this.state.getChainInfoMap(),
216
+ substrateApi: xcmOriginSubstrateApi
217
+ });
218
+ const _xcmFeeInfo = await xcmTransfer.paymentInfo(address);
219
+ const xcmFeeInfo = _xcmFeeInfo.toPrimitive();
220
+ // TODO: calculate fee for destination chain
221
+
222
+ const fee = {
223
+ slug: altInputTokenSlug,
224
+ amount: Math.round(xcmFeeInfo.partialFee * 1.2).toString() // TODO
225
+ };
226
+
227
+ return [step, fee];
228
+ }
229
+ }
230
+ }
231
+ return undefined;
232
+ }
233
+ get defaultSubmitStep() {
234
+ return [this.submitJoinStepInfo, {
235
+ slug: this.feeAssets[0],
236
+ amount: '0'
237
+ }];
238
+ }
239
+
240
+ /**
241
+ * @function submitJoinStepInfo
242
+ * @description Base info of submit step
243
+ * @return Fee of the submitting step
244
+ * */
245
+
246
+ async getSubmitStep(params) {
247
+ const fee = await this.getSubmitStepFee(params);
248
+ return [this.submitJoinStepInfo, fee];
249
+ }
250
+
251
+ /* Generate steps */
252
+
253
+ /* Validate join action */
254
+
255
+ async validateTokenApproveStep(params, path) {
256
+ return Promise.resolve([new TransactionError(BasicTxErrorType.UNSUPPORTED)]);
257
+ }
258
+ async validateXcmStep(params, path, bnInputTokenBalance) {
259
+ const processValidation = {
260
+ ok: true,
261
+ status: YieldValidationStatus.OK
262
+ };
263
+ const bnAmount = new BN(params.amount);
264
+ const altInputTokenSlug = this.altInputAsset || '';
265
+ const altInputTokenInfo = this.state.getAssetBySlug(altInputTokenSlug);
266
+ const altInputTokenBalance = await this.state.balanceService.getTokenFreeBalance(params.address, altInputTokenInfo.originChain, altInputTokenSlug);
267
+ const missingAmount = bnAmount.sub(bnInputTokenBalance); // TODO: what if input token is not LOCAL ??
268
+ const xcmFee = new BN(path.totalFee[1].amount || '0');
269
+ const xcmAmount = missingAmount.add(xcmFee);
270
+ const bnAltInputTokenBalance = new BN(altInputTokenBalance.value || '0');
271
+ const altInputTokenMinAmount = new BN(altInputTokenInfo.minAmount || '0');
272
+ if (!bnAltInputTokenBalance.sub(xcmAmount).gte(altInputTokenMinAmount)) {
273
+ processValidation.failedStep = path.steps[1];
274
+ processValidation.ok = false;
275
+ processValidation.status = YieldValidationStatus.NOT_ENOUGH_BALANCE;
276
+ return [new TransactionError(YieldValidationStatus.NOT_ENOUGH_BALANCE, processValidation.message, processValidation)];
277
+ }
278
+ return [];
279
+ }
280
+ async validateJoinStep(id, params, path, bnInputTokenBalance, isXcmOk) {
281
+ const _poolInfo = await this.getPoolInfo();
282
+ if (!_poolInfo) {
283
+ return [new TransactionError(BasicTxErrorType.INTERNAL_ERROR)];
284
+ }
285
+ const poolInfo = _poolInfo;
286
+ if (!poolInfo.statistic) {
287
+ return [new TransactionError(BasicTxErrorType.INTERNAL_ERROR)];
288
+ }
289
+ const processValidation = {
290
+ ok: true,
291
+ status: YieldValidationStatus.OK
292
+ };
293
+ const feeTokenSlug = path.totalFee[id].slug;
294
+ const feeTokenInfo = this.state.getAssetBySlug(feeTokenSlug);
295
+ const defaultFeeTokenSlug = this.feeAssets[0];
296
+ const bnAmount = new BN(params.amount);
297
+ if (this.feeAssets.length === 1 && feeTokenSlug === defaultFeeTokenSlug) {
298
+ var _path$totalFee$id;
299
+ const bnFeeAmount = new BN(((_path$totalFee$id = path.totalFee[id]) === null || _path$totalFee$id === void 0 ? void 0 : _path$totalFee$id.amount) || '0');
300
+ const feeTokenBalance = await this.state.balanceService.getTokenFreeBalance(params.address, feeTokenInfo.originChain, feeTokenSlug);
301
+ const bnFeeTokenBalance = new BN(feeTokenBalance.value || '0');
302
+ const bnFeeTokenMinAmount = new BN((feeTokenInfo === null || feeTokenInfo === void 0 ? void 0 : feeTokenInfo.minAmount) || '0');
303
+ if (!bnFeeTokenBalance.sub(bnFeeAmount).gte(bnFeeTokenMinAmount)) {
304
+ processValidation.failedStep = path.steps[id];
305
+ processValidation.ok = false;
306
+ processValidation.status = YieldValidationStatus.NOT_ENOUGH_FEE;
307
+ return [new TransactionError(YieldValidationStatus.NOT_ENOUGH_FEE, processValidation.message, processValidation)];
308
+ }
309
+ }
310
+ if (!bnAmount.gte(new BN(poolInfo.statistic.earningThreshold.join || '0'))) {
311
+ processValidation.failedStep = path.steps[id];
312
+ processValidation.ok = false;
313
+ processValidation.status = YieldValidationStatus.NOT_ENOUGH_MIN_JOIN_POOL;
314
+ return [new TransactionError(YieldValidationStatus.NOT_ENOUGH_MIN_JOIN_POOL, processValidation.message, processValidation)];
315
+ }
316
+ if (!isXcmOk && bnAmount.gt(bnInputTokenBalance)) {
317
+ processValidation.failedStep = path.steps[id];
318
+ processValidation.ok = false;
319
+ processValidation.status = YieldValidationStatus.NOT_ENOUGH_BALANCE;
320
+ return [new TransactionError(YieldValidationStatus.NOT_ENOUGH_BALANCE, processValidation.message, processValidation)];
321
+ }
322
+ return [];
323
+ }
324
+ async validateYieldJoin(params, path) {
325
+ const inputTokenSlug = this.inputAsset;
326
+ const inputTokenInfo = this.state.getAssetBySlug(inputTokenSlug);
327
+ const balanceService = this.state.balanceService;
328
+ const inputTokenBalance = await balanceService.getTokenFreeBalance(params.address, inputTokenInfo.originChain, inputTokenSlug);
329
+ const bnInputTokenBalance = new BN(inputTokenBalance.value || '0');
330
+ const bnAmount = new BN(params.amount);
331
+ if (bnAmount.lte(BN_ZERO)) {
332
+ return [new TransactionError(BasicTxErrorType.INVALID_PARAMS, 'Amount must be greater than 0')];
333
+ }
334
+ let isXcmOk = false;
335
+ for (const step of path.steps) {
336
+ const getErrors = async () => {
337
+ switch (step.type) {
338
+ case YieldStepType.DEFAULT:
339
+ return Promise.resolve([]);
340
+ case YieldStepType.XCM:
341
+ return this.validateXcmStep(params, path, bnInputTokenBalance);
342
+ case YieldStepType.TOKEN_APPROVAL:
343
+ return this.validateTokenApproveStep(params, path);
344
+ default:
345
+ return this.validateJoinStep(step.id, params, path, bnInputTokenBalance, isXcmOk);
346
+ }
347
+ };
348
+ const errors = await getErrors();
349
+ if (errors.length) {
350
+ return errors;
351
+ } else if (step.type === YieldStepType.XCM) {
352
+ isXcmOk = true;
353
+ }
354
+ }
355
+ return [];
356
+ }
357
+
358
+ /* Validate join action */
359
+
360
+ /* Submit join action */
361
+
362
+ async handleTokenApproveStep(data, path) {
363
+ return Promise.reject(new TransactionError(BasicTxErrorType.UNSUPPORTED));
364
+ }
365
+ async handleXcmStep(data, path, xcmFee) {
366
+ const {
367
+ address,
368
+ amount
369
+ } = data;
370
+ const destinationTokenSlug = this.inputAsset;
371
+ const originChainInfo = this.state.getChainInfo(COMMON_CHAIN_SLUGS.POLKADOT);
372
+ const originTokenSlug = _getChainNativeTokenSlug(originChainInfo);
373
+ const originTokenInfo = this.state.getAssetBySlug(originTokenSlug);
374
+ const destinationTokenInfo = this.state.getAssetBySlug(destinationTokenSlug);
375
+ const substrateApi = this.state.getSubstrateApi(originChainInfo.slug);
376
+ const inputTokenBalance = await this.state.balanceService.getTokenFreeBalance(address, destinationTokenInfo.originChain, destinationTokenSlug);
377
+ const bnInputTokenBalance = new BN(inputTokenBalance.value);
378
+ const bnXcmFee = new BN(xcmFee);
379
+ const bnAmount = new BN(amount);
380
+ const bnTotalAmount = bnAmount.sub(bnInputTokenBalance).add(bnXcmFee);
381
+ const extrinsic = await createXcmExtrinsic({
382
+ chainInfoMap: this.state.getChainInfoMap(),
383
+ destinationTokenInfo,
384
+ originTokenInfo,
385
+ recipient: address,
386
+ sendingValue: bnTotalAmount.toString(),
387
+ substrateApi
388
+ });
389
+ const xcmData = {
390
+ originNetworkKey: originChainInfo.slug,
391
+ destinationNetworkKey: destinationTokenInfo.originChain,
392
+ from: address,
393
+ to: address,
394
+ value: bnTotalAmount.toString(),
395
+ tokenSlug: originTokenSlug,
396
+ showExtraWarning: true
397
+ };
398
+ return {
399
+ txChain: originChainInfo.slug,
400
+ extrinsicType: ExtrinsicType.TRANSFER_XCM,
401
+ extrinsic,
402
+ txData: xcmData,
403
+ transferNativeAmount: bnTotalAmount.toString()
404
+ };
405
+ }
406
+ handleYieldJoin(data, path, currentStep) {
407
+ const type = path.steps[currentStep].type;
408
+ switch (type) {
409
+ case YieldStepType.DEFAULT:
410
+ return Promise.reject(new TransactionError(BasicTxErrorType.UNSUPPORTED));
411
+ case YieldStepType.TOKEN_APPROVAL:
412
+ return this.handleTokenApproveStep(data, path);
413
+ case YieldStepType.XCM:
414
+ {
415
+ const xcmFee = path.totalFee[currentStep].amount || '0';
416
+ return this.handleXcmStep(data, path, xcmFee);
417
+ }
418
+ default:
419
+ return this.handleSubmitStep(data, path);
420
+ }
421
+ }
422
+
423
+ /* Submit join action */
424
+
425
+ /* Join pool action */
426
+
427
+ /* Leave pool action */
428
+
429
+ async validateYieldLeave(amount, address, fastLeave, selectedTarget) {
430
+ const poolInfo = await this.getPoolInfo();
431
+ const poolPosition = await this.getPoolPosition(address);
432
+ if (!poolInfo || !poolInfo.statistic || !poolPosition) {
433
+ return [new TransactionError(BasicTxErrorType.INTERNAL_ERROR)];
434
+ }
435
+ if (!this.availableMethod.defaultUnstake && !fastLeave) {
436
+ return [new TransactionError(BasicTxErrorType.INTERNAL_ERROR)];
437
+ }
438
+ if (!this.availableMethod.fastUnstake && fastLeave) {
439
+ return [new TransactionError(BasicTxErrorType.INTERNAL_ERROR)];
440
+ }
441
+ const errors = [];
442
+ const bnActiveStake = new BN(poolPosition.activeStake);
443
+ const bnAmount = new BN(amount);
444
+ const bnRemainingStake = bnActiveStake.sub(bnAmount);
445
+ const minStake = new BN(poolInfo.statistic.earningThreshold.join || '0');
446
+ const minUnstake = new BN((fastLeave ? poolInfo.statistic.earningThreshold.fastUnstake : poolInfo.statistic.earningThreshold.defaultUnstake) || '0');
447
+ const maxUnstakeRequest = poolInfo.statistic.maxWithdrawalRequestPerFarmer;
448
+ const derivativeTokenInfo = this.state.getAssetBySlug(this.derivativeAssets[0]);
449
+ if (bnAmount.lte(BN_ZERO)) {
450
+ return [new TransactionError(BasicTxErrorType.INVALID_PARAMS, t('Amount must be greater than 0'))];
451
+ }
452
+ if (bnAmount.lt(minUnstake)) {
453
+ const minUnstakeStr = formatNumber(minUnstake.toString(), derivativeTokenInfo.decimals || 0);
454
+ errors.push(new TransactionError(StakingTxErrorType.NOT_ENOUGH_MIN_UNSTAKE, t('You need to unstake at least {{amount}} {{token}}', {
455
+ replace: {
456
+ amount: minUnstakeStr,
457
+ token: derivativeTokenInfo.symbol
458
+ }
459
+ })));
460
+ }
461
+ if (!fastLeave) {
462
+ if (!(bnRemainingStake.isZero() || bnRemainingStake.gte(minStake))) {
463
+ errors.push(new TransactionError(StakingTxErrorType.INVALID_ACTIVE_STAKE)); // TODO
464
+ }
465
+
466
+ if (poolPosition.unstakings.length > maxUnstakeRequest) {
467
+ errors.push(new TransactionError(StakingTxErrorType.EXCEED_MAX_UNSTAKING, t('You cannot unstake more than {{number}} times', {
468
+ replace: {
469
+ number: maxUnstakeRequest
470
+ }
471
+ })));
472
+ }
473
+ }
474
+ return Promise.resolve(errors);
475
+ }
476
+ handleYieldUnstake(amount, address, selectedTarget) {
477
+ return Promise.reject(new TransactionError(BasicTxErrorType.UNSUPPORTED));
478
+ }
479
+
480
+ /* Leave pool action */
481
+
482
+ /* Other action */
483
+
484
+ handleYieldCancelUnstake() {
485
+ return Promise.reject(new TransactionError(BasicTxErrorType.UNSUPPORTED));
486
+ }
487
+ handleYieldClaimReward(address, bondReward) {
488
+ return Promise.reject(new TransactionError(BasicTxErrorType.UNSUPPORTED));
489
+ }
490
+ handleYieldWithdraw(address, unstakingInfo) {
491
+ return Promise.reject(new TransactionError(BasicTxErrorType.UNSUPPORTED));
492
+ }
493
+
494
+ /* Other actions */
495
+ }
@@ -0,0 +1,45 @@
1
+ import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
2
+ import { ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
3
+ import KoniState from '@subwallet/extension-base/koni/background/handlers/State';
4
+ import { EarningRewardHistoryItem, EarningRewardItem, EarningRewardJson, HandleYieldStepData, HandleYieldStepParams, OptimalYieldPath, OptimalYieldPathParams, RequestEarlyValidateYield, RequestStakeCancelWithdrawal, RequestStakeClaimReward, RequestYieldLeave, RequestYieldWithdrawal, ResponseEarlyValidateYield, TransactionData, ValidateYieldProcessParams, YieldPoolInfo, YieldPoolTarget, YieldPositionInfo } from '@subwallet/extension-base/types';
5
+ import { BehaviorSubject } from 'rxjs';
6
+ import { BasePoolHandler } from './handlers';
7
+ export default class EarningService {
8
+ protected readonly state: KoniState;
9
+ protected handlers: Record<string, BasePoolHandler>;
10
+ private earningRewardSubject;
11
+ private earningRewardHistorySubject;
12
+ private minAmountPercentSubject;
13
+ constructor(state: KoniState);
14
+ private initHandlers;
15
+ getPoolHandler(slug: string): BasePoolHandler | undefined;
16
+ isPoolSupportAlternativeFee(slug: string): boolean;
17
+ subscribeMinAmountPercent(): BehaviorSubject<Record<string, number>>;
18
+ getMinAmountPercent(): Record<string, number>;
19
+ subscribePoolsInfo(callback: (rs: YieldPoolInfo) => void): Promise<VoidFunction>;
20
+ subscribePoolPositions(addresses: string[], callback: (rs: YieldPositionInfo) => void): Promise<VoidFunction>;
21
+ updateEarningReward(stakingRewardData: EarningRewardItem): void;
22
+ getPoolReward(addresses: string[], callback: (result: EarningRewardItem) => void): Promise<VoidFunction>;
23
+ subscribeEarningReward(): BehaviorSubject<EarningRewardJson>;
24
+ getEarningRewards(): EarningRewardJson;
25
+ fetchPoolRewardHistory(addresses: string[], callback: (result: EarningRewardHistoryItem) => void): Promise<VoidFunction>;
26
+ updateEarningRewardHistory(earningRewardHistory: EarningRewardHistoryItem): void;
27
+ subscribeEarningRewardHistory(): BehaviorSubject<Record<string, EarningRewardHistoryItem>>;
28
+ getEarningRewardHistory(): Record<string, EarningRewardHistoryItem>;
29
+ /**
30
+ * @async
31
+ * @function getPoolTargets
32
+ * @param {string} slug - Pool's slug
33
+ * @return {Promise<YieldPoolTarget[]>} List of pool's target
34
+ * */
35
+ getPoolTargets(slug: string): Promise<YieldPoolTarget[]>;
36
+ earlyValidateJoin(request: RequestEarlyValidateYield): Promise<ResponseEarlyValidateYield>;
37
+ generateOptimalSteps(params: OptimalYieldPathParams): Promise<OptimalYieldPath>;
38
+ validateYieldJoin(params: ValidateYieldProcessParams): Promise<TransactionError[]>;
39
+ handleYieldJoin(params: HandleYieldStepParams): Promise<HandleYieldStepData>;
40
+ validateYieldLeave(params: RequestYieldLeave): Promise<TransactionError[]>;
41
+ handleYieldLeave(params: RequestYieldLeave): Promise<[ExtrinsicType, TransactionData]>;
42
+ handleYieldWithdraw(params: RequestYieldWithdrawal): Promise<TransactionData>;
43
+ handleYieldCancelUnstake(params: RequestStakeCancelWithdrawal): Promise<TransactionData>;
44
+ handleYieldClaimReward(params: RequestStakeClaimReward): Promise<TransactionData>;
45
+ }