@subwallet/extension-base 1.1.28-1 → 1.1.28-beta.2

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 (289) hide show
  1. package/background/KoniTypes.d.ts +94 -68
  2. package/background/KoniTypes.js +16 -13
  3. package/background/errors/TransactionError.js +9 -0
  4. package/cjs/background/KoniTypes.js +17 -16
  5. package/cjs/background/errors/TransactionError.js +9 -0
  6. package/cjs/constants/index.js +9 -3
  7. package/cjs/koni/api/nft/config.js +33 -23
  8. package/cjs/koni/api/nft/index.js +14 -0
  9. package/cjs/koni/api/nft/nft.js +1 -22
  10. package/cjs/koni/api/nft/ordinal_nft/constants.js +21 -0
  11. package/cjs/koni/api/nft/ordinal_nft/index.js +121 -0
  12. package/cjs/koni/api/nft/ordinal_nft/utils.js +41 -0
  13. package/cjs/koni/api/staking/bonding/amplitude.js +17 -15
  14. package/cjs/koni/api/staking/bonding/astar.js +11 -10
  15. package/cjs/koni/api/staking/bonding/index.js +4 -1
  16. package/cjs/koni/api/staking/bonding/paraChain.js +25 -23
  17. package/cjs/koni/api/staking/bonding/relayChain.js +48 -45
  18. package/cjs/koni/api/staking/bonding/utils.js +104 -86
  19. package/cjs/koni/api/staking/index.js +6 -5
  20. package/cjs/koni/api/staking/paraChain.js +6 -5
  21. package/cjs/koni/api/staking/relayChain.js +3 -2
  22. package/cjs/koni/api/yield/helper/utils.js +46 -0
  23. package/cjs/koni/background/cron.js +2 -0
  24. package/cjs/koni/background/handlers/Extension.js +347 -69
  25. package/cjs/koni/background/handlers/State.js +57 -4
  26. package/cjs/koni/background/handlers/index.js +4 -2
  27. package/cjs/koni/background/subscription.js +89 -19
  28. package/cjs/services/campaign-service/index.js +9 -6
  29. package/cjs/services/chain-service/constants.js +2 -16
  30. package/cjs/services/chain-service/utils.js +7 -1
  31. package/cjs/services/earning-service/constants/chains.js +29 -0
  32. package/cjs/services/earning-service/constants/index.js +27 -0
  33. package/cjs/services/earning-service/constants/step.js +18 -0
  34. package/cjs/services/earning-service/handlers/base.js +220 -0
  35. package/cjs/services/earning-service/handlers/index.js +60 -0
  36. package/cjs/services/earning-service/handlers/lending/base.js +20 -0
  37. package/cjs/services/earning-service/handlers/lending/index.js +13 -0
  38. package/cjs/services/earning-service/handlers/lending/interlay.js +170 -0
  39. package/cjs/services/earning-service/handlers/liquid-staking/acala.js +198 -0
  40. package/cjs/services/earning-service/handlers/liquid-staking/base.js +43 -0
  41. package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +259 -0
  42. package/cjs/services/earning-service/handlers/liquid-staking/index.js +34 -0
  43. package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +182 -0
  44. package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +375 -0
  45. package/cjs/services/earning-service/handlers/native-staking/amplitude.js +373 -0
  46. package/cjs/services/earning-service/handlers/native-staking/astar.js +446 -0
  47. package/cjs/services/earning-service/handlers/native-staking/base-para.js +137 -0
  48. package/cjs/services/earning-service/handlers/native-staking/base.js +119 -0
  49. package/cjs/services/earning-service/handlers/native-staking/index.js +34 -0
  50. package/cjs/services/earning-service/handlers/native-staking/para-chain.js +375 -0
  51. package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +529 -0
  52. package/cjs/services/earning-service/handlers/nomination-pool/index.js +521 -0
  53. package/cjs/services/earning-service/handlers/special.js +411 -0
  54. package/cjs/services/earning-service/service.js +351 -0
  55. package/cjs/services/earning-service/utils/index.js +128 -0
  56. package/cjs/services/event-service/index.js +4 -0
  57. package/cjs/services/keyring-service/index.js +14 -2
  58. package/cjs/services/migration-service/scripts/DeleteEarningData.js +21 -0
  59. package/cjs/services/migration-service/scripts/EnableEarningChains.js +21 -0
  60. package/cjs/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
  61. package/cjs/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
  62. package/cjs/services/migration-service/scripts/databases/MigrateEarningHistory.js +21 -0
  63. package/cjs/services/migration-service/scripts/databases/MigrateEarningVersion.js +21 -0
  64. package/cjs/services/migration-service/scripts/index.js +7 -1
  65. package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +149 -0
  66. package/cjs/services/mint-campaign-service/campaigns/index.js +13 -0
  67. package/cjs/services/mint-campaign-service/constants.js +11 -0
  68. package/cjs/services/mint-campaign-service/index.js +18 -0
  69. package/cjs/services/notification-service/NotificationService.js +1 -1
  70. package/cjs/services/storage-service/DatabaseService.js +51 -0
  71. package/cjs/services/storage-service/databases/index.js +4 -0
  72. package/cjs/services/storage-service/db-stores/NominatorMetadata.js +3 -3
  73. package/cjs/services/storage-service/db-stores/YieldPoolStore.js +36 -0
  74. package/cjs/services/storage-service/db-stores/YieldPositionStore.js +65 -0
  75. package/cjs/services/transaction-service/event-parser/index.js +58 -0
  76. package/cjs/services/transaction-service/helpers/index.js +3 -1
  77. package/cjs/services/transaction-service/index.js +180 -74
  78. package/cjs/services/transaction-service/utils.js +1 -0
  79. package/cjs/types/campaigns/index.js +16 -0
  80. package/cjs/types/campaigns/unlock-dot.js +1 -0
  81. package/cjs/types/index.js +44 -0
  82. package/cjs/types/ordinal.js +1 -0
  83. package/cjs/types/transaction.js +1 -0
  84. package/cjs/types/yield/actions/index.js +27 -0
  85. package/cjs/types/yield/actions/join/index.js +38 -0
  86. package/cjs/types/yield/actions/join/step.js +47 -0
  87. package/cjs/types/yield/actions/join/submit.js +1 -0
  88. package/cjs/types/yield/actions/join/validate.js +16 -0
  89. package/cjs/types/yield/actions/others.js +1 -0
  90. package/cjs/types/yield/index.js +27 -0
  91. package/cjs/types/yield/info/account/index.js +49 -0
  92. package/cjs/types/yield/info/account/info.js +1 -0
  93. package/cjs/types/yield/info/account/reward.js +1 -0
  94. package/cjs/types/yield/info/account/target.js +32 -0
  95. package/cjs/types/yield/info/account/unstake.js +27 -0
  96. package/cjs/types/yield/info/base.js +41 -0
  97. package/cjs/types/yield/info/chain/index.js +27 -0
  98. package/cjs/types/yield/info/chain/info.js +1 -0
  99. package/cjs/types/yield/info/chain/target.js +1 -0
  100. package/cjs/types/yield/info/index.js +49 -0
  101. package/cjs/types/yield/info/pallet.js +15 -0
  102. package/cjs/utils/fetchStaticData.js +2 -1
  103. package/cjs/utils/index.js +89 -1
  104. package/cjs/utils/object.js +12 -0
  105. package/cjs/utils/yield/index.js +3 -0
  106. package/constants/index.d.ts +2 -0
  107. package/constants/index.js +2 -0
  108. package/koni/api/nft/config.js +33 -23
  109. package/koni/api/nft/index.js +15 -1
  110. package/koni/api/nft/nft.js +2 -23
  111. package/koni/api/nft/ordinal_nft/constants.d.ts +9 -0
  112. package/koni/api/nft/ordinal_nft/constants.js +12 -0
  113. package/koni/api/nft/ordinal_nft/index.d.ts +8 -0
  114. package/koni/api/nft/ordinal_nft/index.js +114 -0
  115. package/koni/api/nft/ordinal_nft/utils.d.ts +2 -0
  116. package/koni/api/nft/ordinal_nft/utils.js +33 -0
  117. package/koni/api/staking/bonding/amplitude.js +11 -9
  118. package/koni/api/staking/bonding/astar.js +9 -8
  119. package/koni/api/staking/bonding/index.d.ts +1 -1
  120. package/koni/api/staking/bonding/index.js +5 -1
  121. package/koni/api/staking/bonding/paraChain.js +12 -10
  122. package/koni/api/staking/bonding/relayChain.d.ts +2 -2
  123. package/koni/api/staking/bonding/relayChain.js +33 -30
  124. package/koni/api/staking/bonding/utils.d.ts +15 -38
  125. package/koni/api/staking/bonding/utils.js +85 -69
  126. package/koni/api/staking/index.js +2 -1
  127. package/koni/api/staking/paraChain.js +7 -6
  128. package/koni/api/staking/relayChain.js +4 -3
  129. package/koni/api/yield/helper/utils.d.ts +10 -0
  130. package/koni/api/yield/helper/utils.js +32 -0
  131. package/koni/background/cron.js +2 -0
  132. package/koni/background/handlers/Extension.d.ts +16 -1
  133. package/koni/background/handlers/Extension.js +306 -30
  134. package/koni/background/handlers/State.d.ts +18 -2
  135. package/koni/background/handlers/State.js +56 -4
  136. package/koni/background/handlers/index.js +4 -2
  137. package/koni/background/subscription.d.ts +5 -1
  138. package/koni/background/subscription.js +91 -21
  139. package/package.json +317 -4
  140. package/services/campaign-service/index.js +9 -6
  141. package/services/chain-service/constants.d.ts +0 -11
  142. package/services/chain-service/constants.js +1 -14
  143. package/services/chain-service/utils.d.ts +1 -0
  144. package/services/chain-service/utils.js +5 -1
  145. package/services/earning-service/constants/abis/compound_finance_v2_abi.json +1235 -0
  146. package/services/earning-service/constants/abis/st_liquid_token_abi.json +1355 -0
  147. package/services/earning-service/constants/chains.d.ts +14 -0
  148. package/services/earning-service/constants/chains.js +21 -0
  149. package/services/earning-service/constants/index.d.ts +2 -0
  150. package/services/earning-service/constants/index.js +5 -0
  151. package/services/earning-service/constants/step.d.ts +3 -0
  152. package/services/earning-service/constants/step.js +10 -0
  153. package/services/earning-service/handlers/base.d.ts +107 -0
  154. package/services/earning-service/handlers/base.js +213 -0
  155. package/services/earning-service/handlers/index.d.ts +5 -0
  156. package/services/earning-service/handlers/index.js +8 -0
  157. package/services/earning-service/handlers/lending/base.d.ts +6 -0
  158. package/services/earning-service/handlers/lending/base.js +12 -0
  159. package/services/earning-service/handlers/lending/index.d.ts +1 -0
  160. package/services/earning-service/handlers/lending/index.js +4 -0
  161. package/services/earning-service/handlers/lending/interlay.d.ts +22 -0
  162. package/services/earning-service/handlers/lending/interlay.js +162 -0
  163. package/services/earning-service/handlers/liquid-staking/acala.d.ts +27 -0
  164. package/services/earning-service/handlers/liquid-staking/acala.js +190 -0
  165. package/services/earning-service/handlers/liquid-staking/base.d.ts +9 -0
  166. package/services/earning-service/handlers/liquid-staking/base.js +35 -0
  167. package/services/earning-service/handlers/liquid-staking/bifrost.d.ts +44 -0
  168. package/services/earning-service/handlers/liquid-staking/bifrost.js +248 -0
  169. package/services/earning-service/handlers/liquid-staking/index.d.ts +4 -0
  170. package/services/earning-service/handlers/liquid-staking/index.js +7 -0
  171. package/services/earning-service/handlers/liquid-staking/parallel.d.ts +27 -0
  172. package/services/earning-service/handlers/liquid-staking/parallel.js +174 -0
  173. package/services/earning-service/handlers/liquid-staking/stella-swap.d.ts +36 -0
  174. package/services/earning-service/handlers/liquid-staking/stella-swap.js +365 -0
  175. package/services/earning-service/handlers/native-staking/amplitude.d.ts +22 -0
  176. package/services/earning-service/handlers/native-staking/amplitude.js +364 -0
  177. package/services/earning-service/handlers/native-staking/astar.d.ts +19 -0
  178. package/services/earning-service/handlers/native-staking/astar.js +436 -0
  179. package/services/earning-service/handlers/native-staking/base-para.d.ts +11 -0
  180. package/services/earning-service/handlers/native-staking/base-para.js +129 -0
  181. package/services/earning-service/handlers/native-staking/base.d.ts +20 -0
  182. package/services/earning-service/handlers/native-staking/base.js +110 -0
  183. package/services/earning-service/handlers/native-staking/index.d.ts +4 -0
  184. package/services/earning-service/handlers/native-staking/index.js +7 -0
  185. package/services/earning-service/handlers/native-staking/para-chain.d.ts +15 -0
  186. package/services/earning-service/handlers/native-staking/para-chain.js +367 -0
  187. package/services/earning-service/handlers/native-staking/relay-chain.d.ts +21 -0
  188. package/services/earning-service/handlers/native-staking/relay-chain.js +520 -0
  189. package/services/earning-service/handlers/nomination-pool/index.d.ts +33 -0
  190. package/services/earning-service/handlers/nomination-pool/index.js +511 -0
  191. package/services/earning-service/handlers/special.d.ts +58 -0
  192. package/services/earning-service/handlers/special.js +403 -0
  193. package/services/earning-service/service.d.ts +40 -0
  194. package/services/earning-service/service.js +343 -0
  195. package/services/earning-service/utils/index.d.ts +18 -0
  196. package/services/earning-service/utils/index.js +112 -0
  197. package/services/event-service/index.d.ts +1 -0
  198. package/services/event-service/index.js +4 -0
  199. package/services/event-service/types.d.ts +8 -0
  200. package/services/keyring-service/index.d.ts +2 -1
  201. package/services/keyring-service/index.js +14 -2
  202. package/services/migration-service/scripts/DeleteEarningData.d.ts +4 -0
  203. package/services/migration-service/scripts/DeleteEarningData.js +13 -0
  204. package/services/migration-service/scripts/EnableEarningChains.d.ts +4 -0
  205. package/services/migration-service/scripts/EnableEarningChains.js +13 -0
  206. package/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
  207. package/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
  208. package/services/migration-service/scripts/databases/MigrateEarningHistory.d.ts +4 -0
  209. package/services/migration-service/scripts/databases/MigrateEarningHistory.js +13 -0
  210. package/services/migration-service/scripts/databases/MigrateEarningVersion.d.ts +4 -0
  211. package/services/migration-service/scripts/databases/MigrateEarningVersion.js +13 -0
  212. package/services/migration-service/scripts/index.js +7 -1
  213. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.d.ts +13 -0
  214. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +139 -0
  215. package/services/mint-campaign-service/campaigns/index.d.ts +1 -0
  216. package/services/mint-campaign-service/campaigns/index.js +4 -0
  217. package/services/mint-campaign-service/constants.d.ts +1 -0
  218. package/services/mint-campaign-service/constants.js +4 -0
  219. package/services/mint-campaign-service/index.d.ts +7 -0
  220. package/services/mint-campaign-service/index.js +11 -0
  221. package/services/notification-service/NotificationService.js +1 -1
  222. package/services/storage-service/DatabaseService.d.ts +18 -1
  223. package/services/storage-service/DatabaseService.js +51 -0
  224. package/services/storage-service/databases/index.d.ts +3 -1
  225. package/services/storage-service/databases/index.js +4 -0
  226. package/services/storage-service/db-stores/NominatorMetadata.js +3 -3
  227. package/services/storage-service/db-stores/YieldPoolStore.d.ts +10 -0
  228. package/services/storage-service/db-stores/YieldPoolStore.js +28 -0
  229. package/services/storage-service/db-stores/YieldPositionStore.d.ts +9 -0
  230. package/services/storage-service/db-stores/YieldPositionStore.js +57 -0
  231. package/services/subscan-service/index.d.ts +2 -2
  232. package/services/transaction-service/event-parser/index.d.ts +3 -1
  233. package/services/transaction-service/event-parser/index.js +57 -1
  234. package/services/transaction-service/helpers/index.js +3 -1
  235. package/services/transaction-service/index.d.ts +4 -15
  236. package/services/transaction-service/index.js +178 -72
  237. package/services/transaction-service/types.d.ts +2 -0
  238. package/services/transaction-service/utils.js +1 -0
  239. package/types/campaigns/index.d.ts +1 -0
  240. package/types/campaigns/index.js +4 -0
  241. package/types/campaigns/unlock-dot.d.ts +71 -0
  242. package/types/campaigns/unlock-dot.js +1 -0
  243. package/types/index.d.ts +5 -0
  244. package/types/index.js +5 -1
  245. package/types/ordinal.d.ts +69 -0
  246. package/types/ordinal.js +1 -0
  247. package/types/transaction.d.ts +3 -0
  248. package/types/transaction.js +1 -0
  249. package/types/yield/actions/index.d.ts +2 -0
  250. package/types/yield/actions/index.js +5 -0
  251. package/types/yield/actions/join/index.d.ts +3 -0
  252. package/types/yield/actions/join/index.js +6 -0
  253. package/types/yield/actions/join/step.d.ts +94 -0
  254. package/types/yield/actions/join/step.js +46 -0
  255. package/types/yield/actions/join/submit.d.ts +53 -0
  256. package/types/yield/actions/join/submit.js +1 -0
  257. package/types/yield/actions/join/validate.d.ts +18 -0
  258. package/types/yield/actions/join/validate.js +10 -0
  259. package/types/yield/actions/others.d.ts +63 -0
  260. package/types/yield/actions/others.js +1 -0
  261. package/types/yield/index.d.ts +2 -0
  262. package/types/yield/index.js +5 -0
  263. package/types/yield/info/account/index.d.ts +4 -0
  264. package/types/yield/info/account/index.js +7 -0
  265. package/types/yield/info/account/info.d.ts +101 -0
  266. package/types/yield/info/account/info.js +1 -0
  267. package/types/yield/info/account/reward.d.ts +30 -0
  268. package/types/yield/info/account/reward.js +1 -0
  269. package/types/yield/info/account/target.d.ts +43 -0
  270. package/types/yield/info/account/target.js +27 -0
  271. package/types/yield/info/account/unstake.d.ts +31 -0
  272. package/types/yield/info/account/unstake.js +22 -0
  273. package/types/yield/info/base.d.ts +45 -0
  274. package/types/yield/info/base.js +36 -0
  275. package/types/yield/info/chain/index.d.ts +2 -0
  276. package/types/yield/info/chain/index.js +5 -0
  277. package/types/yield/info/chain/info.d.ts +208 -0
  278. package/types/yield/info/chain/info.js +1 -0
  279. package/types/yield/info/chain/target.d.ts +37 -0
  280. package/types/yield/info/chain/target.js +1 -0
  281. package/types/yield/info/index.d.ts +4 -0
  282. package/types/yield/info/index.js +7 -0
  283. package/types/yield/info/pallet.d.ts +143 -0
  284. package/types/yield/info/pallet.js +9 -0
  285. package/utils/fetchStaticData.js +2 -1
  286. package/utils/index.d.ts +5 -0
  287. package/utils/index.js +53 -1
  288. package/utils/object.d.ts +1 -0
  289. package/utils/object.js +6 -0
