@subwallet/extension-base 1.1.35-0 → 1.1.35-beta.1

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 (317) hide show
  1. package/background/KoniTypes.d.ts +111 -69
  2. package/background/KoniTypes.js +19 -13
  3. package/background/errors/TransactionError.js +9 -0
  4. package/cjs/background/KoniTypes.js +20 -16
  5. package/cjs/background/errors/TransactionError.js +9 -0
  6. package/cjs/constants/index.js +19 -4
  7. package/cjs/koni/api/dotsama/balance.js +464 -0
  8. package/cjs/koni/api/nft/config.js +33 -23
  9. package/cjs/koni/api/nft/index.js +14 -0
  10. package/cjs/koni/api/nft/nft.js +1 -22
  11. package/cjs/koni/api/nft/ordinal_nft/constants.js +21 -0
  12. package/cjs/koni/api/nft/ordinal_nft/index.js +121 -0
  13. package/cjs/koni/api/nft/ordinal_nft/utils.js +41 -0
  14. package/cjs/koni/api/staking/bonding/amplitude.js +19 -16
  15. package/cjs/koni/api/staking/bonding/astar.js +11 -10
  16. package/cjs/koni/api/staking/bonding/index.js +4 -1
  17. package/cjs/koni/api/staking/bonding/paraChain.js +25 -23
  18. package/cjs/koni/api/staking/bonding/relayChain.js +48 -45
  19. package/cjs/koni/api/staking/bonding/utils.js +104 -86
  20. package/cjs/koni/api/staking/index.js +6 -5
  21. package/cjs/koni/api/staking/paraChain.js +6 -5
  22. package/cjs/koni/api/staking/relayChain.js +3 -2
  23. package/cjs/koni/api/yield/helper/utils.js +46 -0
  24. package/cjs/koni/background/cron.js +3 -21
  25. package/cjs/koni/background/handlers/Extension.js +368 -69
  26. package/cjs/koni/background/handlers/State.js +18 -12
  27. package/cjs/koni/background/handlers/index.js +4 -2
  28. package/cjs/koni/background/subscription.js +7 -104
  29. package/cjs/services/campaign-service/index.js +9 -6
  30. package/cjs/services/chain-service/constants.js +1 -16
  31. package/cjs/services/chain-service/index.js +6 -2
  32. package/cjs/services/chain-service/utils.js +7 -1
  33. package/cjs/services/earning-service/constants/chains.js +30 -0
  34. package/cjs/services/earning-service/constants/index.js +27 -0
  35. package/cjs/services/earning-service/constants/step.js +18 -0
  36. package/cjs/services/earning-service/handlers/base.js +262 -0
  37. package/cjs/services/earning-service/handlers/index.js +60 -0
  38. package/cjs/services/earning-service/handlers/lending/base.js +81 -0
  39. package/cjs/services/earning-service/handlers/lending/index.js +13 -0
  40. package/cjs/services/earning-service/handlers/lending/interlay.js +192 -0
  41. package/cjs/services/earning-service/handlers/liquid-staking/acala.js +240 -0
  42. package/cjs/services/earning-service/handlers/liquid-staking/base.js +97 -0
  43. package/cjs/services/earning-service/handlers/liquid-staking/bifrost-manta.js +140 -0
  44. package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +298 -0
  45. package/cjs/services/earning-service/handlers/liquid-staking/index.js +34 -0
  46. package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +227 -0
  47. package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +404 -0
  48. package/cjs/services/earning-service/handlers/native-staking/amplitude.js +434 -0
  49. package/cjs/services/earning-service/handlers/native-staking/astar.js +466 -0
  50. package/cjs/services/earning-service/handlers/native-staking/base-para.js +146 -0
  51. package/cjs/services/earning-service/handlers/native-staking/base.js +161 -0
  52. package/cjs/services/earning-service/handlers/native-staking/index.js +34 -0
  53. package/cjs/services/earning-service/handlers/native-staking/para-chain.js +390 -0
  54. package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +567 -0
  55. package/cjs/services/earning-service/handlers/nomination-pool/index.js +566 -0
  56. package/cjs/services/earning-service/handlers/special.js +493 -0
  57. package/cjs/services/earning-service/service.js +733 -0
  58. package/cjs/services/earning-service/utils/index.js +128 -0
  59. package/cjs/services/event-service/index.js +5 -0
  60. package/cjs/services/keyring-service/index.js +14 -2
  61. package/cjs/services/migration-service/scripts/DeleteEarningData.js +21 -0
  62. package/cjs/services/migration-service/scripts/EnableEarningChains.js +21 -0
  63. package/cjs/services/migration-service/scripts/MigrateEthProvider.js +17 -0
  64. package/cjs/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
  65. package/cjs/services/migration-service/scripts/MigratePioneerProvider.js +17 -0
  66. package/cjs/services/migration-service/scripts/MigrateProvider.js +29 -0
  67. package/cjs/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
  68. package/cjs/services/migration-service/scripts/databases/MigrateEarningHistory.js +21 -0
  69. package/cjs/services/migration-service/scripts/databases/MigrateEarningVersion.js +21 -0
  70. package/cjs/services/migration-service/scripts/index.js +6 -1
  71. package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +149 -0
  72. package/cjs/services/mint-campaign-service/campaigns/index.js +13 -0
  73. package/cjs/services/mint-campaign-service/constants.js +11 -0
  74. package/cjs/services/mint-campaign-service/index.js +18 -0
  75. package/cjs/services/notification-service/NotificationService.js +3 -2
  76. package/cjs/services/request-service/handler/PopupHandler.js +2 -3
  77. package/cjs/services/storage-service/DatabaseService.js +63 -0
  78. package/cjs/services/storage-service/databases/index.js +4 -0
  79. package/cjs/services/storage-service/db-stores/NominatorMetadata.js +3 -3
  80. package/cjs/services/storage-service/db-stores/YieldPoolStore.js +36 -0
  81. package/cjs/services/storage-service/db-stores/YieldPositionStore.js +71 -0
  82. package/cjs/services/storage-service/index.js +241 -0
  83. package/cjs/services/subscan-service/index.js +16 -0
  84. package/cjs/services/transaction-service/event-parser/index.js +58 -0
  85. package/cjs/services/transaction-service/helpers/index.js +3 -1
  86. package/cjs/services/transaction-service/index.js +249 -75
  87. package/cjs/services/transaction-service/utils.js +1 -0
  88. package/cjs/types/campaigns/index.js +16 -0
  89. package/cjs/types/campaigns/unlock-dot.js +1 -0
  90. package/cjs/types/index.js +44 -0
  91. package/cjs/types/ordinal.js +1 -0
  92. package/cjs/types/transaction.js +1 -0
  93. package/cjs/types/yield/actions/index.js +27 -0
  94. package/cjs/types/yield/actions/join/index.js +38 -0
  95. package/cjs/types/yield/actions/join/step.js +47 -0
  96. package/cjs/types/yield/actions/join/submit.js +1 -0
  97. package/cjs/types/yield/actions/join/validate.js +16 -0
  98. package/cjs/types/yield/actions/others.js +1 -0
  99. package/cjs/types/yield/index.js +27 -0
  100. package/cjs/types/yield/info/account/index.js +49 -0
  101. package/cjs/types/yield/info/account/info.js +1 -0
  102. package/cjs/types/yield/info/account/reward.js +1 -0
  103. package/cjs/types/yield/info/account/target.js +32 -0
  104. package/cjs/types/yield/info/account/unstake.js +27 -0
  105. package/cjs/types/yield/info/base.js +41 -0
  106. package/cjs/types/yield/info/chain/index.js +27 -0
  107. package/cjs/types/yield/info/chain/info.js +1 -0
  108. package/cjs/types/yield/info/chain/target.js +1 -0
  109. package/cjs/types/yield/info/index.js +49 -0
  110. package/cjs/types/yield/info/pallet.js +15 -0
  111. package/cjs/types.js +1 -0
  112. package/cjs/utils/address.js +34 -0
  113. package/cjs/utils/environment.js +23 -28
  114. package/cjs/utils/fetchStaticCache.js +22 -0
  115. package/cjs/utils/fetchStaticData.js +2 -1
  116. package/cjs/utils/index.js +94 -10
  117. package/cjs/utils/keyring.js +57 -0
  118. package/cjs/utils/mv3.js +21 -0
  119. package/cjs/utils/number.js +6 -2
  120. package/cjs/utils/object.js +12 -0
  121. package/constants/index.d.ts +6 -1
  122. package/constants/index.js +6 -1
  123. package/koni/api/nft/config.js +33 -23
  124. package/koni/api/nft/index.js +15 -1
  125. package/koni/api/nft/nft.js +2 -23
  126. package/koni/api/nft/ordinal_nft/constants.d.ts +9 -0
  127. package/koni/api/nft/ordinal_nft/constants.js +12 -0
  128. package/koni/api/nft/ordinal_nft/index.d.ts +8 -0
  129. package/koni/api/nft/ordinal_nft/index.js +114 -0
  130. package/koni/api/nft/ordinal_nft/utils.d.ts +2 -0
  131. package/koni/api/nft/ordinal_nft/utils.js +33 -0
  132. package/koni/api/staking/bonding/amplitude.js +13 -10
  133. package/koni/api/staking/bonding/astar.js +9 -8
  134. package/koni/api/staking/bonding/index.d.ts +1 -1
  135. package/koni/api/staking/bonding/index.js +5 -1
  136. package/koni/api/staking/bonding/paraChain.js +12 -10
  137. package/koni/api/staking/bonding/relayChain.d.ts +2 -2
  138. package/koni/api/staking/bonding/relayChain.js +33 -30
  139. package/koni/api/staking/bonding/utils.d.ts +15 -38
  140. package/koni/api/staking/bonding/utils.js +85 -69
  141. package/koni/api/staking/index.js +2 -1
  142. package/koni/api/staking/paraChain.js +7 -6
  143. package/koni/api/staking/relayChain.js +4 -3
  144. package/koni/api/yield/helper/utils.d.ts +10 -0
  145. package/koni/api/yield/helper/utils.js +32 -0
  146. package/koni/background/cron.d.ts +0 -4
  147. package/koni/background/cron.js +4 -22
  148. package/koni/background/handlers/Extension.d.ts +17 -1
  149. package/koni/background/handlers/Extension.js +327 -30
  150. package/koni/background/handlers/State.d.ts +6 -1
  151. package/koni/background/handlers/State.js +17 -12
  152. package/koni/background/handlers/index.js +4 -2
  153. package/koni/background/subscription.d.ts +1 -6
  154. package/koni/background/subscription.js +8 -104
  155. package/package.json +326 -3
  156. package/services/campaign-service/index.js +9 -6
  157. package/services/chain-service/constants.d.ts +0 -12
  158. package/services/chain-service/constants.js +0 -14
  159. package/services/chain-service/index.js +6 -2
  160. package/services/chain-service/utils.d.ts +1 -0
  161. package/services/chain-service/utils.js +5 -1
  162. package/services/earning-service/constants/abis/compound_finance_v2_abi.json +1235 -0
  163. package/services/earning-service/constants/abis/st_liquid_token_abi.json +1355 -0
  164. package/services/earning-service/constants/chains.d.ts +15 -0
  165. package/services/earning-service/constants/chains.js +22 -0
  166. package/services/earning-service/constants/index.d.ts +2 -0
  167. package/services/earning-service/constants/index.js +5 -0
  168. package/services/earning-service/constants/step.d.ts +3 -0
  169. package/services/earning-service/constants/step.js +10 -0
  170. package/services/earning-service/handlers/base.d.ts +113 -0
  171. package/services/earning-service/handlers/base.js +256 -0
  172. package/services/earning-service/handlers/index.d.ts +5 -0
  173. package/services/earning-service/handlers/index.js +8 -0
  174. package/services/earning-service/handlers/lending/base.d.ts +8 -0
  175. package/services/earning-service/handlers/lending/base.js +73 -0
  176. package/services/earning-service/handlers/lending/index.d.ts +1 -0
  177. package/services/earning-service/handlers/lending/index.js +4 -0
  178. package/services/earning-service/handlers/lending/interlay.d.ts +24 -0
  179. package/services/earning-service/handlers/lending/interlay.js +184 -0
  180. package/services/earning-service/handlers/liquid-staking/acala.d.ts +27 -0
  181. package/services/earning-service/handlers/liquid-staking/acala.js +232 -0
  182. package/services/earning-service/handlers/liquid-staking/base.d.ts +11 -0
  183. package/services/earning-service/handlers/liquid-staking/base.js +89 -0
  184. package/services/earning-service/handlers/liquid-staking/bifrost.d.ts +46 -0
  185. package/services/earning-service/handlers/liquid-staking/bifrost.js +287 -0
  186. package/services/earning-service/handlers/liquid-staking/index.d.ts +4 -0
  187. package/services/earning-service/handlers/liquid-staking/index.js +7 -0
  188. package/services/earning-service/handlers/liquid-staking/parallel.d.ts +26 -0
  189. package/services/earning-service/handlers/liquid-staking/parallel.js +219 -0
  190. package/services/earning-service/handlers/liquid-staking/stella-swap.d.ts +34 -0
  191. package/services/earning-service/handlers/liquid-staking/stella-swap.js +394 -0
  192. package/services/earning-service/handlers/native-staking/amplitude.d.ts +22 -0
  193. package/services/earning-service/handlers/native-staking/amplitude.js +425 -0
  194. package/services/earning-service/handlers/native-staking/astar.d.ts +19 -0
  195. package/services/earning-service/handlers/native-staking/astar.js +456 -0
  196. package/services/earning-service/handlers/native-staking/base-para.d.ts +11 -0
  197. package/services/earning-service/handlers/native-staking/base-para.js +138 -0
  198. package/services/earning-service/handlers/native-staking/base.d.ts +21 -0
  199. package/services/earning-service/handlers/native-staking/base.js +152 -0
  200. package/services/earning-service/handlers/native-staking/index.d.ts +4 -0
  201. package/services/earning-service/handlers/native-staking/index.js +7 -0
  202. package/services/earning-service/handlers/native-staking/para-chain.d.ts +15 -0
  203. package/services/earning-service/handlers/native-staking/para-chain.js +382 -0
  204. package/services/earning-service/handlers/native-staking/relay-chain.d.ts +21 -0
  205. package/services/earning-service/handlers/native-staking/relay-chain.js +558 -0
  206. package/services/earning-service/handlers/nomination-pool/index.d.ts +36 -0
  207. package/services/earning-service/handlers/nomination-pool/index.js +556 -0
  208. package/services/earning-service/handlers/special.d.ts +64 -0
  209. package/services/earning-service/handlers/special.js +485 -0
  210. package/services/earning-service/service.d.ts +94 -0
  211. package/services/earning-service/service.js +722 -0
  212. package/services/earning-service/utils/index.d.ts +18 -0
  213. package/services/earning-service/utils/index.js +112 -0
  214. package/services/event-service/index.d.ts +2 -0
  215. package/services/event-service/index.js +5 -0
  216. package/services/event-service/types.d.ts +9 -0
  217. package/services/keyring-service/index.d.ts +2 -1
  218. package/services/keyring-service/index.js +14 -2
  219. package/services/migration-service/scripts/DeleteEarningData.d.ts +4 -0
  220. package/services/migration-service/scripts/DeleteEarningData.js +13 -0
  221. package/services/migration-service/scripts/EnableEarningChains.d.ts +4 -0
  222. package/services/migration-service/scripts/EnableEarningChains.js +13 -0
  223. package/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
  224. package/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
  225. package/services/migration-service/scripts/databases/MigrateEarningHistory.d.ts +4 -0
  226. package/services/migration-service/scripts/databases/MigrateEarningHistory.js +13 -0
  227. package/services/migration-service/scripts/databases/MigrateEarningVersion.d.ts +4 -0
  228. package/services/migration-service/scripts/databases/MigrateEarningVersion.js +13 -0
  229. package/services/migration-service/scripts/index.js +6 -1
  230. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.d.ts +13 -0
  231. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +139 -0
  232. package/services/mint-campaign-service/campaigns/index.d.ts +1 -0
  233. package/services/mint-campaign-service/campaigns/index.js +4 -0
  234. package/services/mint-campaign-service/constants.d.ts +1 -0
  235. package/services/mint-campaign-service/constants.js +4 -0
  236. package/services/mint-campaign-service/index.d.ts +7 -0
  237. package/services/mint-campaign-service/index.js +11 -0
  238. package/services/notification-service/NotificationService.js +3 -2
  239. package/services/request-service/handler/PopupHandler.js +3 -4
  240. package/services/storage-service/DatabaseService.d.ts +22 -1
  241. package/services/storage-service/DatabaseService.js +63 -0
  242. package/services/storage-service/databases/index.d.ts +3 -1
  243. package/services/storage-service/databases/index.js +4 -0
  244. package/services/storage-service/db-stores/NominatorMetadata.js +3 -3
  245. package/services/storage-service/db-stores/YieldPoolStore.d.ts +10 -0
  246. package/services/storage-service/db-stores/YieldPoolStore.js +28 -0
  247. package/services/storage-service/db-stores/YieldPositionStore.d.ts +11 -0
  248. package/services/storage-service/db-stores/YieldPositionStore.js +63 -0
  249. package/services/subscan-service/index.d.ts +3 -2
  250. package/services/subscan-service/index.js +15 -0
  251. package/services/subscan-service/types.d.ts +20 -0
  252. package/services/transaction-service/event-parser/index.d.ts +3 -1
  253. package/services/transaction-service/event-parser/index.js +57 -1
  254. package/services/transaction-service/helpers/index.js +3 -1
  255. package/services/transaction-service/index.d.ts +6 -13
  256. package/services/transaction-service/index.js +247 -73
  257. package/services/transaction-service/types.d.ts +2 -0
  258. package/services/transaction-service/utils.js +1 -0
  259. package/types/campaigns/index.d.ts +1 -0
  260. package/types/campaigns/index.js +4 -0
  261. package/types/campaigns/unlock-dot.d.ts +71 -0
  262. package/types/campaigns/unlock-dot.js +1 -0
  263. package/types/index.d.ts +5 -0
  264. package/types/index.js +5 -1
  265. package/types/ordinal.d.ts +69 -0
  266. package/types/ordinal.js +1 -0
  267. package/types/transaction.d.ts +3 -0
  268. package/types/transaction.js +1 -0
  269. package/types/yield/actions/index.d.ts +2 -0
  270. package/types/yield/actions/index.js +5 -0
  271. package/types/yield/actions/join/index.d.ts +3 -0
  272. package/types/yield/actions/join/index.js +6 -0
  273. package/types/yield/actions/join/step.d.ts +95 -0
  274. package/types/yield/actions/join/step.js +46 -0
  275. package/types/yield/actions/join/submit.d.ts +58 -0
  276. package/types/yield/actions/join/submit.js +1 -0
  277. package/types/yield/actions/join/validate.d.ts +18 -0
  278. package/types/yield/actions/join/validate.js +10 -0
  279. package/types/yield/actions/others.d.ts +85 -0
  280. package/types/yield/actions/others.js +1 -0
  281. package/types/yield/index.d.ts +2 -0
  282. package/types/yield/index.js +5 -0
  283. package/types/yield/info/account/index.d.ts +4 -0
  284. package/types/yield/info/account/index.js +7 -0
  285. package/types/yield/info/account/info.d.ts +92 -0
  286. package/types/yield/info/account/info.js +1 -0
  287. package/types/yield/info/account/reward.d.ts +47 -0
  288. package/types/yield/info/account/reward.js +1 -0
  289. package/types/yield/info/account/target.d.ts +43 -0
  290. package/types/yield/info/account/target.js +27 -0
  291. package/types/yield/info/account/unstake.d.ts +31 -0
  292. package/types/yield/info/account/unstake.js +22 -0
  293. package/types/yield/info/base.d.ts +45 -0
  294. package/types/yield/info/base.js +36 -0
  295. package/types/yield/info/chain/index.d.ts +2 -0
  296. package/types/yield/info/chain/index.js +5 -0
  297. package/types/yield/info/chain/info.d.ts +252 -0
  298. package/types/yield/info/chain/info.js +1 -0
  299. package/types/yield/info/chain/target.d.ts +37 -0
  300. package/types/yield/info/chain/target.js +1 -0
  301. package/types/yield/info/index.d.ts +4 -0
  302. package/types/yield/info/index.js +7 -0
  303. package/types/yield/info/pallet.d.ts +143 -0
  304. package/types/yield/info/pallet.js +9 -0
  305. package/utils/environment.d.ts +9 -2
  306. package/utils/environment.js +14 -26
  307. package/utils/fetchStaticCache.d.ts +1 -0
  308. package/utils/fetchStaticCache.js +14 -0
  309. package/utils/fetchStaticData.js +2 -1
  310. package/utils/index.d.ts +5 -1
  311. package/utils/index.js +53 -3
  312. package/utils/mv3.d.ts +2 -0
  313. package/utils/mv3.js +13 -0
  314. package/utils/number.d.ts +2 -1
  315. package/utils/number.js +2 -1
  316. package/utils/object.d.ts +1 -0
  317. package/utils/object.js +6 -0
