@subwallet/extension-base 1.1.28-1 → 1.1.28-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 (290) hide show
  1. package/background/KoniTypes.d.ts +92 -68
  2. package/background/KoniTypes.js +16 -13
  3. package/background/errors/TransactionError.js +9 -0
  4. package/cjs/background/KoniTypes.js +17 -16
  5. package/cjs/background/errors/TransactionError.js +9 -0
  6. package/cjs/constants/index.js +9 -3
  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 +17 -15
  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 +2 -0
  25. package/cjs/koni/background/handlers/Extension.js +323 -69
  26. package/cjs/koni/background/handlers/State.js +57 -4
  27. package/cjs/koni/background/handlers/index.js +4 -2
  28. package/cjs/koni/background/subscription.js +89 -19
  29. package/cjs/services/campaign-service/index.js +9 -6
  30. package/cjs/services/chain-service/constants.js +2 -16
  31. package/cjs/services/chain-service/utils.js +7 -1
  32. package/cjs/services/earning-service/constants/chains.js +29 -0
  33. package/cjs/services/earning-service/constants/index.js +27 -0
  34. package/cjs/services/earning-service/constants/step.js +18 -0
  35. package/cjs/services/earning-service/handlers/base.js +202 -0
  36. package/cjs/services/earning-service/handlers/index.js +60 -0
  37. package/cjs/services/earning-service/handlers/lending/base.js +20 -0
  38. package/cjs/services/earning-service/handlers/lending/index.js +13 -0
  39. package/cjs/services/earning-service/handlers/lending/interlay.js +168 -0
  40. package/cjs/services/earning-service/handlers/liquid-staking/acala.js +196 -0
  41. package/cjs/services/earning-service/handlers/liquid-staking/base.js +39 -0
  42. package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +257 -0
  43. package/cjs/services/earning-service/handlers/liquid-staking/index.js +34 -0
  44. package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +180 -0
  45. package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +373 -0
  46. package/cjs/services/earning-service/handlers/native-staking/amplitude.js +359 -0
  47. package/cjs/services/earning-service/handlers/native-staking/astar.js +426 -0
  48. package/cjs/services/earning-service/handlers/native-staking/base-para.js +137 -0
  49. package/cjs/services/earning-service/handlers/native-staking/base.js +109 -0
  50. package/cjs/services/earning-service/handlers/native-staking/index.js +34 -0
  51. package/cjs/services/earning-service/handlers/native-staking/para-chain.js +361 -0
  52. package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +512 -0
  53. package/cjs/services/earning-service/handlers/nomination-pool/index.js +501 -0
  54. package/cjs/services/earning-service/handlers/special.js +387 -0
  55. package/cjs/services/earning-service/service.js +327 -0
  56. package/cjs/services/earning-service/utils/index.js +111 -0
  57. package/cjs/services/event-service/index.js +4 -0
  58. package/cjs/services/keyring-service/index.js +14 -2
  59. package/cjs/services/migration-service/scripts/DeleteEarningData.js +21 -0
  60. package/cjs/services/migration-service/scripts/EnableEarningChains.js +21 -0
  61. package/cjs/services/migration-service/scripts/MigrateEthProvider.js +17 -0
  62. package/cjs/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
  63. package/cjs/services/migration-service/scripts/MigratePioneerProvider.js +17 -0
  64. package/cjs/services/migration-service/scripts/MigrateProvider.js +29 -0
  65. package/cjs/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
  66. package/cjs/services/migration-service/scripts/index.js +4 -0
  67. package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +149 -0
  68. package/cjs/services/mint-campaign-service/campaigns/index.js +13 -0
  69. package/cjs/services/mint-campaign-service/constants.js +11 -0
  70. package/cjs/services/mint-campaign-service/index.js +18 -0
  71. package/cjs/services/notification-service/NotificationService.js +1 -1
  72. package/cjs/services/storage-service/DatabaseService.js +47 -0
  73. package/cjs/services/storage-service/databases/index.js +4 -0
  74. package/cjs/services/storage-service/db-stores/NominatorMetadata.js +3 -3
  75. package/cjs/services/storage-service/db-stores/YieldPoolStore.js +36 -0
  76. package/cjs/services/storage-service/db-stores/YieldPositionStore.js +65 -0
  77. package/cjs/services/storage-service/index.js +241 -0
  78. package/cjs/services/transaction-service/event-parser/index.js +58 -0
  79. package/cjs/services/transaction-service/helpers/index.js +3 -1
  80. package/cjs/services/transaction-service/index.js +180 -74
  81. package/cjs/services/transaction-service/utils.js +1 -0
  82. package/cjs/types/campaigns/index.js +16 -0
  83. package/cjs/types/campaigns/unlock-dot.js +1 -0
  84. package/cjs/types/index.js +44 -0
  85. package/cjs/types/ordinal.js +1 -0
  86. package/cjs/types/transaction.js +1 -0
  87. package/cjs/types/yield/actions/index.js +27 -0
  88. package/cjs/types/yield/actions/join/index.js +38 -0
  89. package/cjs/types/yield/actions/join/step.js +37 -0
  90. package/cjs/types/yield/actions/join/submit.js +1 -0
  91. package/cjs/types/yield/actions/join/validate.js +16 -0
  92. package/cjs/types/yield/actions/others.js +1 -0
  93. package/cjs/types/yield/index.js +27 -0
  94. package/cjs/types/yield/info/account/index.js +49 -0
  95. package/cjs/types/yield/info/account/info.js +1 -0
  96. package/cjs/types/yield/info/account/reward.js +1 -0
  97. package/cjs/types/yield/info/account/target.js +32 -0
  98. package/cjs/types/yield/info/account/unstake.js +27 -0
  99. package/cjs/types/yield/info/base.js +34 -0
  100. package/cjs/types/yield/info/chain/index.js +27 -0
  101. package/cjs/types/yield/info/chain/info.js +1 -0
  102. package/cjs/types/yield/info/chain/target.js +1 -0
  103. package/cjs/types/yield/info/index.js +49 -0
  104. package/cjs/types/yield/info/pallet.js +15 -0
  105. package/cjs/types.js +1 -0
  106. package/cjs/utils/address.js +34 -0
  107. package/cjs/utils/fetchStaticData.js +2 -1
  108. package/cjs/utils/index.js +89 -1
  109. package/cjs/utils/keyring.js +57 -0
  110. package/cjs/utils/object.js +12 -0
  111. package/constants/index.d.ts +2 -0
  112. package/constants/index.js +2 -0
  113. package/koni/api/nft/config.js +33 -23
  114. package/koni/api/nft/index.js +15 -1
  115. package/koni/api/nft/nft.js +2 -23
  116. package/koni/api/nft/ordinal_nft/constants.d.ts +9 -0
  117. package/koni/api/nft/ordinal_nft/constants.js +12 -0
  118. package/koni/api/nft/ordinal_nft/index.d.ts +8 -0
  119. package/koni/api/nft/ordinal_nft/index.js +114 -0
  120. package/koni/api/nft/ordinal_nft/utils.d.ts +2 -0
  121. package/koni/api/nft/ordinal_nft/utils.js +33 -0
  122. package/koni/api/staking/bonding/amplitude.js +11 -9
  123. package/koni/api/staking/bonding/astar.js +9 -8
  124. package/koni/api/staking/bonding/index.d.ts +1 -1
  125. package/koni/api/staking/bonding/index.js +5 -1
  126. package/koni/api/staking/bonding/paraChain.js +12 -10
  127. package/koni/api/staking/bonding/relayChain.d.ts +2 -2
  128. package/koni/api/staking/bonding/relayChain.js +33 -30
  129. package/koni/api/staking/bonding/utils.d.ts +15 -38
  130. package/koni/api/staking/bonding/utils.js +85 -69
  131. package/koni/api/staking/index.js +2 -1
  132. package/koni/api/staking/paraChain.js +7 -6
  133. package/koni/api/staking/relayChain.js +4 -3
  134. package/koni/api/yield/helper/utils.d.ts +10 -0
  135. package/koni/api/yield/helper/utils.js +32 -0
  136. package/koni/background/cron.js +2 -0
  137. package/koni/background/handlers/Extension.d.ts +14 -1
  138. package/koni/background/handlers/Extension.js +282 -30
  139. package/koni/background/handlers/State.d.ts +18 -2
  140. package/koni/background/handlers/State.js +56 -4
  141. package/koni/background/handlers/index.js +4 -2
  142. package/koni/background/subscription.d.ts +5 -1
  143. package/koni/background/subscription.js +91 -21
  144. package/package.json +307 -4
  145. package/services/campaign-service/index.js +9 -6
  146. package/services/chain-service/constants.d.ts +0 -11
  147. package/services/chain-service/constants.js +1 -14
  148. package/services/chain-service/utils.d.ts +1 -0
  149. package/services/chain-service/utils.js +5 -1
  150. package/services/earning-service/constants/abis/compound_finance_v2_abi.json +1235 -0
  151. package/services/earning-service/constants/abis/st_liquid_token_abi.json +1355 -0
  152. package/services/earning-service/constants/chains.d.ts +14 -0
  153. package/services/earning-service/constants/chains.js +21 -0
  154. package/services/earning-service/constants/index.d.ts +2 -0
  155. package/services/earning-service/constants/index.js +5 -0
  156. package/services/earning-service/constants/step.d.ts +3 -0
  157. package/services/earning-service/constants/step.js +10 -0
  158. package/services/earning-service/handlers/base.d.ts +105 -0
  159. package/services/earning-service/handlers/base.js +195 -0
  160. package/services/earning-service/handlers/index.d.ts +5 -0
  161. package/services/earning-service/handlers/index.js +8 -0
  162. package/services/earning-service/handlers/lending/base.d.ts +6 -0
  163. package/services/earning-service/handlers/lending/base.js +12 -0
  164. package/services/earning-service/handlers/lending/index.d.ts +1 -0
  165. package/services/earning-service/handlers/lending/index.js +4 -0
  166. package/services/earning-service/handlers/lending/interlay.d.ts +22 -0
  167. package/services/earning-service/handlers/lending/interlay.js +160 -0
  168. package/services/earning-service/handlers/liquid-staking/acala.d.ts +27 -0
  169. package/services/earning-service/handlers/liquid-staking/acala.js +188 -0
  170. package/services/earning-service/handlers/liquid-staking/base.d.ts +8 -0
  171. package/services/earning-service/handlers/liquid-staking/base.js +31 -0
  172. package/services/earning-service/handlers/liquid-staking/bifrost.d.ts +44 -0
  173. package/services/earning-service/handlers/liquid-staking/bifrost.js +246 -0
  174. package/services/earning-service/handlers/liquid-staking/index.d.ts +4 -0
  175. package/services/earning-service/handlers/liquid-staking/index.js +7 -0
  176. package/services/earning-service/handlers/liquid-staking/parallel.d.ts +27 -0
  177. package/services/earning-service/handlers/liquid-staking/parallel.js +172 -0
  178. package/services/earning-service/handlers/liquid-staking/stella-swap.d.ts +36 -0
  179. package/services/earning-service/handlers/liquid-staking/stella-swap.js +363 -0
  180. package/services/earning-service/handlers/native-staking/amplitude.d.ts +22 -0
  181. package/services/earning-service/handlers/native-staking/amplitude.js +350 -0
  182. package/services/earning-service/handlers/native-staking/astar.d.ts +18 -0
  183. package/services/earning-service/handlers/native-staking/astar.js +416 -0
  184. package/services/earning-service/handlers/native-staking/base-para.d.ts +11 -0
  185. package/services/earning-service/handlers/native-staking/base-para.js +129 -0
  186. package/services/earning-service/handlers/native-staking/base.d.ts +19 -0
  187. package/services/earning-service/handlers/native-staking/base.js +101 -0
  188. package/services/earning-service/handlers/native-staking/index.d.ts +4 -0
  189. package/services/earning-service/handlers/native-staking/index.js +7 -0
  190. package/services/earning-service/handlers/native-staking/para-chain.d.ts +15 -0
  191. package/services/earning-service/handlers/native-staking/para-chain.js +353 -0
  192. package/services/earning-service/handlers/native-staking/relay-chain.d.ts +21 -0
  193. package/services/earning-service/handlers/native-staking/relay-chain.js +503 -0
  194. package/services/earning-service/handlers/nomination-pool/index.d.ts +33 -0
  195. package/services/earning-service/handlers/nomination-pool/index.js +492 -0
  196. package/services/earning-service/handlers/special.d.ts +56 -0
  197. package/services/earning-service/handlers/special.js +379 -0
  198. package/services/earning-service/service.d.ts +36 -0
  199. package/services/earning-service/service.js +320 -0
  200. package/services/earning-service/utils/index.d.ts +14 -0
  201. package/services/earning-service/utils/index.js +100 -0
  202. package/services/event-service/index.d.ts +1 -0
  203. package/services/event-service/index.js +4 -0
  204. package/services/event-service/types.d.ts +8 -0
  205. package/services/keyring-service/index.d.ts +2 -1
  206. package/services/keyring-service/index.js +14 -2
  207. package/services/migration-service/scripts/DeleteEarningData.d.ts +4 -0
  208. package/services/migration-service/scripts/DeleteEarningData.js +13 -0
  209. package/services/migration-service/scripts/EnableEarningChains.d.ts +4 -0
  210. package/services/migration-service/scripts/EnableEarningChains.js +13 -0
  211. package/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
  212. package/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
  213. package/services/migration-service/scripts/index.js +4 -0
  214. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.d.ts +13 -0
  215. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +139 -0
  216. package/services/mint-campaign-service/campaigns/index.d.ts +1 -0
  217. package/services/mint-campaign-service/campaigns/index.js +4 -0
  218. package/services/mint-campaign-service/constants.d.ts +1 -0
  219. package/services/mint-campaign-service/constants.js +4 -0
  220. package/services/mint-campaign-service/index.d.ts +7 -0
  221. package/services/mint-campaign-service/index.js +11 -0
  222. package/services/notification-service/NotificationService.js +1 -1
  223. package/services/storage-service/DatabaseService.d.ts +17 -1
  224. package/services/storage-service/DatabaseService.js +47 -0
  225. package/services/storage-service/databases/index.d.ts +3 -1
  226. package/services/storage-service/databases/index.js +4 -0
  227. package/services/storage-service/db-stores/NominatorMetadata.js +3 -3
  228. package/services/storage-service/db-stores/YieldPoolStore.d.ts +10 -0
  229. package/services/storage-service/db-stores/YieldPoolStore.js +28 -0
  230. package/services/storage-service/db-stores/YieldPositionStore.d.ts +9 -0
  231. package/services/storage-service/db-stores/YieldPositionStore.js +57 -0
  232. package/services/subscan-service/index.d.ts +2 -2
  233. package/services/transaction-service/event-parser/index.d.ts +3 -1
  234. package/services/transaction-service/event-parser/index.js +57 -1
  235. package/services/transaction-service/helpers/index.js +3 -1
  236. package/services/transaction-service/index.d.ts +4 -15
  237. package/services/transaction-service/index.js +178 -72
  238. package/services/transaction-service/types.d.ts +2 -0
  239. package/services/transaction-service/utils.js +1 -0
  240. package/types/campaigns/index.d.ts +1 -0
  241. package/types/campaigns/index.js +4 -0
  242. package/types/campaigns/unlock-dot.d.ts +71 -0
  243. package/types/campaigns/unlock-dot.js +1 -0
  244. package/types/index.d.ts +5 -0
  245. package/types/index.js +5 -1
  246. package/types/ordinal.d.ts +69 -0
  247. package/types/ordinal.js +1 -0
  248. package/types/transaction.d.ts +3 -0
  249. package/types/transaction.js +1 -0
  250. package/types/yield/actions/index.d.ts +2 -0
  251. package/types/yield/actions/index.js +5 -0
  252. package/types/yield/actions/join/index.d.ts +3 -0
  253. package/types/yield/actions/join/index.js +6 -0
  254. package/types/yield/actions/join/step.d.ts +75 -0
  255. package/types/yield/actions/join/step.js +34 -0
  256. package/types/yield/actions/join/submit.d.ts +53 -0
  257. package/types/yield/actions/join/submit.js +1 -0
  258. package/types/yield/actions/join/validate.d.ts +18 -0
  259. package/types/yield/actions/join/validate.js +10 -0
  260. package/types/yield/actions/others.d.ts +60 -0
  261. package/types/yield/actions/others.js +1 -0
  262. package/types/yield/index.d.ts +2 -0
  263. package/types/yield/index.js +5 -0
  264. package/types/yield/info/account/index.d.ts +4 -0
  265. package/types/yield/info/account/index.js +7 -0
  266. package/types/yield/info/account/info.d.ts +112 -0
  267. package/types/yield/info/account/info.js +1 -0
  268. package/types/yield/info/account/reward.d.ts +41 -0
  269. package/types/yield/info/account/reward.js +1 -0
  270. package/types/yield/info/account/target.d.ts +43 -0
  271. package/types/yield/info/account/target.js +27 -0
  272. package/types/yield/info/account/unstake.d.ts +31 -0
  273. package/types/yield/info/account/unstake.js +22 -0
  274. package/types/yield/info/base.d.ts +28 -0
  275. package/types/yield/info/base.js +28 -0
  276. package/types/yield/info/chain/index.d.ts +2 -0
  277. package/types/yield/info/chain/index.js +5 -0
  278. package/types/yield/info/chain/info.d.ts +190 -0
  279. package/types/yield/info/chain/info.js +1 -0
  280. package/types/yield/info/chain/target.d.ts +33 -0
  281. package/types/yield/info/chain/target.js +1 -0
  282. package/types/yield/info/index.d.ts +4 -0
  283. package/types/yield/info/index.js +7 -0
  284. package/types/yield/info/pallet.d.ts +143 -0
  285. package/types/yield/info/pallet.js +9 -0
  286. package/utils/fetchStaticData.js +2 -1
  287. package/utils/index.d.ts +5 -0
  288. package/utils/index.js +53 -1
  289. package/utils/object.d.ts +1 -0
  290. package/utils/object.js +6 -0
