@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
@@ -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 { _getAssetDecimals, _getAssetSymbol, _getChainNativeTokenBasicInfo, _getEvmChainId, _isChainEvmCompatible } from '@subwallet/extension-base/services/chain-service/utils';
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';
10
11
  import { EXTENSION_REQUEST_URL } from '@subwallet/extension-base/services/request-service/constants';
11
12
  import { TRANSACTION_TIMEOUT } from '@subwallet/extension-base/services/transaction-service/constants';
12
- import { parseLiquidStakingEvents, parseLiquidStakingFastUnstakeEvents, parseTransferEventLogs, parseXcmEventLogs } from '@subwallet/extension-base/services/transaction-service/event-parser';
13
+ import { parseTransferEventLogs, parseXcmEventLogs } from '@subwallet/extension-base/services/transaction-service/event-parser';
13
14
  import { getBaseTransactionInfo, getTransactionId, isSubstrateTransaction } from '@subwallet/extension-base/services/transaction-service/helpers';
14
15
  import { getExplorerLink, parseTransactionData } from '@subwallet/extension-base/services/transaction-service/utils';
15
16
  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,15 +26,20 @@ 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";
30
29
  export default class TransactionService {
31
30
  transactionSubject = new BehaviorSubject({});
32
31
  watchTransactionSubscribes = {};
33
32
  get transactions() {
34
33
  return this.transactionSubject.getValue();
35
34
  }
36
- constructor(state) {
37
- this.state = state;
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;
38
43
  }
39
44
  get allTransactions() {
40
45
  return Object.values(this.transactions);
@@ -91,7 +96,7 @@ export default class TransactionService {
91
96
  decimals: 0,
92
97
  value: ''
93
98
  };
94
- const chainInfo = this.state.chainService.getChainInfoByKey(chain);
99
+ const chainInfo = this.chainService.getChainInfoByKey(chain);
95
100
  if (!chainInfo) {
96
101
  validationResponse.errors.push(new TransactionError(BasicTxErrorType.INTERNAL_ERROR, t('Cannot find network')));
97
102
  } else {
@@ -106,7 +111,7 @@ export default class TransactionService {
106
111
  if (isSubstrateTransaction(transaction)) {
107
112
  estimateFee.value = (await transaction.paymentInfo(address)).partialFee.toString();
108
113
  } else {
109
- const web3 = this.state.chainService.getEvmApi(chain);
114
+ const web3 = this.chainService.getEvmApi(chain);
110
115
  if (!web3) {
111
116
  validationResponse.errors.push(new TransactionError(BasicTxErrorType.CHAIN_DISCONNECTED, undefined));
112
117
  } else {
@@ -140,35 +145,32 @@ export default class TransactionService {
140
145
 
141
146
  // Balance
142
147
  const transferNative = validationResponse.transferNativeAmount || '0';
143
- const nativeTokenInfo = this.state.chainService.getNativeTokenInfo(chain);
144
- const balance = await this.state.balanceService.getTokenFreeBalance(address, chain, nativeTokenInfo.slug);
148
+ const nativeTokenInfo = this.chainService.getNativeTokenInfo(chain);
149
+ const balance = await this.balanceService.getTokenFreeBalance(address, chain, nativeTokenInfo.slug);
145
150
  const existentialDeposit = nativeTokenInfo.minAmount || '0';
146
151
  const feeNum = parseInt(estimateFee.value);
147
152
  const balanceNum = parseInt(balance.value);
148
153
  const edNum = parseInt(existentialDeposit);
149
154
  const transferNativeNum = parseInt(transferNative);
150
- if (!validationInput.skipFeeValidation) {
151
- // TODO
152
- if (!new BigN(balance.value).gt(0)) {
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) {
153
160
  validationResponse.errors.push(new TransactionError(BasicTxErrorType.NOT_ENOUGH_BALANCE));
154
- }
155
- if (transferNativeNum + feeNum > balanceNum) {
156
- if (!isTransferAll) {
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
157
164
  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
- }
163
165
  }
164
166
  }
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
- }
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));
172
174
  }
173
175
  }
174
176
  }
@@ -235,21 +237,12 @@ export default class TransactionService {
235
237
  }
236
238
  validatedTransaction.warnings = [];
237
239
  const emitter = await this.addTransaction(validatedTransaction);
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
- }
240
+ await new Promise(resolve => {
241
+ emitter.on('signed', data => {
242
+ validatedTransaction.id = data.id;
243
+ validatedTransaction.extrinsicHash = data.extrinsicHash;
244
+ resolve();
245
+ });
253
246
  emitter.on('error', data => {
254
247
  if (data.errors.length > 0) {
255
248
  validatedTransaction.errors.push(...data.errors);
@@ -315,7 +308,7 @@ export default class TransactionService {
315
308
  }
316
309
  getTransactionLink(id) {
317
310
  const transaction = this.getTransaction(id);
318
- const chainInfo = this.state.chainService.getChainInfoByKey(transaction.chain);
311
+ const chainInfo = this.chainService.getChainInfoByKey(transaction.chain);
319
312
  return getExplorerLink(chainInfo, transaction.extrinsicHash, 'tx');
320
313
  }
321
314
  transactionToHistories(id, startBlock, nonce, eventLogs) {
@@ -343,7 +336,7 @@ export default class TransactionService {
343
336
  nonce: nonce !== null && nonce !== void 0 ? nonce : 0,
344
337
  startBlock: startBlock || 0
345
338
  };
346
- const chainInfo = this.state.chainService.getChainInfoByKey(transaction.chain);
339
+ const chainInfo = this.chainService.getChainInfoByKey(transaction.chain);
347
340
  const nativeAsset = _getChainNativeTokenBasicInfo(chainInfo);
348
341
  const baseNativeAmount = {
349
342
  value: '0',
@@ -357,7 +350,7 @@ export default class TransactionService {
357
350
  {
358
351
  const inputData = parseTransactionData(transaction.data);
359
352
  historyItem.to = inputData.to;
360
- const sendingTokenInfo = this.state.chainService.getAssetBySlug(inputData.tokenSlug);
353
+ const sendingTokenInfo = this.chainService.getAssetBySlug(inputData.tokenSlug);
361
354
  historyItem.amount = {
362
355
  value: inputData.value || '0',
363
356
  decimals: sendingTokenInfo.decimals || 0,
@@ -370,7 +363,7 @@ export default class TransactionService {
370
363
  {
371
364
  const inputData = parseTransactionData(transaction.data);
372
365
  historyItem.to = inputData.to;
373
- const sendingTokenInfo = this.state.chainService.getAssetBySlug(inputData.tokenSlug);
366
+ const sendingTokenInfo = this.chainService.getAssetBySlug(inputData.tokenSlug);
374
367
  historyItem.amount = {
375
368
  value: inputData.value || '0',
376
369
  decimals: sendingTokenInfo.decimals || 0,
@@ -383,7 +376,7 @@ export default class TransactionService {
383
376
  {
384
377
  const inputData = parseTransactionData(transaction.data);
385
378
  historyItem.to = inputData.to;
386
- const sendingTokenInfo = this.state.chainService.getAssetBySlug(inputData.tokenSlug);
379
+ const sendingTokenInfo = this.chainService.getAssetBySlug(inputData.tokenSlug);
387
380
  historyItem.amount = {
388
381
  value: inputData.value || '0',
389
382
  decimals: sendingTokenInfo.decimals || 0,
@@ -432,29 +425,17 @@ export default class TransactionService {
432
425
  case ExtrinsicType.STAKING_UNBOND:
433
426
  {
434
427
  const data = parseTransactionData(transaction.data);
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
- }
428
+ historyItem.to = data.validatorAddress || '';
429
+ historyItem.amount = {
430
+ ...baseNativeAmount,
431
+ value: data.amount || '0'
432
+ };
452
433
  }
453
434
  break;
454
435
  case ExtrinsicType.STAKING_LEAVE_POOL:
455
436
  {
456
437
  const data = parseTransactionData(transaction.data);
457
- historyItem.to = data.address || '';
438
+ historyItem.to = data.nominatorMetadata.address || '';
458
439
  historyItem.amount = {
459
440
  ...baseNativeAmount,
460
441
  value: data.amount || '0'
@@ -473,21 +454,11 @@ export default class TransactionService {
473
454
  case ExtrinsicType.STAKING_WITHDRAW:
474
455
  {
475
456
  const data = parseTransactionData(transaction.data);
476
- const slug = data.slug;
477
- const poolHandler = this.state.earningService.getPoolHandler(slug);
478
- const amount = {
457
+ historyItem.to = data.validatorAddress || '';
458
+ historyItem.amount = {
479
459
  ...baseNativeAmount,
480
460
  value: data.unstakingInfo.claimable || '0'
481
461
  };
482
- if (poolHandler) {
483
- const asset = this.state.getAssetBySlug(poolHandler.metadataInfo.inputAsset);
484
- if (asset) {
485
- amount.decimals = asset.decimals || 0;
486
- amount.symbol = asset.symbol;
487
- }
488
- }
489
- historyItem.to = data.unstakingInfo.validatorAddress || '';
490
- historyItem.amount = amount;
491
462
  break;
492
463
  }
493
464
  case ExtrinsicType.STAKING_CANCEL_UNSTAKE:
@@ -508,102 +479,6 @@ export default class TransactionService {
508
479
  historyItem.to = (data === null || data === void 0 ? void 0 : data.to) || '';
509
480
  break;
510
481
  }
511
- case ExtrinsicType.MINT_STDOT:
512
- case ExtrinsicType.MINT_QDOT:
513
- case ExtrinsicType.MINT_LDOT:
514
- case ExtrinsicType.MINT_SDOT:
515
-
516
- // eslint-disable-next-line no-fallthrough
517
- case ExtrinsicType.MINT_VDOT:
518
- {
519
- const params = parseTransactionData(transaction.data);
520
- const inputTokenInfo = this.state.chainService.getAssetBySlug(params.inputTokenSlug);
521
- const isFeePaidWithInputAsset = params.feeTokenSlug === params.inputTokenSlug;
522
- historyItem.amount = {
523
- value: params.amount,
524
- symbol: _getAssetSymbol(inputTokenInfo),
525
- decimals: _getAssetDecimals(inputTokenInfo)
526
- };
527
- const additionalInfo = {
528
- slug: params.slug,
529
- derivativeTokenSlug: params.derivativeTokenSlug,
530
- exchangeRate: params.exchangeRate
531
- };
532
- historyItem.additionalInfo = additionalInfo;
533
- eventLogs && !_isChainEvmCompatible(chainInfo) && parseLiquidStakingEvents(historyItem, eventLogs, inputTokenInfo, chainInfo, isFeePaidWithInputAsset, extrinsicType);
534
- break;
535
- }
536
- case ExtrinsicType.REDEEM_QDOT:
537
- {
538
- const data = parseTransactionData(transaction.data);
539
- const yieldPoolInfo = data.poolInfo;
540
- if (yieldPoolInfo.metadata.derivativeAssets) {
541
- const inputTokenSlug = yieldPoolInfo.metadata.inputAsset;
542
- const inputTokenInfo = this.state.chainService.getAssetBySlug(inputTokenSlug);
543
- historyItem.amount = {
544
- value: data.amount,
545
- symbol: _getAssetSymbol(inputTokenInfo),
546
- decimals: _getAssetDecimals(inputTokenInfo)
547
- };
548
- eventLogs && parseLiquidStakingFastUnstakeEvents(historyItem, eventLogs, chainInfo, extrinsicType);
549
- }
550
- break;
551
- }
552
- case ExtrinsicType.UNSTAKE_QDOT:
553
- case ExtrinsicType.UNSTAKE_VDOT:
554
- case ExtrinsicType.UNSTAKE_LDOT:
555
- case ExtrinsicType.UNSTAKE_SDOT:
556
- case ExtrinsicType.UNSTAKE_STDOT:
557
- case ExtrinsicType.REDEEM_STDOT:
558
- case ExtrinsicType.REDEEM_LDOT:
559
- case ExtrinsicType.REDEEM_SDOT:
560
-
561
- // eslint-disable-next-line no-fallthrough
562
- case ExtrinsicType.REDEEM_VDOT:
563
- {
564
- const data = parseTransactionData(transaction.data);
565
- const yieldPoolInfo = data.poolInfo;
566
- const minAmountPercents = this.state.earningService.getMinAmountPercent();
567
- if (yieldPoolInfo.metadata.derivativeAssets) {
568
- var _yieldPoolInfo$statis;
569
- const derivativeTokenSlug = yieldPoolInfo.metadata.derivativeAssets[0];
570
- const derivativeTokenInfo = this.state.chainService.getAssetBySlug(derivativeTokenSlug);
571
- const chainInfo = this.state.chainService.getChainInfoByKey(data.poolInfo.chain);
572
- historyItem.amount = {
573
- value: data.amount,
574
- symbol: _getAssetSymbol(derivativeTokenInfo),
575
- decimals: _getAssetDecimals(derivativeTokenInfo)
576
- };
577
- eventLogs && !_isChainEvmCompatible(chainInfo) && parseLiquidStakingFastUnstakeEvents(historyItem, eventLogs, chainInfo, extrinsicType);
578
- const minAmountPercent = minAmountPercents[yieldPoolInfo.slug] || 1;
579
- const inputTokenSlug = yieldPoolInfo.metadata.inputAsset;
580
- const inputTokenInfo = this.state.chainService.getAssetBySlug(inputTokenSlug);
581
- const additionalInfo = {
582
- minAmountPercent,
583
- symbol: inputTokenInfo.symbol,
584
- decimals: inputTokenInfo.decimals || 0,
585
- exchangeRate: ((_yieldPoolInfo$statis = yieldPoolInfo.statistic) === null || _yieldPoolInfo$statis === void 0 ? void 0 : _yieldPoolInfo$statis.assetEarning[0].exchangeRate) || 1,
586
- slug: yieldPoolInfo.slug,
587
- type: yieldPoolInfo.type,
588
- chain: yieldPoolInfo.chain,
589
- group: yieldPoolInfo.group,
590
- isFast: data.fastLeave
591
- };
592
- historyItem.additionalInfo = additionalInfo;
593
- }
594
- break;
595
- }
596
- case ExtrinsicType.TOKEN_APPROVE:
597
- {
598
- const data = parseTransactionData(transaction.data);
599
- const inputAsset = this.state.chainService.getAssetBySlug(data.inputTokenSlug);
600
- historyItem.amount = {
601
- value: '0',
602
- symbol: _getAssetSymbol(inputAsset),
603
- decimals: _getAssetDecimals(inputAsset)
604
- };
605
- break;
606
- }
607
482
  case ExtrinsicType.UNKNOWN:
608
483
  break;
609
484
  }
@@ -649,7 +524,7 @@ export default class TransactionService {
649
524
  });
650
525
 
651
526
  // Create Input History Transaction History
652
- this.state.historyService.insertHistories(this.transactionToHistories(id, startBlock, nonce)).catch(console.error);
527
+ this.historyService.insertHistories(this.transactionToHistories(id, startBlock, nonce)).catch(console.error);
653
528
  console.debug(`Transaction "${id}" is sent`);
654
529
  }
655
530
  onHasTransactionHash({
@@ -666,12 +541,8 @@ export default class TransactionService {
666
541
  this.updateTransaction(id, updateData);
667
542
 
668
543
  // In this case transaction id is the same as extrinsic hash and will change after below update
669
- this.state.historyService.updateHistoryByExtrinsicHash(id, updateData).catch(console.error);
544
+ this.historyService.updateHistoryByExtrinsicHash(id, updateData).catch(console.error);
670
545
  console.debug(`Transaction "${id}" is submitted with hash ${extrinsicHash || ''}`);
671
- const transaction = this.getTransaction(id);
672
- if ([ExtrinsicType.STAKING_JOIN_POOL, ExtrinsicType.JOIN_YIELD_POOL, ExtrinsicType.MINT_LDOT, ExtrinsicType.MINT_QDOT, ExtrinsicType.MINT_SDOT, ExtrinsicType.MINT_VDOT].includes(transaction.extrinsicType)) {
673
- this.handlePostEarningTransaction(id);
674
- }
675
546
  }
676
547
  handlePostProcessing(id) {
677
548
  // must be done after success/failure to make sure the transaction is finalized
@@ -680,15 +551,15 @@ export default class TransactionService {
680
551
  const inputData = parseTransactionData(transaction.data);
681
552
  try {
682
553
  const sender = keyring.getPair(inputData.senderAddress);
683
- sender && this.state.dbService.handleNftTransfer(transaction.chain, [sender.address, ALL_ACCOUNT_KEY], inputData.nftItem).then(() => {
684
- this.state.eventService.emit('transaction.transferNft', undefined);
554
+ sender && this.databaseService.handleNftTransfer(transaction.chain, [sender.address, ALL_ACCOUNT_KEY], inputData.nftItem).then(() => {
555
+ this.eventService.emit('transaction.transferNft', undefined);
685
556
  }).catch(console.error);
686
557
  } catch (e) {
687
558
  console.error(e);
688
559
  }
689
560
  try {
690
561
  const recipient = keyring.getPair(inputData.recipientAddress);
691
- recipient && this.state.dbService.addNft(recipient.address, {
562
+ recipient && this.databaseService.addNft(recipient.address, {
692
563
  ...inputData.nftItem,
693
564
  owner: recipient.address
694
565
  }).catch(console.error);
@@ -696,7 +567,7 @@ export default class TransactionService {
696
567
  console.error(e);
697
568
  }
698
569
  } 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)) {
699
- this.state.eventService.emit('transaction.submitStaking', transaction.chain);
570
+ this.eventService.emit('transaction.submitStaking', transaction.chain);
700
571
  }
701
572
  }
702
573
  onSuccess({
@@ -712,14 +583,14 @@ export default class TransactionService {
712
583
  });
713
584
 
714
585
  // Write success transaction history
715
- this.state.historyService.updateHistoryByExtrinsicHash(transaction.extrinsicHash, {
586
+ this.historyService.updateHistoryByExtrinsicHash(transaction.extrinsicHash, {
716
587
  extrinsicHash,
717
588
  status: ExtrinsicStatus.SUCCESS,
718
589
  blockNumber: blockNumber || 0,
719
590
  blockHash: blockHash || ''
720
591
  }).catch(console.error);
721
- const info = isHex(extrinsicHash) ? extrinsicHash : getBaseTransactionInfo(transaction, this.state.chainService.getChainInfoMap());
722
- this.state.notificationService.notify({
592
+ const info = isHex(extrinsicHash) ? extrinsicHash : getBaseTransactionInfo(transaction, this.chainService.getChainInfoMap());
593
+ this.notificationService.notify({
723
594
  type: NotificationType.SUCCESS,
724
595
  title: t('Transaction completed'),
725
596
  message: t('Transaction {{info}} completed', {
@@ -732,7 +603,7 @@ export default class TransactionService {
732
603
  },
733
604
  notifyViaBrowser: true
734
605
  });
735
- this.state.eventService.emit('transaction.done', transaction);
606
+ this.eventService.emit('transaction.done', transaction);
736
607
  }
737
608
  onFailed({
738
609
  blockHash,
@@ -751,14 +622,14 @@ export default class TransactionService {
751
622
  });
752
623
 
753
624
  // Write failed transaction history
754
- this.state.historyService.updateHistoryByExtrinsicHash(transaction.extrinsicHash, {
625
+ this.historyService.updateHistoryByExtrinsicHash(transaction.extrinsicHash, {
755
626
  extrinsicHash: extrinsicHash || transaction.extrinsicHash,
756
627
  status: nextStatus,
757
628
  blockNumber: blockNumber || 0,
758
629
  blockHash: blockHash || ''
759
630
  }).catch(console.error);
760
- 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());
761
- this.state.notificationService.notify({
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({
762
633
  type: NotificationType.ERROR,
763
634
  title: t('Transaction failed'),
764
635
  message: t('Transaction {{info}} failed', {
@@ -772,11 +643,11 @@ export default class TransactionService {
772
643
  notifyViaBrowser: true
773
644
  });
774
645
  }
775
- this.state.eventService.emit('transaction.failed', transaction);
646
+ this.eventService.emit('transaction.failed', transaction);
776
647
  }
777
648
  generateHashPayload(chain, transaction) {
778
649
  var _transaction$nonce;
779
- const chainInfo = this.state.chainService.getChainInfoByKey(chain);
650
+ const chainInfo = this.chainService.getChainInfoByKey(chain);
780
651
  const txObject = {
781
652
  nonce: (_transaction$nonce = transaction.nonce) !== null && _transaction$nonce !== void 0 ? _transaction$nonce : 0,
782
653
  gasPrice: addHexPrefix(anyNumberToBN(transaction.gasPrice).toString(16)),
@@ -797,8 +668,8 @@ export default class TransactionService {
797
668
  }) {
798
669
  var _payload$nonce;
799
670
  const payload = transaction;
800
- const evmApi = this.state.chainService.getEvmApi(chain);
801
- const chainInfo = this.state.chainService.getChainInfoByKey(chain);
671
+ const evmApi = this.chainService.getEvmApi(chain);
672
+ const chainInfo = this.chainService.getChainInfoByKey(chain);
802
673
  const accountPair = keyring.getPair(address);
803
674
  const account = {
804
675
  address,
@@ -828,7 +699,7 @@ export default class TransactionService {
828
699
 
829
700
  // Set unique nonce to avoid transaction errors
830
701
  if (!payload.nonce) {
831
- const evmApi = this.state.chainService.getEvmApi(chain);
702
+ const evmApi = this.chainService.getEvmApi(chain);
832
703
  payload.nonce = await evmApi.api.eth.getTransactionCount(address);
833
704
  }
834
705
  if (!payload.chainId) {
@@ -863,7 +734,7 @@ export default class TransactionService {
863
734
  extrinsicHash: id
864
735
  };
865
736
  if (isInjected) {
866
- this.state.requestService.addConfirmation(id, url || EXTENSION_REQUEST_URL, 'evmWatchTransactionRequest', payload, {}).then(async ({
737
+ this.requestService.addConfirmation(id, url || EXTENSION_REQUEST_URL, 'evmWatchTransactionRequest', payload, {}).then(async ({
867
738
  isApproved,
868
739
  payload
869
740
  }) => {
@@ -871,7 +742,7 @@ export default class TransactionService {
871
742
  if (!payload) {
872
743
  throw new EvmProviderError(EvmProviderErrorType.UNAUTHORIZED, 'Bad signature');
873
744
  }
874
- const web3Api = this.state.chainService.getEvmApi(chain).api;
745
+ const web3Api = this.chainService.getEvmApi(chain).api;
875
746
 
876
747
  // Emit signed event
877
748
  emitter.emit('signed', eventData);
@@ -927,7 +798,7 @@ export default class TransactionService {
927
798
  emitter.emit('error', eventData);
928
799
  });
929
800
  } else {
930
- this.state.requestService.addConfirmation(id, url || EXTENSION_REQUEST_URL, 'evmSendTransactionRequest', payload, {}).then(async ({
801
+ this.requestService.addConfirmation(id, url || EXTENSION_REQUEST_URL, 'evmSendTransactionRequest', payload, {}).then(async ({
931
802
  isApproved,
932
803
  payload
933
804
  }) => {
@@ -936,7 +807,7 @@ export default class TransactionService {
936
807
  if (!payload) {
937
808
  throw new EvmProviderError(EvmProviderErrorType.UNAUTHORIZED, t('Failed to sign'));
938
809
  }
939
- const web3Api = this.state.chainService.getEvmApi(chain).api;
810
+ const web3Api = this.chainService.getEvmApi(chain).api;
940
811
  if (!isExternal) {
941
812
  signedTransaction = payload;
942
813
  } else {
@@ -1003,7 +874,7 @@ export default class TransactionService {
1003
874
  transaction.signAsync(address, {
1004
875
  signer: {
1005
876
  signPayload: async payload => {
1006
- const signing = await this.state.requestService.signInternalTransaction(id, address, url || EXTENSION_REQUEST_URL, payload);
877
+ const signing = await this.requestService.signInternalTransaction(id, address, url || EXTENSION_REQUEST_URL, payload);
1007
878
  return {
1008
879
  id: new Date().getTime(),
1009
880
  signature: signing.signature
@@ -1015,7 +886,7 @@ export default class TransactionService {
1015
886
  emitter.emit('signed', eventData);
1016
887
 
1017
888
  // Send transaction
1018
- const api = this.state.chainService.getSubstrateApi(chain);
889
+ const api = this.chainService.getSubstrateApi(chain);
1019
890
  eventData.nonce = rs.nonce.toNumber();
1020
891
  eventData.startBlock = (await api.api.query.system.number()).toPrimitive();
1021
892
  this.handleTransactionTimeout(emitter, eventData);
@@ -1083,33 +954,6 @@ export default class TransactionService {
1083
954
  clearTimeout(timeout);
1084
955
  });
1085
956
  }
1086
- handlePostEarningTransaction(id) {
1087
- const transaction = this.getTransaction(id);
1088
- let slug;
1089
-
1090
- // TODO
1091
- if ('data' in transaction.data) {
1092
- slug = transaction.data.data.slug;
1093
- } else {
1094
- slug = transaction.data.slug;
1095
- }
1096
- const poolHandler = this.state.earningService.getPoolHandler(slug);
1097
- if (poolHandler) {
1098
- const type = poolHandler.type;
1099
- if (type === YieldPoolType.NATIVE_STAKING) {
1100
- return;
1101
- }
1102
- } else {
1103
- return;
1104
- }
1105
- this.state.mintCampaignService.unlockDotCampaign.mintNft({
1106
- transactionId: id,
1107
- address: transaction.address,
1108
- slug: slug,
1109
- network: transaction.chain,
1110
- extrinsicHash: transaction.extrinsicHash
1111
- }).catch(console.error);
1112
- }
1113
957
  resetWallet() {
1114
958
  this.transactionSubject.next({});
1115
959
  }
@@ -30,8 +30,6 @@ 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;
35
33
  }
36
34
  export declare type SWTransactionResponse = SwInputBase & Pick<SWTransaction, 'warnings' | 'errors'> & Partial<Pick<SWTransaction, 'id' | 'extrinsicHash' | 'status' | 'estimateFee'>>;
37
35
  export declare type ValidateTransactionResponseInput = SWTransactionInput;
@@ -5,7 +5,6 @@ import { _getBlockExplorerFromChain, _isPureEvmChain } from '@subwallet/extensio
5
5
 
6
6
  // @ts-ignore
7
7
  export function parseTransactionData(data) {
8
- // @ts-ignore
9
8
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
10
9
  return data;
11
10
  }
package/types/index.d.ts CHANGED
@@ -5,12 +5,7 @@ export interface Message extends MessageEvent {
5
5
  origin: string;
6
6
  response?: string;
7
7
  subscription?: string;
8
- sender?: string;
9
8
  };
10
9
  }
11
10
  export * from './balance';
12
11
  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,10 +1,6 @@
1
- // Copyright 2019-2022 @subwallet/extension-base authors & contributors
1
+ // Copyright 2019-2022 @polkadot/extension 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";
10
6
  export {};
@@ -3,9 +3,8 @@
3
3
 
4
4
  import { staticData } from '@subwallet/extension-base/utils/staticData';
5
5
  import axios from 'axios';
6
- const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
7
6
  const branchName = process.env.BRANCH_NAME || 'koni-dev';
8
- const fetchTarget = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'list.json' : 'preview.json';
7
+ const fetchTarget = branchName === 'master' || branchName === 'webapp' ? 'list.json' : 'preview.json';
9
8
  export async function fetchStaticData(slug, targetFile) {
10
9
  const fetchFile = targetFile || fetchTarget;
11
10
  try {
package/utils/index.d.ts CHANGED
@@ -39,15 +39,10 @@ export declare function isSameAddress(address1: string, address2: string): boole
39
39
  export declare function getDomainFromUrl(url: string): string;
40
40
  export declare function waitTimeout(ms: number): Promise<void>;
41
41
  export declare const stripUrl: (url: string) => string;
42
- export declare const baseParseIPFSUrl: (input: string) => string | undefined;
43
- export declare const swParseIPFSUrl: (input: string) => string | undefined;
44
42
  export declare function wait(milliseconds: number): Promise<void>;
45
43
  export * from './account';
46
44
  export * from './array';
47
45
  export * from './environment';
48
- export * from './number';
49
46
  export * from './lazy';
50
- export * from './promise';
51
47
  export * from './registry';
52
48
  export * from './translate';
53
- export * from './object';