@@ -24,4 +24,48 @@ Object.keys(_buy).forEach(function (key) {
24
24
  return _buy[key];
25
25
  }
26
26
  });
27
+ });
28
+ var _campaigns = require("./campaigns");
29
+ Object.keys(_campaigns).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _campaigns[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _campaigns[key];
36
+ }
37
+ });
38
+ });
39
+ var _ordinal = require("./ordinal");
40
+ Object.keys(_ordinal).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _ordinal[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _ordinal[key];
47
+ }
48
+ });
49
+ });
50
+ var _transaction = require("./transaction");
51
+ Object.keys(_transaction).forEach(function (key) {
52
+ if (key === "default" || key === "__esModule") return;
53
+ if (key in exports && exports[key] === _transaction[key]) return;
54
+ Object.defineProperty(exports, key, {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _transaction[key];
58
+ }
59
+ });
60
+ });
61
+ var _yield = require("./yield");
62
+ Object.keys(_yield).forEach(function (key) {
63
+ if (key === "default" || key === "__esModule") return;
64
+ if (key in exports && exports[key] === _yield[key]) return;
65
+ Object.defineProperty(exports, key, {
66
+ enumerable: true,
67
+ get: function () {
68
+ return _yield[key];
69
+ }
70
+ });
27
71
  });
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,27 @@
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
+ });
@@ -0,0 +1,38 @@
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
+ });
@@ -0,0 +1,47 @@
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_LDOT"] = "MINT_LDOT";
43
+ YieldStepType["MINT_QDOT"] = "MINT_QDOT";
44
+ YieldStepType["MINT_SDOT"] = "MINT_SDOT";
45
+ YieldStepType["MINT_STDOT"] = "MINT_STDOT";
46
+ YieldStepType["TOKEN_APPROVAL"] = "TOKEN_APPROVAL";
47
+ })(YieldStepType || (exports.YieldStepType = YieldStepType = {}));
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,16 @@
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 = {}));
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,27 @@
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
+ });
@@ -0,0 +1,49 @@
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
+ });
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,32 @@
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 = {}));
@@ -0,0 +1,27 @@
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 = {}));
@@ -0,0 +1,41 @@
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 = {}));
@@ -0,0 +1,27 @@
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
+ });
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,49 @@
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
+ });
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PalletParachainStakingRequestType = void 0;
7
+ // Copyright 2019-2022 @subwallet/extension-base
8
+ // SPDX-License-Identifier: Apache-2.0
9
+ let PalletParachainStakingRequestType;
10
+ exports.PalletParachainStakingRequestType = PalletParachainStakingRequestType;
11
+ (function (PalletParachainStakingRequestType) {
12
+ PalletParachainStakingRequestType["REVOKE"] = "revoke";
13
+ PalletParachainStakingRequestType["DECREASE"] = "decrease";
14
+ PalletParachainStakingRequestType["BOND_LESS"] = "bondLess";
15
+ })(PalletParachainStakingRequestType || (exports.PalletParachainStakingRequestType = PalletParachainStakingRequestType = {}));
package/cjs/types.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.convertSubjectInfoToAddresses = void 0;
7
+ exports.quickFormatAddressToCompare = quickFormatAddressToCompare;
8
+ exports.simpleAddress = void 0;
9
+ var _index = require("@subwallet/extension-base/utils/index");
10
+ var _utilCrypto = require("@polkadot/util-crypto");
11
+ // Copyright 2019-2022 @subwallet/extension-base authors & contributors
12
+ // SPDX-License-Identifier: Apache-2.0
13
+
14
+ const simpleAddress = address => {
15
+ if ((0, _utilCrypto.isEthereumAddress)(address)) {
16
+ return address;
17
+ }
18
+ return (0, _utilCrypto.encodeAddress)((0, _utilCrypto.decodeAddress)(address));
19
+ };
20
+ exports.simpleAddress = simpleAddress;
21
+ function quickFormatAddressToCompare(address) {
22
+ if (!(0, _utilCrypto.isAddress)(address)) {
23
+ return address;
24
+ }
25
+ return (0, _index.reformatAddress)(address, 42).toLowerCase();
26
+ }
27
+ const convertSubjectInfoToAddresses = subjectInfo => {
28
+ return Object.values(subjectInfo).map(info => ({
29
+ address: info.json.address,
30
+ type: info.type,
31
+ ...info.json.meta
32
+ }));
33
+ };
34
+ exports.convertSubjectInfoToAddresses = convertSubjectInfoToAddresses;
@@ -1,15 +1,18 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.getOS = exports.TARGET_ENV = exports.RuntimeInfo = exports.MODULE_SUPPORT = void 0;
7
+ exports.targetIsWeb = exports.targetIsMobile = exports.targetIsExtension = exports.osName = exports.isMobile = exports.isFirefox = exports.TARGET_ENV = exports.RuntimeInfo = exports.MODULE_SUPPORT = exports.BowserParser = void 0;
8
+ var _mv = require("@subwallet/extension-base/utils/mv3");
9
+ var _bowser = _interopRequireDefault(require("bowser"));
7
10
  var _KoniTypes = require("../background/KoniTypes");
