@subwallet/extension-base 1.1.28-beta.1 → 1.1.30-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 (292) hide show
  1. package/background/KoniTypes.d.ts +70 -93
  2. package/background/KoniTypes.js +14 -16
  3. package/background/errors/TransactionError.js +4 -9
  4. package/cjs/background/KoniTypes.js +17 -17
  5. package/cjs/background/errors/TransactionError.js +4 -9
  6. package/cjs/constants/index.js +3 -9
  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 +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 +5 -6
  18. package/cjs/koni/api/staking/relayChain.js +2 -3
  19. package/cjs/koni/background/cron.js +0 -2
  20. package/cjs/koni/background/handlers/Extension.js +88 -326
  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 +18 -88
  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 +16 -2
  27. package/cjs/services/chain-service/utils.js +1 -7
  28. package/cjs/services/event-service/index.js +0 -4
  29. package/cjs/services/keyring-service/index.js +2 -14
  30. package/cjs/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
  31. package/cjs/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
  32. package/cjs/services/migration-service/scripts/index.js +0 -4
  33. package/cjs/services/notification-service/NotificationService.js +1 -1
  34. package/cjs/services/storage-service/DatabaseService.js +0 -47
  35. package/cjs/services/storage-service/databases/index.js +0 -4
  36. package/cjs/services/storage-service/db-stores/NominatorMetadata.js +3 -3
  37. package/cjs/services/transaction-service/event-parser/index.js +0 -58
  38. package/cjs/services/transaction-service/helpers/index.js +1 -3
  39. package/cjs/services/transaction-service/index.js +74 -180
  40. package/cjs/services/transaction-service/utils.js +0 -1
  41. package/cjs/types/index.js +0 -44
  42. package/cjs/utils/fetchStaticData.js +1 -2
  43. package/cjs/utils/index.js +1 -89
  44. package/constants/index.d.ts +0 -2
  45. package/constants/index.js +0 -2
  46. package/koni/api/nft/config.js +23 -33
  47. package/koni/api/nft/index.js +1 -15
  48. package/koni/api/nft/nft.js +23 -2
  49. package/koni/api/staking/bonding/amplitude.js +9 -11
  50. package/koni/api/staking/bonding/astar.js +8 -9
  51. package/koni/api/staking/bonding/index.d.ts +1 -1
  52. package/koni/api/staking/bonding/index.js +1 -5
  53. package/koni/api/staking/bonding/paraChain.js +10 -12
  54. package/koni/api/staking/bonding/relayChain.d.ts +2 -2
  55. package/koni/api/staking/bonding/relayChain.js +30 -33
  56. package/koni/api/staking/bonding/utils.d.ts +38 -15
  57. package/koni/api/staking/bonding/utils.js +69 -85
  58. package/koni/api/staking/index.js +1 -2
  59. package/koni/api/staking/paraChain.js +6 -7
  60. package/koni/api/staking/relayChain.js +3 -4
  61. package/koni/background/cron.js +0 -2
  62. package/koni/background/handlers/Extension.d.ts +1 -14
  63. package/koni/background/handlers/Extension.js +50 -286
  64. package/koni/background/handlers/State.d.ts +2 -18
  65. package/koni/background/handlers/State.js +3 -50
  66. package/koni/background/handlers/index.js +2 -4
  67. package/koni/background/subscription.d.ts +1 -5
  68. package/koni/background/subscription.js +20 -90
  69. package/package.json +8 -311
  70. package/packageInfo.js +1 -1
  71. package/services/campaign-service/index.js +6 -9
  72. package/services/chain-service/constants.d.ts +11 -0
  73. package/services/chain-service/constants.js +14 -1
  74. package/services/chain-service/utils.d.ts +0 -1
  75. package/services/chain-service/utils.js +1 -5
  76. package/services/event-service/index.d.ts +0 -1
  77. package/services/event-service/index.js +0 -4
  78. package/services/event-service/types.d.ts +0 -8
  79. package/services/keyring-service/index.d.ts +1 -2
  80. package/services/keyring-service/index.js +2 -14
  81. package/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
  82. package/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
  83. package/services/migration-service/scripts/index.js +0 -4
  84. package/services/notification-service/NotificationService.js +1 -1
  85. package/services/storage-service/DatabaseService.d.ts +1 -17
  86. package/services/storage-service/DatabaseService.js +0 -47
  87. package/services/storage-service/databases/index.d.ts +1 -3
  88. package/services/storage-service/databases/index.js +0 -4
  89. package/services/storage-service/db-stores/NominatorMetadata.js +3 -3
  90. package/services/subscan-service/index.d.ts +2 -2
  91. package/services/transaction-service/event-parser/index.d.ts +1 -3
  92. package/services/transaction-service/event-parser/index.js +1 -57
  93. package/services/transaction-service/helpers/index.js +1 -3
  94. package/services/transaction-service/index.d.ts +15 -4
  95. package/services/transaction-service/index.js +72 -178
  96. package/services/transaction-service/types.d.ts +0 -2
  97. package/services/transaction-service/utils.js +0 -1
  98. package/types/index.d.ts +0 -5
  99. package/types/index.js +1 -5
  100. package/utils/fetchStaticData.js +1 -2
  101. package/utils/index.d.ts +0 -5
  102. package/utils/index.js +1 -53
  103. package/cjs/koni/api/dotsama/balance.js +0 -464
  104. package/cjs/koni/api/nft/ordinal_nft/constants.js +0 -21
  105. package/cjs/koni/api/nft/ordinal_nft/index.js +0 -121
  106. package/cjs/koni/api/nft/ordinal_nft/utils.js +0 -41
  107. package/cjs/koni/api/yield/helper/utils.js +0 -46
  108. package/cjs/services/earning-service/constants/chains.js +0 -29
  109. package/cjs/services/earning-service/constants/index.js +0 -27
  110. package/cjs/services/earning-service/constants/step.js +0 -18
  111. package/cjs/services/earning-service/handlers/base.js +0 -202
  112. package/cjs/services/earning-service/handlers/index.js +0 -60
  113. package/cjs/services/earning-service/handlers/lending/base.js +0 -20
  114. package/cjs/services/earning-service/handlers/lending/index.js +0 -13
  115. package/cjs/services/earning-service/handlers/lending/interlay.js +0 -168
  116. package/cjs/services/earning-service/handlers/liquid-staking/acala.js +0 -196
  117. package/cjs/services/earning-service/handlers/liquid-staking/base.js +0 -39
  118. package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +0 -257
  119. package/cjs/services/earning-service/handlers/liquid-staking/index.js +0 -34
  120. package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +0 -180
  121. package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +0 -373
  122. package/cjs/services/earning-service/handlers/native-staking/amplitude.js +0 -359
  123. package/cjs/services/earning-service/handlers/native-staking/astar.js +0 -426
  124. package/cjs/services/earning-service/handlers/native-staking/base-para.js +0 -137
  125. package/cjs/services/earning-service/handlers/native-staking/base.js +0 -109
  126. package/cjs/services/earning-service/handlers/native-staking/index.js +0 -34
  127. package/cjs/services/earning-service/handlers/native-staking/para-chain.js +0 -361
  128. package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +0 -512
  129. package/cjs/services/earning-service/handlers/nomination-pool/index.js +0 -501
  130. package/cjs/services/earning-service/handlers/special.js +0 -387
  131. package/cjs/services/earning-service/service.js +0 -327
  132. package/cjs/services/earning-service/utils/index.js +0 -111
  133. package/cjs/services/migration-service/scripts/DeleteEarningData.js +0 -21
  134. package/cjs/services/migration-service/scripts/EnableEarningChains.js +0 -21
  135. package/cjs/services/migration-service/scripts/MigrateEthProvider.js +0 -17
  136. package/cjs/services/migration-service/scripts/MigratePioneerProvider.js +0 -17
  137. package/cjs/services/migration-service/scripts/MigrateProvider.js +0 -29
  138. package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -149
  139. package/cjs/services/mint-campaign-service/campaigns/index.js +0 -13
  140. package/cjs/services/mint-campaign-service/constants.js +0 -11
  141. package/cjs/services/mint-campaign-service/index.js +0 -18
  142. package/cjs/services/storage-service/db-stores/YieldPoolStore.js +0 -36
  143. package/cjs/services/storage-service/db-stores/YieldPositionStore.js +0 -65
  144. package/cjs/services/storage-service/index.js +0 -241
  145. package/cjs/types/campaigns/index.js +0 -16
  146. package/cjs/types/campaigns/unlock-dot.js +0 -1
  147. package/cjs/types/ordinal.js +0 -1
  148. package/cjs/types/transaction.js +0 -1
  149. package/cjs/types/yield/actions/index.js +0 -27
  150. package/cjs/types/yield/actions/join/index.js +0 -38
  151. package/cjs/types/yield/actions/join/step.js +0 -37
  152. package/cjs/types/yield/actions/join/submit.js +0 -1
  153. package/cjs/types/yield/actions/join/validate.js +0 -16
  154. package/cjs/types/yield/actions/others.js +0 -1
  155. package/cjs/types/yield/index.js +0 -27
  156. package/cjs/types/yield/info/account/index.js +0 -49
  157. package/cjs/types/yield/info/account/info.js +0 -1
  158. package/cjs/types/yield/info/account/reward.js +0 -1
  159. package/cjs/types/yield/info/account/target.js +0 -32
  160. package/cjs/types/yield/info/account/unstake.js +0 -27
  161. package/cjs/types/yield/info/base.js +0 -34
  162. package/cjs/types/yield/info/chain/index.js +0 -27
  163. package/cjs/types/yield/info/chain/info.js +0 -1
  164. package/cjs/types/yield/info/chain/target.js +0 -1
  165. package/cjs/types/yield/info/index.js +0 -49
  166. package/cjs/types/yield/info/pallet.js +0 -15
  167. package/cjs/types.js +0 -1
  168. package/cjs/utils/address.js +0 -34
  169. package/cjs/utils/keyring.js +0 -57
  170. package/cjs/utils/object.js +0 -12
  171. package/koni/api/nft/ordinal_nft/constants.d.ts +0 -9
  172. package/koni/api/nft/ordinal_nft/constants.js +0 -12
  173. package/koni/api/nft/ordinal_nft/index.d.ts +0 -8
  174. package/koni/api/nft/ordinal_nft/index.js +0 -114
  175. package/koni/api/nft/ordinal_nft/utils.d.ts +0 -2
  176. package/koni/api/nft/ordinal_nft/utils.js +0 -33
  177. package/koni/api/yield/helper/utils.d.ts +0 -10
  178. package/koni/api/yield/helper/utils.js +0 -32
  179. package/services/earning-service/constants/abis/compound_finance_v2_abi.json +0 -1235
  180. package/services/earning-service/constants/abis/st_liquid_token_abi.json +0 -1355
  181. package/services/earning-service/constants/chains.d.ts +0 -14
  182. package/services/earning-service/constants/chains.js +0 -21
  183. package/services/earning-service/constants/index.d.ts +0 -2
  184. package/services/earning-service/constants/index.js +0 -5
  185. package/services/earning-service/constants/step.d.ts +0 -3
  186. package/services/earning-service/constants/step.js +0 -10
  187. package/services/earning-service/handlers/base.d.ts +0 -105
  188. package/services/earning-service/handlers/base.js +0 -195
  189. package/services/earning-service/handlers/index.d.ts +0 -5
  190. package/services/earning-service/handlers/index.js +0 -8
  191. package/services/earning-service/handlers/lending/base.d.ts +0 -6
  192. package/services/earning-service/handlers/lending/base.js +0 -12
  193. package/services/earning-service/handlers/lending/index.d.ts +0 -1
  194. package/services/earning-service/handlers/lending/index.js +0 -4
  195. package/services/earning-service/handlers/lending/interlay.d.ts +0 -22
  196. package/services/earning-service/handlers/lending/interlay.js +0 -160
  197. package/services/earning-service/handlers/liquid-staking/acala.d.ts +0 -27
  198. package/services/earning-service/handlers/liquid-staking/acala.js +0 -188
  199. package/services/earning-service/handlers/liquid-staking/base.d.ts +0 -8
  200. package/services/earning-service/handlers/liquid-staking/base.js +0 -31
  201. package/services/earning-service/handlers/liquid-staking/bifrost.d.ts +0 -44
  202. package/services/earning-service/handlers/liquid-staking/bifrost.js +0 -246
  203. package/services/earning-service/handlers/liquid-staking/index.d.ts +0 -4
  204. package/services/earning-service/handlers/liquid-staking/index.js +0 -7
  205. package/services/earning-service/handlers/liquid-staking/parallel.d.ts +0 -27
  206. package/services/earning-service/handlers/liquid-staking/parallel.js +0 -172
  207. package/services/earning-service/handlers/liquid-staking/stella-swap.d.ts +0 -36
  208. package/services/earning-service/handlers/liquid-staking/stella-swap.js +0 -363
  209. package/services/earning-service/handlers/native-staking/amplitude.d.ts +0 -22
  210. package/services/earning-service/handlers/native-staking/amplitude.js +0 -350
  211. package/services/earning-service/handlers/native-staking/astar.d.ts +0 -18
  212. package/services/earning-service/handlers/native-staking/astar.js +0 -416
  213. package/services/earning-service/handlers/native-staking/base-para.d.ts +0 -11
  214. package/services/earning-service/handlers/native-staking/base-para.js +0 -129
  215. package/services/earning-service/handlers/native-staking/base.d.ts +0 -19
  216. package/services/earning-service/handlers/native-staking/base.js +0 -101
  217. package/services/earning-service/handlers/native-staking/index.d.ts +0 -4
  218. package/services/earning-service/handlers/native-staking/index.js +0 -7
  219. package/services/earning-service/handlers/native-staking/para-chain.d.ts +0 -15
  220. package/services/earning-service/handlers/native-staking/para-chain.js +0 -353
  221. package/services/earning-service/handlers/native-staking/relay-chain.d.ts +0 -21
  222. package/services/earning-service/handlers/native-staking/relay-chain.js +0 -503
  223. package/services/earning-service/handlers/nomination-pool/index.d.ts +0 -33
  224. package/services/earning-service/handlers/nomination-pool/index.js +0 -492
  225. package/services/earning-service/handlers/special.d.ts +0 -56
  226. package/services/earning-service/handlers/special.js +0 -379
  227. package/services/earning-service/service.d.ts +0 -36
  228. package/services/earning-service/service.js +0 -320
  229. package/services/earning-service/utils/index.d.ts +0 -14
  230. package/services/earning-service/utils/index.js +0 -100
  231. package/services/migration-service/scripts/DeleteEarningData.d.ts +0 -4
  232. package/services/migration-service/scripts/DeleteEarningData.js +0 -13
  233. package/services/migration-service/scripts/EnableEarningChains.d.ts +0 -4
  234. package/services/migration-service/scripts/EnableEarningChains.js +0 -13
  235. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.d.ts +0 -13
  236. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -139
  237. package/services/mint-campaign-service/campaigns/index.d.ts +0 -1
  238. package/services/mint-campaign-service/campaigns/index.js +0 -4
  239. package/services/mint-campaign-service/constants.d.ts +0 -1
  240. package/services/mint-campaign-service/constants.js +0 -4
  241. package/services/mint-campaign-service/index.d.ts +0 -7
  242. package/services/mint-campaign-service/index.js +0 -11
  243. package/services/storage-service/db-stores/YieldPoolStore.d.ts +0 -10
  244. package/services/storage-service/db-stores/YieldPoolStore.js +0 -28
  245. package/services/storage-service/db-stores/YieldPositionStore.d.ts +0 -9
  246. package/services/storage-service/db-stores/YieldPositionStore.js +0 -57
  247. package/types/campaigns/index.d.ts +0 -1
  248. package/types/campaigns/index.js +0 -4
  249. package/types/campaigns/unlock-dot.d.ts +0 -71
  250. package/types/campaigns/unlock-dot.js +0 -1
  251. package/types/ordinal.d.ts +0 -69
  252. package/types/ordinal.js +0 -1
  253. package/types/transaction.d.ts +0 -3
  254. package/types/transaction.js +0 -1
  255. package/types/yield/actions/index.d.ts +0 -2
  256. package/types/yield/actions/index.js +0 -5
  257. package/types/yield/actions/join/index.d.ts +0 -3
  258. package/types/yield/actions/join/index.js +0 -6
  259. package/types/yield/actions/join/step.d.ts +0 -75
  260. package/types/yield/actions/join/step.js +0 -34
  261. package/types/yield/actions/join/submit.d.ts +0 -53
  262. package/types/yield/actions/join/submit.js +0 -1
  263. package/types/yield/actions/join/validate.d.ts +0 -18
  264. package/types/yield/actions/join/validate.js +0 -10
  265. package/types/yield/actions/others.d.ts +0 -60
  266. package/types/yield/actions/others.js +0 -1
  267. package/types/yield/index.d.ts +0 -2
  268. package/types/yield/index.js +0 -5
  269. package/types/yield/info/account/index.d.ts +0 -4
  270. package/types/yield/info/account/index.js +0 -7
  271. package/types/yield/info/account/info.d.ts +0 -112
  272. package/types/yield/info/account/info.js +0 -1
  273. package/types/yield/info/account/reward.d.ts +0 -41
  274. package/types/yield/info/account/reward.js +0 -1
  275. package/types/yield/info/account/target.d.ts +0 -43
  276. package/types/yield/info/account/target.js +0 -27
  277. package/types/yield/info/account/unstake.d.ts +0 -31
  278. package/types/yield/info/account/unstake.js +0 -22
  279. package/types/yield/info/base.d.ts +0 -28
  280. package/types/yield/info/base.js +0 -28
  281. package/types/yield/info/chain/index.d.ts +0 -2
  282. package/types/yield/info/chain/index.js +0 -5
  283. package/types/yield/info/chain/info.d.ts +0 -190
  284. package/types/yield/info/chain/info.js +0 -1
  285. package/types/yield/info/chain/target.d.ts +0 -33
  286. package/types/yield/info/chain/target.js +0 -1
  287. package/types/yield/info/index.d.ts +0 -4
  288. package/types/yield/info/index.js +0 -7
  289. package/types/yield/info/pallet.d.ts +0 -143
  290. package/types/yield/info/pallet.js +0 -9
  291. package/utils/object.d.ts +0 -1
  292. package/utils/object.js +0 -6
@@ -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,34 +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
- exports.YieldCompoundingPeriod = YieldCompoundingPeriod;
29
- (function (YieldCompoundingPeriod) {
30
- YieldCompoundingPeriod[YieldCompoundingPeriod["DAILY"] = 1] = "DAILY";
31
- YieldCompoundingPeriod[YieldCompoundingPeriod["WEEKLY"] = 7] = "WEEKLY";
32
- YieldCompoundingPeriod[YieldCompoundingPeriod["MONTHLY"] = 30] = "MONTHLY";
33
- YieldCompoundingPeriod[YieldCompoundingPeriod["YEARLY"] = 365] = "YEARLY";
34
- })(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$metadata$as;
26
- const derivativeDecimals = _getAssetDecimals(derivativeTokenInfo);
27
- const originDecimals = _getAssetDecimals(originTokenInfo);
28
- const exchangeRate = ((_poolInfo$metadata$as = poolInfo.metadata.assetEarning) === null || _poolInfo$metadata$as === void 0 ? void 0 : _poolInfo$metadata$as[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
- }