@subwallet/extension-base 1.1.31-beta.0 → 1.1.32-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 (307) hide show
  1. package/background/KoniTypes.d.ts +69 -111
  2. package/background/KoniTypes.js +13 -19
  3. package/background/errors/TransactionError.js +0 -9
  4. package/cjs/background/KoniTypes.js +16 -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 +15 -17
  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 +5 -6
  18. package/cjs/koni/api/staking/relayChain.js +2 -3
  19. package/cjs/koni/background/cron.js +1 -11
  20. package/cjs/koni/background/handlers/Extension.js +69 -362
  21. package/cjs/koni/background/handlers/State.js +3 -51
  22. package/cjs/koni/background/handlers/index.js +2 -4
  23. package/cjs/koni/background/subscription.js +37 -95
  24. package/cjs/packageInfo.js +1 -1
  25. package/cjs/services/campaign-service/index.js +6 -9
  26. package/cjs/services/chain-service/constants.js +18 -3
  27. package/cjs/services/chain-service/index.js +2 -3
  28. package/cjs/services/chain-service/utils.js +1 -7
  29. package/cjs/services/event-service/index.js +0 -4
  30. package/cjs/services/keyring-service/index.js +2 -14
  31. package/cjs/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
  32. package/cjs/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
  33. package/cjs/services/migration-service/scripts/index.js +1 -7
  34. package/cjs/services/notification-service/NotificationService.js +1 -1
  35. package/cjs/services/storage-service/DatabaseService.js +0 -51
  36. package/cjs/services/storage-service/databases/index.js +0 -4
  37. package/cjs/services/storage-service/db-stores/NominatorMetadata.js +3 -3
  38. package/cjs/services/subscan-service/index.js +0 -16
  39. package/cjs/services/transaction-service/event-parser/index.js +0 -58
  40. package/cjs/services/transaction-service/helpers/index.js +1 -3
  41. package/cjs/services/transaction-service/index.js +75 -231
  42. package/cjs/services/transaction-service/utils.js +0 -1
  43. package/cjs/types/index.js +0 -44
  44. package/cjs/utils/fetchStaticData.js +1 -2
  45. package/cjs/utils/index.js +1 -89
  46. package/cjs/utils/number.js +1 -3
  47. package/constants/index.d.ts +1 -6
  48. package/constants/index.js +1 -6
  49. package/koni/api/nft/config.js +23 -33
  50. package/koni/api/nft/index.js +1 -15
  51. package/koni/api/nft/nft.js +23 -2
  52. package/koni/api/staking/bonding/amplitude.js +9 -11
  53. package/koni/api/staking/bonding/astar.js +8 -9
  54. package/koni/api/staking/bonding/index.d.ts +2 -1
  55. package/koni/api/staking/bonding/index.js +3 -5
  56. package/koni/api/staking/bonding/paraChain.js +16 -15
  57. package/koni/api/staking/bonding/relayChain.d.ts +2 -2
  58. package/koni/api/staking/bonding/relayChain.js +30 -33
  59. package/koni/api/staking/bonding/utils.d.ts +38 -15
  60. package/koni/api/staking/bonding/utils.js +69 -85
  61. package/koni/api/staking/index.js +1 -2
  62. package/koni/api/staking/paraChain.js +6 -7
  63. package/koni/api/staking/relayChain.js +3 -4
  64. package/koni/background/cron.d.ts +0 -1
  65. package/koni/background/cron.js +2 -12
  66. package/koni/background/handlers/Extension.d.ts +1 -17
  67. package/koni/background/handlers/Extension.js +30 -321
  68. package/koni/background/handlers/State.d.ts +2 -18
  69. package/koni/background/handlers/State.js +3 -50
  70. package/koni/background/handlers/index.js +2 -4
  71. package/koni/background/subscription.d.ts +1 -6
  72. package/koni/background/subscription.js +38 -97
  73. package/package.json +8 -321
  74. package/packageInfo.js +1 -1
  75. package/services/campaign-service/index.js +6 -9
  76. package/services/chain-service/constants.d.ts +11 -0
  77. package/services/chain-service/constants.js +16 -2
  78. package/services/chain-service/index.js +2 -3
  79. package/services/chain-service/utils.d.ts +0 -1
  80. package/services/chain-service/utils.js +1 -5
  81. package/services/event-service/index.d.ts +0 -1
  82. package/services/event-service/index.js +0 -4
  83. package/services/event-service/types.d.ts +0 -8
  84. package/services/keyring-service/index.d.ts +1 -2
  85. package/services/keyring-service/index.js +2 -14
  86. package/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
  87. package/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
  88. package/services/migration-service/scripts/index.js +1 -7
  89. package/services/notification-service/NotificationService.js +1 -1
  90. package/services/storage-service/DatabaseService.d.ts +1 -18
  91. package/services/storage-service/DatabaseService.js +0 -51
  92. package/services/storage-service/databases/index.d.ts +1 -3
  93. package/services/storage-service/databases/index.js +0 -4
  94. package/services/storage-service/db-stores/NominatorMetadata.js +3 -3
  95. package/services/subscan-service/index.d.ts +2 -3
  96. package/services/subscan-service/index.js +0 -15
  97. package/services/subscan-service/types.d.ts +0 -20
  98. package/services/transaction-service/event-parser/index.d.ts +1 -3
  99. package/services/transaction-service/event-parser/index.js +1 -57
  100. package/services/transaction-service/helpers/index.js +1 -3
  101. package/services/transaction-service/index.d.ts +15 -4
  102. package/services/transaction-service/index.js +73 -229
  103. package/services/transaction-service/types.d.ts +0 -2
  104. package/services/transaction-service/utils.js +0 -1
  105. package/types/index.d.ts +0 -5
  106. package/types/index.js +1 -5
  107. package/utils/fetchStaticData.js +1 -2
  108. package/utils/index.d.ts +0 -5
  109. package/utils/index.js +1 -53
  110. package/utils/number.d.ts +1 -1
  111. package/utils/number.js +1 -1
  112. package/cjs/koni/api/dotsama/balance.js +0 -464
  113. package/cjs/koni/api/nft/ordinal_nft/constants.js +0 -21
  114. package/cjs/koni/api/nft/ordinal_nft/index.js +0 -121
  115. package/cjs/koni/api/nft/ordinal_nft/utils.js +0 -41
  116. package/cjs/koni/api/yield/helper/utils.js +0 -46
  117. package/cjs/services/earning-service/constants/chains.js +0 -29
  118. package/cjs/services/earning-service/constants/index.js +0 -27
  119. package/cjs/services/earning-service/constants/step.js +0 -18
  120. package/cjs/services/earning-service/handlers/base.js +0 -259
  121. package/cjs/services/earning-service/handlers/index.js +0 -60
  122. package/cjs/services/earning-service/handlers/lending/base.js +0 -20
  123. package/cjs/services/earning-service/handlers/lending/index.js +0 -13
  124. package/cjs/services/earning-service/handlers/lending/interlay.js +0 -191
  125. package/cjs/services/earning-service/handlers/liquid-staking/acala.js +0 -239
  126. package/cjs/services/earning-service/handlers/liquid-staking/base.js +0 -43
  127. package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +0 -297
  128. package/cjs/services/earning-service/handlers/liquid-staking/index.js +0 -34
  129. package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +0 -226
  130. package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +0 -395
  131. package/cjs/services/earning-service/handlers/native-staking/amplitude.js +0 -384
  132. package/cjs/services/earning-service/handlers/native-staking/astar.js +0 -461
  133. package/cjs/services/earning-service/handlers/native-staking/base-para.js +0 -146
  134. package/cjs/services/earning-service/handlers/native-staking/base.js +0 -159
  135. package/cjs/services/earning-service/handlers/native-staking/index.js +0 -34
  136. package/cjs/services/earning-service/handlers/native-staking/para-chain.js +0 -385
  137. package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +0 -558
  138. package/cjs/services/earning-service/handlers/nomination-pool/index.js +0 -560
  139. package/cjs/services/earning-service/handlers/special.js +0 -503
  140. package/cjs/services/earning-service/service.js +0 -387
  141. package/cjs/services/earning-service/utils/index.js +0 -128
  142. package/cjs/services/migration-service/scripts/DeleteEarningData.js +0 -21
  143. package/cjs/services/migration-service/scripts/EnableEarningChains.js +0 -21
  144. package/cjs/services/migration-service/scripts/MigrateEthProvider.js +0 -17
  145. package/cjs/services/migration-service/scripts/MigratePioneerProvider.js +0 -17
  146. package/cjs/services/migration-service/scripts/MigrateProvider.js +0 -29
  147. package/cjs/services/migration-service/scripts/databases/MigrateEarningHistory.js +0 -21
  148. package/cjs/services/migration-service/scripts/databases/MigrateEarningVersion.js +0 -21
  149. package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -149
  150. package/cjs/services/mint-campaign-service/campaigns/index.js +0 -13
  151. package/cjs/services/mint-campaign-service/constants.js +0 -11
  152. package/cjs/services/mint-campaign-service/index.js +0 -18
  153. package/cjs/services/storage-service/db-stores/YieldPoolStore.js +0 -36
  154. package/cjs/services/storage-service/db-stores/YieldPositionStore.js +0 -65
  155. package/cjs/services/storage-service/index.js +0 -241
  156. package/cjs/types/campaigns/index.js +0 -16
  157. package/cjs/types/campaigns/unlock-dot.js +0 -1
  158. package/cjs/types/ordinal.js +0 -1
  159. package/cjs/types/transaction.js +0 -1
  160. package/cjs/types/yield/actions/index.js +0 -27
  161. package/cjs/types/yield/actions/join/index.js +0 -38
  162. package/cjs/types/yield/actions/join/step.js +0 -47
  163. package/cjs/types/yield/actions/join/submit.js +0 -1
  164. package/cjs/types/yield/actions/join/validate.js +0 -16
  165. package/cjs/types/yield/actions/others.js +0 -1
  166. package/cjs/types/yield/index.js +0 -27
  167. package/cjs/types/yield/info/account/index.js +0 -49
  168. package/cjs/types/yield/info/account/info.js +0 -1
  169. package/cjs/types/yield/info/account/reward.js +0 -1
  170. package/cjs/types/yield/info/account/target.js +0 -32
  171. package/cjs/types/yield/info/account/unstake.js +0 -27
  172. package/cjs/types/yield/info/base.js +0 -41
  173. package/cjs/types/yield/info/chain/index.js +0 -27
  174. package/cjs/types/yield/info/chain/info.js +0 -1
  175. package/cjs/types/yield/info/chain/target.js +0 -1
  176. package/cjs/types/yield/info/index.js +0 -49
  177. package/cjs/types/yield/info/pallet.js +0 -15
  178. package/cjs/types.js +0 -1
  179. package/cjs/utils/address.js +0 -34
  180. package/cjs/utils/keyring.js +0 -57
  181. package/cjs/utils/object.js +0 -12
  182. package/koni/api/nft/ordinal_nft/constants.d.ts +0 -9
  183. package/koni/api/nft/ordinal_nft/constants.js +0 -12
  184. package/koni/api/nft/ordinal_nft/index.d.ts +0 -8
  185. package/koni/api/nft/ordinal_nft/index.js +0 -114
  186. package/koni/api/nft/ordinal_nft/utils.d.ts +0 -2
  187. package/koni/api/nft/ordinal_nft/utils.js +0 -33
  188. package/koni/api/yield/helper/utils.d.ts +0 -10
  189. package/koni/api/yield/helper/utils.js +0 -32
  190. package/services/earning-service/constants/abis/compound_finance_v2_abi.json +0 -1235
  191. package/services/earning-service/constants/abis/st_liquid_token_abi.json +0 -1355
  192. package/services/earning-service/constants/chains.d.ts +0 -14
  193. package/services/earning-service/constants/chains.js +0 -21
  194. package/services/earning-service/constants/index.d.ts +0 -2
  195. package/services/earning-service/constants/index.js +0 -5
  196. package/services/earning-service/constants/step.d.ts +0 -3
  197. package/services/earning-service/constants/step.js +0 -10
  198. package/services/earning-service/handlers/base.d.ts +0 -112
  199. package/services/earning-service/handlers/base.js +0 -253
  200. package/services/earning-service/handlers/index.d.ts +0 -5
  201. package/services/earning-service/handlers/index.js +0 -8
  202. package/services/earning-service/handlers/lending/base.d.ts +0 -6
  203. package/services/earning-service/handlers/lending/base.js +0 -12
  204. package/services/earning-service/handlers/lending/index.d.ts +0 -1
  205. package/services/earning-service/handlers/lending/index.js +0 -4
  206. package/services/earning-service/handlers/lending/interlay.d.ts +0 -24
  207. package/services/earning-service/handlers/lending/interlay.js +0 -183
  208. package/services/earning-service/handlers/liquid-staking/acala.d.ts +0 -27
  209. package/services/earning-service/handlers/liquid-staking/acala.js +0 -231
  210. package/services/earning-service/handlers/liquid-staking/base.d.ts +0 -9
  211. package/services/earning-service/handlers/liquid-staking/base.js +0 -35
  212. package/services/earning-service/handlers/liquid-staking/bifrost.d.ts +0 -46
  213. package/services/earning-service/handlers/liquid-staking/bifrost.js +0 -286
  214. package/services/earning-service/handlers/liquid-staking/index.d.ts +0 -4
  215. package/services/earning-service/handlers/liquid-staking/index.js +0 -7
  216. package/services/earning-service/handlers/liquid-staking/parallel.d.ts +0 -26
  217. package/services/earning-service/handlers/liquid-staking/parallel.js +0 -218
  218. package/services/earning-service/handlers/liquid-staking/stella-swap.d.ts +0 -34
  219. package/services/earning-service/handlers/liquid-staking/stella-swap.js +0 -385
  220. package/services/earning-service/handlers/native-staking/amplitude.d.ts +0 -22
  221. package/services/earning-service/handlers/native-staking/amplitude.js +0 -375
  222. package/services/earning-service/handlers/native-staking/astar.d.ts +0 -19
  223. package/services/earning-service/handlers/native-staking/astar.js +0 -451
  224. package/services/earning-service/handlers/native-staking/base-para.d.ts +0 -11
  225. package/services/earning-service/handlers/native-staking/base-para.js +0 -138
  226. package/services/earning-service/handlers/native-staking/base.d.ts +0 -21
  227. package/services/earning-service/handlers/native-staking/base.js +0 -150
  228. package/services/earning-service/handlers/native-staking/index.d.ts +0 -4
  229. package/services/earning-service/handlers/native-staking/index.js +0 -7
  230. package/services/earning-service/handlers/native-staking/para-chain.d.ts +0 -15
  231. package/services/earning-service/handlers/native-staking/para-chain.js +0 -377
  232. package/services/earning-service/handlers/native-staking/relay-chain.d.ts +0 -21
  233. package/services/earning-service/handlers/native-staking/relay-chain.js +0 -549
  234. package/services/earning-service/handlers/nomination-pool/index.d.ts +0 -36
  235. package/services/earning-service/handlers/nomination-pool/index.js +0 -550
  236. package/services/earning-service/handlers/special.d.ts +0 -65
  237. package/services/earning-service/handlers/special.js +0 -495
  238. package/services/earning-service/service.d.ts +0 -45
  239. package/services/earning-service/service.js +0 -379
  240. package/services/earning-service/utils/index.d.ts +0 -18
  241. package/services/earning-service/utils/index.js +0 -112
  242. package/services/migration-service/scripts/DeleteEarningData.d.ts +0 -4
  243. package/services/migration-service/scripts/DeleteEarningData.js +0 -13
  244. package/services/migration-service/scripts/EnableEarningChains.d.ts +0 -4
  245. package/services/migration-service/scripts/EnableEarningChains.js +0 -13
  246. package/services/migration-service/scripts/databases/MigrateEarningHistory.d.ts +0 -4
  247. package/services/migration-service/scripts/databases/MigrateEarningHistory.js +0 -13
  248. package/services/migration-service/scripts/databases/MigrateEarningVersion.d.ts +0 -4
  249. package/services/migration-service/scripts/databases/MigrateEarningVersion.js +0 -13
  250. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.d.ts +0 -13
  251. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -139
  252. package/services/mint-campaign-service/campaigns/index.d.ts +0 -1
  253. package/services/mint-campaign-service/campaigns/index.js +0 -4
  254. package/services/mint-campaign-service/constants.d.ts +0 -1
  255. package/services/mint-campaign-service/constants.js +0 -4
  256. package/services/mint-campaign-service/index.d.ts +0 -7
  257. package/services/mint-campaign-service/index.js +0 -11
  258. package/services/storage-service/db-stores/YieldPoolStore.d.ts +0 -10
  259. package/services/storage-service/db-stores/YieldPoolStore.js +0 -28
  260. package/services/storage-service/db-stores/YieldPositionStore.d.ts +0 -9
  261. package/services/storage-service/db-stores/YieldPositionStore.js +0 -57
  262. package/types/campaigns/index.d.ts +0 -1
  263. package/types/campaigns/index.js +0 -4
  264. package/types/campaigns/unlock-dot.d.ts +0 -71
  265. package/types/campaigns/unlock-dot.js +0 -1
  266. package/types/ordinal.d.ts +0 -69
  267. package/types/ordinal.js +0 -1
  268. package/types/transaction.d.ts +0 -3
  269. package/types/transaction.js +0 -1
  270. package/types/yield/actions/index.d.ts +0 -2
  271. package/types/yield/actions/index.js +0 -5
  272. package/types/yield/actions/join/index.d.ts +0 -3
  273. package/types/yield/actions/join/index.js +0 -6
  274. package/types/yield/actions/join/step.d.ts +0 -95
  275. package/types/yield/actions/join/step.js +0 -46
  276. package/types/yield/actions/join/submit.d.ts +0 -57
  277. package/types/yield/actions/join/submit.js +0 -1
  278. package/types/yield/actions/join/validate.d.ts +0 -18
  279. package/types/yield/actions/join/validate.js +0 -10
  280. package/types/yield/actions/others.d.ts +0 -85
  281. package/types/yield/actions/others.js +0 -1
  282. package/types/yield/index.d.ts +0 -2
  283. package/types/yield/index.js +0 -5
  284. package/types/yield/info/account/index.d.ts +0 -4
  285. package/types/yield/info/account/index.js +0 -7
  286. package/types/yield/info/account/info.d.ts +0 -92
  287. package/types/yield/info/account/info.js +0 -1
  288. package/types/yield/info/account/reward.d.ts +0 -45
  289. package/types/yield/info/account/reward.js +0 -1
  290. package/types/yield/info/account/target.d.ts +0 -43
  291. package/types/yield/info/account/target.js +0 -27
  292. package/types/yield/info/account/unstake.d.ts +0 -31
  293. package/types/yield/info/account/unstake.js +0 -22
  294. package/types/yield/info/base.d.ts +0 -45
  295. package/types/yield/info/base.js +0 -36
  296. package/types/yield/info/chain/index.d.ts +0 -2
  297. package/types/yield/info/chain/index.js +0 -5
  298. package/types/yield/info/chain/info.d.ts +0 -251
  299. package/types/yield/info/chain/info.js +0 -1
  300. package/types/yield/info/chain/target.d.ts +0 -37
  301. package/types/yield/info/chain/target.js +0 -1
  302. package/types/yield/info/index.d.ts +0 -4
  303. package/types/yield/info/index.js +0 -7
  304. package/types/yield/info/pallet.d.ts +0 -143
  305. package/types/yield/info/pallet.js +0 -9
  306. package/utils/object.d.ts +0 -1
  307. package/utils/object.js +0 -6