@@ -0,0 +1,13 @@
1
+ // Copyright 2019-2022 @subwallet/extension-koni authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import BaseMigrationJob from '@subwallet/extension-base/services/migration-service/Base';
5
+ export default class MigrateEarningVersion extends BaseMigrationJob {
6
+ async run() {
7
+ try {
8
+ await this.state.dbService.removeOldEarningData();
9
+ } catch (e) {
10
+ console.error(e);
11
+ }
12
+ }
13
+ }
@@ -1,6 +1,9 @@
1
1
  // Copyright 2019-2022 @subwallet/extension-koni authors & contributors
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ import DeleteEarningData from '@subwallet/extension-base/services/migration-service/scripts/DeleteEarningData';
5
+ import EnableEarningChains from '@subwallet/extension-base/services/migration-service/scripts/EnableEarningChains';
6
+ import MigrateEarningVersion from "./databases/MigrateEarningVersion.js";
4
7
  import MigrateEthProvider from "./providers/MigrateEthProvider.js";
5
8
  import MigratePioneerProvider from "./providers/MigratePioneerProvider.js";
6
9
  import MigrateProvidersV1M1P24 from "./providers/MigrateProvidersV1M1P24.js";
@@ -33,9 +36,12 @@ export default {
33
36
  '1.1.6-01': MigrateWalletReference,
34
37
  '1.1.7': DeleteChain,
35
38
  '1.1.13-01': MigrateTokenDecimals,
39
+ '1.1.13-02': EnableEarningChains,
40
+ '1.1.13-03': DeleteEarningData,
36
41
  '1.1.17-01': MigratePioneerProvider,
37
42
  '1.1.17-03': EnableVaraChain,
38
43
  '1.1.24-01': MigrateProvidersV1M1P24,
39
- '1.1.26-01': MigratePolygonUSDCProvider
44
+ '1.1.26-01': MigratePolygonUSDCProvider,
45
+ '1.1.28-01': MigrateEarningVersion
40
46
  // [`${EVERYTIME}-1`]: AutoEnableChainsTokens
41
47
  };