@@ -6,14 +6,14 @@ import { TransactionError } from '@subwallet/extension-base/background/errors/Tr
6
6
  import { BasicTxErrorType, BasicTxWarningCode, ChainType, EvmProviderErrorType, ExtrinsicStatus, ExtrinsicType, NotificationType, TransactionDirection } from '@subwallet/extension-base/background/KoniTypes';
7
7
  import { TransactionWarning } from '@subwallet/extension-base/background/warnings/TransactionWarning';
8
8
  import { ALL_ACCOUNT_KEY } from '@subwallet/extension-base/constants';
9
- import { _TRANSFER_CHAIN_GROUP } from '@subwallet/extension-base/services/chain-service/constants';
10
- import { _getChainNativeTokenBasicInfo, _getEvmChainId } from '@subwallet/extension-base/services/chain-service/utils';
9
+ import { _getAssetDecimals, _getAssetSymbol, _getChainNativeTokenBasicInfo, _getEvmChainId, _isChainEvmCompatible } from '@subwallet/extension-base/services/chain-service/utils';
11
10
  import { EXTENSION_REQUEST_URL } from '@subwallet/extension-base/services/request-service/constants';
12
11
  import { TRANSACTION_TIMEOUT } from '@subwallet/extension-base/services/transaction-service/constants';
