@subwallet/extension-base 1.1.33-beta.1 → 1.1.34-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 (316) hide show
  1. package/background/KoniTypes.d.ts +69 -120
  2. package/background/KoniTypes.js +13 -22
  3. package/background/errors/TransactionError.js +0 -9
  4. package/cjs/background/KoniTypes.js +16 -23
  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 +16 -19
  11. package/cjs/koni/api/staking/bonding/astar.js +10 -11
  12. package/cjs/koni/api/staking/bonding/index.js +1 -4
  13. package/cjs/koni/api/staking/bonding/paraChain.js +23 -25
  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 +17 -10
  18. package/cjs/koni/api/staking/relayChain.js +2 -3
  19. package/cjs/koni/background/cron.js +21 -3
  20. package/cjs/koni/background/handlers/Extension.js +69 -368
  21. package/cjs/koni/background/handlers/State.js +12 -18
  22. package/cjs/koni/background/handlers/index.js +2 -4
  23. package/cjs/koni/background/subscription.js +104 -7
  24. package/cjs/packageInfo.js +1 -1
  25. package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +1 -3
  26. package/cjs/services/campaign-service/index.js +6 -9
  27. package/cjs/services/chain-service/constants.js +17 -2
  28. package/cjs/services/chain-service/index.js +3 -25
  29. package/cjs/services/chain-service/utils.js +1 -7
  30. package/cjs/services/event-service/index.js +0 -5
  31. package/cjs/services/keyring-service/index.js +2 -14
  32. package/cjs/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
  33. package/cjs/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
  34. package/cjs/services/migration-service/scripts/index.js +1 -6
  35. package/cjs/services/notification-service/NotificationService.js +1 -1
  36. package/cjs/services/storage-service/DatabaseService.js +1 -92
  37. package/cjs/services/storage-service/databases/index.js +0 -7
  38. package/cjs/services/storage-service/db-stores/NominatorMetadata.js +3 -3
  39. package/cjs/services/subscan-service/index.js +0 -16
  40. package/cjs/services/transaction-service/event-parser/index.js +0 -58
  41. package/cjs/services/transaction-service/helpers/index.js +1 -3
  42. package/cjs/services/transaction-service/index.js +75 -252
  43. package/cjs/services/transaction-service/utils.js +0 -1
  44. package/cjs/types/index.js +0 -44
  45. package/cjs/utils/fetchStaticData.js +1 -2
  46. package/cjs/utils/index.js +1 -89
  47. package/cjs/utils/number.js +2 -6
  48. package/constants/index.d.ts +1 -6
  49. package/constants/index.js +1 -6
  50. package/koni/api/nft/config.js +23 -33
  51. package/koni/api/nft/index.js +1 -15
  52. package/koni/api/nft/nft.js +23 -2
  53. package/koni/api/staking/bonding/amplitude.js +10 -13
  54. package/koni/api/staking/bonding/astar.js +8 -9
  55. package/koni/api/staking/bonding/index.d.ts +1 -1
  56. package/koni/api/staking/bonding/index.js +1 -5
  57. package/koni/api/staking/bonding/paraChain.js +10 -12
  58. package/koni/api/staking/bonding/relayChain.d.ts +2 -2
  59. package/koni/api/staking/bonding/relayChain.js +30 -33
  60. package/koni/api/staking/bonding/utils.d.ts +38 -15
  61. package/koni/api/staking/bonding/utils.js +69 -85
  62. package/koni/api/staking/index.js +1 -2
  63. package/koni/api/staking/paraChain.js +18 -11
  64. package/koni/api/staking/relayChain.js +3 -4
  65. package/koni/background/cron.d.ts +4 -0
  66. package/koni/background/cron.js +22 -4
  67. package/koni/background/handlers/Extension.d.ts +1 -17
  68. package/koni/background/handlers/Extension.js +30 -327
  69. package/koni/background/handlers/State.d.ts +1 -6
  70. package/koni/background/handlers/State.js +12 -17
  71. package/koni/background/handlers/index.js +2 -4
  72. package/koni/background/subscription.d.ts +6 -1
  73. package/koni/background/subscription.js +104 -8
  74. package/package.json +8 -331
  75. package/packageInfo.js +1 -1
  76. package/services/balance-service/helpers/subscribe/substrate/index.js +2 -4
  77. package/services/campaign-service/index.js +6 -9
  78. package/services/chain-service/constants.d.ts +13 -1
  79. package/services/chain-service/constants.js +15 -1
  80. package/services/chain-service/index.d.ts +0 -2
  81. package/services/chain-service/index.js +3 -25
  82. package/services/chain-service/utils.d.ts +0 -1
  83. package/services/chain-service/utils.js +1 -5
  84. package/services/event-service/index.d.ts +0 -2
  85. package/services/event-service/index.js +0 -5
  86. package/services/event-service/types.d.ts +0 -9
  87. package/services/keyring-service/index.d.ts +1 -2
  88. package/services/keyring-service/index.js +2 -14
  89. package/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
  90. package/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
  91. package/services/migration-service/scripts/index.js +1 -6
  92. package/services/notification-service/NotificationService.js +1 -1
  93. package/services/storage-service/DatabaseService.d.ts +3 -30
  94. package/services/storage-service/DatabaseService.js +1 -91
  95. package/services/storage-service/databases/index.d.ts +2 -8
  96. package/services/storage-service/databases/index.js +0 -7
  97. package/services/storage-service/db-stores/NominatorMetadata.js +3 -3
  98. package/services/subscan-service/index.d.ts +2 -3
  99. package/services/subscan-service/index.js +0 -15
  100. package/services/subscan-service/types.d.ts +0 -20
  101. package/services/transaction-service/event-parser/index.d.ts +1 -3
  102. package/services/transaction-service/event-parser/index.js +1 -57
  103. package/services/transaction-service/helpers/index.js +1 -3
  104. package/services/transaction-service/index.d.ts +13 -6
  105. package/services/transaction-service/index.js +73 -250
  106. package/services/transaction-service/types.d.ts +0 -2
  107. package/services/transaction-service/utils.js +0 -1
  108. package/types/index.d.ts +0 -5
  109. package/types/index.js +1 -5
  110. package/utils/fetchStaticData.js +1 -2
  111. package/utils/index.d.ts +0 -5
  112. package/utils/index.js +0 -52
  113. package/utils/number.d.ts +1 -2
  114. package/utils/number.js +1 -2
  115. package/cjs/koni/api/dotsama/balance.js +0 -464
  116. package/cjs/koni/api/nft/ordinal_nft/constants.js +0 -21
  117. package/cjs/koni/api/nft/ordinal_nft/index.js +0 -121
  118. package/cjs/koni/api/nft/ordinal_nft/utils.js +0 -41
  119. package/cjs/koni/api/yield/helper/utils.js +0 -49
  120. package/cjs/services/earning-service/constants/chains.js +0 -30
  121. package/cjs/services/earning-service/constants/index.js +0 -27
  122. package/cjs/services/earning-service/constants/step.js +0 -18
  123. package/cjs/services/earning-service/handlers/base.js +0 -262
  124. package/cjs/services/earning-service/handlers/index.js +0 -60
  125. package/cjs/services/earning-service/handlers/lending/base.js +0 -81
  126. package/cjs/services/earning-service/handlers/lending/index.js +0 -13
  127. package/cjs/services/earning-service/handlers/lending/interlay.js +0 -192
  128. package/cjs/services/earning-service/handlers/liquid-staking/acala.js +0 -240
  129. package/cjs/services/earning-service/handlers/liquid-staking/base.js +0 -98
  130. package/cjs/services/earning-service/handlers/liquid-staking/bifrost-manta.js +0 -140
  131. package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +0 -299
  132. package/cjs/services/earning-service/handlers/liquid-staking/index.js +0 -41
  133. package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +0 -227
  134. package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +0 -404
  135. package/cjs/services/earning-service/handlers/native-staking/amplitude.js +0 -434
  136. package/cjs/services/earning-service/handlers/native-staking/astar.js +0 -466
  137. package/cjs/services/earning-service/handlers/native-staking/base-para.js +0 -146
  138. package/cjs/services/earning-service/handlers/native-staking/base.js +0 -161
  139. package/cjs/services/earning-service/handlers/native-staking/index.js +0 -34
  140. package/cjs/services/earning-service/handlers/native-staking/para-chain.js +0 -390
  141. package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +0 -567
  142. package/cjs/services/earning-service/handlers/nomination-pool/index.js +0 -566
  143. package/cjs/services/earning-service/handlers/special.js +0 -497
  144. package/cjs/services/earning-service/service.js +0 -741
  145. package/cjs/services/earning-service/utils/index.js +0 -128
  146. package/cjs/services/migration-service/scripts/DeleteEarningData.js +0 -21
  147. package/cjs/services/migration-service/scripts/EnableEarningChains.js +0 -21
  148. package/cjs/services/migration-service/scripts/MigrateEthProvider.js +0 -17
  149. package/cjs/services/migration-service/scripts/MigratePioneerProvider.js +0 -17
  150. package/cjs/services/migration-service/scripts/MigrateProvider.js +0 -29
  151. package/cjs/services/migration-service/scripts/databases/MigrateEarningHistory.js +0 -21
  152. package/cjs/services/migration-service/scripts/databases/MigrateEarningVersion.js +0 -21
  153. package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -149
  154. package/cjs/services/mint-campaign-service/campaigns/index.js +0 -13
  155. package/cjs/services/mint-campaign-service/constants.js +0 -11
  156. package/cjs/services/mint-campaign-service/index.js +0 -18
  157. package/cjs/services/storage-service/db-stores/AssetRef.js +0 -24
  158. package/cjs/services/storage-service/db-stores/YieldPoolStore.js +0 -36
  159. package/cjs/services/storage-service/db-stores/YieldPositionStore.js +0 -71
  160. package/cjs/services/storage-service/index.js +0 -241
  161. package/cjs/types/campaigns/index.js +0 -16
  162. package/cjs/types/campaigns/unlock-dot.js +0 -1
  163. package/cjs/types/ordinal.js +0 -1
  164. package/cjs/types/transaction.js +0 -1
  165. package/cjs/types/yield/actions/index.js +0 -27
  166. package/cjs/types/yield/actions/join/index.js +0 -38
  167. package/cjs/types/yield/actions/join/step.js +0 -48
  168. package/cjs/types/yield/actions/join/submit.js +0 -1
  169. package/cjs/types/yield/actions/join/validate.js +0 -16
  170. package/cjs/types/yield/actions/others.js +0 -1
  171. package/cjs/types/yield/index.js +0 -27
  172. package/cjs/types/yield/info/account/index.js +0 -49
  173. package/cjs/types/yield/info/account/info.js +0 -1
  174. package/cjs/types/yield/info/account/reward.js +0 -1
  175. package/cjs/types/yield/info/account/target.js +0 -32
  176. package/cjs/types/yield/info/account/unstake.js +0 -27
  177. package/cjs/types/yield/info/base.js +0 -41
  178. package/cjs/types/yield/info/chain/index.js +0 -27
  179. package/cjs/types/yield/info/chain/info.js +0 -1
  180. package/cjs/types/yield/info/chain/target.js +0 -1
  181. package/cjs/types/yield/info/index.js +0 -49
  182. package/cjs/types/yield/info/pallet.js +0 -15
  183. package/cjs/types.js +0 -1
  184. package/cjs/utils/address.js +0 -34
  185. package/cjs/utils/keyring.js +0 -57
  186. package/cjs/utils/object.js +0 -12
  187. package/koni/api/nft/ordinal_nft/constants.d.ts +0 -9
  188. package/koni/api/nft/ordinal_nft/constants.js +0 -12
  189. package/koni/api/nft/ordinal_nft/index.d.ts +0 -8
  190. package/koni/api/nft/ordinal_nft/index.js +0 -114
  191. package/koni/api/nft/ordinal_nft/utils.d.ts +0 -2
  192. package/koni/api/nft/ordinal_nft/utils.js +0 -33
  193. package/koni/api/yield/helper/utils.d.ts +0 -10
  194. package/koni/api/yield/helper/utils.js +0 -34
  195. package/services/earning-service/constants/abis/compound_finance_v2_abi.json +0 -1235
  196. package/services/earning-service/constants/abis/st_liquid_token_abi.json +0 -1355
  197. package/services/earning-service/constants/chains.d.ts +0 -15
  198. package/services/earning-service/constants/chains.js +0 -22
  199. package/services/earning-service/constants/index.d.ts +0 -2
  200. package/services/earning-service/constants/index.js +0 -5
  201. package/services/earning-service/constants/step.d.ts +0 -3
  202. package/services/earning-service/constants/step.js +0 -10
  203. package/services/earning-service/handlers/base.d.ts +0 -113
  204. package/services/earning-service/handlers/base.js +0 -256
  205. package/services/earning-service/handlers/index.d.ts +0 -5
  206. package/services/earning-service/handlers/index.js +0 -8
  207. package/services/earning-service/handlers/lending/base.d.ts +0 -8
  208. package/services/earning-service/handlers/lending/base.js +0 -73
  209. package/services/earning-service/handlers/lending/index.d.ts +0 -1
  210. package/services/earning-service/handlers/lending/index.js +0 -4
  211. package/services/earning-service/handlers/lending/interlay.d.ts +0 -24
  212. package/services/earning-service/handlers/lending/interlay.js +0 -184
  213. package/services/earning-service/handlers/liquid-staking/acala.d.ts +0 -27
  214. package/services/earning-service/handlers/liquid-staking/acala.js +0 -232
  215. package/services/earning-service/handlers/liquid-staking/base.d.ts +0 -11
  216. package/services/earning-service/handlers/liquid-staking/base.js +0 -90
  217. package/services/earning-service/handlers/liquid-staking/bifrost-manta.d.ts +0 -37
  218. package/services/earning-service/handlers/liquid-staking/bifrost-manta.js +0 -132
  219. package/services/earning-service/handlers/liquid-staking/bifrost.d.ts +0 -46
  220. package/services/earning-service/handlers/liquid-staking/bifrost.js +0 -288
  221. package/services/earning-service/handlers/liquid-staking/index.d.ts +0 -5
  222. package/services/earning-service/handlers/liquid-staking/index.js +0 -8
  223. package/services/earning-service/handlers/liquid-staking/parallel.d.ts +0 -26
  224. package/services/earning-service/handlers/liquid-staking/parallel.js +0 -219
  225. package/services/earning-service/handlers/liquid-staking/stella-swap.d.ts +0 -34
  226. package/services/earning-service/handlers/liquid-staking/stella-swap.js +0 -394
  227. package/services/earning-service/handlers/native-staking/amplitude.d.ts +0 -22
  228. package/services/earning-service/handlers/native-staking/amplitude.js +0 -425
  229. package/services/earning-service/handlers/native-staking/astar.d.ts +0 -19
  230. package/services/earning-service/handlers/native-staking/astar.js +0 -456
  231. package/services/earning-service/handlers/native-staking/base-para.d.ts +0 -11
  232. package/services/earning-service/handlers/native-staking/base-para.js +0 -138
  233. package/services/earning-service/handlers/native-staking/base.d.ts +0 -21
  234. package/services/earning-service/handlers/native-staking/base.js +0 -152
  235. package/services/earning-service/handlers/native-staking/index.d.ts +0 -4
  236. package/services/earning-service/handlers/native-staking/index.js +0 -7
  237. package/services/earning-service/handlers/native-staking/para-chain.d.ts +0 -15
  238. package/services/earning-service/handlers/native-staking/para-chain.js +0 -382
  239. package/services/earning-service/handlers/native-staking/relay-chain.d.ts +0 -21
  240. package/services/earning-service/handlers/native-staking/relay-chain.js +0 -558
  241. package/services/earning-service/handlers/nomination-pool/index.d.ts +0 -36
  242. package/services/earning-service/handlers/nomination-pool/index.js +0 -556
  243. package/services/earning-service/handlers/special.d.ts +0 -64
  244. package/services/earning-service/handlers/special.js +0 -489
  245. package/services/earning-service/service.d.ts +0 -94
  246. package/services/earning-service/service.js +0 -730
  247. package/services/earning-service/utils/index.d.ts +0 -18
  248. package/services/earning-service/utils/index.js +0 -112
  249. package/services/migration-service/scripts/DeleteEarningData.d.ts +0 -4
  250. package/services/migration-service/scripts/DeleteEarningData.js +0 -13
  251. package/services/migration-service/scripts/EnableEarningChains.d.ts +0 -4
  252. package/services/migration-service/scripts/EnableEarningChains.js +0 -13
  253. package/services/migration-service/scripts/databases/MigrateEarningHistory.d.ts +0 -4
  254. package/services/migration-service/scripts/databases/MigrateEarningHistory.js +0 -13
  255. package/services/migration-service/scripts/databases/MigrateEarningVersion.d.ts +0 -4
  256. package/services/migration-service/scripts/databases/MigrateEarningVersion.js +0 -13
  257. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.d.ts +0 -13
  258. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -139
  259. package/services/mint-campaign-service/campaigns/index.d.ts +0 -1
  260. package/services/mint-campaign-service/campaigns/index.js +0 -4
  261. package/services/mint-campaign-service/constants.d.ts +0 -1
  262. package/services/mint-campaign-service/constants.js +0 -4
  263. package/services/mint-campaign-service/index.d.ts +0 -7
  264. package/services/mint-campaign-service/index.js +0 -11
  265. package/services/storage-service/db-stores/AssetRef.d.ts +0 -7
  266. package/services/storage-service/db-stores/AssetRef.js +0 -16
  267. package/services/storage-service/db-stores/YieldPoolStore.d.ts +0 -10
  268. package/services/storage-service/db-stores/YieldPoolStore.js +0 -28
  269. package/services/storage-service/db-stores/YieldPositionStore.d.ts +0 -11
  270. package/services/storage-service/db-stores/YieldPositionStore.js +0 -63
  271. package/types/campaigns/index.d.ts +0 -1
  272. package/types/campaigns/index.js +0 -4
  273. package/types/campaigns/unlock-dot.d.ts +0 -71
  274. package/types/campaigns/unlock-dot.js +0 -1
  275. package/types/ordinal.d.ts +0 -69
  276. package/types/ordinal.js +0 -1
  277. package/types/transaction.d.ts +0 -3
  278. package/types/transaction.js +0 -1
  279. package/types/yield/actions/index.d.ts +0 -2
  280. package/types/yield/actions/index.js +0 -5
  281. package/types/yield/actions/join/index.d.ts +0 -3
  282. package/types/yield/actions/join/index.js +0 -6
  283. package/types/yield/actions/join/step.d.ts +0 -96
  284. package/types/yield/actions/join/step.js +0 -47
  285. package/types/yield/actions/join/submit.d.ts +0 -58
  286. package/types/yield/actions/join/submit.js +0 -1
  287. package/types/yield/actions/join/validate.d.ts +0 -18
  288. package/types/yield/actions/join/validate.js +0 -10
  289. package/types/yield/actions/others.d.ts +0 -85
  290. package/types/yield/actions/others.js +0 -1
  291. package/types/yield/index.d.ts +0 -2
  292. package/types/yield/index.js +0 -5
  293. package/types/yield/info/account/index.d.ts +0 -4
  294. package/types/yield/info/account/index.js +0 -7
  295. package/types/yield/info/account/info.d.ts +0 -92
  296. package/types/yield/info/account/info.js +0 -1
  297. package/types/yield/info/account/reward.d.ts +0 -47
  298. package/types/yield/info/account/reward.js +0 -1
  299. package/types/yield/info/account/target.d.ts +0 -43
  300. package/types/yield/info/account/target.js +0 -27
  301. package/types/yield/info/account/unstake.d.ts +0 -31
  302. package/types/yield/info/account/unstake.js +0 -22
  303. package/types/yield/info/base.d.ts +0 -45
  304. package/types/yield/info/base.js +0 -36
  305. package/types/yield/info/chain/index.d.ts +0 -2
  306. package/types/yield/info/chain/index.js +0 -5
  307. package/types/yield/info/chain/info.d.ts +0 -252
  308. package/types/yield/info/chain/info.js +0 -1
  309. package/types/yield/info/chain/target.d.ts +0 -37
  310. package/types/yield/info/chain/target.js +0 -1
  311. package/types/yield/info/index.d.ts +0 -4
  312. package/types/yield/info/index.js +0 -7
  313. package/types/yield/info/pallet.d.ts +0 -143
  314. package/types/yield/info/pallet.js +0 -9
  315. package/utils/object.d.ts +0 -1
  316. package/utils/object.js +0 -6