@@ -0,0 +1,13 @@
1
+ import KoniState from '@subwallet/extension-base/koni/background/handlers/State';
2
+ import { UnlockDotSubmitMintData, UnlockDotTransactionNft } from '@subwallet/extension-base/types';
3
+ export default class UnlockDotCampaign {
4
+ #private;
5
+ constructor(state: KoniState);
6
+ mintNft({ address, extrinsicHash, network, slug, transactionId }: UnlockDotSubmitMintData): Promise<void>;
7
+ private checkMint;
8
+ private submitNft;
9
+ private getMinted;
10
+ canMint(address: string, slug: string, network: string): Promise<boolean>;
11
+ subscribeMintedNft(transactionId: string, cb: (data: UnlockDotTransactionNft) => void): import("rxjs").Subscription;
12
+ getMintedNft(transactionId: string): UnlockDotTransactionNft;
13
+ }
@@ -0,0 +1,139 @@
1
+ // Copyright 2019-2022 @subwallet/extension-base authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { isSameAddress } from '@subwallet/extension-base/utils';
5
+ import axios from 'axios';
6
+ import { BehaviorSubject } from 'rxjs';
7
+ import { MINT_HOST } from "../constants.js";
8
+ export default class UnlockDotCampaign {
9
+ #host = MINT_HOST;
10
+ #campaignId = 4;
11
+ #state;
12
+ #transactionNftSubject = new BehaviorSubject({});
13
+ #transactionNftState = {};
14
+ constructor(state) {
15
+ this.#state = state;
16
+ }
17
+ async mintNft({
18
+ address,
19
+ extrinsicHash,
20
+ network,
21
+ slug,
22
+ transactionId
23
+ }) {
24
+ var _result;
25
+ this.#transactionNftState[transactionId] = undefined;
26
+ this.#transactionNftSubject.next(this.#transactionNftState);
27
+ const requestId = await this.checkMint({
28
+ address,
29
+ extrinsicHash,
30
+ network,
31
+ slug
32
+ });
33
+ let result;
34
+ if (requestId) {
35
+ result = await this.submitNft(address, requestId);
36
+ await this.#state.reloadNft();
37
+ // } else {
38
+ // result = await this.getMinted(address, slug);
39
+ }
40
+
41
+ this.#transactionNftState[transactionId] = (_result = result) !== null && _result !== void 0 ? _result : {
42
+ nftImage: ''
43
+ };
44
+ this.#transactionNftSubject.next(this.#transactionNftState);
45
+ }
46
+ async checkMint({
47
+ address,
48
+ extrinsicHash,
49
+ network,
50
+ slug
51
+ }) {
52
+ const data = {
53
+ address,
54
+ campaignId: this.#campaignId,
55
+ category: slug,
56
+ additionalData: {
57
+ slug,
58
+ extrinsicHash,
59
+ network
60
+ }
61
+ };
62
+ const response = await axios.request({
63
+ baseURL: this.#host,
64
+ url: '/api/mint/check',
65
+ method: 'POST',
66
+ data
67
+ });
68
+ const respData = response.data;
69
+ if (respData.inMintingTime && respData.hasBalance && respData.validCampaign && respData.validCategory && respData.validUser && respData.notDuplicated && respData.requestId && respData.requestId > 1) {
70
+ return respData.requestId;
71
+ }
72
+ return null;
73
+ }
74
+ async submitNft(address, id) {
75
+ const data = {
76
+ requestId: id,
77
+ recipient: address
78
+ };
79
+ const response = await axios.request({
80
+ baseURL: this.#host,
81
+ url: '/api/mint/submit',
82
+ method: 'POST',
83
+ data
84
+ });
85
+ return response.data;
86
+ }
87
+
88
+ // @ts-ignore
89
+ async getMinted(address, slug) {
90
+ const params = {
91
+ address
92
+ };
93
+ const response = await axios.request({
94
+ baseURL: this.#host,
95
+ url: '/api/mint/fetch',
96
+ method: 'GET',
97
+ params: params
98
+ });
99
+ const data = response.data;
100
+ for (const item of data) {
101
+ if (isSameAddress(item.address, address) && slug === item.mintCategory && item.status === 'success' && item.campaignId === this.#campaignId) {
102
+ return item;
103
+ }
104
+ }
105
+ return undefined;
106
+ }
107
+ async canMint(address, slug, network) {
108
+ const data = {
109
+ address,
110
+ campaignId: this.#campaignId,
111
+ category: slug,
112
+ additionalData: {
113
+ slug,
114
+ network
115
+ }
116
+ };
117
+ const response = await axios.request({
118
+ baseURL: this.#host,
119
+ url: '/api/mint/check',
120
+ method: 'POST',
121
+ data
122
+ });
123
+ const respData = response.data;
124
+ if (respData.inMintingTime && respData.validCampaign && respData.validCategory && respData.validUser && respData.notDuplicated) {
125
+ return true;
126
+ }
127
+ return false;
128
+ }
129
+ subscribeMintedNft(transactionId, cb) {
130
+ return this.#transactionNftSubject.subscribe({
131
+ next: map => {
132
+ cb(map[transactionId]);
133
+ }
134
+ });
135
+ }
136
+ getMintedNft(transactionId) {
137
+ return this.#transactionNftSubject.value[transactionId];
138
+ }
139
+ }
@@ -0,0 +1 @@
1
+ export { default as UnlockDotCampaign } from './UnlockDotCampaign';
@@ -0,0 +1,4 @@
1
+ // Copyright 2019-2022 @subwallet/extension-base authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export { default as UnlockDotCampaign } from "./UnlockDotCampaign.js";
@@ -0,0 +1 @@
1
+ export declare const MINT_HOST: string;
@@ -0,0 +1,4 @@
1
+ // Copyright 2019-2022 @polkadot/extension-base authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export const MINT_HOST = process.env.NFT_MINTING_HOST || '';
@@ -0,0 +1,7 @@
1
+ import KoniState from '@subwallet/extension-base/koni/background/handlers/State';
2
+ import { UnlockDotCampaign } from './campaigns';
3
+ export default class MintCampaignService {
4
+ #private;
5
+ readonly unlockDotCampaign: UnlockDotCampaign;
6
+ constructor(state: KoniState);
7
+ }
@@ -0,0 +1,11 @@
1
+ // Copyright 2019-2022 @polkadot/extension-base authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { UnlockDotCampaign } from "./campaigns/index.js";
5
+ export default class MintCampaignService {
6
+ #state;
7
+ constructor(state) {
8
+ this.#state = state;
9
+ this.unlockDotCampaign = new UnlockDotCampaign(this.#state);
10
+ }
11
+ }
@@ -33,7 +33,7 @@ export default class NotificationService {
33
33
  type: 'basic',
34
34
  title,
35
35
  message,
36
- iconUrl: './images/icon-128.png',
36
+ iconUrl: '/images/icon-128.png',
37
37
  priority: 2,
38
38
  isClickable: !!link || !!onClick,
39
39
  buttons
@@ -8,7 +8,9 @@ import ChainStakingMetadataStore from '@subwallet/extension-base/services/storag
8
8
  import MantaPayStore from '@subwallet/extension-base/services/storage-service/db-stores/MantaPay';
9
9
  import NominatorMetadataStore from '@subwallet/extension-base/services/storage-service/db-stores/NominatorMetadata';
10
10
  import { HistoryQuery } from '@subwallet/extension-base/services/storage-service/db-stores/Transaction';
11
- import { BalanceItem } from '@subwallet/extension-base/types';
11
+ import YieldPoolStore from '@subwallet/extension-base/services/storage-service/db-stores/YieldPoolStore';
12
+ import YieldPositionStore from '@subwallet/extension-base/services/storage-service/db-stores/YieldPositionStore';
13
+ import { BalanceItem, YieldPoolInfo, YieldPoolType, YieldPositionInfo } from '@subwallet/extension-base/types';
12
14
  import { Subscription } from 'dexie';
13
15
  import { DexieExportJsonStructure } from 'dexie-export-import';
14
16
  export declare const DEXIE_BACKUP_TABLES: string[];
@@ -27,6 +29,8 @@ export default class DatabaseService {
27
29
  metadata: MetadataStore;
28
30
  chain: ChainStore;
29
31
  asset: AssetStore;
32
+ yieldPoolInfo: YieldPoolStore;
33
+ yieldPosition: YieldPositionStore;
30
34
  chainStakingMetadata: ChainStakingMetadataStore;
31
35
  nominatorMetadata: NominatorMetadataStore;
32
36
  mantaPay: MantaPayStore;
@@ -35,6 +39,7 @@ export default class DatabaseService {
35
39
  private logger;
36
40
  private nftSubscription;
37
41
  private stakingSubscription;
42
+ private yieldInfoSubscription;
38
43
  constructor(eventService: EventService);
39
44
  updatePriceStore(priceData: PriceJson): Promise<void>;
40
45
  getPriceStore(): Promise<PriceJson | undefined>;
@@ -83,6 +88,18 @@ export default class DatabaseService {
83
88
  subscribeMantaPayConfig(chain: string, callback: (data: MantaPayConfig[]) => void): void;
84
89
  getMantaPayConfig(chain: string): Promise<any[]>;
85
90
  getMantaPayFirstConfig(chain: string): Promise<any>;
91
+ removeOldEarningData(): Promise<void>;
92
+ updateYieldPoolStore(data: YieldPoolInfo): Promise<void>;
93
+ deleteYieldPoolInfo(slugs: string[]): Promise<void>;
94
+ getYieldPools(): Promise<YieldPoolInfo[]>;
95
+ getYieldPoolStakingInfo(chain: string, poolType: YieldPoolType): Promise<YieldPoolInfo | undefined>;
96
+ getYieldPool(slug: string): Promise<YieldPoolInfo | undefined>;
97
+ getYieldPositionByAddressAndSlug(address: string, slug: string): Promise<YieldPositionInfo | undefined>;
98
+ subscribeYieldPoolInfo(chains: string[], callback: (data: YieldPoolInfo[]) => void): Subscription;
99
+ updateYieldPosition(data: YieldPositionInfo): Promise<void>;
100
+ getYieldPositionByAddress(addresses: string[]): Promise<YieldPositionInfo[]>;
101
+ subscribeYieldPosition(addresses: string[], callback: (data: YieldPositionInfo[]) => void): Subscription;
102
+ getYieldNominationPoolPosition(addresses: string[], chains: string[]): Promise<YieldPositionInfo[]>;
86
103
  subscribeProcessingCampaign(): import("dexie").Observable<import("@subwallet/extension-base/background/KoniTypes").CampaignData[]>;
87
104
  getProcessingCampaign(): Promise<import("@subwallet/extension-base/background/KoniTypes").CampaignData[]>;
88
105
  getCampaign(slug: string): Promise<import("@subwallet/extension-base/background/KoniTypes").CampaignData | undefined>;
@@ -8,6 +8,8 @@ import CampaignStore from '@subwallet/extension-base/services/storage-service/db
8
8
  import ChainStakingMetadataStore from '@subwallet/extension-base/services/storage-service/db-stores/ChainStakingMetadata';
9
9
  import MantaPayStore from '@subwallet/extension-base/services/storage-service/db-stores/MantaPay';
10
10
  import NominatorMetadataStore from '@subwallet/extension-base/services/storage-service/db-stores/NominatorMetadata';
11
+ import YieldPoolStore from '@subwallet/extension-base/services/storage-service/db-stores/YieldPoolStore';
12
+ import YieldPositionStore from '@subwallet/extension-base/services/storage-service/db-stores/YieldPositionStore';
11
13
  import { reformatAddress } from '@subwallet/extension-base/utils';
12
14
  import { exportDB } from 'dexie-export-import';
13
15
  import { logger as createLogger } from '@polkadot/util';
@@ -34,6 +36,9 @@ export default class DatabaseService {
34
36
  metadata: new MetadataStore(this._db.metadata),
35
37
  chain: new ChainStore(this._db.chain),
36
38
  asset: new AssetStore(this._db.asset),
39
+ // yield
40
+ yieldPoolInfo: new YieldPoolStore(this._db.yieldPoolInfo),
41
+ yieldPosition: new YieldPositionStore(this._db.yieldPosition),
37
42
  // staking
38
43
  chainStakingMetadata: new ChainStakingMetadataStore(this._db.chainStakingMetadata),
39
44
  nominatorMetadata: new NominatorMetadataStore(this._db.nominatorMetadata),
@@ -272,6 +277,52 @@ export default class DatabaseService {
272
277
  return this.stores.mantaPay.getFirstConfig(chain);
273
278
  }
274
279
 
280
+ /* Earning */
281
+
282
+ async removeOldEarningData() {
283
+ await this.stores.yieldPoolInfo.clear();
284
+ await this.stores.yieldPosition.clear();
285
+ }
286
+ async updateYieldPoolStore(data) {
287
+ await this.stores.yieldPoolInfo.upsert(data);
288
+ }
289
+ async deleteYieldPoolInfo(slugs) {
290
+ await this.stores.yieldPoolInfo.bulkDelete(slugs);
291
+ }
292
+ async getYieldPools() {
293
+ return this.stores.yieldPoolInfo.getAll();
294
+ }
295
+ async getYieldPoolStakingInfo(chain, poolType) {
296
+ return this.stores.yieldPoolInfo.getByChainAndType(chain, poolType);
297
+ }
298
+ async getYieldPool(slug) {
299
+ return this.stores.yieldPoolInfo.getBySlug(slug);
300
+ }
301
+ async getYieldPositionByAddressAndSlug(address, slug) {
302
+ return this.stores.yieldPosition.getByAddressAndSlug(address, slug);
303
+ }
304
+ subscribeYieldPoolInfo(chains, callback) {
305
+ this.yieldInfoSubscription && this.yieldInfoSubscription.unsubscribe();
306
+ this.yieldInfoSubscription = this.stores.yieldPoolInfo.subscribeYieldPoolInfo(chains).subscribe({
307
+ next: data => callback && callback(data)
308
+ });
309
+ return this.yieldInfoSubscription;
310
+ }
311
+ async updateYieldPosition(data) {
312
+ await this.stores.yieldPosition.upsert(data);
313
+ }
314
+ async getYieldPositionByAddress(addresses) {
315
+ return this.stores.yieldPosition.getByAddress(addresses);
316
+ }
317
+ subscribeYieldPosition(addresses, callback) {
318
+ return this.stores.yieldPosition.subscribeYieldPositions(addresses).subscribe({
319
+ next: data => callback && callback(data)
320
+ });
321
+ }
322
+ async getYieldNominationPoolPosition(addresses, chains) {
323
+ return this.stores.yieldPosition.getByAddressAndChains(addresses, chains);
324
+ }
325
+
275
326
  /* Campaign */
276
327
 
277
328
  subscribeProcessingCampaign() {
@@ -1,6 +1,6 @@
1
1
  import { _ChainAsset, _ChainInfo } from '@subwallet/chain-list/types';
2
2
  import { CampaignData, ChainStakingMetadata, CrowdloanItem, MetadataItem, NftCollection, NftItem, NominatorMetadata, PriceJson, StakingItem, TransactionHistoryItem } from '@subwallet/extension-base/background/KoniTypes';
3
- import { BalanceItem } from '@subwallet/extension-base/types';
3
+ import { BalanceItem, YieldPoolInfo, YieldPositionInfo } from '@subwallet/extension-base/types';
4
4
  import Dexie, { Table } from 'dexie';
5
5
  export interface DefaultChainDoc {
6
6
  chain: string;
@@ -45,6 +45,8 @@ export default class KoniDatabase extends Dexie {
45
45
  asset: Table<_ChainAsset, object>;
46
46
  chainStakingMetadata: Table<ChainStakingMetadata, object>;
47
47
  nominatorMetadata: Table<NominatorMetadata, object>;
48
+ yieldPoolInfo: Table<YieldPoolInfo, object>;
49
+ yieldPosition: Table<YieldPositionInfo, object>;
48
50
  mantaPay: Table<IMantaPayLedger, object>;
49
51
  campaign: Table<ICampaign, object>;
50
52
  private schemaVersion;
@@ -31,6 +31,10 @@ export default class KoniDatabase extends Dexie {
31
31
  mantaPay: 'key, chain'
32
32
  });
33
33
  this.conditionalVersion(4, {
34
+ yieldPoolInfo: 'slug, chain, type',
35
+ yieldPosition: '[slug+chain+address], [address+slug], address, chain'
36
+ });
37
+ this.conditionalVersion(5, {
34
38
  campaign: 'slug'
35
39
  });
36
40
  }
@@ -1,12 +1,12 @@
1
1
  // Copyright 2019-2022 @subwallet/extension-base authors & contributors
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { StakingStatus } from '@subwallet/extension-base/background/KoniTypes';
5
4
  import BaseStoreWithAddressAndChain from '@subwallet/extension-base/services/storage-service/db-stores/BaseStoreWithAddressAndChain';
5
+ import { EarningStatus } from '@subwallet/extension-base/types';
6
6
  import { liveQuery } from 'dexie';
7
7
  export default class NominatorMetadataStore extends BaseStoreWithAddressAndChain {
8
8
  async getAll() {
9
- return this.table.filter(item => item.status !== StakingStatus.NOT_STAKING).toArray();
9
+ return this.table.filter(item => item.status !== EarningStatus.NOT_STAKING).toArray();
10
10
  }
11
11
  subscribeByAddresses(addresses) {
12
12
  return liveQuery(() => this.getByAddress(addresses));
@@ -15,7 +15,7 @@ export default class NominatorMetadataStore extends BaseStoreWithAddressAndChain
15
15
  return liveQuery(() => this.getAll());
16
16
  }
17
17
  getByAddress(addresses) {
18
- return this.table.where('address').anyOfIgnoreCase(addresses).and(item => item.status !== StakingStatus.NOT_STAKING).toArray();
18
+ return this.table.where('address').anyOfIgnoreCase(addresses).and(item => item.status !== EarningStatus.NOT_STAKING).toArray();
19
19
  }
20
20
  async removeByAddress(address) {
21
21
  return this.table.where('address').anyOfIgnoreCase(address).delete();
@@ -0,0 +1,10 @@
1
+ import BaseStore from '@subwallet/extension-base/services/storage-service/db-stores/BaseStore';
2
+ import { YieldPoolInfo, YieldPoolType } from '@subwallet/extension-base/types';
3
+ export default class YieldPoolStore extends BaseStore<YieldPoolInfo> {
4
+ getAll(): Promise<YieldPoolInfo[]>;
5
+ getByChains(chains: string[]): Promise<YieldPoolInfo[]>;
6
+ getByChainAndType(chain: string, poolType: YieldPoolType): Promise<YieldPoolInfo | undefined>;
7
+ bulkDelete(slugs: string[]): Promise<void>;
8
+ getBySlug(slug: string): Promise<YieldPoolInfo | undefined>;
9
+ subscribeYieldPoolInfo(chains: string[]): import("dexie").Observable<YieldPoolInfo[]>;
10
+ }
@@ -0,0 +1,28 @@
1
+ // Copyright 2019-2022 @subwallet/extension-base authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import BaseStore from '@subwallet/extension-base/services/storage-service/db-stores/BaseStore';
5
+ import { liveQuery } from 'dexie';
6
+ export default class YieldPoolStore extends BaseStore {
7
+ async getAll() {
8
+ return this.table.toArray();
9
+ }
10
+ async getByChains(chains) {
11
+ if (chains.length === 0) {
12
+ return this.getAll();
13
+ }
14
+ return this.table.where('chain').anyOfIgnoreCase(chains).toArray();
15
+ }
16
+ async getByChainAndType(chain, poolType) {
17
+ return this.table.where('chain').equals(chain).and(item => item.type === poolType).first();
18
+ }
19
+ async bulkDelete(slugs) {
20
+ return this.table.bulkDelete(slugs);
21
+ }
22
+ async getBySlug(slug) {
23
+ return this.table.get(slug);
24
+ }
25
+ subscribeYieldPoolInfo(chains) {
26
+ return liveQuery(() => this.getByChains(chains));
27
+ }
28
+ }
@@ -0,0 +1,9 @@
1
+ import BaseStore from '@subwallet/extension-base/services/storage-service/db-stores/BaseStore';
2
+ import { YieldPositionInfo } from '@subwallet/extension-base/types';
3
+ export default class YieldPositionStore extends BaseStore<YieldPositionInfo> {
4
+ getAll(): Promise<YieldPositionInfo[]>;
5
+ getByAddress(addresses: string[]): Promise<YieldPositionInfo[]>;
6
+ getByAddressAndChains(addresses: string[], chains: string[]): Promise<YieldPositionInfo[]>;
7
+ getByAddressAndSlug(address: string, slug: string): import("dexie").PromiseExtended<YieldPositionInfo | undefined>;
8
+ subscribeYieldPositions(addresses: string[]): import("dexie").Observable<YieldPositionInfo[]>;
9
+ }
@@ -0,0 +1,57 @@
1
+ // Copyright 2019-2022 @subwallet/extension-base authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import BaseStore from '@subwallet/extension-base/services/storage-service/db-stores/BaseStore';
5
+ import { liveQuery } from 'dexie';
6
+ export default class YieldPositionStore extends BaseStore {
7
+ async getAll() {
8
+ return this.table
9
+ // .filter((item) => {
10
+ // let isValidLiquidStaking = false;
11
+ //
12
+ // if (item.type === YieldPoolType.LIQUID_STAKING) {
13
+ // const nominatorMetadata = item.metadata as NominatorMetadata;
14
+ //
15
+ // if (nominatorMetadata.unstakings.length > 0) {
16
+ // console.log('true', item);
17
+ // isValidLiquidStaking = true;
18
+ // }
19
+ // }
20
+ //
21
+ // return parseInt(item.balance[0].activeBalance) > 0 || isValidLiquidStaking;
22
+ // })
23
+ .toArray();
24
+ }
25
+ async getByAddress(addresses) {
26
+ if (addresses.length === 0) {
27
+ return this.getAll();
28
+ }
29
+ return this.table.where('address').anyOfIgnoreCase(addresses)
30
+ // .filter((item) => {
31
+ // let isValidLiquidStaking = false;
32
+ //
33
+ // if (item.type === YieldPoolType.LIQUID_STAKING) {
34
+ // const nominatorMetadata = item.metadata as NominatorMetadata;
35
+ //
36
+ // if (nominatorMetadata && nominatorMetadata?.unstakings?.length > 0) {
37
+ // isValidLiquidStaking = true;
38
+ // }
39
+ // }
40
+ //
41
+ // return parseInt(item.balance[0].activeBalance) > 0 || isValidLiquidStaking;
42
+ // })
43
+ .toArray();
44
+ }
45
+ async getByAddressAndChains(addresses, chains) {
46
+ return this.table.where('address').anyOfIgnoreCase(addresses).filter(item => chains.includes(item.chain)).toArray();
47
+ }
48
+ getByAddressAndSlug(address, slug) {
49
+ return this.table.get({
50
+ address,
51
+ slug
52
+ });
53
+ }
54
+ subscribeYieldPositions(addresses) {
55
+ return liveQuery(() => this.getByAddress(addresses));
56
+ }
57
+ }
@@ -1,4 +1,4 @@
1
- import { CrowdloanContributionsResponse, ExtrinsicItem, ExtrinsicsListResponse, IMultiChainBalance, RequestBlockRange, TransferItem, TransfersListResponse } from '@subwallet/extension-base/services/subscan-service/types';
1
+ import { CrowdloanContributionsResponse, ExtrinsicItem, ExtrinsicsListResponse, IMultiChainBalance, RequestBlockRange, SubscanRequest, TransferItem, TransfersListResponse } from '@subwallet/extension-base/services/subscan-service/types';
2
2
  export declare class SubscanService {
3
3
  private subscanChainMap;
4
4
  private limitRate;
@@ -15,7 +15,7 @@ export declare class SubscanService {
15
15
  });
16
16
  private getApiUrl;
17
17
  private postRequest;
18
- private addRequest;
18
+ addRequest<T>(run: SubscanRequest<T>['run']): Promise<T>;
19
19
  private process;
20
20
  checkSupportedSubscanChain(chain: string): boolean;
21
21
  setSubscanChainMap(subscanChainMap: Record<string, string>): void;
@@ -1,5 +1,7 @@
1
1
  import { _ChainAsset, _ChainInfo } from '@subwallet/chain-list/types';
2
- import { TransactionHistoryItem } from '@subwallet/extension-base/background/KoniTypes';
2
+ import { ExtrinsicType, TransactionHistoryItem } from '@subwallet/extension-base/background/KoniTypes';
3
3
  import { EventRecord } from '@polkadot/types/interfaces';
4
4
  export declare function parseXcmEventLogs(historyItem: Partial<TransactionHistoryItem>, eventLogs: EventRecord[], chain: string, sendingTokenInfo: _ChainAsset, chainInfo: _ChainInfo): void;
5
5
  export declare function parseTransferEventLogs(historyItem: Partial<TransactionHistoryItem>, eventLogs: EventRecord[], chain: string, sendingTokenInfo: _ChainAsset, chainInfo: _ChainInfo): void;
6
+ export declare function parseLiquidStakingEvents(historyItem: Partial<TransactionHistoryItem>, eventLogs: EventRecord[], inputTokenInfo: _ChainAsset, chainInfo: _ChainInfo, feePaidWithInputAsset: boolean, extrinsicType: ExtrinsicType): void;
7
+ export declare function parseLiquidStakingFastUnstakeEvents(historyItem: Partial<TransactionHistoryItem>, eventLogs: EventRecord[], chainInfo: _ChainInfo, extrinsicType: ExtrinsicType): void;
@@ -1,7 +1,8 @@
1
1
  // Copyright 2019-2022 @subwallet/extension-base authors & contributors
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { _getAssetDecimals, _getChainNativeTokenBasicInfo } from '@subwallet/extension-base/services/chain-service/utils';
4
+ import { ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
5
+ import { _getAssetDecimals, _getAssetSymbol, _getChainNativeTokenBasicInfo } from '@subwallet/extension-base/services/chain-service/utils';
5
6
  export function parseXcmEventLogs(historyItem, eventLogs, chain, sendingTokenInfo, chainInfo) {
6
7
  for (let index = 0; index < eventLogs.length; index++) {
7
8
  const record = eventLogs[index];
@@ -65,4 +66,59 @@ export function parseTransferEventLogs(historyItem, eventLogs, chain, sendingTok
65
66
  }
66
67
  }
67
68
  }
69
+ }
70
+ export function parseLiquidStakingEvents(historyItem, eventLogs, inputTokenInfo, chainInfo, feePaidWithInputAsset, extrinsicType) {
71
+ if (feePaidWithInputAsset) {
72
+ historyItem.fee = {
73
+ value: '0',
74
+ // TODO
75
+ symbol: _getAssetSymbol(inputTokenInfo),
76
+ decimals: _getAssetDecimals(inputTokenInfo)
77
+ };
78
+ } else {
79
+ for (let index = 0; index < eventLogs.length; index++) {
80
+ const record = eventLogs[index];
81
+ const {
82
+ decimals: nativeDecimals,
83
+ symbol: nativeSymbol
84
+ } = _getChainNativeTokenBasicInfo(chainInfo);
85
+ const section = extrinsicType === ExtrinsicType.REDEEM_QDOT ? 'tokens' : 'balances';
86
+ const eventMethod = extrinsicType === ExtrinsicType.REDEEM_QDOT ? 'withdrawn' : 'withdraw';
87
+ if (record.event.section === section && record.event.method.toLowerCase() === eventMethod) {
88
+ var _record$event$data$9;
89
+ if ((_record$event$data$9 = record.event.data[2]) !== null && _record$event$data$9 !== void 0 && _record$event$data$9.toString()) {
90
+ var _record$event$data$10;
91
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
92
+ historyItem.fee = {
93
+ value: ((_record$event$data$10 = record.event.data[2]) === null || _record$event$data$10 === void 0 ? void 0 : _record$event$data$10.toString()) || '0',
94
+ symbol: nativeSymbol,
95
+ decimals: nativeDecimals
96
+ };
97
+ }
98
+ }
99
+ }
100
+ }
101
+ }
102
+ export function parseLiquidStakingFastUnstakeEvents(historyItem, eventLogs, chainInfo, extrinsicType) {
103
+ for (let index = 0; index < eventLogs.length; index++) {
104
+ const record = eventLogs[index];
105
+ const {
106
+ decimals: nativeDecimals,
107
+ symbol: nativeSymbol
108
+ } = _getChainNativeTokenBasicInfo(chainInfo);
109
+ const section = extrinsicType === ExtrinsicType.REDEEM_QDOT ? 'tokens' : 'balances';
110
+ const eventMethod = extrinsicType === ExtrinsicType.REDEEM_QDOT ? 'withdrawn' : 'withdraw';
111
+ if (record.event.section === section && record.event.method.toLowerCase() === eventMethod) {
112
+ var _record$event$data$11;
113
+ if ((_record$event$data$11 = record.event.data[2]) !== null && _record$event$data$11 !== void 0 && _record$event$data$11.toString()) {
114
+ var _record$event$data$12;
115
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
116
+ historyItem.fee = {
117
+ value: ((_record$event$data$12 = record.event.data[2]) === null || _record$event$data$12 === void 0 ? void 0 : _record$event$data$12.toString()) || '0',
118
+ symbol: nativeSymbol,
119
+ decimals: nativeDecimals
120
+ };
121
+ }
122
+ }
123
+ }
68
124
  }
@@ -30,7 +30,7 @@ const typeName = type => {
30
30
  case ExtrinsicType.STAKING_BOND:
31
31
  return 'Bond';
32
32
  case ExtrinsicType.STAKING_UNBOND:
33
- return 'Unbond';
33
+ return 'Unstake';
34
34
  case ExtrinsicType.STAKING_CLAIM_REWARD:
35
35
  return 'Claim reward';
36
36
  case ExtrinsicType.STAKING_WITHDRAW:
@@ -45,6 +45,8 @@ const typeName = type => {
45
45
  return 'Cancel compounding';
46
46
  case ExtrinsicType.STAKING_POOL_WITHDRAW:
47
47
  return 'Withdraw pool';
48
+ case ExtrinsicType.JOIN_YIELD_POOL:
49
+ return 'Start earning';
48
50
  case ExtrinsicType.UNKNOWN:
49
51
  default:
50
52
  return 'unknown';