13
- import { parseTransferEventLogs, parseXcmEventLogs } from '@subwallet/extension-base/services/transaction-service/event-parser';
12
+ import { parseLiquidStakingEvents, parseLiquidStakingFastUnstakeEvents, parseTransferEventLogs, parseXcmEventLogs } from '@subwallet/extension-base/services/transaction-service/event-parser';
14
13
  import { getBaseTransactionInfo, getTransactionId, isSubstrateTransaction } from '@subwallet/extension-base/services/transaction-service/helpers';
15
14
  import { getExplorerLink, parseTransactionData } from '@subwallet/extension-base/services/transaction-service/utils';
16
15
  import { isWalletConnectRequest } from '@subwallet/extension-base/services/wallet-connect-service/helpers';
16
+ import { YieldPoolType } from '@subwallet/extension-base/types';
17
17
  import { reformatAddress } from '@subwallet/extension-base/utils';
18
18
  import { anyNumberToBN, recalculateGasPrice } from '@subwallet/extension-base/utils/eth';
19
19
  import { mergeTransactionAndSignature } from '@subwallet/extension-base/utils/eth/mergeTransactionAndSignature';
@@ -26,20 +26,15 @@ import EventEmitter from 'eventemitter3';
26
26
  import { t } from 'i18next';
27
27
  import { BehaviorSubject } from 'rxjs';
