@subwallet/extension-base 1.1.31-beta.0 → 1.1.33-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 (319) hide show
  1. package/background/KoniTypes.d.ts +71 -111
  2. package/background/KoniTypes.js +14 -19
  3. package/background/errors/TransactionError.js +0 -9
  4. package/cjs/background/KoniTypes.js +17 -20
  5. package/cjs/background/errors/TransactionError.js +0 -9
  6. package/cjs/constants/index.js +4 -19
  7. package/cjs/koni/api/nft/config.js +23 -33
  8. package/cjs/koni/api/nft/index.js +0 -14
  9. package/cjs/koni/api/nft/nft.js +22 -1
  10. package/cjs/koni/api/staking/bonding/amplitude.js +108 -76
  11. package/cjs/koni/api/staking/bonding/astar.js +10 -11
  12. package/cjs/koni/api/staking/bonding/index.js +3 -4
  13. package/cjs/koni/api/staking/bonding/paraChain.js +29 -28
  14. package/cjs/koni/api/staking/bonding/relayChain.js +45 -48
  15. package/cjs/koni/api/staking/bonding/utils.js +86 -104
  16. package/cjs/koni/api/staking/index.js +5 -6
  17. package/cjs/koni/api/staking/paraChain.js +36 -11
  18. package/cjs/koni/api/staking/relayChain.js +2 -3
  19. package/cjs/koni/api/xcm/xTokens.js +1 -1
  20. package/cjs/koni/background/cron.js +1 -11
  21. package/cjs/koni/background/handlers/Extension.js +69 -362
  22. package/cjs/koni/background/handlers/State.js +3 -51
  23. package/cjs/koni/background/handlers/Tabs.js +19 -2
  24. package/cjs/koni/background/handlers/index.js +2 -4
  25. package/cjs/koni/background/subscription.js +37 -95
  26. package/cjs/packageInfo.js +1 -1
  27. package/cjs/services/campaign-service/index.js +25 -9
  28. package/cjs/services/chain-service/constants.js +21 -4
  29. package/cjs/services/chain-service/index.js +2 -3
  30. package/cjs/services/chain-service/utils.js +1 -7
  31. package/cjs/services/event-service/index.js +0 -4
  32. package/cjs/services/history-service/index.js +12 -8
  33. package/cjs/services/keyring-service/index.js +2 -14
  34. package/cjs/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
  35. package/cjs/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
  36. package/cjs/services/migration-service/scripts/index.js +1 -7
  37. package/cjs/services/notification-service/NotificationService.js +1 -1
  38. package/cjs/services/storage-service/DatabaseService.js +3 -51
  39. package/cjs/services/storage-service/databases/index.js +0 -4
  40. package/cjs/services/storage-service/db-stores/Campaign.js +9 -3
  41. package/cjs/services/storage-service/db-stores/NominatorMetadata.js +3 -3
  42. package/cjs/services/subscan-service/index.js +0 -16
  43. package/cjs/services/transaction-service/event-parser/index.js +0 -58
  44. package/cjs/services/transaction-service/helpers/index.js +1 -3
  45. package/cjs/services/transaction-service/index.js +131 -242
  46. package/cjs/services/transaction-service/utils.js +0 -1
  47. package/cjs/types/index.js +0 -44
  48. package/cjs/utils/fetchEvmChainInfo.js +20 -0
  49. package/cjs/utils/fetchStaticData.js +1 -2
  50. package/cjs/utils/index.js +17 -81
  51. package/cjs/utils/number.js +1 -3
  52. package/constants/index.d.ts +1 -6
  53. package/constants/index.js +1 -6
  54. package/koni/api/nft/config.js +23 -33
  55. package/koni/api/nft/index.js +1 -15
  56. package/koni/api/nft/nft.js +23 -2
  57. package/koni/api/staking/bonding/amplitude.d.ts +1 -1
  58. package/koni/api/staking/bonding/amplitude.js +105 -73
  59. package/koni/api/staking/bonding/astar.js +8 -9
  60. package/koni/api/staking/bonding/index.d.ts +2 -1
  61. package/koni/api/staking/bonding/index.js +3 -5
  62. package/koni/api/staking/bonding/paraChain.js +16 -15
  63. package/koni/api/staking/bonding/relayChain.d.ts +2 -2
  64. package/koni/api/staking/bonding/relayChain.js +30 -33
  65. package/koni/api/staking/bonding/utils.d.ts +42 -15
  66. package/koni/api/staking/bonding/utils.js +69 -85
  67. package/koni/api/staking/index.js +1 -2
  68. package/koni/api/staking/paraChain.js +37 -12
  69. package/koni/api/staking/relayChain.js +3 -4
  70. package/koni/api/xcm/xTokens.js +1 -1
  71. package/koni/background/cron.d.ts +0 -1
  72. package/koni/background/cron.js +2 -12
  73. package/koni/background/handlers/Extension.d.ts +1 -17
  74. package/koni/background/handlers/Extension.js +30 -321
  75. package/koni/background/handlers/State.d.ts +2 -18
  76. package/koni/background/handlers/State.js +3 -50
  77. package/koni/background/handlers/Tabs.js +20 -3
  78. package/koni/background/handlers/index.js +2 -4
  79. package/koni/background/subscription.d.ts +1 -6
  80. package/koni/background/subscription.js +38 -97
  81. package/package.json +13 -321
  82. package/packageInfo.js +1 -1
  83. package/services/campaign-service/index.js +25 -9
  84. package/services/chain-service/constants.d.ts +12 -0
  85. package/services/chain-service/constants.js +19 -3
  86. package/services/chain-service/index.js +2 -3
  87. package/services/chain-service/utils.d.ts +0 -1
  88. package/services/chain-service/utils.js +1 -5
  89. package/services/event-service/index.d.ts +0 -1
  90. package/services/event-service/index.js +0 -4
  91. package/services/event-service/types.d.ts +1 -8
  92. package/services/history-service/index.js +12 -8
  93. package/services/keyring-service/index.d.ts +1 -2
  94. package/services/keyring-service/index.js +2 -14
  95. package/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
  96. package/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
  97. package/services/migration-service/scripts/index.js +1 -7
  98. package/services/notification-service/NotificationService.js +1 -1
  99. package/services/storage-service/DatabaseService.d.ts +2 -18
  100. package/services/storage-service/DatabaseService.js +3 -51
  101. package/services/storage-service/databases/index.d.ts +1 -3
  102. package/services/storage-service/databases/index.js +0 -4
  103. package/services/storage-service/db-stores/Campaign.js +9 -3
  104. package/services/storage-service/db-stores/NominatorMetadata.js +3 -3
  105. package/services/subscan-service/index.d.ts +2 -3
  106. package/services/subscan-service/index.js +0 -15
  107. package/services/subscan-service/types.d.ts +0 -20
  108. package/services/transaction-service/event-parser/index.d.ts +1 -3
  109. package/services/transaction-service/event-parser/index.js +1 -57
  110. package/services/transaction-service/helpers/index.js +1 -3
  111. package/services/transaction-service/index.d.ts +16 -4
  112. package/services/transaction-service/index.js +118 -230
  113. package/services/transaction-service/types.d.ts +1 -2
  114. package/services/transaction-service/utils.js +0 -1
  115. package/types/index.d.ts +0 -5
  116. package/types/index.js +1 -5
  117. package/utils/fetchEvmChainInfo.d.ts +17 -0
  118. package/utils/fetchEvmChainInfo.js +14 -0
  119. package/utils/fetchStaticData.js +1 -2
  120. package/utils/index.d.ts +2 -5
  121. package/utils/index.js +2 -52
  122. package/utils/number.d.ts +1 -1
  123. package/utils/number.js +1 -1
  124. package/cjs/koni/api/dotsama/balance.js +0 -464
  125. package/cjs/koni/api/nft/ordinal_nft/constants.js +0 -21
  126. package/cjs/koni/api/nft/ordinal_nft/index.js +0 -121
  127. package/cjs/koni/api/nft/ordinal_nft/utils.js +0 -41
  128. package/cjs/koni/api/yield/helper/utils.js +0 -46
  129. package/cjs/services/earning-service/constants/chains.js +0 -29
  130. package/cjs/services/earning-service/constants/index.js +0 -27
  131. package/cjs/services/earning-service/constants/step.js +0 -18
  132. package/cjs/services/earning-service/handlers/base.js +0 -259
  133. package/cjs/services/earning-service/handlers/index.js +0 -60
  134. package/cjs/services/earning-service/handlers/lending/base.js +0 -20
  135. package/cjs/services/earning-service/handlers/lending/index.js +0 -13
  136. package/cjs/services/earning-service/handlers/lending/interlay.js +0 -191
  137. package/cjs/services/earning-service/handlers/liquid-staking/acala.js +0 -239
  138. package/cjs/services/earning-service/handlers/liquid-staking/base.js +0 -43
  139. package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +0 -297
  140. package/cjs/services/earning-service/handlers/liquid-staking/index.js +0 -34
  141. package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +0 -226
  142. package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +0 -395
  143. package/cjs/services/earning-service/handlers/native-staking/amplitude.js +0 -384
  144. package/cjs/services/earning-service/handlers/native-staking/astar.js +0 -461
  145. package/cjs/services/earning-service/handlers/native-staking/base-para.js +0 -146
  146. package/cjs/services/earning-service/handlers/native-staking/base.js +0 -159
  147. package/cjs/services/earning-service/handlers/native-staking/index.js +0 -34
  148. package/cjs/services/earning-service/handlers/native-staking/para-chain.js +0 -385
  149. package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +0 -558
  150. package/cjs/services/earning-service/handlers/nomination-pool/index.js +0 -560
  151. package/cjs/services/earning-service/handlers/special.js +0 -503
  152. package/cjs/services/earning-service/service.js +0 -387
  153. package/cjs/services/earning-service/utils/index.js +0 -128
  154. package/cjs/services/migration-service/scripts/DeleteEarningData.js +0 -21
  155. package/cjs/services/migration-service/scripts/EnableEarningChains.js +0 -21
  156. package/cjs/services/migration-service/scripts/MigrateEthProvider.js +0 -17
  157. package/cjs/services/migration-service/scripts/MigratePioneerProvider.js +0 -17
  158. package/cjs/services/migration-service/scripts/MigrateProvider.js +0 -29
  159. package/cjs/services/migration-service/scripts/databases/MigrateEarningHistory.js +0 -21
  160. package/cjs/services/migration-service/scripts/databases/MigrateEarningVersion.js +0 -21
  161. package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -149
  162. package/cjs/services/mint-campaign-service/campaigns/index.js +0 -13
  163. package/cjs/services/mint-campaign-service/constants.js +0 -11
  164. package/cjs/services/mint-campaign-service/index.js +0 -18
  165. package/cjs/services/storage-service/db-stores/YieldPoolStore.js +0 -36
  166. package/cjs/services/storage-service/db-stores/YieldPositionStore.js +0 -65
  167. package/cjs/services/storage-service/index.js +0 -241
  168. package/cjs/types/campaigns/index.js +0 -16
  169. package/cjs/types/campaigns/unlock-dot.js +0 -1
  170. package/cjs/types/ordinal.js +0 -1
  171. package/cjs/types/transaction.js +0 -1
  172. package/cjs/types/yield/actions/index.js +0 -27
  173. package/cjs/types/yield/actions/join/index.js +0 -38
  174. package/cjs/types/yield/actions/join/step.js +0 -47
  175. package/cjs/types/yield/actions/join/submit.js +0 -1
  176. package/cjs/types/yield/actions/join/validate.js +0 -16
  177. package/cjs/types/yield/actions/others.js +0 -1
  178. package/cjs/types/yield/index.js +0 -27
  179. package/cjs/types/yield/info/account/index.js +0 -49
  180. package/cjs/types/yield/info/account/info.js +0 -1
  181. package/cjs/types/yield/info/account/reward.js +0 -1
  182. package/cjs/types/yield/info/account/target.js +0 -32
  183. package/cjs/types/yield/info/account/unstake.js +0 -27
  184. package/cjs/types/yield/info/base.js +0 -41
  185. package/cjs/types/yield/info/chain/index.js +0 -27
  186. package/cjs/types/yield/info/chain/info.js +0 -1
  187. package/cjs/types/yield/info/chain/target.js +0 -1
  188. package/cjs/types/yield/info/index.js +0 -49
  189. package/cjs/types/yield/info/pallet.js +0 -15
  190. package/cjs/types.js +0 -1
  191. package/cjs/utils/address.js +0 -34
  192. package/cjs/utils/keyring.js +0 -57
  193. package/cjs/utils/object.js +0 -12
  194. package/koni/api/nft/ordinal_nft/constants.d.ts +0 -9
  195. package/koni/api/nft/ordinal_nft/constants.js +0 -12
  196. package/koni/api/nft/ordinal_nft/index.d.ts +0 -8
  197. package/koni/api/nft/ordinal_nft/index.js +0 -114
  198. package/koni/api/nft/ordinal_nft/utils.d.ts +0 -2
  199. package/koni/api/nft/ordinal_nft/utils.js +0 -33
  200. package/koni/api/yield/helper/utils.d.ts +0 -10
  201. package/koni/api/yield/helper/utils.js +0 -32
  202. package/services/earning-service/constants/abis/compound_finance_v2_abi.json +0 -1235
  203. package/services/earning-service/constants/abis/st_liquid_token_abi.json +0 -1355
  204. package/services/earning-service/constants/chains.d.ts +0 -14
  205. package/services/earning-service/constants/chains.js +0 -21
  206. package/services/earning-service/constants/index.d.ts +0 -2
  207. package/services/earning-service/constants/index.js +0 -5
  208. package/services/earning-service/constants/step.d.ts +0 -3
  209. package/services/earning-service/constants/step.js +0 -10
  210. package/services/earning-service/handlers/base.d.ts +0 -112
  211. package/services/earning-service/handlers/base.js +0 -253
  212. package/services/earning-service/handlers/index.d.ts +0 -5
  213. package/services/earning-service/handlers/index.js +0 -8
  214. package/services/earning-service/handlers/lending/base.d.ts +0 -6
  215. package/services/earning-service/handlers/lending/base.js +0 -12
  216. package/services/earning-service/handlers/lending/index.d.ts +0 -1
  217. package/services/earning-service/handlers/lending/index.js +0 -4
  218. package/services/earning-service/handlers/lending/interlay.d.ts +0 -24
  219. package/services/earning-service/handlers/lending/interlay.js +0 -183
  220. package/services/earning-service/handlers/liquid-staking/acala.d.ts +0 -27
  221. package/services/earning-service/handlers/liquid-staking/acala.js +0 -231
  222. package/services/earning-service/handlers/liquid-staking/base.d.ts +0 -9
  223. package/services/earning-service/handlers/liquid-staking/base.js +0 -35
  224. package/services/earning-service/handlers/liquid-staking/bifrost.d.ts +0 -46
  225. package/services/earning-service/handlers/liquid-staking/bifrost.js +0 -286
  226. package/services/earning-service/handlers/liquid-staking/index.d.ts +0 -4
  227. package/services/earning-service/handlers/liquid-staking/index.js +0 -7
  228. package/services/earning-service/handlers/liquid-staking/parallel.d.ts +0 -26
  229. package/services/earning-service/handlers/liquid-staking/parallel.js +0 -218
  230. package/services/earning-service/handlers/liquid-staking/stella-swap.d.ts +0 -34
  231. package/services/earning-service/handlers/liquid-staking/stella-swap.js +0 -385
  232. package/services/earning-service/handlers/native-staking/amplitude.d.ts +0 -22
  233. package/services/earning-service/handlers/native-staking/amplitude.js +0 -375
  234. package/services/earning-service/handlers/native-staking/astar.d.ts +0 -19
  235. package/services/earning-service/handlers/native-staking/astar.js +0 -451
  236. package/services/earning-service/handlers/native-staking/base-para.d.ts +0 -11
  237. package/services/earning-service/handlers/native-staking/base-para.js +0 -138
  238. package/services/earning-service/handlers/native-staking/base.d.ts +0 -21
  239. package/services/earning-service/handlers/native-staking/base.js +0 -150
  240. package/services/earning-service/handlers/native-staking/index.d.ts +0 -4
  241. package/services/earning-service/handlers/native-staking/index.js +0 -7
  242. package/services/earning-service/handlers/native-staking/para-chain.d.ts +0 -15
  243. package/services/earning-service/handlers/native-staking/para-chain.js +0 -377
  244. package/services/earning-service/handlers/native-staking/relay-chain.d.ts +0 -21
  245. package/services/earning-service/handlers/native-staking/relay-chain.js +0 -549
  246. package/services/earning-service/handlers/nomination-pool/index.d.ts +0 -36
  247. package/services/earning-service/handlers/nomination-pool/index.js +0 -550
  248. package/services/earning-service/handlers/special.d.ts +0 -65
  249. package/services/earning-service/handlers/special.js +0 -495
  250. package/services/earning-service/service.d.ts +0 -45
  251. package/services/earning-service/service.js +0 -379
  252. package/services/earning-service/utils/index.d.ts +0 -18
  253. package/services/earning-service/utils/index.js +0 -112
  254. package/services/migration-service/scripts/DeleteEarningData.d.ts +0 -4
  255. package/services/migration-service/scripts/DeleteEarningData.js +0 -13
  256. package/services/migration-service/scripts/EnableEarningChains.d.ts +0 -4
  257. package/services/migration-service/scripts/EnableEarningChains.js +0 -13
  258. package/services/migration-service/scripts/databases/MigrateEarningHistory.d.ts +0 -4
  259. package/services/migration-service/scripts/databases/MigrateEarningHistory.js +0 -13
  260. package/services/migration-service/scripts/databases/MigrateEarningVersion.d.ts +0 -4
  261. package/services/migration-service/scripts/databases/MigrateEarningVersion.js +0 -13
  262. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.d.ts +0 -13
  263. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -139
  264. package/services/mint-campaign-service/campaigns/index.d.ts +0 -1
  265. package/services/mint-campaign-service/campaigns/index.js +0 -4
  266. package/services/mint-campaign-service/constants.d.ts +0 -1
  267. package/services/mint-campaign-service/constants.js +0 -4
  268. package/services/mint-campaign-service/index.d.ts +0 -7
  269. package/services/mint-campaign-service/index.js +0 -11
  270. package/services/storage-service/db-stores/YieldPoolStore.d.ts +0 -10
  271. package/services/storage-service/db-stores/YieldPoolStore.js +0 -28
  272. package/services/storage-service/db-stores/YieldPositionStore.d.ts +0 -9
  273. package/services/storage-service/db-stores/YieldPositionStore.js +0 -57
  274. package/types/campaigns/index.d.ts +0 -1
  275. package/types/campaigns/index.js +0 -4
  276. package/types/campaigns/unlock-dot.d.ts +0 -71
  277. package/types/campaigns/unlock-dot.js +0 -1
  278. package/types/ordinal.d.ts +0 -69
  279. package/types/ordinal.js +0 -1
  280. package/types/transaction.d.ts +0 -3
  281. package/types/transaction.js +0 -1
  282. package/types/yield/actions/index.d.ts +0 -2
  283. package/types/yield/actions/index.js +0 -5
  284. package/types/yield/actions/join/index.d.ts +0 -3
  285. package/types/yield/actions/join/index.js +0 -6
  286. package/types/yield/actions/join/step.d.ts +0 -95
  287. package/types/yield/actions/join/step.js +0 -46
  288. package/types/yield/actions/join/submit.d.ts +0 -57
  289. package/types/yield/actions/join/submit.js +0 -1
  290. package/types/yield/actions/join/validate.d.ts +0 -18
  291. package/types/yield/actions/join/validate.js +0 -10
  292. package/types/yield/actions/others.d.ts +0 -85
  293. package/types/yield/actions/others.js +0 -1
  294. package/types/yield/index.d.ts +0 -2
  295. package/types/yield/index.js +0 -5
  296. package/types/yield/info/account/index.d.ts +0 -4
  297. package/types/yield/info/account/index.js +0 -7
  298. package/types/yield/info/account/info.d.ts +0 -92
  299. package/types/yield/info/account/info.js +0 -1
  300. package/types/yield/info/account/reward.d.ts +0 -45
  301. package/types/yield/info/account/reward.js +0 -1
  302. package/types/yield/info/account/target.d.ts +0 -43
  303. package/types/yield/info/account/target.js +0 -27
  304. package/types/yield/info/account/unstake.d.ts +0 -31
  305. package/types/yield/info/account/unstake.js +0 -22
  306. package/types/yield/info/base.d.ts +0 -45
  307. package/types/yield/info/base.js +0 -36
  308. package/types/yield/info/chain/index.d.ts +0 -2
  309. package/types/yield/info/chain/index.js +0 -5
  310. package/types/yield/info/chain/info.d.ts +0 -251
  311. package/types/yield/info/chain/info.js +0 -1
  312. package/types/yield/info/chain/target.d.ts +0 -37
  313. package/types/yield/info/chain/target.js +0 -1
  314. package/types/yield/info/index.d.ts +0 -4
  315. package/types/yield/info/index.js +0 -7
  316. package/types/yield/info/pallet.d.ts +0 -143
  317. package/types/yield/info/pallet.js +0 -9
  318. package/utils/object.d.ts +0 -1
  319. package/utils/object.js +0 -6