@@ -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
- });
@@ -1,15 +0,0 @@
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 DELETED
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,34 +0,0 @@
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,57 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.extractPrivateKey = extractPrivateKey;
7
- exports.unlockAccount = exports.lockAccount = void 0;
8
- var _uiKeyring = require("@subwallet/ui-keyring");
9
- // Copyright 2019-2022 @subwallet/extension-base
10
- // SPDX-License-Identifier: Apache-2.0
11
-
12
- // import _decode from '@polkadot/keyring/pair/decode';
13
-
14
- function extract(address) {
15
- // @ts-ignore
16
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
17
- const rs = this.getPair(address);
18
-
19
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
20
- console.log(rs.publicKey);
21
- }
22
- function extractPrivateKey(keyring, address, password) {
23
- extract.call(keyring, address);
24
- }
25
- const unlockAccount = signAddress => {
26
- let publicKey;
27
- try {
28
- publicKey = _uiKeyring.keyring.decodeAddress(signAddress);
29
- } catch (error) {
30
- console.error(error);
31
- return 'Unable to decode address';
32
- }
33
- const pair = _uiKeyring.keyring.getPair(publicKey);
34
- if (!pair) {
35
- return 'Unable to find pair';
36
- }
37
- if (pair.isLocked) {
38
- try {
39
- _uiKeyring.keyring.unlockPair(pair.address);
40
- } catch (e) {
41
- return e.message;
42
- }
43
- }
44
- return null;
45
- };
46
- exports.unlockAccount = unlockAccount;
47
- const lockAccount = address => {
48
- try {
49
- const pair = _uiKeyring.keyring.getPair(address);
50
- if (pair) {
51
- pair.lock();
52
- }
53
- } catch (error) {
54
- console.error('Unable to lock account', error);
55
- }
56
- };
57
- exports.lockAccount = lockAccount;
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isEmptyObject = isEmptyObject;
7
- // Copyright 2019-2022 @subwallet/extension-koni authors & contributors
8
- // SPDX-License-Identifier: Apache-2.0
9
-
10
- function isEmptyObject(input) {
11
- return Object.keys(input).length === 0;
12
- }
@@ -1,9 +0,0 @@
1
- export declare const GET_EVENT_LIST_API = "https://{{chain}}.api.subscan.io/api/v2/scan/events";
2
- export declare const GET_EXTRINSIC_PARAMS_API = "https://{{chain}}.api.subscan.io/api/scan/extrinsic/params";
3
- export declare const BASE_FETCH_ORDINAL_EVENT_DATA: {
4
- event_id: string;
5
- module: string;
6
- order: string;
7
- success: boolean;
8
- row: number;
9
- };
@@ -1,12 +0,0 @@
1
- // Copyright 2019-2022 @subwallet/extension-base authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- export const GET_EVENT_LIST_API = 'https://{{chain}}.api.subscan.io/api/v2/scan/events';
5
- export const GET_EXTRINSIC_PARAMS_API = 'https://{{chain}}.api.subscan.io/api/scan/extrinsic/params';
6
- export const BASE_FETCH_ORDINAL_EVENT_DATA = {
7
- event_id: 'Remarked',
8
- module: 'system',
9
- order: 'desc',
10
- success: true,
11
- row: 100
12
- };
@@ -1,8 +0,0 @@
1
- import { BaseNftApi, HandleNftParams } from '@subwallet/extension-base/koni/api/nft/nft';
2
- export default class OrdinalNftApi extends BaseNftApi {
3
- subscanChain: string;
4
- constructor(addresses: string[], chain: string, subscanChain: string);
5
- handleNft(address: string, handleNftParams: HandleNftParams): Promise<void>;
6
- handleNfts(params: HandleNftParams): Promise<void>;
7
- fetchNfts(params: HandleNftParams): Promise<number>;
8
- }
@@ -1,114 +0,0 @@
1
- // Copyright 2019-2022 @subwallet/extension-koni authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { ORDINAL_COLLECTION } from '@subwallet/extension-base/constants';
5
- import { BaseNftApi } from '@subwallet/extension-base/koni/api/nft/nft';
6
- import { fetchExtrinsicParams, fetchRemarkEvent } from '@subwallet/extension-base/koni/api/nft/ordinal_nft/utils';
7
- import { state } from '@subwallet/extension-base/koni/background/handlers';
8
- const parseParamData = (param, event, chain, address) => {
9
- const ordinalData = JSON.parse(param.value);
10
- if ('p' in ordinalData) {
11
- const properties = {};
12
- for (const [key, value] of Object.entries(ordinalData)) {
13
- const _name = key.charAt(0).toUpperCase() + key.slice(1);
14
- properties[_name] = {
15
- value: value
16
- };
17
- }
18
- properties['Block number'] = {
19
- value: event.extrinsic_index.split('-')[0]
20
- };
21
- properties.Timestamp = {
22
- value: event.block_timestamp
23
- };
24
- const op = ordinalData.op.charAt(0).toUpperCase() + ordinalData.op.slice(1);
25
- const nameParams = [op];
26
- if (ordinalData.amt !== undefined) {
27
- nameParams.push(ordinalData.amt);
28
- }
29
- nameParams.push(ordinalData.tick);
30
- const name = nameParams.join(' ');
31
- return {
32
- chain: chain,
33
- collectionId: ORDINAL_COLLECTION,
34
- id: event.extrinsic_hash,
35
- description: JSON.stringify(ordinalData),
36
- name,
37
- owner: address,
38
- properties: properties
39
- };
40
- }
41
- return undefined;
42
- };
43
- export default class OrdinalNftApi extends BaseNftApi {
44
- constructor(addresses, chain, subscanChain) {
45
- super(chain, undefined, addresses);
46
- this.subscanChain = subscanChain;
47
- }
48
- async handleNft(address, handleNftParams) {
49
- const events = await state.subscanService.addRequest(async () => {
50
- return await fetchRemarkEvent(this.subscanChain, address);
51
- });
52
- if (events && events.length) {
53
- const extrinsicIds = events.map(data => data.extrinsic_index);
54
- const extrinsicParams = await state.subscanService.addRequest(async () => {
55
- return await fetchExtrinsicParams(this.subscanChain, extrinsicIds);
56
- });
57
- const items = [];
58
- for (const data of extrinsicParams) {
59
- const {
60
- extrinsic_index: extrinsicIndex,
61
- params
62
- } = data;
63
- const event = events.find(item => item.extrinsic_index === extrinsicIndex);
64
- if (params.length === 1 && event) {
65
- const [param] = params;
66
- if (param.name === 'remark') {
67
- const childParam = {
68
- name: param.name,
69
- type: param.type,
70
- value: param.value
71
- };
72
- const item = parseParamData(childParam, event, this.chain, address);
73
- if (item) {
74
- items.push(item);
75
- }
76
- } else if (param.name === 'calls') {
77
- const children = param.value;
78
- for (const child of children) {
79
- if (child.call_module === 'System' && child.call_name === 'remark_with_event') {
80
- for (const childParam of child.params) {
81
- const item = parseParamData(childParam, event, this.chain, address);
82
- if (item) {
83
- items.push(item);
84
- }
85
- }
86
- }
87
- }
88
- }
89
- }
90
- }
91
- if (items.length) {
92
- // handleNftParams.updateCollection(this.chain, {
93
- // chain: this.chain,
94
- // collectionId: ORDINAL_COLLECTION
95
- // });
96
-
97
- for (const item of items) {
98
- handleNftParams.updateItem(this.chain, item, address);
99
- }
100
- }
101
- }
102
- }
103
- async handleNfts(params) {
104
- await Promise.all(this.addresses.map(address => this.handleNft(address, params)));
105
- }
106
- async fetchNfts(params) {
107
- try {
108
- await this.handleNfts(params);
109
- } catch (e) {
110
- return 0;
111
- }
112
- return 1;
113
- }
114
- }
@@ -1,2 +0,0 @@
1
- export declare const fetchRemarkEvent: (chain: string, address: string) => Promise<import("@subwallet/extension-base/types").SubscanEventBaseItemData[]>;
2
- export declare const fetchExtrinsicParams: (chain: string, extrinsicIndexes: string[]) => Promise<import("@subwallet/extension-base/types").SubscanExtrinsicParam[]>;
@@ -1,33 +0,0 @@
1
- // Copyright 2019-2022 @subwallet/extension-base authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { BASE_FETCH_ORDINAL_EVENT_DATA, GET_EVENT_LIST_API, GET_EXTRINSIC_PARAMS_API } from "./constants.js";
5
- export const fetchRemarkEvent = async (chain, address) => {
6
- const params = {
7
- ...BASE_FETCH_ORDINAL_EVENT_DATA,
8
- address
9
- };
10
- const response = await fetch(GET_EVENT_LIST_API.replace('{{chain}}', chain), {
11
- method: 'POST',
12
- headers: {
13
- 'Content-Type': 'application/json'
14
- },
15
- body: JSON.stringify(params)
16
- });
17
- const data = await response.json();
18
- return data.data.events;
19
- };
20
- export const fetchExtrinsicParams = async (chain, extrinsicIndexes) => {
21
- const params = {
22
- extrinsic_index: extrinsicIndexes
23
- };
24
- const response = await fetch(GET_EXTRINSIC_PARAMS_API.replace('{{chain}}', chain), {
25
- method: 'POST',
26
- headers: {
27
- 'Content-Type': 'application/json'
28
- },
29
- body: JSON.stringify(params)
30
- });
31
- const data = await response.json();
32
- return data.data;
33
- };
@@ -1,10 +0,0 @@
1
- import { _ChainAsset } from '@subwallet/chain-list/types';
2
- import { ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
3
- import { RuntimeDispatchInfo, SpecialYieldPoolInfo, YieldStepDetail } from '@subwallet/extension-base/types';
4
- export declare const syntheticSelectedValidators: string[];
5
- export declare function calculateAlternativeFee(feeInfo: RuntimeDispatchInfo): number;
6
- export declare const DEFAULT_YIELD_FIRST_STEP: YieldStepDetail;
7
- export declare const YIELD_EXTRINSIC_TYPES: ExtrinsicType[];
8
- export declare const YIELD_POOL_STAT_REFRESH_INTERVAL = 90000;
9
- export declare const YIELD_POOL_MIN_AMOUNT_PERCENT: Record<string, number>;
10
- export declare function convertDerivativeToOriginToken(amount: string, poolInfo: SpecialYieldPoolInfo, derivativeTokenInfo: _ChainAsset, originTokenInfo: _ChainAsset): number;
@@ -1,32 +0,0 @@
1
- // Copyright 2019-2022 @subwallet/extension-base
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
5
- import { _getAssetDecimals } from '@subwallet/extension-base/services/chain-service/utils';
6
- import { YieldStepType } from '@subwallet/extension-base/types';
7
- export const syntheticSelectedValidators = ['15MLn9YQaHZ4GMkhK3qXqR5iGGSdULyJ995ctjeBgFRseyi6', '1REAJ1k691g5Eqqg9gL7vvZCBG7FCCZ8zgQkZWd4va5ESih', '1yGJ3h7TQuJWLYSsUVPZbM8aR8UsQXCqMvrFx5Fn1ktiAmq', '16GDRhRYxk42paoK6TfHAqWej8PdDDUwdDazjv4bAn4KGNeb', '13Ybj8CPEArUee78DxUAP9yX3ABmFNVQME1ZH4w8HVncHGzc', '14yx4vPAACZRhoDQm1dyvXD3QdRQyCRRCe5tj1zPomhhS29a', '14Vh8S1DzzycngbAB9vqEgPFR9JpSvmF1ezihTUES1EaHAV', '153YD8ZHD9dRh82U419bSCB5SzWhbdAFzjj4NtA5pMazR2yC', '1LUckyocmz9YzeQZHVpBvYYRGXb3rnSm2tvfz79h3G3JDgP', '14oRE62MB1SWR6h5RTx3GY5HK2oZipi1Gp3zdiLwVYLfEyRZ', '1cFsLn7o74nmjbRyDtMAnMpQMc5ZLsjgCSz9Np2mcejUK83', '15ZvLonEseaWZNy8LDkXXj3Y8bmAjxCjwvpy4pXWSL4nGSBs', '1NebF2xZHb4TJJpiqZZ3reeTo8dZov6LZ49qZqcHHbsmHfo', '1HmAqbBRrWvsqbLkvpiVDkdA2PcctUE5JUe3qokEh1FN455', '15tfUt4iQNjMyhZiJGBf4EpETE2KqtW1nfJwbBT1MvWjvcK9', '12RXTLiaYh59PokjZVhQvKzcfBEB5CvDnjKKUmDUotzcTH3S'];
8
- export function calculateAlternativeFee(feeInfo) {
9
- return feeInfo.partialFee;
10
- }
11
- export const DEFAULT_YIELD_FIRST_STEP = {
12
- id: 0,
13
- name: 'Fill information',
14
- type: YieldStepType.DEFAULT
15
- };
16
- export const YIELD_EXTRINSIC_TYPES = [ExtrinsicType.MINT_VDOT, ExtrinsicType.MINT_LDOT, ExtrinsicType.MINT_SDOT, ExtrinsicType.MINT_QDOT, ExtrinsicType.MINT_STDOT, ExtrinsicType.REDEEM_QDOT, ExtrinsicType.REDEEM_SDOT, ExtrinsicType.REDEEM_VDOT, ExtrinsicType.REDEEM_LDOT, ExtrinsicType.REDEEM_STDOT, ExtrinsicType.STAKING_JOIN_POOL, ExtrinsicType.STAKING_CLAIM_REWARD, ExtrinsicType.STAKING_LEAVE_POOL, ExtrinsicType.STAKING_POOL_WITHDRAW];
17
- export const YIELD_POOL_STAT_REFRESH_INTERVAL = 90000;
18
- export const YIELD_POOL_MIN_AMOUNT_PERCENT = {
19
- DOT___acala_liquid_staking: 0.98,
20
- DOT___bifrost_liquid_staking: 0.99,
21
- DOT___parallel_liquid_staking: 0.97,
22
- default: 0.98
23
- };
24
- export function convertDerivativeToOriginToken(amount, poolInfo, derivativeTokenInfo, originTokenInfo) {
25
- var _poolInfo$statistic, _poolInfo$statistic$a;
26
- const derivativeDecimals = _getAssetDecimals(derivativeTokenInfo);
27
- const originDecimals = _getAssetDecimals(originTokenInfo);
28
- const exchangeRate = ((_poolInfo$statistic = poolInfo.statistic) === null || _poolInfo$statistic === void 0 ? void 0 : (_poolInfo$statistic$a = _poolInfo$statistic.assetEarning) === null || _poolInfo$statistic$a === void 0 ? void 0 : _poolInfo$statistic$a[0].exchangeRate) || 1;
29
- const formattedAmount = parseInt(amount) / 10 ** derivativeDecimals; // TODO: decimals
30
- const minAmount = formattedAmount * exchangeRate;
31
- return Math.floor(minAmount * 10 ** originDecimals);
32
- }