28
28
  import { isHex } from '@polkadot/util';
29
+ import { _TRANSFER_CHAIN_GROUP } from "../chain-service/constants.js";
29
30
  export default class TransactionService {
30
31
  transactionSubject = new BehaviorSubject({});
31
32
  watchTransactionSubscribes = {};
32
33
  get transactions() {
33
34
  return this.transactionSubject.getValue();
34
35
  }
35
- constructor(chainService, eventService, requestService, balanceService, historyService, notificationService, databaseService) {
36
- this.chainService = chainService;
37
- this.eventService = eventService;
38
- this.requestService = requestService;
39
- this.balanceService = balanceService;
40
- this.historyService = historyService;
41
- this.notificationService = notificationService;
42
- this.databaseService = databaseService;
36
+ constructor(state) {
37
+ this.state = state;
43
38
  }
44
39
  get allTransactions() {
45
40
  return Object.values(this.transactions);
@@ -96,7 +91,7 @@ export default class TransactionService {
96
91
  decimals: 0,
97
92
  value: ''
98
93
  };
99
- const chainInfo = this.chainService.getChainInfoByKey(chain);
94
+ const chainInfo = this.state.chainService.getChainInfoByKey(chain);
100
95
  if (!chainInfo) {
101
96
  validationResponse.errors.push(new TransactionError(BasicTxErrorType.INTERNAL_ERROR, t('Cannot find network')));
102
97
  } else {
@@ -111,7 +106,7 @@ export default class TransactionService {
111
106
  if (isSubstrateTransaction(transaction)) {
112
107
  estimateFee.value = (await transaction.paymentInfo(address)).partialFee.toString();
113
108
  } else {
114
- const web3 = this.chainService.getEvmApi(chain);
109
+ const web3 = this.state.chainService.getEvmApi(chain);
115
110
  if (!web3) {
116
111
  validationResponse.errors.push(new TransactionError(BasicTxErrorType.CHAIN_DISCONNECTED, undefined));
117
112
  } else {
@@ -145,32 +140,35 @@ export default class TransactionService {
145
140
 
146
141
  // Balance
147
142
  const transferNative = validationResponse.transferNativeAmount || '0';
148
- const nativeTokenInfo = this.chainService.getNativeTokenInfo(chain);
149
- const balance = await this.balanceService.getTokenFreeBalance(address, chain, nativeTokenInfo.slug);
143
+ const nativeTokenInfo = this.state.chainService.getNativeTokenInfo(chain);
144
+ const balance = await this.state.balanceService.getTokenFreeBalance(address, chain, nativeTokenInfo.slug);
150
145
  const existentialDeposit = nativeTokenInfo.minAmount || '0';
151
146
  const feeNum = parseInt(estimateFee.value);
152
147
  const balanceNum = parseInt(balance.value);
153
148
  const edNum = parseInt(existentialDeposit);
154
149
  const transferNativeNum = parseInt(transferNative);
155
- if (!new BigN(balance.value).gt(0)) {
156
- validationResponse.errors.push(new TransactionError(BasicTxErrorType.NOT_ENOUGH_BALANCE));
157
- }
158
- if (transferNativeNum + feeNum > balanceNum) {
159
- if (!isTransferAll) {
150
+ if (!validationInput.skipFeeValidation) {
151
+ // TODO
152
+ if (!new BigN(balance.value).gt(0)) {
160
153
  validationResponse.errors.push(new TransactionError(BasicTxErrorType.NOT_ENOUGH_BALANCE));
161
- } else {
162
- if ([..._TRANSFER_CHAIN_GROUP.acala, ..._TRANSFER_CHAIN_GROUP.genshiro, ..._TRANSFER_CHAIN_GROUP.bitcountry, ..._TRANSFER_CHAIN_GROUP.statemine].includes(chain)) {
163
- // Chain not have transfer all function
154
+ }
155
+ if (transferNativeNum + feeNum > balanceNum) {
156
+ if (!isTransferAll) {
164
157
  validationResponse.errors.push(new TransactionError(BasicTxErrorType.NOT_ENOUGH_BALANCE));
158
+ } else {
159
+ if ([..._TRANSFER_CHAIN_GROUP.acala, ..._TRANSFER_CHAIN_GROUP.genshiro, ..._TRANSFER_CHAIN_GROUP.bitcountry, ..._TRANSFER_CHAIN_GROUP.statemine].includes(chain)) {
160
+ // Chain not have transfer all function
161
+ validationResponse.errors.push(new TransactionError(BasicTxErrorType.NOT_ENOUGH_BALANCE));
162
+ }
165
163
  }
166
164
  }
167
- }
168
- if (!isTransferAll) {
169
- if (balanceNum - (transferNativeNum + feeNum) < edNum) {
170
- if (edAsWarning) {
171
- validationResponse.warnings.push(new TransactionWarning(BasicTxWarningCode.NOT_ENOUGH_EXISTENTIAL_DEPOSIT));
172
- } else {
173
- validationResponse.errors.push(new TransactionError(BasicTxErrorType.NOT_ENOUGH_EXISTENTIAL_DEPOSIT));
165
+ if (!isTransferAll) {
166
+ if (balanceNum - (transferNativeNum + feeNum) < edNum) {
167
+ if (edAsWarning) {
168
+ validationResponse.warnings.push(new TransactionWarning(BasicTxWarningCode.NOT_ENOUGH_EXISTENTIAL_DEPOSIT));
169
+ } else {
170
+ validationResponse.errors.push(new TransactionError(BasicTxErrorType.NOT_ENOUGH_EXISTENTIAL_DEPOSIT));
171
+ }
174
172
  }
175
173
  }
176
174
  }
@@ -237,12 +235,21 @@ export default class TransactionService {
237
235
  }
238
236
  validatedTransaction.warnings = [];
239
237
  const emitter = await this.addTransaction(validatedTransaction);
240
- await new Promise(resolve => {
241
- emitter.on('signed', data => {
242
- validatedTransaction.id = data.id;
243
- validatedTransaction.extrinsicHash = data.extrinsicHash;
244
- resolve();
245
- });
238
+ await new Promise((resolve, reject) => {
239
+ // TODO
240
+ if (transaction.resolveOnDone) {
241
+ emitter.on('success', data => {
242
+ validatedTransaction.id = data.id;
243
+ validatedTransaction.extrinsicHash = data.extrinsicHash;
244
+ resolve();
245
+ });
246
+ } else {
247
+ emitter.on('signed', data => {
248
+ validatedTransaction.id = data.id;
249
+ validatedTransaction.extrinsicHash = data.extrinsicHash;
250
+ resolve();
251
+ });
252
+ }
246
253
  emitter.on('error', data => {
247
254
  if (data.errors.length > 0) {
248
255
  validatedTransaction.errors.push(...data.errors);
@@ -308,7 +315,7 @@ export default class TransactionService {
308
315
  }
309
316
  getTransactionLink(id) {
310
317
  const transaction = this.getTransaction(id);
311
- const chainInfo = this.chainService.getChainInfoByKey(transaction.chain);
318
+ const chainInfo = this.state.chainService.getChainInfoByKey(transaction.chain);
312
319
  return getExplorerLink(chainInfo, transaction.extrinsicHash, 'tx');
313
320
  }
314
321
  transactionToHistories(id, startBlock, nonce, eventLogs) {
@@ -336,7 +343,7 @@ export default class TransactionService {
336
343
  nonce: nonce !== null && nonce !== void 0 ? nonce : 0,
337
344
  startBlock: startBlock || 0
338
345
  };
339
- const chainInfo = this.chainService.getChainInfoByKey(transaction.chain);
346
+ const chainInfo = this.state.chainService.getChainInfoByKey(transaction.chain);
340
347
  const nativeAsset = _getChainNativeTokenBasicInfo(chainInfo);
341
348
  const baseNativeAmount = {
342
349
  value: '0',
@@ -350,7 +357,7 @@ export default class TransactionService {
350
357
  {
351
358
  const inputData = parseTransactionData(transaction.data);
352
359
  historyItem.to = inputData.to;
353
- const sendingTokenInfo = this.chainService.getAssetBySlug(inputData.tokenSlug);
360
+ const sendingTokenInfo = this.state.chainService.getAssetBySlug(inputData.tokenSlug);
354
361
  historyItem.amount = {
355
362
  value: inputData.value || '0',
356
363
  decimals: sendingTokenInfo.decimals || 0,
@@ -363,7 +370,7 @@ export default class TransactionService {
363
370
  {
364
371
  const inputData = parseTransactionData(transaction.data);
365
372
  historyItem.to = inputData.to;
366
- const sendingTokenInfo = this.chainService.getAssetBySlug(inputData.tokenSlug);
373
+ const sendingTokenInfo = this.state.chainService.getAssetBySlug(inputData.tokenSlug);
367
374
  historyItem.amount = {
368
375
  value: inputData.value || '0',
369
376
  decimals: sendingTokenInfo.decimals || 0,
@@ -376,7 +383,7 @@ export default class TransactionService {
376
383
  {
377
384
  const inputData = parseTransactionData(transaction.data);
378
385
  historyItem.to = inputData.to;
379
- const sendingTokenInfo = this.chainService.getAssetBySlug(inputData.tokenSlug);
386
+ const sendingTokenInfo = this.state.chainService.getAssetBySlug(inputData.tokenSlug);
380
387
  historyItem.amount = {
381
388
  value: inputData.value || '0',
382
389
  decimals: sendingTokenInfo.decimals || 0,
@@ -425,17 +432,29 @@ export default class TransactionService {
425
432
  case ExtrinsicType.STAKING_UNBOND:
426
433
  {
427
434
  const data = parseTransactionData(transaction.data);
428
- historyItem.to = data.validatorAddress || '';
429
- historyItem.amount = {
430
- ...baseNativeAmount,
431
- value: data.amount || '0'
432
- };
435
+ if (data.isLiquidStaking && data.derivativeTokenInfo && data.exchangeRate && data.inputTokenInfo) {
436
+ historyItem.amount = {
437
+ decimals: _getAssetDecimals(data.derivativeTokenInfo),
438
+ symbol: _getAssetSymbol(data.derivativeTokenInfo),
439
+ value: data.amount
440
+ };
441
+ historyItem.additionalInfo = {
442
+ inputTokenSlug: data.inputTokenInfo.slug,
443
+ exchangeRate: data.exchangeRate
444
+ };
445
+ } else {
446
+ historyItem.to = data.validatorAddress || '';
447
+ historyItem.amount = {
448
+ ...baseNativeAmount,
449
+ value: data.amount || '0'
450
+ };
451
+ }
433
452
  }
434
453
  break;
435
454
  case ExtrinsicType.STAKING_LEAVE_POOL:
436
455
  {
437
456
  const data = parseTransactionData(transaction.data);
438
- historyItem.to = data.nominatorMetadata.address || '';
457
+ historyItem.to = data.address || '';
439
458
  historyItem.amount = {
440
459
  ...baseNativeAmount,
441
460
  value: data.amount || '0'
@@ -454,7 +473,7 @@ export default class TransactionService {
454
473
  case ExtrinsicType.STAKING_WITHDRAW:
455
474
  {
456
475
  const data = parseTransactionData(transaction.data);
457
- historyItem.to = data.validatorAddress || '';
476
+ historyItem.to = data.unstakingInfo.validatorAddress || '';
458
477
  historyItem.amount = {
459
478
  ...baseNativeAmount,
460
479
  value: data.unstakingInfo.claimable || '0'
@@ -479,6 +498,68 @@ export default class TransactionService {
479
498
  historyItem.to = (data === null || data === void 0 ? void 0 : data.to) || '';
480
499
  break;
481
500
  }
501
+ case ExtrinsicType.MINT_STDOT:
502
+ case ExtrinsicType.MINT_QDOT:
503
+ case ExtrinsicType.MINT_LDOT:
504
+ case ExtrinsicType.MINT_SDOT:
505
+
506
+ // eslint-disable-next-line no-fallthrough
507
+ case ExtrinsicType.MINT_VDOT:
508
+ {
509
+ const data = parseTransactionData(transaction.data);
510
+ const params = data.data;
511
+ const inputTokenInfo = this.state.chainService.getAssetBySlug(params.inputTokenSlug);
512
+ const isFeePaidWithInputAsset = params.feeTokenSlug === params.inputTokenSlug;
513
+ historyItem.amount = {
514
+ value: params.amount,
515
+ symbol: _getAssetSymbol(inputTokenInfo),
516
+ decimals: _getAssetDecimals(inputTokenInfo)
517
+ };
518
+ historyItem.additionalInfo = {
519
+ derivativeTokenSlug: params.derivativeTokenSlug,
520
+ exchangeRate: params.exchangeRate
521
+ };
522
+ eventLogs && !_isChainEvmCompatible(chainInfo) && parseLiquidStakingEvents(historyItem, eventLogs, inputTokenInfo, chainInfo, isFeePaidWithInputAsset, extrinsicType);
523
+ break;
524
+ }
525
+ case ExtrinsicType.REDEEM_QDOT:
526
+ {
527
+ const data = parseTransactionData(transaction.data);
528
+ const yieldPoolInfo = data.yieldPoolInfo;
529
+ if (yieldPoolInfo.metadata.derivativeAssets) {
530
+ const inputTokenSlug = yieldPoolInfo.metadata.inputAsset;
531
+ const inputTokenInfo = this.state.chainService.getAssetBySlug(inputTokenSlug);
532
+ historyItem.amount = {
533
+ value: data.amount,
534
+ symbol: _getAssetSymbol(inputTokenInfo),
535
+ decimals: _getAssetDecimals(inputTokenInfo)
536
+ };
537
+ eventLogs && parseLiquidStakingFastUnstakeEvents(historyItem, eventLogs, chainInfo, extrinsicType);
538
+ }
539
+ break;
540
+ }
541
+ case ExtrinsicType.REDEEM_STDOT:
542
+ case ExtrinsicType.REDEEM_LDOT:
543
+ case ExtrinsicType.REDEEM_SDOT:
544
+
545
+ // eslint-disable-next-line no-fallthrough
546
+ case ExtrinsicType.REDEEM_VDOT:
547
+ {
548
+ const data = parseTransactionData(transaction.data);
549
+ const yieldPoolInfo = data.yieldPoolInfo;
550
+ if (yieldPoolInfo.metadata.derivativeAssets) {
551
+ const derivativeTokenSlug = yieldPoolInfo.metadata.derivativeAssets[0];
552
+ const derivativeTokenInfo = this.state.chainService.getAssetBySlug(derivativeTokenSlug);
553
+ const chainInfo = this.state.chainService.getChainInfoByKey(data.yieldPoolInfo.chain);
554
+ historyItem.amount = {
555
+ value: data.amount,
556
+ symbol: _getAssetSymbol(derivativeTokenInfo),
557
+ decimals: _getAssetDecimals(derivativeTokenInfo)
558
+ };
559
+ eventLogs && !_isChainEvmCompatible(chainInfo) && parseLiquidStakingFastUnstakeEvents(historyItem, eventLogs, chainInfo, extrinsicType);
560
+ }
561
+ break;
562
+ }
482
563
  case ExtrinsicType.UNKNOWN:
483
564
  break;
484
565
  }
@@ -524,7 +605,7 @@ export default class TransactionService {
524
605
  });
525
606
 
526
607
  // Create Input History Transaction History
527
- this.historyService.insertHistories(this.transactionToHistories(id, startBlock, nonce)).catch(console.error);
608
+ this.state.historyService.insertHistories(this.transactionToHistories(id, startBlock, nonce)).catch(console.error);
528
609
  console.debug(`Transaction "${id}" is sent`);
529
610
  }
530
611
  onHasTransactionHash({
@@ -541,8 +622,12 @@ export default class TransactionService {
541
622
  this.updateTransaction(id, updateData);
542
623
 
543
624
  // In this case transaction id is the same as extrinsic hash and will change after below update
544
- this.historyService.updateHistoryByExtrinsicHash(id, updateData).catch(console.error);
625
+ this.state.historyService.updateHistoryByExtrinsicHash(id, updateData).catch(console.error);
545
626
  console.debug(`Transaction "${id}" is submitted with hash ${extrinsicHash || ''}`);
627
+ const transaction = this.getTransaction(id);
628
+ if ([ExtrinsicType.STAKING_JOIN_POOL, ExtrinsicType.JOIN_YIELD_POOL, ExtrinsicType.MINT_LDOT, ExtrinsicType.MINT_QDOT, ExtrinsicType.MINT_SDOT, ExtrinsicType.MINT_VDOT].includes(transaction.extrinsicType)) {
629
+ this.handlePostEarningTransaction(id);
630
+ }
546
631
  }
547
632
  handlePostProcessing(id) {
548
633
  // must be done after success/failure to make sure the transaction is finalized
@@ -551,15 +636,15 @@ export default class TransactionService {
551
636
  const inputData = parseTransactionData(transaction.data);
552
637
  try {
553
638
  const sender = keyring.getPair(inputData.senderAddress);
554
- sender && this.databaseService.handleNftTransfer(transaction.chain, [sender.address, ALL_ACCOUNT_KEY], inputData.nftItem).then(() => {
555
- this.eventService.emit('transaction.transferNft', undefined);
639
+ sender && this.state.dbService.handleNftTransfer(transaction.chain, [sender.address, ALL_ACCOUNT_KEY], inputData.nftItem).then(() => {
640
+ this.state.eventService.emit('transaction.transferNft', undefined);
556
641
  }).catch(console.error);
557
642
  } catch (e) {
558
643
  console.error(e);
559
644
  }
560
645
  try {
561
646
  const recipient = keyring.getPair(inputData.recipientAddress);
562
- recipient && this.databaseService.addNft(recipient.address, {
647
+ recipient && this.state.dbService.addNft(recipient.address, {
563
648
  ...inputData.nftItem,
564
649
  owner: recipient.address
565
650
  }).catch(console.error);
@@ -567,7 +652,7 @@ export default class TransactionService {
567
652
  console.error(e);
568
653
  }
569
654
  } else if ([ExtrinsicType.STAKING_BOND, ExtrinsicType.STAKING_UNBOND, ExtrinsicType.STAKING_WITHDRAW, ExtrinsicType.STAKING_CANCEL_UNSTAKE, ExtrinsicType.STAKING_CLAIM_REWARD, ExtrinsicType.STAKING_JOIN_POOL, ExtrinsicType.STAKING_POOL_WITHDRAW, ExtrinsicType.STAKING_LEAVE_POOL].includes(transaction.extrinsicType)) {
570
- this.eventService.emit('transaction.submitStaking', transaction.chain);
655
+ this.state.eventService.emit('transaction.submitStaking', transaction.chain);
571
656
  }
572
657
  }
573
658
  onSuccess({
@@ -583,14 +668,14 @@ export default class TransactionService {
583
668
  });
584
669
 
585
670
  // Write success transaction history
586
- this.historyService.updateHistoryByExtrinsicHash(transaction.extrinsicHash, {
671
+ this.state.historyService.updateHistoryByExtrinsicHash(transaction.extrinsicHash, {
587
672
  extrinsicHash,
588
673
  status: ExtrinsicStatus.SUCCESS,
589
674
  blockNumber: blockNumber || 0,
590
675
  blockHash: blockHash || ''
591
676
  }).catch(console.error);
592
- const info = isHex(extrinsicHash) ? extrinsicHash : getBaseTransactionInfo(transaction, this.chainService.getChainInfoMap());
593
- this.notificationService.notify({
677
+ const info = isHex(extrinsicHash) ? extrinsicHash : getBaseTransactionInfo(transaction, this.state.chainService.getChainInfoMap());
678
+ this.state.notificationService.notify({
594
679
  type: NotificationType.SUCCESS,
595
680
  title: t('Transaction completed'),
596
681
  message: t('Transaction {{info}} completed', {
@@ -603,7 +688,7 @@ export default class TransactionService {
603
688
  },
604
689
  notifyViaBrowser: true
605
690
  });
606
- this.eventService.emit('transaction.done', transaction);
691
+ this.state.eventService.emit('transaction.done', transaction);
607
692
  }
608
693
  onFailed({
609
694
  blockHash,
@@ -622,14 +707,14 @@ export default class TransactionService {
622
707
  });
623
708
 
624
709
  // Write failed transaction history
625
- this.historyService.updateHistoryByExtrinsicHash(transaction.extrinsicHash, {
710
+ this.state.historyService.updateHistoryByExtrinsicHash(transaction.extrinsicHash, {
626
711
  extrinsicHash: extrinsicHash || transaction.extrinsicHash,
627
712
  status: nextStatus,
628
713
  blockNumber: blockNumber || 0,
629
714
  blockHash: blockHash || ''
630
715
  }).catch(console.error);
631
- const info = isHex(transaction === null || transaction === void 0 ? void 0 : transaction.extrinsicHash) ? transaction === null || transaction === void 0 ? void 0 : transaction.extrinsicHash : getBaseTransactionInfo(transaction, this.chainService.getChainInfoMap());
632
- this.notificationService.notify({
716
+ const info = isHex(transaction === null || transaction === void 0 ? void 0 : transaction.extrinsicHash) ? transaction === null || transaction === void 0 ? void 0 : transaction.extrinsicHash : getBaseTransactionInfo(transaction, this.state.chainService.getChainInfoMap());
717
+ this.state.notificationService.notify({
633
718
  type: NotificationType.ERROR,
634
719
  title: t('Transaction failed'),
635
720
  message: t('Transaction {{info}} failed', {
@@ -643,11 +728,11 @@ export default class TransactionService {
643
728
  notifyViaBrowser: true
644
729
  });
645
730
  }
646
- this.eventService.emit('transaction.failed', transaction);
731
+ this.state.eventService.emit('transaction.failed', transaction);
647
732
  }
648
733
  generateHashPayload(chain, transaction) {
649
734
  var _transaction$nonce;
650
- const chainInfo = this.chainService.getChainInfoByKey(chain);
735
+ const chainInfo = this.state.chainService.getChainInfoByKey(chain);
651
736
  const txObject = {
652
737
  nonce: (_transaction$nonce = transaction.nonce) !== null && _transaction$nonce !== void 0 ? _transaction$nonce : 0,
653
738
  gasPrice: addHexPrefix(anyNumberToBN(transaction.gasPrice).toString(16)),
@@ -668,8 +753,8 @@ export default class TransactionService {
668
753
  }) {
669
754
  var _payload$nonce;
670
755
  const payload = transaction;
671
- const evmApi = this.chainService.getEvmApi(chain);
672
- const chainInfo = this.chainService.getChainInfoByKey(chain);
756
+ const evmApi = this.state.chainService.getEvmApi(chain);
757
+ const chainInfo = this.state.chainService.getChainInfoByKey(chain);
673
758
  const accountPair = keyring.getPair(address);
674
759
  const account = {
675
760
  address,
@@ -699,7 +784,7 @@ export default class TransactionService {
699
784
 
700
785
  // Set unique nonce to avoid transaction errors
701
786
  if (!payload.nonce) {
702
- const evmApi = this.chainService.getEvmApi(chain);
787
+ const evmApi = this.state.chainService.getEvmApi(chain);
703
788
  payload.nonce = await evmApi.api.eth.getTransactionCount(address);
704
789
  }
705
790
  if (!payload.chainId) {
@@ -734,7 +819,7 @@ export default class TransactionService {
734
819
  extrinsicHash: id
735
820
  };
736
821
  if (isInjected) {
737
- this.requestService.addConfirmation(id, url || EXTENSION_REQUEST_URL, 'evmWatchTransactionRequest', payload, {}).then(async ({
822
+ this.state.requestService.addConfirmation(id, url || EXTENSION_REQUEST_URL, 'evmWatchTransactionRequest', payload, {}).then(async ({
738
823
  isApproved,
739
824
  payload
740
825
  }) => {
@@ -742,7 +827,7 @@ export default class TransactionService {
742
827
  if (!payload) {
743
828
  throw new EvmProviderError(EvmProviderErrorType.UNAUTHORIZED, 'Bad signature');
744
829
  }
745
- const web3Api = this.chainService.getEvmApi(chain).api;
830
+ const web3Api = this.state.chainService.getEvmApi(chain).api;
746
831
 
747
832
  // Emit signed event
748
833
  emitter.emit('signed', eventData);
@@ -798,7 +883,7 @@ export default class TransactionService {
798
883
  emitter.emit('error', eventData);
799
884
  });
800
885
  } else {
801
- this.requestService.addConfirmation(id, url || EXTENSION_REQUEST_URL, 'evmSendTransactionRequest', payload, {}).then(async ({
886
+ this.state.requestService.addConfirmation(id, url || EXTENSION_REQUEST_URL, 'evmSendTransactionRequest', payload, {}).then(async ({
802
887
  isApproved,
803
888
  payload
804
889
  }) => {
@@ -807,7 +892,7 @@ export default class TransactionService {
807
892
  if (!payload) {
808
893
  throw new EvmProviderError(EvmProviderErrorType.UNAUTHORIZED, t('Failed to sign'));
809
894
  }
810
- const web3Api = this.chainService.getEvmApi(chain).api;
895
+ const web3Api = this.state.chainService.getEvmApi(chain).api;
811
896
  if (!isExternal) {
812
897
  signedTransaction = payload;
813
898
  } else {
@@ -874,7 +959,7 @@ export default class TransactionService {
874
959
  transaction.signAsync(address, {
875
960
  signer: {
876
961
  signPayload: async payload => {
877
- const signing = await this.requestService.signInternalTransaction(id, address, url || EXTENSION_REQUEST_URL, payload);
962
+ const signing = await this.state.requestService.signInternalTransaction(id, address, url || EXTENSION_REQUEST_URL, payload);
878
963
  return {
879
964
  id: new Date().getTime(),
880
965
  signature: signing.signature
@@ -886,7 +971,7 @@ export default class TransactionService {
886
971
  emitter.emit('signed', eventData);
887
972
 
888
973
  // Send transaction
889
- const api = this.chainService.getSubstrateApi(chain);
974
+ const api = this.state.chainService.getSubstrateApi(chain);
890
975
  eventData.nonce = rs.nonce.toNumber();
891
976
  eventData.startBlock = (await api.api.query.system.number()).toPrimitive();
892
977
  this.handleTransactionTimeout(emitter, eventData);
@@ -954,6 +1039,27 @@ export default class TransactionService {
954
1039
  clearTimeout(timeout);
955
1040
  });
956
1041
  }
1042
+ handlePostEarningTransaction(id) {
1043
+ const transaction = this.getTransaction(id);
1044
+ const data = transaction.data;
1045
+ const slug = data.data.slug;
1046
+ const poolHandler = this.state.earningService.getPoolHandler(slug);
1047
+ if (poolHandler) {
1048
+ const type = poolHandler.type;
1049
+ if (type === YieldPoolType.NATIVE_STAKING) {
1050
+ return;
1051
+ }
1052
+ } else {
1053
+ return;
1054
+ }
1055
+ this.state.mintCampaignService.unlockDotCampaign.mintNft({
1056
+ transactionId: id,
1057
+ address: transaction.address,
1058
+ slug: slug,
1059
+ network: transaction.chain,
1060
+ extrinsicHash: transaction.extrinsicHash
1061
+ }).catch(console.error);
1062
+ }
957
1063
  resetWallet() {
958
1064
  this.transactionSubject.next({});
959
1065
  }
@@ -30,6 +30,8 @@ export interface SWTransactionInput extends SwInputBase, Partial<Pick<SWTransact
30
30
  errors?: SWTransaction['errors'];
31
31
  edAsWarning?: boolean;
32
32
  isTransferAll?: boolean;
33
+ resolveOnDone?: boolean;
34
+ skipFeeValidation?: boolean;
33
35
  }
34
36
  export declare type SWTransactionResponse = SwInputBase & Pick<SWTransaction, 'warnings' | 'errors'> & Partial<Pick<SWTransaction, 'id' | 'extrinsicHash' | 'status' | 'estimateFee'>>;
35
37
  export declare type ValidateTransactionResponseInput = SWTransactionInput;
@@ -5,6 +5,7 @@ import { _getBlockExplorerFromChain, _isPureEvmChain } from '@subwallet/extensio
5
5
 
6
6
  // @ts-ignore
7
7
  export function parseTransactionData(data) {
8
+ // @ts-ignore
8
9
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
9
10
  return data;
10
11
  }
@@ -0,0 +1 @@
1
+ export * from './unlock-dot';
@@ -0,0 +1,4 @@
1
+ // Copyright 2019-2022 @subwallet/extension-base authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from "./unlock-dot.js";
@@ -0,0 +1,71 @@
1
+ export interface UnlockDotAdditionalData {
2
+ slug: string;
3
+ network: string;
4
+ extrinsicHash?: string;
5
+ }
6
+ export interface UnlockDotCheckMintRequest {
7
+ address: string;
8
+ additionalData: UnlockDotAdditionalData;
9
+ category: string;
10
+ campaignId: number;
11
+ }
12
+ export interface UnlockDotCheckMintResponse {
13
+ requestId: number | null;
14
+ userId: number;
15
+ validUser: boolean;
16
+ validCampaign: boolean;
17
+ validCategory: boolean;
18
+ isWhiteList: boolean;
19
+ isOwner: boolean;
20
+ hasBalance: boolean;
21
+ notDuplicated: boolean;
22
+ inMintingTime: boolean;
23
+ }
24
+ export interface UnlockDotMintedData {
25
+ id: number;
26
+ campaignId: number;
27
+ collectionId: number;
28
+ userId: number;
29
+ address: string;
30
+ status: string;
31
+ extrinsicHash: string;
32
+ mintCategory: string;
33
+ mintDate: null;
34
+ rmrkNftId: string;
35
+ nftName: string;
36
+ nftImage: string;
37
+ recipient: string;
38
+ blockNumber: number;
39
+ additionalData: string;
40
+ }
41
+ export declare type UnlockDotTransactionNft = UnlockDotMintedData | undefined | Pick<UnlockDotMintedData, 'nftImage'>;
42
+ export interface UnlockDotFetchMintedRequest {
43
+ address: string;
44
+ }
45
+ export declare type UnlockDotFetchMintedResponse = UnlockDotMintedData[];
46
+ export interface UnlockDotMintSubmitRequest {
47
+ recipient: string;
48
+ requestId: number;
49
+ }
50
+ export declare type UnlockDotMintSubmitResponse = UnlockDotMintedData;
51
+ export interface UnlockDotCheckMintData {
52
+ address: string;
53
+ slug: string;
54
+ network: string;
55
+ extrinsicHash?: string;
56
+ }
57
+ export interface UnlockDotSubmitMintData {
58
+ transactionId: string;
59
+ address: string;
60
+ slug: string;
61
+ network: string;
62
+ extrinsicHash: string;
63
+ }
64
+ export interface RequestUnlockDotCheckCanMint {
65
+ address: string;
66
+ slug: string;
67
+ network: string;
68
+ }
69
+ export interface RequestUnlockDotSubscribeMintedData {
70
+ transactionId: string;
71
+ }
@@ -0,0 +1 @@
1
+ export {};
package/types/index.d.ts CHANGED
@@ -5,7 +5,12 @@ export interface Message extends MessageEvent {
5
5
  origin: string;
6
6
  response?: string;
7
7
  subscription?: string;
8
+ sender?: string;
8
9
  };
9
10
  }
10
11
  export * from './balance';
11
12
  export * from './buy';
13
+ export * from './campaigns';
14
+ export * from './ordinal';
15
+ export * from './transaction';
16
+ export * from './yield';
package/types/index.js CHANGED
@@ -1,6 +1,10 @@
1
- // Copyright 2019-2022 @polkadot/extension authors & contributors
1
+ // Copyright 2019-2022 @subwallet/extension-base authors & contributors
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  export * from "./balance.js";
5
5
  export * from "./buy.js";
6
+ export * from "./campaigns/index.js";
7
+ export * from "./ordinal.js";
8
+ export * from "./transaction.js";
9
+ export * from "./yield/index.js";
6
10
  export {};