@@ -18,12 +18,10 @@ var _campaignService = _interopRequireDefault(require("@subwallet/extension-base
18
18
  var _chainService = require("@subwallet/extension-base/services/chain-service");
19
19
  var _constants2 = require("@subwallet/extension-base/services/chain-service/constants");
20
20
  var _utils = require("@subwallet/extension-base/services/chain-service/utils");
21
- var _service = _interopRequireDefault(require("@subwallet/extension-base/services/earning-service/service"));
22
21
  var _eventService = require("@subwallet/extension-base/services/event-service");
23
22
  var _historyService = require("@subwallet/extension-base/services/history-service");
24
23
  var _keyringService = require("@subwallet/extension-base/services/keyring-service");
25
24
  var _migrationService = _interopRequireDefault(require("@subwallet/extension-base/services/migration-service"));
26
- var _mintCampaignService = _interopRequireDefault(require("@subwallet/extension-base/services/mint-campaign-service"));
27
25
  var _NotificationService = _interopRequireDefault(require("@subwallet/extension-base/services/notification-service/NotificationService"));
28
26
  var _priceService = require("@subwallet/extension-base/services/price-service");
29
27
  var _requestService = _interopRequireDefault(require("@subwallet/extension-base/services/request-service"));
@@ -83,10 +81,6 @@ class KoniState {
83
81
  ready: false,
84
82
  data: {}
85
83
  };
86
-
87
- // earning
88
- yieldPoolInfoSubject = new _rxjs.Subject();
89
- yieldPositionSubject = new _rxjs.Subject();
90
84
  lazyMap = {};
91
85
  // Handle the general status of the extension
92
86
  generalStatus = _types.ServiceStatus.INITIALIZING;
@@ -106,13 +100,11 @@ class KoniState {
106
100
  this.priceService = new _priceService.PriceService(this.dbService, this.eventService, this.chainService);
107
101
  this.balanceService = new _balanceService.BalanceService(this);
108
102
  this.historyService = new _historyService.HistoryService(this.dbService, this.chainService, this.eventService, this.keyringService, this.subscanService);
109
- this.mintCampaignService = new _mintCampaignService.default(this);
103
+ this.transactionService = new _transactionService.default(this.chainService, this.eventService, this.requestService, this.balanceService, this.historyService, this.notificationService, this.dbService);
110
104
  this.walletConnectService = new _walletConnectService.default(this, this.requestService);
111
105
  this.migrationService = new _migrationService.default(this, this.eventService);
112
106
  this.campaignService = new _campaignService.default(this);
113
107
  this.buyService = new _buyService.default(this);
114
- this.transactionService = new _transactionService.default(this);
115
- this.earningService = new _service.default(this);
116
108
  this.subscription = new _subscription.KoniSubscription(this, this.dbService);
117
109
  this.cron = new _cron.KoniCron(this, this.subscription, this.dbService);
118
110
  this.logger = (0, _util.logger)('State');
@@ -256,7 +248,6 @@ class KoniState {
256
248
  }
257
249
  async startSubscription() {
258
250
  await this.eventService.waitKeyringReady;
259
- await this.eventService.waitAssetReady;
260
251
  this.dbService.subscribeChainStakingMetadata([], data => {
261
252
  this.chainStakingMetadataSubject.next(data);
262
253
  });
@@ -267,8 +258,8 @@ class KoniState {
267
258
  this.keyringService.accountSubject.subscribe(accounts => {
268
259
  // TODO: improve this
269
260
  unsub && unsub.unsubscribe();
270
- unsub = this.dbService.subscribeYieldPosition(Object.keys(accounts), data => {
271
- this.yieldPositionSubject.next(data);
261
+ unsub = this.dbService.subscribeNominatorMetadata(Object.keys(accounts), data => {
262
+ this.stakingNominatorMetadataSubject.next(data);
272
263
  });
273
264
  });
274
265
  }
@@ -363,22 +354,6 @@ class KoniState {
363
354
  async getPooledStakingRecordsByAddress(addresses) {
364
355
  return this.dbService.getPooledStakings(addresses, this.activeChainSlugs);
365
356
  }
366
- async getPooledPositionByAddress(addresses) {
367
- return this.dbService.getYieldNominationPoolPosition(addresses, this.activeChainSlugs);
368
- }
369
- subscribeYieldPoolInfo() {
370
- return this.yieldPoolInfoSubject;
371
- }
372
- subscribeYieldPosition() {
373
- return this.yieldPositionSubject;
374
- }
375
- getYieldPoolInfo() {
376
- return this.dbService.getYieldPools();
377
- }
378
- getYieldPositionInfo() {
379
- const addresses = this.getDecodedAddresses(this.keyringService.currentAccount.address);
380
- return this.dbService.getYieldPositionByAddress(addresses);
381
- }
382
357
  subscribeMantaPayConfig() {
383
358
  return this.mantaPayConfigSubject;
384
359
  }
@@ -1790,28 +1765,5 @@ class KoniState {
1790
1765
  specVersion: parseInt((metadata === null || metadata === void 0 ? void 0 : metadata.specVersion) || '0')
1791
1766
  };
1792
1767
  }
1793
- updateYieldPoolInfo(data) {
1794
- this.dbService.updateYieldPoolStore(data).catch(e => this.logger.warn(e));
1795
- }
1796
- resetYieldPoolInfo(chains) {
1797
- this.dbService.subscribeYieldPoolInfo(chains, data => {
1798
- // TODO: no unsub
1799
- this.yieldPoolInfoSubject.next(data);
1800
- });
1801
- }
1802
- updateYieldPosition(data) {
1803
- this.dbService.updateYieldPosition(data).catch(e => this.logger.warn(e));
1804
- }
1805
- getYieldPoolStakingInfo(chain, poolType) {
1806
- return this.dbService.getYieldPoolStakingInfo(chain, poolType);
1807
- }
1808
- getCrowdloanContributions(_ref11) {
1809
- let {
1810
- address,
1811
- page,
1812
- relayChain
1813
- } = _ref11;
1814
- return this.subscanService.getCrowdloanContributions(relayChain, address, page);
1815
- }
1816
1768
  }
1817
1769
  exports.default = KoniState;
@@ -424,15 +424,32 @@ class KoniTabs {
424
424
  } = _ref13;
425
425
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
426
426
  const chainId = params[0].chainId;
427
+ const chainIdDec = parseInt(chainId, 16);
427
428
  const evmState = await this.getEvmState(url);
428
429
  if (evmState.chainId === chainId) {
429
430
  return null;
430
431
  }
431
- const [networkKey] = this.#koniState.findNetworkKeyByChainId(parseInt(chainId, 16));
432
+ const [networkKey] = this.#koniState.findNetworkKeyByChainId(chainIdDec);
432
433
  if (networkKey) {
433
434
  await this.#koniState.switchEvmNetworkByUrl((0, _utils2.stripUrl)(url), networkKey);
434
435
  } else {
435
- throw new _EvmProviderError.EvmProviderError(_KoniTypes.EvmProviderErrorType.INVALID_PARAMS, 'This network is currently not supported');
436
+ const onlineData = await (0, _utils2.getEVMChainInfo)(chainIdDec);
437
+ if (onlineData) {
438
+ const chainData = {
439
+ chainId: chainId,
440
+ rpcUrls: onlineData.rpc.filter(url => url.startsWith('https://')),
441
+ chainName: onlineData.name,
442
+ blockExplorerUrls: onlineData.explorers.map(explorer => explorer.url),
443
+ nativeCurrency: onlineData.nativeCurrency,
444
+ requestId: id
445
+ };
446
+ await this.addEvmChain(id, url, {
447
+ method: 'wallet_addEthereumChain',
448
+ params: [chainData]
449
+ });
450
+ } else {
451
+ throw new _EvmProviderError.EvmProviderError(_KoniTypes.EvmProviderErrorType.INVALID_PARAMS, 'This network is currently not supported');
452
+ }
436
453
  }
437
454
  return null;
438
455
  }
@@ -72,8 +72,7 @@ function handlers(_ref, port) {
72
72
  (0, _util.assert)(port, 'Port has been disconnected');
73
73
  port.postMessage({
74
74
  id,
75
- response,
76
- sender: 'BACKGROUND'
75
+ response
77
76
  });
78
77
  }).catch(error => {
79
78
  console.error(error);
@@ -85,8 +84,7 @@ function handlers(_ref, port) {
85
84
  error: error.message,
86
85
  errorCode: error.code,
87
86
  errorData: error.data,
88
- id,
89
- sender: 'BACKGROUND'
87
+ id
90
88
  });
91
89
  }
92
90
  });
@@ -7,6 +7,7 @@ exports.KoniSubscription = void 0;
7
7
  var _crowdloan = require("@subwallet/extension-base/koni/api/dotsama/crowdloan");
8
8
  var _staking = require("@subwallet/extension-base/koni/api/staking");
9
9
  var _bonding = require("@subwallet/extension-base/koni/api/staking/bonding");
10
+ var _paraChain = require("@subwallet/extension-base/koni/api/staking/paraChain");
10
11
  var _handlers = require("@subwallet/extension-base/koni/background/handlers");
11
12
  var _balance = require("@subwallet/extension-base/services/balance-service/helpers/subscribe/balance");
12
13
  var _utils = require("@subwallet/extension-base/services/chain-service/utils");
@@ -21,9 +22,7 @@ class KoniSubscription {
21
22
  crowdloan: undefined,
22
23
  balance: undefined,
23
24
  stakingOnChain: undefined,
24
- essentialChainStakingMetadata: undefined,
25
- yieldPoolStats: undefined,
26
- yieldPosition: undefined
25
+ essentialChainStakingMetadata: undefined
27
26
  };
28
27
  constructor(state, dbService) {
29
28
  this.dbService = dbService;
@@ -59,7 +58,6 @@ class KoniSubscription {
59
58
  var _this$state$keyringSe;
60
59
  await Promise.all([this.state.eventService.waitCryptoReady, this.state.eventService.waitKeyringReady, this.state.eventService.waitAssetReady]);
61
60
  const currentAddress = (_this$state$keyringSe = this.state.keyringService.currentAccount) === null || _this$state$keyringSe === void 0 ? void 0 : _this$state$keyringSe.address;
62
- this.subscribeYieldPools(this.state.getChainInfoMap(), this.state.getAssetRegistry(), this.state.getSubstrateApiMap(), this.state.getEvmApiMap(), currentAddress);
63
61
  if (currentAddress) {
64
62
  this.subscribeBalances(currentAddress, this.state.getChainInfoMap(), this.state.getChainStateMap(), this.state.getSubstrateApiMap(), this.state.getEvmApiMap());
65
63
  this.subscribeCrowdloans(currentAddress, this.state.getSubstrateApiMap());
@@ -73,9 +71,6 @@ class KoniSubscription {
73
71
  return;
74
72
  }
75
73
  const address = (_serviceInfo$currentA = serviceInfo.currentAccountInfo) === null || _serviceInfo$currentA === void 0 ? void 0 : _serviceInfo$currentA.address;
76
-
77
- // @ts-ignore
78
- this.subscribeYieldPools(serviceInfo.chainInfoMap, serviceInfo.assetRegistry, serviceInfo.chainApiMap.substrate, serviceInfo.chainApiMap.evm, address);
79
74
  if (!address) {
80
75
  return;
81
76
  }
@@ -111,72 +106,6 @@ class KoniSubscription {
111
106
  this.updateSubscription('crowdloan', this.initCrowdloanSubscription(addresses, substrateApiMap, onlyRunOnFirstTime));
112
107
  }).catch(console.error);
113
108
  }
114
- subscribeYieldPools(chainInfoMap, assetInfoMap, substrateApiMap, evmApiMap, address, onlyRunOnFirstTime) {
115
- this.updateSubscription('yieldPoolStats', this.initYieldPoolStatsSubscription(substrateApiMap, evmApiMap, onlyRunOnFirstTime));
116
- if (address) {
117
- const addresses = this.state.getDecodedAddresses(address);
118
- if (!addresses.length) {
119
- return;
120
- }
121
- this.updateSubscription('yieldPosition', this.initYieldPositionSubscription(addresses, substrateApiMap, evmApiMap, chainInfoMap, assetInfoMap));
122
- }
123
- }
124
- initYieldPositionSubscription(addresses, substrateApiMap, evmApiMap, chainInfoMap, assetInfoMap, onlyRunOnFirstTime) {
125
- let cancel = false;
126
- const updateYieldPoolStats = data => {
127
- this.state.updateYieldPosition(data);
128
- };
129
- let unsub = _util.noop;
130
- this.state.earningService.subscribePoolPositions(addresses, updateYieldPoolStats).then(rs => {
131
- if (cancel) {
132
- rs();
133
- } else {
134
- if (onlyRunOnFirstTime) {
135
- rs && rs();
136
- } else {
137
- unsub = rs;
138
- }
139
- }
140
- }).catch(console.error);
141
- return () => {
142
- cancel = true;
143
- unsub && unsub();
144
- };
145
- }
146
- initYieldPoolStatsSubscription(substrateApiMap, evmApiMap, onlyRunOnFirstTime) {
147
- let cancel = false;
148
- this.state.resetYieldPoolInfo(Object.keys(this.state.getChainInfoMap()));
149
- const updateYieldPoolStats = data => {
150
- this.state.updateYieldPoolInfo(data);
151
- };
152
-
153
- // const unsub = subscribeYieldPoolStats(substrateApiMap, evmApiMap, this.state.getActiveChainInfoMap(), this.state.getAssetRegistry(), updateYieldPoolStats);
154
- let unsub = _util.noop;
155
- this.state.earningService.subscribePoolsInfo(updateYieldPoolStats).then(rs => {
156
- if (cancel) {
157
- rs();
158
- } else {
159
- if (onlyRunOnFirstTime) {
160
- rs && rs();
161
- } else {
162
- unsub = rs;
163
- }
164
- }
165
- }).catch(console.error);
166
-
167
- //
168
- // if (onlyRunOnFirstTime) {
169
- // unsub && unsub();
170
- //
171
- // return;
172
- // }
173
-
174
- return () => {
175
- cancel = true;
176
- // unsub && unsub();
177
- unsub && unsub();
178
- };
179
- }
180
109
  subscribeStakingOnChain(address, substrateApiMap, onlyRunOnFirstTime) {
181
110
  this.state.resetStaking(address);
182
111
  const addresses = this.state.getDecodedAddresses(address);
@@ -252,11 +181,15 @@ class KoniSubscription {
252
181
  this.state.setCrowdloanItem(networkKey, rs);
253
182
  });
254
183
  if (onlyRunOnFirstTime) {
255
- subscriptionPromise.then(unsub => unsub === null || unsub === void 0 ? void 0 : unsub()).catch(this.logger.warn);
184
+ subscriptionPromise.then(unsub => {
185
+ unsub && unsub();
186
+ }).catch(this.logger.warn);
256
187
  return;
257
188
  }
258
189
  return () => {
259
- subscriptionPromise.then(unsub => unsub === null || unsub === void 0 ? void 0 : unsub()).catch(this.logger.warn);
190
+ subscriptionPromise.then(unsub => {
191
+ unsub && unsub();
192
+ }).catch(this.logger.warn);
260
193
  };
261
194
  }
262
195
  subscribeNft(address, substrateApiMap, evmApiMap, smartContractNfts, chainInfoMap) {
@@ -301,38 +234,47 @@ class KoniSubscription {
301
234
  if (!addresses.length) {
302
235
  return;
303
236
  }
237
+ const pooledStakingItems = await this.state.getPooledStakingRecordsByAddress(addresses);
238
+ const pooledAddresses = [];
239
+ pooledStakingItems.forEach(pooledItem => {
240
+ if (!pooledAddresses.includes(pooledItem.address)) {
241
+ pooledAddresses.push(pooledItem.address);
242
+ }
243
+ });
244
+ const chainInfoMap = this.state.getChainInfoMap();
245
+ const targetChainMap = {};
246
+ Object.entries(chainInfoMap).forEach(_ref2 => {
247
+ let [key, network] = _ref2;
248
+ const chainState = this.state.getChainStateByKey(key);
249
+ if ((0, _utils._isChainEnabled)(chainState) && (0, _utils._isChainSupportSubstrateStaking)(network)) {
250
+ targetChainMap[key] = network;
251
+ }
252
+ });
253
+ const activeNetworks = [];
254
+ Object.keys(targetChainMap).forEach(key => {
255
+ activeNetworks.push(key);
256
+ });
304
257
  const updateState = result => {
305
- this.state.earningService.updateEarningReward(result);
306
- };
307
- await Promise.all([this.state.earningService.getPoolReward(addresses, updateState)]);
308
- }
309
- async subscribeEarningRewardHistoryInterval(address) {
310
- const addresses = this.state.getDecodedAddresses(address);
311
- if (!addresses.length) {
312
- return;
313
- }
314
- const updateState = result => {
315
- this.state.earningService.updateEarningRewardHistory(result);
258
+ this.state.updateStakingReward(result);
316
259
  };
317
- await Promise.all([this.state.earningService.fetchPoolRewardHistory(addresses, updateState)]);
260
+ await Promise.all([(0, _staking.getPoolingStakingRewardData)(pooledAddresses, targetChainMap, this.state.getSubstrateApiMap(), updateState), (0, _paraChain.getAmplitudeUnclaimedStakingReward)(this.state.getSubstrateApiMap(), addresses, chainInfoMap, activeNetworks, updateState)]);
318
261
  }
319
262
  async reloadStaking() {
320
- // const currentAddress = this.state.keyringService.currentAccount?.address;
321
-
322
- // this.subscribeYieldPools(this.state.getSubstrateApiMap());
323
-
263
+ var _this$state$keyringSe2;
264
+ const currentAddress = (_this$state$keyringSe2 = this.state.keyringService.currentAccount) === null || _this$state$keyringSe2 === void 0 ? void 0 : _this$state$keyringSe2.address;
265
+ this.subscribeStakingOnChain(currentAddress, this.state.getSubstrateApiMap());
324
266
  await (0, _utils2.waitTimeout)(1800);
325
267
  }
326
268
  async reloadBalance() {
327
- var _this$state$keyringSe2;
328
- const currentAddress = (_this$state$keyringSe2 = this.state.keyringService.currentAccount) === null || _this$state$keyringSe2 === void 0 ? void 0 : _this$state$keyringSe2.address;
269
+ var _this$state$keyringSe3;
270
+ const currentAddress = (_this$state$keyringSe3 = this.state.keyringService.currentAccount) === null || _this$state$keyringSe3 === void 0 ? void 0 : _this$state$keyringSe3.address;
329
271
  await this.state.handleResetBalance(currentAddress, true);
330
272
  this.subscribeBalances(currentAddress, this.state.getChainInfoMap(), this.state.getChainStateMap(), this.state.getSubstrateApiMap(), this.state.getEvmApiMap());
331
273
  await (0, _utils2.waitTimeout)(1800);
332
274
  }
333
275
  async reloadCrowdloan() {
334
- var _this$state$keyringSe3;
335
- const currentAddress = (_this$state$keyringSe3 = this.state.keyringService.currentAccount) === null || _this$state$keyringSe3 === void 0 ? void 0 : _this$state$keyringSe3.address;
276
+ var _this$state$keyringSe4;
277
+ const currentAddress = (_this$state$keyringSe4 = this.state.keyringService.currentAccount) === null || _this$state$keyringSe4 === void 0 ? void 0 : _this$state$keyringSe4.address;
336
278
  this.subscribeCrowdloans(currentAddress, this.state.getSubstrateApiMap());
337
279
  await (0, _utils2.waitTimeout)(1800);
338
280
  }
@@ -13,6 +13,6 @@ const packageInfo = {
13
13
  name: '@subwallet/extension-base',
14
14
  path: typeof __dirname === 'string' ? __dirname : 'auto',
15
15
  type: 'cjs',
16
- version: '1.1.31-1'
16
+ version: '1.1.33-0'
17
17
  };
18
18
  exports.packageInfo = packageInfo;
@@ -11,21 +11,18 @@ var _helpers = require("./helpers");
11
11
  // Copyright 2019-2022 @subwallet/extension-base authors & contributors
12
12
  // SPDX-License-Identifier: Apache-2.0
13
13
 
14
- const targetEnvs = ['extension', 'mobile'];
15
14
  class CampaignService {
16
15
  #state;
17
16
  constructor(state) {
18
17
  this.#state = state;
19
18
  }
20
19
  init() {
21
- if (targetEnvs.includes(_utils.TARGET_ENV)) {
22
- this.fetchCampaign().catch(e => {
23
- console.error('Error on fetch campaigns', e);
24
- });
25
- this.runCampaign().catch(e => {
26
- console.error('Error on run campaigns', e);
27
- });
28
- }
20
+ this.fetchCampaign().catch(e => {
21
+ console.error('Error on fetch campaigns', e);
22
+ });
23
+ this.runCampaign().catch(e => {
24
+ console.error('Error on run campaigns', e);
25
+ });
29
26
  }
30
27
  async fetchCampaign() {
31
28
  const respData = await (0, _fetchStaticData.fetchStaticData)('marketing-campaigns');
@@ -53,6 +50,7 @@ class CampaignService {
53
50
  endTime,
54
51
  startTime,
55
52
  isDone: false,
53
+ isArchive: false,
56
54
  campaignId,
57
55
  type: _KoniTypes.CampaignDataType.BANNER,
58
56
  buttons,
@@ -73,6 +71,7 @@ class CampaignService {
73
71
  endTime,
74
72
  startTime,
75
73
  isDone: false,
74
+ isArchive: false,
76
75
  campaignId,
77
76
  type: _KoniTypes.CampaignDataType.NOTIFICATION,
78
77
  buttons,
@@ -85,6 +84,23 @@ class CampaignService {
85
84
  const exists = await this.#state.dbService.getCampaign(campaign.slug);
86
85
  if (!exists) {
87
86
  await this.#state.dbService.upsertCampaign(campaign);
87
+ } else {
88
+ const data = {
89
+ ...campaign,
90
+ isDone: exists.isDone
91
+ };
92
+ await this.#state.dbService.upsertCampaign(data);
93
+ }
94
+ }
95
+ const allCampaign = await this.#state.dbService.getAllCampaign();
96
+ for (const stored of allCampaign) {
97
+ const exists = campaigns.find(campaign => campaign.slug === stored.slug);
98
+ if (!exists) {
99
+ const data = {
100
+ ...stored,
101
+ isArchive: true
102
+ };
103
+ await this.#state.dbService.upsertCampaign(data);
88
104
  }
89
105
  }
90
106
  this.#state.eventService.emit('campaign.ready', true);
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports._ZK_ASSET_PREFIX = exports._XCM_TYPE = exports._XCM_CHAIN_GROUP = exports._TRANSFER_NOT_SUPPORTED_CHAINS = exports._TRANSFER_CHAIN_GROUP = exports._SUBSTRATE_DEFAULT_INFLATION_PARAMS = exports._STAKING_ERA_LENGTH_MAP = exports._PURE_EVM_CHAINS = exports._PREDEFINED_SINGLE_MODES = exports._PARACHAIN_INFLATION_DISTRIBUTION = exports._NFT_CHAIN_GROUP = exports._MULTI_CHAIN_ASSET_SRC = exports._MANTA_ZK_CHAIN_GROUP = exports._KNOWN_CHAIN_INFLATION_PARAMS = exports._EXPECTED_BLOCK_TIME = exports._DEFAULT_MANTA_ZK_CHAIN = exports._DEFAULT_ACTIVE_CHAINS = exports._CHAIN_LOGO_MAP_SRC = exports._CHAIN_INFO_SRC = exports._CHAIN_ASSET_SRC = exports._BALANCE_TOKEN_GROUP = exports._BALANCE_PARSING_CHAIN_GROUP = exports._BALANCE_CHAIN_GROUP = exports._ASSET_REF_SRC = exports._ASSET_LOGO_MAP_SRC = exports._API_OPTIONS_CHAIN_GROUP = exports.EVM_REFORMAT_DECIMALS = exports.EVM_PASS_CONNECT_STATUS = exports.API_MAX_RETRY = exports.API_CONNECT_TIMEOUT = exports.API_AUTO_CONNECT_MS = void 0;
6
+ exports._ZK_ASSET_PREFIX = exports._XCM_TYPE = exports._XCM_CHAIN_GROUP = exports._TRANSFER_NOT_SUPPORTED_CHAINS = exports._TRANSFER_CHAIN_GROUP = exports._SUBSTRATE_DEFAULT_INFLATION_PARAMS = exports._STAKING_ERA_LENGTH_MAP = exports._STAKING_CHAIN_GROUP = exports._PURE_EVM_CHAINS = exports._PREDEFINED_SINGLE_MODES = exports._PARACHAIN_INFLATION_DISTRIBUTION = exports._NFT_CHAIN_GROUP = exports._MULTI_CHAIN_ASSET_SRC = exports._MANTA_ZK_CHAIN_GROUP = exports._KNOWN_CHAIN_INFLATION_PARAMS = exports._EXPECTED_BLOCK_TIME = exports._DEFAULT_MANTA_ZK_CHAIN = exports._DEFAULT_ACTIVE_CHAINS = exports._CHAIN_LOGO_MAP_SRC = exports._CHAIN_INFO_SRC = exports._CHAIN_ASSET_SRC = exports._BALANCE_TOKEN_GROUP = exports._BALANCE_PARSING_CHAIN_GROUP = exports._BALANCE_CHAIN_GROUP = exports._ASSET_REF_SRC = exports._ASSET_LOGO_MAP_SRC = exports._API_OPTIONS_CHAIN_GROUP = exports.EVM_REFORMAT_DECIMALS = exports.EVM_PASS_CONNECT_STATUS = exports.API_MAX_RETRY = exports.API_CONNECT_TIMEOUT = exports.API_AUTO_CONNECT_MS = void 0;
7
7
  var _chainList = require("@subwallet/chain-list");
8
8
  var _types = require("@subwallet/chain-list/types");
9
9
  var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
@@ -40,7 +40,7 @@ const _BALANCE_CHAIN_GROUP = {
40
40
  genshiro: ['genshiro_testnet', 'genshiro'],
41
41
  equilibrium_parachain: ['equilibrium_parachain'],
42
42
  bifrost: ['bifrost', 'acala', 'karura', 'acala_testnet', 'pioneer', 'bitcountry', 'bifrost_dot', 'hydradx_main', 'pendulum', 'amplitude'],
43
- statemine: ['statemine', 'astar', 'shiden', 'statemint', 'moonbeam', 'moonbase', 'moonriver', 'crabParachain', 'darwinia2', 'parallel', 'calamari'],
43
+ statemine: ['statemine', 'astar', 'shiden', 'statemint', 'moonbeam', 'moonbase', 'moonriver', 'crabParachain', 'darwinia2', 'parallel', 'calamari', 'manta_network'],
44
44
  kusama: ['kusama', 'kintsugi', 'kintsugi_test', 'interlay', 'acala', 'statemint', 'karura', 'bifrost'],
45
45
  // perhaps there are some runtime updates
46
46
  centrifuge: ['centrifuge']
@@ -65,6 +65,21 @@ const _NFT_CHAIN_GROUP = {
65
65
 
66
66
  // Staking--------------------------------------------------------------------------------------------------------------
67
67
  exports._NFT_CHAIN_GROUP = _NFT_CHAIN_GROUP;
68
+ const _STAKING_CHAIN_GROUP = {
69
+ relay: ['polkadot', 'kusama', 'aleph', 'polkadex', 'ternoa', 'ternoa_alphanet', 'alephTest', 'polkadexTest', 'westend', 'kate', 'edgeware', 'creditcoin', 'vara_network', 'goldberg_testnet'],
70
+ para: ['moonbeam', 'moonriver', 'moonbase', 'turing', 'turingStaging', 'bifrost', 'bifrost_testnet', 'calamari_test', 'calamari', 'manta_network'],
71
+ astar: ['astar', 'shiden', 'shibuya'],
72
+ amplitude: ['amplitude', 'amplitude_test', 'kilt', 'kilt_peregrine', 'pendulum', 'krest_network'],
73
+ // amplitude and kilt only share some common logic
74
+ krest_network: ['krest_network'],
75
+ kilt: ['kilt', 'kilt_peregrine'],
76
+ nominationPool: ['polkadot', 'kusama', 'westend', 'alephTest', 'aleph', 'kate', 'vara_network', 'goldberg_testnet'],
77
+ bifrost: ['bifrost', 'bifrost_testnet'],
78
+ aleph: ['aleph', 'alephTest'],
79
+ // A0 has distinct tokenomics
80
+ ternoa: ['ternoa', 'ternoa_alphanet']
81
+ };
82
+ exports._STAKING_CHAIN_GROUP = _STAKING_CHAIN_GROUP;
68
83
  const _STAKING_ERA_LENGTH_MAP = {
69
84
  // in hours
70
85
  alephTest: 24,
@@ -96,7 +111,9 @@ const _STAKING_ERA_LENGTH_MAP = {
96
111
  kate: 6,
97
112
  creditcoin: 24,
98
113
  vara_network: 12,
99
- goldberg_testnet: 24
114
+ goldberg_testnet: 24,
115
+ manta_network: 6,
116
+ krest_network: 4
100
117
  };
101
118
  exports._STAKING_ERA_LENGTH_MAP = _STAKING_ERA_LENGTH_MAP;
102
119
  const _EXPECTED_BLOCK_TIME = {
@@ -251,7 +268,7 @@ const _XCM_TYPE = {
251
268
  PR: `${_types._SubstrateChainType.PARACHAIN}-${_types._SubstrateChainType.RELAYCHAIN}` // UMP
252
269
  };
253
270
  exports._XCM_TYPE = _XCM_TYPE;
254
- const _DEFAULT_ACTIVE_CHAINS = [..._chainList._DEFAULT_CHAINS, 'vara_network', 'bifrost_dot', 'parallel', 'acala', 'interlay'];
271
+ const _DEFAULT_ACTIVE_CHAINS = [..._chainList._DEFAULT_CHAINS, 'vara_network'];
255
272
  exports._DEFAULT_ACTIVE_CHAINS = _DEFAULT_ACTIVE_CHAINS;
256
273
  const EVM_PASS_CONNECT_STATUS = {
257
274
  arbitrum_one: ['*']
@@ -226,9 +226,8 @@ class ChainService {
226
226
  getActiveChainInfos() {
227
227
  const result = {};
228
228
  Object.values(this.getChainStateMap()).forEach(chainState => {
229
- const chainInfo = this.getChainInfoByKey(chainState.slug);
230
- if (chainState.active && chainInfo && chainInfo.chainStatus === _types._ChainStatus.ACTIVE) {
231
- result[chainState.slug] = chainInfo;
229
+ if (chainState.active) {
230
+ result[chainState.slug] = this.getChainInfoByKey(chainState.slug);
232
231
  }
233
232
  });
234
233
  return result;
@@ -60,7 +60,6 @@ exports._isSmartContractToken = _isSmartContractToken;
60
60
  exports._isSubstrateChain = _isSubstrateChain;
61
61
  exports._isSubstrateParaChain = _isSubstrateParaChain;
62
62
  exports._isSubstrateRelayChain = _isSubstrateRelayChain;
63
- exports._isSupportOrdinal = void 0;
64
63
  exports._isTokenEvmSmartContract = _isTokenEvmSmartContract;
65
64
  exports._isTokenTransferredByEvm = _isTokenTransferredByEvm;
66
65
  exports._isTokenWasmSmartContract = _isTokenWasmSmartContract;
@@ -162,7 +161,7 @@ function _getTokenMinAmount(tokenInfo) {
162
161
  return tokenInfo.minAmount || '0';
163
162
  }
164
163
  function _isChainEvmCompatible(chainInfo) {
165
- return !!chainInfo.evmInfo;
164
+ return chainInfo.evmInfo !== undefined && chainInfo.evmInfo !== null;
166
165
  }
167
166
  function _isNativeToken(tokenInfo) {
168
167
  return tokenInfo.assetType === _types._AssetType.NATIVE;
@@ -217,11 +216,6 @@ function _isChainSupportWasmNft(chainInfo) {
217
216
  var _chainInfo$substrateI8, _chainInfo$substrateI9;
218
217
  return ((_chainInfo$substrateI8 = chainInfo.substrateInfo) === null || _chainInfo$substrateI8 === void 0 ? void 0 : (_chainInfo$substrateI9 = _chainInfo$substrateI8.supportSmartContract) === null || _chainInfo$substrateI9 === void 0 ? void 0 : _chainInfo$substrateI9.includes(_types._AssetType.PSP34)) || false;
219
218
  }
220
- const _isSupportOrdinal = chain => {
221
- const chains = ['polkadot', 'astar', 'bifrost_dot', 'moonbeam'];
222
- return chains.includes(chain);
223
- };
224
- exports._isSupportOrdinal = _isSupportOrdinal;
225
219
  function _getNftTypesSupportedByChain(chainInfo) {
226
220
  const result = [];
227
221
  if (chainInfo.substrateInfo && chainInfo.substrateInfo.supportSmartContract) {
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.EventService = void 0;
8
- var _utils = require("@subwallet/extension-base/utils");
9
8
  var _eventemitter = _interopRequireDefault(require("eventemitter3"));
10
9
  // Copyright 2019-2022 @subwallet/extension-base
11
10
  // SPDX-License-Identifier: Apache-2.0
@@ -25,8 +24,6 @@ class EventService extends _eventemitter.default {
25
24
  this.waitDatabaseReady = this.generateWaitPromise('database.ready');
26
25
  this.waitKeyringReady = this.generateWaitPromise('keyring.ready');
27
26
  this.waitAccountReady = this.generateWaitPromise('account.ready');
28
- // TODO: Need to merge logic on web-runner file
29
- this.waitInjectReady = _utils.TARGET_ENV === 'webapp' ? this.generateWaitPromise('inject.ready') : Promise.resolve(true);
30
27
  this.waitChainReady = this.generateWaitPromise('chain.ready');
31
28
  this.waitAssetReady = this.generateWaitPromise('asset.ready');
32
29
  this.waitMigrateReady = this.generateWaitPromise('migration.done');
@@ -37,7 +34,6 @@ class EventService extends _eventemitter.default {
37
34
  generateWaitPromise(eventType) {
38
35
  return new Promise(resolve => {
39
36
  this.once(eventType, isReady => {
40
- console.log('===LOG generateWaitPromise eventType', eventType);
41
37
  resolve(isReady);
42
38
  });
43
39
  });
@@ -173,14 +173,18 @@ class HistoryService {
173
173
 
174
174
  // Insert history with check override origin 'app'
175
175
  async addHistoryItems(historyItems) {
176
- // Prevent override record with original is 'app'
177
- const appRecords = this.historySubject.value.filter(item => item.origin === 'app');
178
- const excludeKeys = appRecords.map(item => {
179
- return `${item.chain}-${item.extrinsicHash}`;
180
- });
181
- const updateRecords = historyItems.filter(item => {
182
- const key = `${item.chain}-${item.extrinsicHash}`;
183
- return item.origin === 'app' || !excludeKeys.includes(key);
176
+ const updateRecords = [];
177
+ const appItems = this.historySubject.value.filter(i => i.origin === 'app');
178
+ historyItems.forEach(item => {
179
+ const needUpdateItem = appItems.find(item_ => item_.extrinsicHash === item.extrinsicHash && item.chain === item_.chain && item.address === item_.address);
180
+ if (needUpdateItem) {
181
+ updateRecords.push({
182
+ ...needUpdateItem,
183
+ status: item.status
184
+ });
185
+ return;
186
+ }
187
+ updateRecords.push(item);
184
188
  });
185
189
  await this.dbService.upsertHistory(updateRecords);
186
190
  this.historySubject.next(await this.dbService.getHistories());
@@ -28,7 +28,6 @@ class KeyringService {
28
28
  });
29
29
  constructor(eventService) {
30
30
  this.eventService = eventService;
31
- this.injected = false;
32
31
  this.eventService.waitCryptoReady.then(() => {
33
32
  this.currentAccountStore.get('CurrentAccountInfo', rs => {
34
33
  rs && this.currentAccountSubject.next(rs);
@@ -141,19 +140,8 @@ class KeyringService {
141
140
  currentGenesisHash: null
142
141
  });
143
142
  }
144
- if (!this.injected) {
145
- this.eventService.emit('inject.ready', true);
146
- this.injected = true;
147
- }
148
143
  }
149
- removeInjectAccounts(_addresses) {
150
- const addresses = _addresses.map(address => {
151
- try {
152
- return _uiKeyring.keyring.getPair(address).address;
153
- } catch (error) {
154
- return address;
155
- }
156
- });
144
+ removeInjectAccounts(addresses) {
157
145
  const currentAddress = this.currentAccountSubject.value.address;
158
146
  const afterAccounts = Object.keys(this.accounts).filter(address => addresses.indexOf(address) < 0);
159
147
  if (afterAccounts.length === 1) {
@@ -178,7 +166,7 @@ class KeyringService {
178
166
  await new Promise(resolve => {
179
167
  setTimeout(() => {
180
168
  resolve();
181
- }, 1500);
169
+ }, 500);
182
170
  });
183
171
  this.updateKeyringState();
184
172
  this.currentAccountSubject.next({
@@ -18,7 +18,7 @@ class MigrateLedgerAccount extends _Base.default {
18
18
  const store = new _stores.AccountsStore();
19
19
  const update = (key, value) => {
20
20
  var _value$meta;
21
- if (key.startsWith('account:') && value !== null && value !== void 0 && value.meta && (0, _util.isString)((_value$meta = value.meta) === null || _value$meta === void 0 ? void 0 : _value$meta.originGenesisHash)) {
21
+ if (key.startsWith('account:') && value.meta && (0, _util.isString)((_value$meta = value.meta) === null || _value$meta === void 0 ? void 0 : _value$meta.originGenesisHash)) {
22
22
  const newValue = {
23
23
  ...value
24
24
  };
@@ -19,7 +19,7 @@ class MigrateTransactionHistory extends _Base.default {
19
19
  const chainInfoMap = state.getChainInfoMap();
20
20
  const assetList = Object.values(state.getAssetRegistry());
21
21
  try {
22
- const db = new _dexie.default('SubWalletDB_v2');
22
+ const db = new _dexie.default('SubWalletDB');
23
23
  const dexieDB = await db.open();
24
24
  const transactionTable = dexieDB.table('transactions');
25
25
  const oldTransactionData = await transactionTable.toArray();