@@ -1,241 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.DatabaseService = void 0;
8
- var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
9
- var _databases = _interopRequireDefault(require("@subwallet/extension-base/services/storage-service/databases"));
10
- var _dbStores = require("@subwallet/extension-base/services/storage-service/db-stores");
11
- var _ChainStakingMetadata = _interopRequireDefault(require("@subwallet/extension-base/services/storage-service/db-stores/ChainStakingMetadata"));
12
- var _NominatorMetadata = _interopRequireDefault(require("@subwallet/extension-base/services/storage-service/db-stores/NominatorMetadata"));
13
- var _utils = require("@subwallet/extension-base/utils");
14
- var _util = require("@polkadot/util");
15
- // Copyright 2019-2022 @subwallet/extension-base authors & contributors
16
- // SPDX-License-Identifier: Apache-2.0
17
-
18
- class DatabaseService {
19
- // TODO: might remove this
20
-
21
- constructor(eventService) {
22
- this.eventService = eventService;
23
- this.logger = (0, _util.logger)('DB-Service');
24
- this._db = new _databases.default();
25
- this._db.on('ready', () => {
26
- this.eventService.emit('database.ready', true);
27
- });
28
- this.stores = {
29
- price: new _dbStores.PriceStore(this._db.price),
30
- balance: new _dbStores.BalanceStore(this._db.balances),
31
- nft: new _dbStores.NftStore(this._db.nfts),
32
- nftCollection: new _dbStores.NftCollectionStore(this._db.nftCollections),
33
- crowdloan: new _dbStores.CrowdloanStore(this._db.crowdloans),
34
- staking: new _dbStores.StakingStore(this._db.stakings),
35
- transaction: new _dbStores.TransactionStore(this._db.transactions),
36
- migration: new _dbStores.MigrationStore(this._db.migrations),
37
- metadata: new _dbStores.MetadataStore(this._db.metadata),
38
- chain: new _dbStores.ChainStore(this._db.chain),
39
- asset: new _dbStores.AssetStore(this._db.asset),
40
- // staking
41
- chainStakingMetadata: new _ChainStakingMetadata.default(this._db.chainStakingMetadata),
42
- nominatorMetadata: new _NominatorMetadata.default(this._db.nominatorMetadata)
43
- };
44
- }
45
- async updatePriceStore(priceData) {
46
- await this.stores.price.table.put(priceData);
47
- }
48
- async getPriceStore() {
49
- try {
50
- const rs = await this.stores.price.table.get('usd');
51
- return rs;
52
- } catch (e) {
53
- this.logger.error(e);
54
- return undefined;
55
- }
56
- }
57
-
58
- // Balance
59
- async getStoredBalance() {
60
- return this.stores.balance.table.toArray();
61
- }
62
- async updateBalanceStore(address, item) {
63
- if (item.state === _KoniTypes.APIItemState.READY) {
64
- return this.stores.balance.upsert({
65
- address,
66
- ...item
67
- });
68
- }
69
- }
70
- async removeFromBalanceStore(assets) {
71
- return this.stores.balance.removeBySlugs(assets);
72
- }
73
-
74
- // Crowdloan
75
- async updateCrowdloanStore(chain, address, item) {
76
- if (item.state === _KoniTypes.APIItemState.READY && item.contribute !== '0') {
77
- return this.stores.crowdloan.upsert({
78
- chain,
79
- address,
80
- ...item
81
- });
82
- } else {
83
- return this.stores.crowdloan.deleteByChainAndAddress(chain, address);
84
- }
85
- }
86
-
87
- // Staking
88
- async updateStaking(chain, address, item) {
89
- if (item.state === _KoniTypes.APIItemState.READY) {
90
- return this.stores.staking.upsert(item);
91
- }
92
- }
93
- async getStakings(addresses, chains) {
94
- return this.stores.staking.getStakings(addresses, chains);
95
- }
96
- async getStakingsByChains(chains) {
97
- return this.stores.staking.getStakingsByChains(chains);
98
- }
99
- async getPooledStakings(addresses, chainHashes) {
100
- return this.stores.staking.getPooledStakings(addresses, chainHashes);
101
- }
102
- subscribeStaking(addresses, chainList, callback) {
103
- this.stakingSubscription && this.stakingSubscription.unsubscribe();
104
- this.stakingSubscription = this.stores.staking.subscribeStaking(addresses, chainList).subscribe({
105
- next: stakings => callback && callback(stakings)
106
- });
107
- return this.stakingSubscription;
108
- }
109
- subscribeChainStakingMetadata(chains, callback) {
110
- this.stores.chainStakingMetadata.subscribeByChain(chains).subscribe({
111
- next: data => callback && callback(data)
112
- });
113
- }
114
- subscribeNominatorMetadata(addresses, callback) {
115
- return this.stores.nominatorMetadata.subscribeByAddresses(addresses).subscribe({
116
- next: data => callback && callback(data)
117
- });
118
- }
119
-
120
- // Transaction histories
121
- async getHistories(query) {
122
- return this.stores.transaction.queryHistory(query);
123
- }
124
- async upsertHistory(histories) {
125
- const cleanedHistory = histories.filter(x => x && x.address && x.chain && x.extrinsicHash);
126
- return this.stores.transaction.bulkUpsert(cleanedHistory);
127
- }
128
- async updateHistoryByExtrinsicHash(extrinsicHash, updateData) {
129
- const canUpdate = updateData && extrinsicHash;
130
- if (!canUpdate) {
131
- return;
132
- }
133
- return this.stores.transaction.updateWithQuery({
134
- extrinsicHash
135
- }, updateData);
136
- }
137
-
138
- // NFT Collection
139
- async addNftCollection(collection) {
140
- return this.stores.nftCollection.upsert(collection);
141
- }
142
- async deleteNftCollection(chain, collectionId) {
143
- await this.stores.nftCollection.removeCollection(chain, collectionId);
144
- await this.stores.nft.deleteNftsByCollection(chain, collectionId);
145
- }
146
- getAllNftCollection(chainHashes) {
147
- return this.stores.nftCollection.getNftCollection(chainHashes);
148
- }
149
-
150
- // NFT
151
- subscribeNft(addresses, chainHashes, callback) {
152
- this.nftSubscription && this.nftSubscription.unsubscribe();
153
- this.nftSubscription = this.stores.nft.subscribeNft(addresses, chainHashes).subscribe({
154
- next: nfts => callback && callback(nfts)
155
- });
156
- return this.nftSubscription;
157
- }
158
- async cleanUpNft(chain, owner, collectionIds, nftIds, ownNothing) {
159
- if (ownNothing) {
160
- return this.stores.nft.deleteNftsByChainAndOwner(chain, (0, _utils.reformatAddress)(owner, 42), collectionIds);
161
- }
162
- return this.stores.nft.cleanUpNfts(chain, (0, _utils.reformatAddress)(owner, 42), collectionIds, nftIds);
163
- }
164
- async getNft(addresses, chainHashes) {
165
- return this.stores.nft.getNft(addresses, chainHashes);
166
- }
167
- async addNft(address, nft) {
168
- return this.stores.nft.upsert({
169
- ...nft,
170
- address
171
- });
172
- }
173
- handleNftTransfer(chain, addresses, nftItem) {
174
- return this.stores.nft.deleteNftItem(chain, addresses, nftItem);
175
- }
176
- removeNfts(chain, address, collectionId, nftIds) {
177
- return this.stores.nft.removeNfts(chain, address, collectionId, nftIds);
178
- }
179
-
180
- // Chain
181
- async updateChainStore(item) {
182
- return this.stores.chain.upsert(item);
183
- }
184
- async bulkUpdateChainStore(data) {
185
- return this.stores.chain.bulkUpsert(data);
186
- }
187
- async removeFromChainStore(chains) {
188
- return this.stores.chain.removeChains(chains);
189
- }
190
- async getAllChainStore() {
191
- return this.stores.chain.getAll();
192
- }
193
-
194
- // Asset
195
- async updateAssetStore(item) {
196
- return this.stores.asset.upsert(item);
197
- }
198
- async getAllAssetStore() {
199
- return this.stores.asset.getAll();
200
- }
201
- async removeFromAssetStore(items) {
202
- return this.stores.asset.removeAssets(items);
203
- }
204
-
205
- // Staking
206
- async updateChainStakingMetadata(item, changes) {
207
- const existingRecord = await this.stores.chainStakingMetadata.getByChainAndType(item.chain, item.type);
208
- if (existingRecord && changes) {
209
- return this.stores.chainStakingMetadata.updateByChainAndType(item.chain, item.type, changes);
210
- }
211
- return this.stores.chainStakingMetadata.upsert(item);
212
- }
213
- async getChainStakingMetadata() {
214
- return this.stores.chainStakingMetadata.getAll();
215
- }
216
- async getStakingMetadataByChain(chain) {
217
- let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _KoniTypes.StakingType.NOMINATED;
218
- return this.stores.chainStakingMetadata.getByChainAndType(chain, type);
219
- }
220
- async updateNominatorMetadata(item) {
221
- return this.stores.nominatorMetadata.upsert(item);
222
- }
223
- async getNominatorMetadata() {
224
- return this.stores.nominatorMetadata.getAll();
225
- }
226
- async resetWallet(resetAll) {
227
- return new Promise((resolve, reject) => {
228
- const stores = [this.stores.balance, this.stores.nft, this.stores.nftCollection, this.stores.crowdloan, this.stores.staking, this.stores.transaction, this.stores.nominatorMetadata];
229
- if (resetAll) {
230
- stores.push(this.stores.chain, this.stores.asset);
231
- }
232
- const promises = stores.map(store => store.clear());
233
- Promise.all(promises).then(() => {
234
- resolve();
235
- }).catch(e => {
236
- reject(e);
237
- });
238
- });
239
- }
240
- }
241
- exports.DatabaseService = DatabaseService;
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _unlockDot = require("./unlock-dot");
7
- Object.keys(_unlockDot).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _unlockDot[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _unlockDot[key];
14
- }
15
- });
16
- });
@@ -1 +0,0 @@
1
- "use strict";
@@ -1 +0,0 @@
1
- "use strict";
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _join = require("./join");
7
- Object.keys(_join).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _join[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _join[key];
14
- }
15
- });
16
- });
17
- var _others = require("./others");
18
- Object.keys(_others).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _others[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _others[key];
25
- }
26
- });
27
- });
@@ -1,38 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _step = require("./step");
7
- Object.keys(_step).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _step[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _step[key];
14
- }
15
- });
16
- });
17
- var _submit = require("./submit");
18
- Object.keys(_submit).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _submit[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _submit[key];
25
- }
26
- });
27
- });
28
- var _validate = require("./validate");
29
- Object.keys(_validate).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _validate[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _validate[key];
36
- }
37
- });
38
- });
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.YieldStepType = void 0;
7
- // Copyright 2019-2022 @subwallet/extension-base
8
- // SPDX-License-Identifier: Apache-2.0
9
- /**
10
- * @interface RequestEarlyValidateYield
11
- * @description Params to early validate join pool
12
- * @prop {string} slug - Pool's slug
13
- * @prop {string} address - Account's address
14
- * */
15
- /**
16
- * @interface ResponseEarlyValidateYield
17
- * @prop {boolean} passed - Passed validate
18
- * */
19
- /**
20
- * @interface OptimalYieldPathParams
21
- * @description Params to generate steps
22
- * */
23
- /**
24
- * @enum {string}
25
- * @description Type of join yield step
26
- * */
27
- let YieldStepType;
28
- /**
29
- * @interface BaseYieldStepDetail
30
- * @description Base info of a step
31
- * @prop {string} name - Step's name
32
- * @prop {YieldStepType} type - Step's type
33
- * @prop {Record<string,unknown>} [metadata] - Metadata for generating extrinsic
34
- * */
35
- exports.YieldStepType = YieldStepType;
36
- (function (YieldStepType) {
37
- YieldStepType["DEFAULT"] = "DEFAULT";
38
- YieldStepType["XCM"] = "XCM";
39
- YieldStepType["NOMINATE"] = "NOMINATE";
40
- YieldStepType["JOIN_NOMINATION_POOL"] = "JOIN_NOMINATION_POOL";
41
- YieldStepType["MINT_VDOT"] = "MINT_VDOT";
42
- YieldStepType["MINT_VMANTA"] = "MINT_VMANTA";
43
- YieldStepType["MINT_LDOT"] = "MINT_LDOT";
44
- YieldStepType["MINT_QDOT"] = "MINT_QDOT";
45
- YieldStepType["MINT_SDOT"] = "MINT_SDOT";
46
- YieldStepType["MINT_STDOT"] = "MINT_STDOT";
47
- YieldStepType["TOKEN_APPROVAL"] = "TOKEN_APPROVAL";
48
- })(YieldStepType || (exports.YieldStepType = YieldStepType = {}));
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.YieldValidationStatus = void 0;
7
- // Copyright 2019-2022 @subwallet/extension-base
8
- // SPDX-License-Identifier: Apache-2.0
9
- let YieldValidationStatus;
10
- exports.YieldValidationStatus = YieldValidationStatus;
11
- (function (YieldValidationStatus) {
12
- YieldValidationStatus["NOT_ENOUGH_FEE"] = "NOT_ENOUGH_FEE";
13
- YieldValidationStatus["NOT_ENOUGH_BALANCE"] = "NOT_ENOUGH_BALANCE";
14
- YieldValidationStatus["NOT_ENOUGH_MIN_JOIN_POOL"] = "NOT_ENOUGH_MIN_JOIN_POOL";
15
- YieldValidationStatus["OK"] = "OK";
16
- })(YieldValidationStatus || (exports.YieldValidationStatus = YieldValidationStatus = {}));
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _info = require("./info");
7
- Object.keys(_info).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _info[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _info[key];
14
- }
15
- });
16
- });
17
- var _actions = require("./actions");
18
- Object.keys(_actions).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _actions[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _actions[key];
25
- }
26
- });
27
- });
@@ -1,49 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _info = require("./info");
7
- Object.keys(_info).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _info[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _info[key];
14
- }
15
- });
16
- });
17
- var _reward = require("./reward");
18
- Object.keys(_reward).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _reward[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _reward[key];
25
- }
26
- });
27
- });
28
- var _target = require("./target");
29
- Object.keys(_target).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _target[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _target[key];
36
- }
37
- });
38
- });
39
- var _unstake = require("./unstake");
40
- Object.keys(_unstake).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _unstake[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function () {
46
- return _unstake[key];
47
- }
48
- });
49
- });
@@ -1 +0,0 @@
1
- "use strict";
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.EarningStatus = void 0;
7
- // Copyright 2019-2022 @subwallet/extension-base
8
- // SPDX-License-Identifier: Apache-2.0
9
- /**
10
- * @enum {string}
11
- * @description The earning status of an account in a pool.
12
- * */
13
- let EarningStatus;
14
- /**
15
- * @interface NominationInfo
16
- * @description Info of the validator account joined
17
- * @prop {string} chain - Slug of chain
18
- * @prop {string} validatorAddress - Validator's address or nomination pool's id
19
- * @prop {string} [validatorIdentity] - Validator's identity
20
- * @prop {string} activeStake - Active staked value
21
- * @prop {boolean} [hasUnstaking] - Does the account have unstake request with validator?
22
- * @prop {string} [validatorMinStake] - Min amount to join with validator
23
- * @prop {EarningStatus} status - The staking status of the account
24
- * */
25
- exports.EarningStatus = EarningStatus;
26
- (function (EarningStatus) {
27
- EarningStatus["EARNING_REWARD"] = "EARNING_REWARD";
28
- EarningStatus["PARTIALLY_EARNING"] = "PARTIALLY_EARNING";
29
- EarningStatus["NOT_EARNING"] = "NOT_EARNING";
30
- EarningStatus["WAITING"] = "WAITING";
31
- EarningStatus["NOT_STAKING"] = "NOT_STAKING";
32
- })(EarningStatus || (exports.EarningStatus = EarningStatus = {}));
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.UnstakingStatus = void 0;
7
- // Copyright 2019-2022 @subwallet/extension-base
8
- // SPDX-License-Identifier: Apache-2.0
9
- /**
10
- * @enum {string}
11
- * @description The status of un-staked request.
12
- * */
13
- let UnstakingStatus;
14
- /**
15
- * @interface UnstakingInfo
16
- * @description Info of un-stake request
17
- * @prop {string} chain - Slug of chain
18
- * @prop {UnstakingStatus} status - Status of request
19
- * @prop {string} claimable - Amount to be withdrawn
20
- * @prop {number} [waitingTime] - Time remains to wait (in hours)
21
- * @prop {string} [validatorAddress] - Address of validator
22
- * */
23
- exports.UnstakingStatus = UnstakingStatus;
24
- (function (UnstakingStatus) {
25
- UnstakingStatus["CLAIMABLE"] = "CLAIMABLE";
26
- UnstakingStatus["UNLOCKING"] = "UNLOCKING";
27
- })(UnstakingStatus || (exports.UnstakingStatus = UnstakingStatus = {}));
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.YieldPoolType = exports.YieldCompoundingPeriod = void 0;
7
- // Copyright 2019-2022 @subwallet/extension-base
8
- // SPDX-License-Identifier: Apache-2.0
9
- /**
10
- * @enum {string}
11
- * @description The types of yield pool.
12
- * */
13
- let YieldPoolType;
14
- /**
15
- * @enum {number}
16
- * @description Time to calculate profit
17
- * */
18
- exports.YieldPoolType = YieldPoolType;
19
- (function (YieldPoolType) {
20
- YieldPoolType["LIQUID_STAKING"] = "LIQUID_STAKING";
21
- YieldPoolType["LENDING"] = "LENDING";
22
- YieldPoolType["SINGLE_FARMING"] = "SINGLE_FARMING";
23
- YieldPoolType["NOMINATION_POOL"] = "NOMINATION_POOL";
24
- YieldPoolType["NATIVE_STAKING"] = "NATIVE_STAKING";
25
- YieldPoolType["PARACHAIN_STAKING"] = "PARACHAIN_STAKING";
26
- })(YieldPoolType || (exports.YieldPoolType = YieldPoolType = {}));
27
- let YieldCompoundingPeriod;
28
- /**
29
- * @interface BasePoolInfo
30
- * @prop {string} slug - Pool's slug
31
- * @prop {string} chain - Pool's chain
32
- * @prop {string} type - Pool's type
33
- * @prop {string} group - Pool's group (by token)
34
- * */
35
- exports.YieldCompoundingPeriod = YieldCompoundingPeriod;
36
- (function (YieldCompoundingPeriod) {
37
- YieldCompoundingPeriod[YieldCompoundingPeriod["DAILY"] = 1] = "DAILY";
38
- YieldCompoundingPeriod[YieldCompoundingPeriod["WEEKLY"] = 7] = "WEEKLY";
39
- YieldCompoundingPeriod[YieldCompoundingPeriod["MONTHLY"] = 30] = "MONTHLY";
40
- YieldCompoundingPeriod[YieldCompoundingPeriod["YEARLY"] = 365] = "YEARLY";
41
- })(YieldCompoundingPeriod || (exports.YieldCompoundingPeriod = YieldCompoundingPeriod = {}));
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _info = require("./info");
7
- Object.keys(_info).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _info[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _info[key];
14
- }
15
- });
16
- });
17
- var _target = require("./target");
18
- Object.keys(_target).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _target[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _target[key];
25
- }
26
- });
27
- });
@@ -1 +0,0 @@
1
- "use strict";
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,49 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _account = require("./account");
7
- Object.keys(_account).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _account[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _account[key];
14
- }
15
- });
16
- });
17
- var _base = require("./base");
18
- Object.keys(_base).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _base[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _base[key];
25
- }
26
- });
27
- });
28
- var _chain = require("./chain");
29
- Object.keys(_chain).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _chain[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _chain[key];
36
- }
37
- });
38
- });
39
- var _pallet = require("./pallet");
40
- Object.keys(_pallet).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _pallet[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function () {
46
- return _pallet[key];
47
- }
48
- });
49
- });