8
11
  // Copyright 2019-2022 @polkadot/extension authors & contributors
9
12
  // SPDX-License-Identifier: Apache-2.0
10
13
 
11
14
  function detectRuntimeEnvironment() {
12
- if (typeof window !== 'undefined' && typeof document !== 'undefined') {
15
+ if (_mv.isSupportWindow) {
13
16
  // Web environment
14
17
  return {
15
18
  environment: _KoniTypes.RuntimeEnvironment.Web,
@@ -23,7 +26,7 @@ function detectRuntimeEnvironment() {
23
26
  environment: _KoniTypes.RuntimeEnvironment.ServiceWorker,
24
27
  version: navigator.userAgent,
25
28
  host: self.location.host,
26
- protocol: window.location.protocol
29
+ protocol: 'https'
27
30
  };
28
31
  } else if (typeof process !== 'undefined' && process.versions && process.versions.node) {
29
32
  // Node.js environment
@@ -63,34 +66,26 @@ function detectRuntimeEnvironment() {
63
66
  }
64
67
  }
65
68
  const RuntimeInfo = detectRuntimeEnvironment();
69
+
70
+ // Todo: Support more in backend case
66
71
  exports.RuntimeInfo = RuntimeInfo;
67
- const getOS = () => {
68
- var _window$navigator, _window$navigator$use;
69
- const userAgent = window.navigator.userAgent;
70
- // @ts-ignore
71
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
72
- const platform = ((_window$navigator = window.navigator) === null || _window$navigator === void 0 ? void 0 : (_window$navigator$use = _window$navigator.userAgentData) === null || _window$navigator$use === void 0 ? void 0 : _window$navigator$use.platform) || window.navigator.platform;
73
- const macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K', 'macOS'];
74
- const windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'];
75
- const iosPlatforms = ['iPhone', 'iPad', 'iPod'];
76
- let os = 'Unknown';
77
- if (macosPlatforms.indexOf(platform) !== -1) {
78
- os = 'Mac OS';
79
- } else if (iosPlatforms.indexOf(platform) !== -1) {
80
- os = 'iOS';
81
- } else if (windowsPlatforms.indexOf(platform) !== -1) {
82
- os = 'Windows';
83
- } else if (/Android/.test(userAgent)) {
84
- os = 'Android';
85
- } else if (/Linux/.test(platform)) {
86
- os = 'Linux';
87
- }
88
- return os;
89
- };
90
- exports.getOS = getOS;
72
+ const BowserParser = _bowser.default.getParser(typeof navigator !== 'undefined' ? navigator.userAgent : '');
73
+ exports.BowserParser = BowserParser;
74
+ const isFirefox = BowserParser.getBrowserName(true) === 'firefox';
75
+ exports.isFirefox = isFirefox;
76
+ const osName = BowserParser.getOSName();
77
+ exports.osName = osName;
78
+ const isMobile = BowserParser.getPlatform().type === 'mobile';
79
+ exports.isMobile = isMobile;
91
80
  const TARGET_ENV = process.env.TARGET_ENV || 'extension';
92
81
  exports.TARGET_ENV = TARGET_ENV;
82
+ const targetIsExtension = TARGET_ENV === 'extension';
83
+ exports.targetIsExtension = targetIsExtension;
84
+ const targetIsWeb = TARGET_ENV === 'webapp';
85
+ exports.targetIsWeb = targetIsWeb;
86
+ const targetIsMobile = TARGET_ENV === 'mobile';
87
+ exports.targetIsMobile = targetIsMobile;
93
88
  const MODULE_SUPPORT = {
94
- MANTA_ZK: TARGET_ENV === 'extension'
89
+ MANTA_ZK: targetIsExtension
95
90
  };
96
91
  exports.MODULE_SUPPORT = MODULE_SUPPORT;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.fetchStaticCache = fetchStaticCache;
8
+ var _axios = _interopRequireDefault(require("axios"));
9
+ // Copyright 2019-2022 @subwallet/extension-base
10
+ // SPDX-License-Identifier: Apache-2.0
11
+
12
+ async function fetchStaticCache(slug, defaultData) {
13
+ let timeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 9000;
14
+ try {
15
+ const rs = await _axios.default.get(`https://static-cache.subwallet.app/${slug}`, {
16
+ timeout
17
+ });
18
+ return rs.data;
19
+ } catch (e) {
20
+ return defaultData;
21
+ }
22
+ }
@@ -10,8 +10,9 @@ var _axios = _interopRequireDefault(require("axios"));
10
10
  // Copyright 2019-2022 @subwallet/extension-base
11
11
  // SPDX-License-Identifier: Apache-2.0
12
12
 
13
+ const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
13
14
  const branchName = process.env.BRANCH_NAME || 'koni-dev';
14
- const fetchTarget = branchName === 'master' || branchName === 'webapp' ? 'list.json' : 'preview.json';
15
+ const fetchTarget = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'list.json' : 'preview.json';
15
16
  async function fetchStaticData(slug, targetFile) {
16
17
  const fetchFile = targetFile || fetchTarget;
17
18
  try {