@yaswap/wallet-core 2.0.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 (563) hide show
  1. package/CHANGELOG.md +804 -0
  2. package/README.md +163 -0
  3. package/dist/package.json +76 -0
  4. package/dist/src/build.config.d.ts +46 -0
  5. package/dist/src/build.config.js +237 -0
  6. package/dist/src/build.config.js.map +1 -0
  7. package/dist/src/factory/client/clients.d.ts +11 -0
  8. package/dist/src/factory/client/clients.js +119 -0
  9. package/dist/src/factory/client/clients.js.map +1 -0
  10. package/dist/src/factory/client/evm.d.ts +6 -0
  11. package/dist/src/factory/client/evm.js +71 -0
  12. package/dist/src/factory/client/evm.js.map +1 -0
  13. package/dist/src/factory/client/index.d.ts +11 -0
  14. package/dist/src/factory/client/index.js +38 -0
  15. package/dist/src/factory/client/index.js.map +1 -0
  16. package/dist/src/factory/client/nft.d.ts +4 -0
  17. package/dist/src/factory/client/nft.js +26 -0
  18. package/dist/src/factory/client/nft.js.map +1 -0
  19. package/dist/src/factory/index.d.ts +3 -0
  20. package/dist/src/factory/index.js +7 -0
  21. package/dist/src/factory/index.js.map +1 -0
  22. package/dist/src/factory/settings.d.ts +4 -0
  23. package/dist/src/factory/settings.js +27 -0
  24. package/dist/src/factory/settings.js.map +1 -0
  25. package/dist/src/factory/swap/index.d.ts +4 -0
  26. package/dist/src/factory/swap/index.js +66 -0
  27. package/dist/src/factory/swap/index.js.map +1 -0
  28. package/dist/src/index.d.ts +1619 -0
  29. package/dist/src/index.js +38 -0
  30. package/dist/src/index.js.map +1 -0
  31. package/dist/src/index.test.d.ts +1 -0
  32. package/dist/src/index.test.js +187 -0
  33. package/dist/src/index.test.js.map +1 -0
  34. package/dist/src/nameResolvers/nameResolver.d.ts +7 -0
  35. package/dist/src/nameResolvers/nameResolver.js +3 -0
  36. package/dist/src/nameResolvers/nameResolver.js.map +1 -0
  37. package/dist/src/nameResolvers/uns.d.ts +12 -0
  38. package/dist/src/nameResolvers/uns.js +83 -0
  39. package/dist/src/nameResolvers/uns.js.map +1 -0
  40. package/dist/src/nameResolvers/uns.test.d.ts +1 -0
  41. package/dist/src/nameResolvers/uns.test.js +29 -0
  42. package/dist/src/nameResolvers/uns.test.js.map +1 -0
  43. package/dist/src/store/actions/acceptTermsAndConditions.d.ts +4 -0
  44. package/dist/src/store/actions/acceptTermsAndConditions.js +17 -0
  45. package/dist/src/store/actions/acceptTermsAndConditions.js.map +1 -0
  46. package/dist/src/store/actions/acceptTermsAndConditions.test.d.ts +1 -0
  47. package/dist/src/store/actions/acceptTermsAndConditions.test.js +22 -0
  48. package/dist/src/store/actions/acceptTermsAndConditions.test.js.map +1 -0
  49. package/dist/src/store/actions/accounts/createAccount.d.ts +7 -0
  50. package/dist/src/store/actions/accounts/createAccount.js +27 -0
  51. package/dist/src/store/actions/accounts/createAccount.js.map +1 -0
  52. package/dist/src/store/actions/accounts/createAccount.test.d.ts +1 -0
  53. package/dist/src/store/actions/accounts/createAccount.test.js +29 -0
  54. package/dist/src/store/actions/accounts/createAccount.test.js.map +1 -0
  55. package/dist/src/store/actions/accounts/index.d.ts +5 -0
  56. package/dist/src/store/actions/accounts/index.js +9 -0
  57. package/dist/src/store/actions/accounts/index.js.map +1 -0
  58. package/dist/src/store/actions/accounts/removeAccount.d.ts +7 -0
  59. package/dist/src/store/actions/accounts/removeAccount.js +12 -0
  60. package/dist/src/store/actions/accounts/removeAccount.js.map +1 -0
  61. package/dist/src/store/actions/accounts/removeAccount.test.d.ts +1 -0
  62. package/dist/src/store/actions/accounts/removeAccount.test.js +53 -0
  63. package/dist/src/store/actions/accounts/removeAccount.test.js.map +1 -0
  64. package/dist/src/store/actions/accounts/toggleAccount.d.ts +8 -0
  65. package/dist/src/store/actions/accounts/toggleAccount.js +19 -0
  66. package/dist/src/store/actions/accounts/toggleAccount.js.map +1 -0
  67. package/dist/src/store/actions/accounts/toggleAccount.test.d.ts +1 -0
  68. package/dist/src/store/actions/accounts/toggleAccount.test.js +44 -0
  69. package/dist/src/store/actions/accounts/toggleAccount.test.js.map +1 -0
  70. package/dist/src/store/actions/accounts/toggleBlockchain.d.ts +9 -0
  71. package/dist/src/store/actions/accounts/toggleBlockchain.js +14 -0
  72. package/dist/src/store/actions/accounts/toggleBlockchain.js.map +1 -0
  73. package/dist/src/store/actions/accounts/updateAccount.d.ts +26 -0
  74. package/dist/src/store/actions/accounts/updateAccount.js +14 -0
  75. package/dist/src/store/actions/accounts/updateAccount.js.map +1 -0
  76. package/dist/src/store/actions/addCustomToken.d.ts +12 -0
  77. package/dist/src/store/actions/addCustomToken.js +12 -0
  78. package/dist/src/store/actions/addCustomToken.js.map +1 -0
  79. package/dist/src/store/actions/addCustomToken.test.d.ts +1 -0
  80. package/dist/src/store/actions/addCustomToken.test.js +59 -0
  81. package/dist/src/store/actions/addCustomToken.test.js.map +1 -0
  82. package/dist/src/store/actions/addExternalConnection.d.ts +9 -0
  83. package/dist/src/store/actions/addExternalConnection.js +13 -0
  84. package/dist/src/store/actions/addExternalConnection.js.map +1 -0
  85. package/dist/src/store/actions/addExternalConnection.test.d.ts +1 -0
  86. package/dist/src/store/actions/addExternalConnection.test.js +100 -0
  87. package/dist/src/store/actions/addExternalConnection.test.js.map +1 -0
  88. package/dist/src/store/actions/analytics.d.ts +21 -0
  89. package/dist/src/store/actions/analytics.js +58 -0
  90. package/dist/src/store/actions/analytics.js.map +1 -0
  91. package/dist/src/store/actions/analytics.test.d.ts +1 -0
  92. package/dist/src/store/actions/analytics.test.js +33 -0
  93. package/dist/src/store/actions/analytics.test.js.map +1 -0
  94. package/dist/src/store/actions/changeActiveNetwork.d.ts +5 -0
  95. package/dist/src/store/actions/changeActiveNetwork.js +13 -0
  96. package/dist/src/store/actions/changeActiveNetwork.js.map +1 -0
  97. package/dist/src/store/actions/changeActiveWalletId.d.ts +5 -0
  98. package/dist/src/store/actions/changeActiveWalletId.js +11 -0
  99. package/dist/src/store/actions/changeActiveWalletId.js.map +1 -0
  100. package/dist/src/store/actions/changeActiveWalletId.test.d.ts +1 -0
  101. package/dist/src/store/actions/changeActiveWalletId.test.js +40 -0
  102. package/dist/src/store/actions/changeActiveWalletId.test.js.map +1 -0
  103. package/dist/src/store/actions/changePassword.d.ts +4 -0
  104. package/dist/src/store/actions/changePassword.js +13 -0
  105. package/dist/src/store/actions/changePassword.js.map +1 -0
  106. package/dist/src/store/actions/changePassword.test.d.ts +1 -0
  107. package/dist/src/store/actions/changePassword.test.js +22 -0
  108. package/dist/src/store/actions/changePassword.test.js.map +1 -0
  109. package/dist/src/store/actions/checkPendingActions.d.ts +5 -0
  110. package/dist/src/store/actions/checkPendingActions.js +25 -0
  111. package/dist/src/store/actions/checkPendingActions.js.map +1 -0
  112. package/dist/src/store/actions/clearErrorLog.d.ts +2 -0
  113. package/dist/src/store/actions/clearErrorLog.js +10 -0
  114. package/dist/src/store/actions/clearErrorLog.js.map +1 -0
  115. package/dist/src/store/actions/createWallet.d.ts +7 -0
  116. package/dist/src/store/actions/createWallet.js +90 -0
  117. package/dist/src/store/actions/createWallet.js.map +1 -0
  118. package/dist/src/store/actions/createWallet.test.d.ts +1 -0
  119. package/dist/src/store/actions/createWallet.test.js +41 -0
  120. package/dist/src/store/actions/createWallet.test.js.map +1 -0
  121. package/dist/src/store/actions/customChainSettings.d.ts +15 -0
  122. package/dist/src/store/actions/customChainSettings.js +37 -0
  123. package/dist/src/store/actions/customChainSettings.js.map +1 -0
  124. package/dist/src/store/actions/disableAssets.d.ts +7 -0
  125. package/dist/src/store/actions/disableAssets.js +28 -0
  126. package/dist/src/store/actions/disableAssets.js.map +1 -0
  127. package/dist/src/store/actions/disableEthereumInjection.d.ts +2 -0
  128. package/dist/src/store/actions/disableEthereumInjection.js +11 -0
  129. package/dist/src/store/actions/disableEthereumInjection.js.map +1 -0
  130. package/dist/src/store/actions/disableEthereumInjection.test.d.ts +1 -0
  131. package/dist/src/store/actions/disableEthereumInjection.test.js +24 -0
  132. package/dist/src/store/actions/disableEthereumInjection.test.js.map +1 -0
  133. package/dist/src/store/actions/enableAssets.d.ts +7 -0
  134. package/dist/src/store/actions/enableAssets.js +65 -0
  135. package/dist/src/store/actions/enableAssets.js.map +1 -0
  136. package/dist/src/store/actions/enableAssets.test.d.ts +1 -0
  137. package/dist/src/store/actions/enableAssets.test.js +37 -0
  138. package/dist/src/store/actions/enableAssets.test.js.map +1 -0
  139. package/dist/src/store/actions/enableDisableAssets.test.d.ts +1 -0
  140. package/dist/src/store/actions/enableDisableAssets.test.js +79 -0
  141. package/dist/src/store/actions/enableDisableAssets.test.js.map +1 -0
  142. package/dist/src/store/actions/enableEthereumInjection.d.ts +2 -0
  143. package/dist/src/store/actions/enableEthereumInjection.js +11 -0
  144. package/dist/src/store/actions/enableEthereumInjection.js.map +1 -0
  145. package/dist/src/store/actions/exportPrivateKey.d.ts +9 -0
  146. package/dist/src/store/actions/exportPrivateKey.js +12 -0
  147. package/dist/src/store/actions/exportPrivateKey.js.map +1 -0
  148. package/dist/src/store/actions/exportPrivateKey.test.d.ts +1 -0
  149. package/dist/src/store/actions/exportPrivateKey.test.js +36 -0
  150. package/dist/src/store/actions/exportPrivateKey.test.js.map +1 -0
  151. package/dist/src/store/actions/fetchTokenDetails.d.ts +11 -0
  152. package/dist/src/store/actions/fetchTokenDetails.js +22 -0
  153. package/dist/src/store/actions/fetchTokenDetails.js.map +1 -0
  154. package/dist/src/store/actions/forgetDappConnections.d.ts +2 -0
  155. package/dist/src/store/actions/forgetDappConnections.js +11 -0
  156. package/dist/src/store/actions/forgetDappConnections.js.map +1 -0
  157. package/dist/src/store/actions/getLockForAsset.d.ts +8 -0
  158. package/dist/src/store/actions/getLockForAsset.js +34 -0
  159. package/dist/src/store/actions/getLockForAsset.js.map +1 -0
  160. package/dist/src/store/actions/getQuotes.d.ts +13 -0
  161. package/dist/src/store/actions/getQuotes.js +70 -0
  162. package/dist/src/store/actions/getQuotes.js.map +1 -0
  163. package/dist/src/store/actions/getQuotes.test.d.ts +1 -0
  164. package/dist/src/store/actions/getQuotes.test.js +30 -0
  165. package/dist/src/store/actions/getQuotes.test.js.map +1 -0
  166. package/dist/src/store/actions/getUnusedAddresses.d.ts +8 -0
  167. package/dist/src/store/actions/getUnusedAddresses.js +51 -0
  168. package/dist/src/store/actions/getUnusedAddresses.js.map +1 -0
  169. package/dist/src/store/actions/hardware-wallet/getLedgerAccounts.d.ts +16 -0
  170. package/dist/src/store/actions/hardware-wallet/getLedgerAccounts.js +57 -0
  171. package/dist/src/store/actions/hardware-wallet/getLedgerAccounts.js.map +1 -0
  172. package/dist/src/store/actions/hardware-wallet/index.d.ts +1 -0
  173. package/dist/src/store/actions/hardware-wallet/index.js +5 -0
  174. package/dist/src/store/actions/hardware-wallet/index.js.map +1 -0
  175. package/dist/src/store/actions/index.d.ts +47 -0
  176. package/dist/src/store/actions/index.js +51 -0
  177. package/dist/src/store/actions/index.js.map +1 -0
  178. package/dist/src/store/actions/initializeAddresses.d.ts +6 -0
  179. package/dist/src/store/actions/initializeAddresses.js +26 -0
  180. package/dist/src/store/actions/initializeAddresses.js.map +1 -0
  181. package/dist/src/store/actions/initializeAddresses.test.d.ts +1 -0
  182. package/dist/src/store/actions/initializeAddresses.test.js +58 -0
  183. package/dist/src/store/actions/initializeAddresses.test.js.map +1 -0
  184. package/dist/src/store/actions/lockWallet.d.ts +2 -0
  185. package/dist/src/store/actions/lockWallet.js +11 -0
  186. package/dist/src/store/actions/lockWallet.js.map +1 -0
  187. package/dist/src/store/actions/lockWallet.test.d.ts +1 -0
  188. package/dist/src/store/actions/lockWallet.test.js +24 -0
  189. package/dist/src/store/actions/lockWallet.test.js.map +1 -0
  190. package/dist/src/store/actions/logError.d.ts +3 -0
  191. package/dist/src/store/actions/logError.js +10 -0
  192. package/dist/src/store/actions/logError.js.map +1 -0
  193. package/dist/src/store/actions/logError.test.d.ts +1 -0
  194. package/dist/src/store/actions/logError.test.js +27 -0
  195. package/dist/src/store/actions/logError.test.js.map +1 -0
  196. package/dist/src/store/actions/newSwap.d.ts +12 -0
  197. package/dist/src/store/actions/newSwap.js +34 -0
  198. package/dist/src/store/actions/newSwap.js.map +1 -0
  199. package/dist/src/store/actions/performNextAction/index.d.ts +7 -0
  200. package/dist/src/store/actions/performNextAction/index.js +65 -0
  201. package/dist/src/store/actions/performNextAction/index.js.map +1 -0
  202. package/dist/src/store/actions/performNextAction/send.d.ts +7 -0
  203. package/dist/src/store/actions/performNextAction/send.js +54 -0
  204. package/dist/src/store/actions/performNextAction/send.js.map +1 -0
  205. package/dist/src/store/actions/performNextAction/sendNFT.d.ts +7 -0
  206. package/dist/src/store/actions/performNextAction/sendNFT.js +50 -0
  207. package/dist/src/store/actions/performNextAction/sendNFT.js.map +1 -0
  208. package/dist/src/store/actions/performNextAction/utils.d.ts +11 -0
  209. package/dist/src/store/actions/performNextAction/utils.js +42 -0
  210. package/dist/src/store/actions/performNextAction/utils.js.map +1 -0
  211. package/dist/src/store/actions/proxyMutation.d.ts +5 -0
  212. package/dist/src/store/actions/proxyMutation.js +9 -0
  213. package/dist/src/store/actions/proxyMutation.js.map +1 -0
  214. package/dist/src/store/actions/removeCustomToken.d.ts +7 -0
  215. package/dist/src/store/actions/removeCustomToken.js +11 -0
  216. package/dist/src/store/actions/removeCustomToken.js.map +1 -0
  217. package/dist/src/store/actions/retrySwap.d.ts +5 -0
  218. package/dist/src/store/actions/retrySwap.js +23 -0
  219. package/dist/src/store/actions/retrySwap.js.map +1 -0
  220. package/dist/src/store/actions/sendNFTTransaction.d.ts +4 -0
  221. package/dist/src/store/actions/sendNFTTransaction.js +47 -0
  222. package/dist/src/store/actions/sendNFTTransaction.js.map +1 -0
  223. package/dist/src/store/actions/sendTransaction.d.ts +17 -0
  224. package/dist/src/store/actions/sendTransaction.js +51 -0
  225. package/dist/src/store/actions/sendTransaction.js.map +1 -0
  226. package/dist/src/store/actions/sendTransaction.test.d.ts +1 -0
  227. package/dist/src/store/actions/sendTransaction.test.js +80 -0
  228. package/dist/src/store/actions/sendTransaction.test.js.map +1 -0
  229. package/dist/src/store/actions/setEthereumInjectionChain.d.ts +5 -0
  230. package/dist/src/store/actions/setEthereumInjectionChain.js +11 -0
  231. package/dist/src/store/actions/setEthereumInjectionChain.js.map +1 -0
  232. package/dist/src/store/actions/setEthereumInjectionChain.test.d.ts +1 -0
  233. package/dist/src/store/actions/setEthereumInjectionChain.test.js +20 -0
  234. package/dist/src/store/actions/setEthereumInjectionChain.test.js.map +1 -0
  235. package/dist/src/store/actions/setWhatsNewModalVersion.d.ts +4 -0
  236. package/dist/src/store/actions/setWhatsNewModalVersion.js +10 -0
  237. package/dist/src/store/actions/setWhatsNewModalVersion.js.map +1 -0
  238. package/dist/src/store/actions/setWhatsNewModalVersion.test.d.ts +1 -0
  239. package/dist/src/store/actions/setWhatsNewModalVersion.test.js +24 -0
  240. package/dist/src/store/actions/setWhatsNewModalVersion.test.js.map +1 -0
  241. package/dist/src/store/actions/showNotification.d.ts +2 -0
  242. package/dist/src/store/actions/showNotification.js +10 -0
  243. package/dist/src/store/actions/showNotification.js.map +1 -0
  244. package/dist/src/store/actions/toggleExperiment.d.ts +5 -0
  245. package/dist/src/store/actions/toggleExperiment.js +10 -0
  246. package/dist/src/store/actions/toggleExperiment.js.map +1 -0
  247. package/dist/src/store/actions/toggleExperiment.test.d.ts +1 -0
  248. package/dist/src/store/actions/toggleExperiment.test.js +34 -0
  249. package/dist/src/store/actions/toggleExperiment.test.js.map +1 -0
  250. package/dist/src/store/actions/toggleNFTStarred.d.ts +8 -0
  251. package/dist/src/store/actions/toggleNFTStarred.js +10 -0
  252. package/dist/src/store/actions/toggleNFTStarred.js.map +1 -0
  253. package/dist/src/store/actions/unlockWallet.d.ts +4 -0
  254. package/dist/src/store/actions/unlockWallet.js +22 -0
  255. package/dist/src/store/actions/unlockWallet.js.map +1 -0
  256. package/dist/src/store/actions/updateAccountBalance.d.ts +7 -0
  257. package/dist/src/store/actions/updateAccountBalance.js +29 -0
  258. package/dist/src/store/actions/updateAccountBalance.js.map +1 -0
  259. package/dist/src/store/actions/updateBalances.d.ts +9 -0
  260. package/dist/src/store/actions/updateBalances.js +169 -0
  261. package/dist/src/store/actions/updateBalances.js.map +1 -0
  262. package/dist/src/store/actions/updateBalances.test.d.ts +1 -0
  263. package/dist/src/store/actions/updateBalances.test.js +43 -0
  264. package/dist/src/store/actions/updateBalances.test.js.map +1 -0
  265. package/dist/src/store/actions/updateCurrenciesInfo.d.ts +5 -0
  266. package/dist/src/store/actions/updateCurrenciesInfo.js +14 -0
  267. package/dist/src/store/actions/updateCurrenciesInfo.js.map +1 -0
  268. package/dist/src/store/actions/updateFees.d.ts +6 -0
  269. package/dist/src/store/actions/updateFees.js +16 -0
  270. package/dist/src/store/actions/updateFees.js.map +1 -0
  271. package/dist/src/store/actions/updateFees.test.d.ts +1 -0
  272. package/dist/src/store/actions/updateFees.test.js +86 -0
  273. package/dist/src/store/actions/updateFees.test.js.map +1 -0
  274. package/dist/src/store/actions/updateFiatRates.d.ts +5 -0
  275. package/dist/src/store/actions/updateFiatRates.js +15 -0
  276. package/dist/src/store/actions/updateFiatRates.js.map +1 -0
  277. package/dist/src/store/actions/updateFiatRates.test.d.ts +1 -0
  278. package/dist/src/store/actions/updateFiatRates.test.js +43 -0
  279. package/dist/src/store/actions/updateFiatRates.test.js.map +1 -0
  280. package/dist/src/store/actions/updateMarketData.d.ts +8 -0
  281. package/dist/src/store/actions/updateMarketData.js +28 -0
  282. package/dist/src/store/actions/updateMarketData.js.map +1 -0
  283. package/dist/src/store/actions/updateMarketData.test.d.ts +1 -0
  284. package/dist/src/store/actions/updateMarketData.test.js +49 -0
  285. package/dist/src/store/actions/updateMarketData.test.js.map +1 -0
  286. package/dist/src/store/actions/updateNFTs.d.ts +7 -0
  287. package/dist/src/store/actions/updateNFTs.js +39 -0
  288. package/dist/src/store/actions/updateNFTs.js.map +1 -0
  289. package/dist/src/store/actions/updateNFTs.test.d.ts +1 -0
  290. package/dist/src/store/actions/updateNFTs.test.js +32 -0
  291. package/dist/src/store/actions/updateNFTs.test.js.map +1 -0
  292. package/dist/src/store/actions/updateTransactionFee.d.ts +11 -0
  293. package/dist/src/store/actions/updateTransactionFee.js +81 -0
  294. package/dist/src/store/actions/updateTransactionFee.js.map +1 -0
  295. package/dist/src/store/broker/notification.d.ts +4 -0
  296. package/dist/src/store/broker/notification.js +84 -0
  297. package/dist/src/store/broker/notification.js.map +1 -0
  298. package/dist/src/store/getters.d.ts +59 -0
  299. package/dist/src/store/getters.js +350 -0
  300. package/dist/src/store/getters.js.map +1 -0
  301. package/dist/src/store/index.d.ts +3524 -0
  302. package/dist/src/store/index.js +24 -0
  303. package/dist/src/store/index.js.map +1 -0
  304. package/dist/src/store/migrations/10_analytics_settings.d.ts +4 -0
  305. package/dist/src/store/migrations/10_analytics_settings.js +19 -0
  306. package/dist/src/store/migrations/10_analytics_settings.js.map +1 -0
  307. package/dist/src/store/migrations/11_12_rsk_legacy_derivation_path.d.ts +8 -0
  308. package/dist/src/store/migrations/11_12_rsk_legacy_derivation_path.js +22 -0
  309. package/dist/src/store/migrations/11_12_rsk_legacy_derivation_path.js.map +1 -0
  310. package/dist/src/store/migrations/13_rsk_fish_token.d.ts +4 -0
  311. package/dist/src/store/migrations/13_rsk_fish_token.js +19 -0
  312. package/dist/src/store/migrations/13_rsk_fish_token.js.map +1 -0
  313. package/dist/src/store/migrations/14_account_set_derivation_path.d.ts +4 -0
  314. package/dist/src/store/migrations/14_account_set_derivation_path.js +56 -0
  315. package/dist/src/store/migrations/14_account_set_derivation_path.js.map +1 -0
  316. package/dist/src/store/migrations/15_accounts_chains_set_enabled.d.ts +4 -0
  317. package/dist/src/store/migrations/15_accounts_chains_set_enabled.js +25 -0
  318. package/dist/src/store/migrations/15_accounts_chains_set_enabled.js.map +1 -0
  319. package/dist/src/store/migrations/16_enable_terra_chain.d.ts +4 -0
  320. package/dist/src/store/migrations/16_enable_terra_chain.js +10 -0
  321. package/dist/src/store/migrations/16_enable_terra_chain.js.map +1 -0
  322. package/dist/src/store/migrations/17_remove_injection_enabled.d.ts +4 -0
  323. package/dist/src/store/migrations/17_remove_injection_enabled.js +12 -0
  324. package/dist/src/store/migrations/17_remove_injection_enabled.js.map +1 -0
  325. package/dist/src/store/migrations/18_enable_avalanche_chain.d.ts +4 -0
  326. package/dist/src/store/migrations/18_enable_avalanche_chain.js +10 -0
  327. package/dist/src/store/migrations/18_enable_avalanche_chain.js.map +1 -0
  328. package/dist/src/store/migrations/19_remove_existing_ledger_accounts.d.ts +4 -0
  329. package/dist/src/store/migrations/19_remove_existing_ledger_accounts.js +25 -0
  330. package/dist/src/store/migrations/19_remove_existing_ledger_accounts.js.map +1 -0
  331. package/dist/src/store/migrations/19_remove_existing_ledger_accounts.state.pre.json +1944 -0
  332. package/dist/src/store/migrations/19_remove_existing_ledger_accounts_test.d.ts +1 -0
  333. package/dist/src/store/migrations/19_remove_existing_ledger_accounts_test.js +7 -0
  334. package/dist/src/store/migrations/19_remove_existing_ledger_accounts_test.js.map +1 -0
  335. package/dist/src/store/migrations/1_first_migration.d.ts +4 -0
  336. package/dist/src/store/migrations/1_first_migration.js +11 -0
  337. package/dist/src/store/migrations/1_first_migration.js.map +1 -0
  338. package/dist/src/store/migrations/20_fix_accounts.d.ts +4 -0
  339. package/dist/src/store/migrations/20_fix_accounts.js +68 -0
  340. package/dist/src/store/migrations/20_fix_accounts.js.map +1 -0
  341. package/dist/src/store/migrations/21_enable_solana_chain.d.ts +4 -0
  342. package/dist/src/store/migrations/21_enable_solana_chain.js +10 -0
  343. package/dist/src/store/migrations/21_enable_solana_chain.js.map +1 -0
  344. package/dist/src/store/migrations/22_enable_optimism_chain.d.ts +4 -0
  345. package/dist/src/store/migrations/22_enable_optimism_chain.js +10 -0
  346. package/dist/src/store/migrations/22_enable_optimism_chain.js.map +1 -0
  347. package/dist/src/store/migrations/2_set_default_assets.d.ts +4 -0
  348. package/dist/src/store/migrations/2_set_default_assets.js +20 -0
  349. package/dist/src/store/migrations/2_set_default_assets.js.map +1 -0
  350. package/dist/src/store/migrations/3_add_network_custom_tokens.d.ts +4 -0
  351. package/dist/src/store/migrations/3_add_network_custom_tokens.js +21 -0
  352. package/dist/src/store/migrations/3_add_network_custom_tokens.js.map +1 -0
  353. package/dist/src/store/migrations/4_fix_rsk_token_injected_asset.d.ts +4 -0
  354. package/dist/src/store/migrations/4_fix_rsk_token_injected_asset.js +15 -0
  355. package/dist/src/store/migrations/4_fix_rsk_token_injected_asset.js.map +1 -0
  356. package/dist/src/store/migrations/5_multiple_account_support.d.ts +4 -0
  357. package/dist/src/store/migrations/5_multiple_account_support.js +96 -0
  358. package/dist/src/store/migrations/5_multiple_account_support.js.map +1 -0
  359. package/dist/src/store/migrations/6_use_ledger_live_default.d.ts +4 -0
  360. package/dist/src/store/migrations/6_use_ledger_live_default.js +11 -0
  361. package/dist/src/store/migrations/6_use_ledger_live_default.js.map +1 -0
  362. package/dist/src/store/migrations/7_multi_provider_swaps.d.ts +4 -0
  363. package/dist/src/store/migrations/7_multi_provider_swaps.js +27 -0
  364. package/dist/src/store/migrations/7_multi_provider_swaps.js.map +1 -0
  365. package/dist/src/store/migrations/8_remove_use_ledger_live.d.ts +4 -0
  366. package/dist/src/store/migrations/8_remove_use_ledger_live.js +12 -0
  367. package/dist/src/store/migrations/8_remove_use_ledger_live.js.map +1 -0
  368. package/dist/src/store/migrations/9_inject_ethereum_asset_chain.d.ts +4 -0
  369. package/dist/src/store/migrations/9_inject_ethereum_asset_chain.js +14 -0
  370. package/dist/src/store/migrations/9_inject_ethereum_asset_chain.js.map +1 -0
  371. package/dist/src/store/migrations/before_after_migration_script.test.d.ts +1 -0
  372. package/dist/src/store/migrations/before_after_migration_script.test.js +92 -0
  373. package/dist/src/store/migrations/before_after_migration_script.test.js.map +1 -0
  374. package/dist/src/store/migrations/enable_chain.d.ts +3 -0
  375. package/dist/src/store/migrations/enable_chain.js +71 -0
  376. package/dist/src/store/migrations/enable_chain.js.map +1 -0
  377. package/dist/src/store/migrations/index.d.ts +5 -0
  378. package/dist/src/store/migrations/index.js +78 -0
  379. package/dist/src/store/migrations/index.js.map +1 -0
  380. package/dist/src/store/migrations/migration_script.test.d.ts +1 -0
  381. package/dist/src/store/migrations/migration_script.test.js +59 -0
  382. package/dist/src/store/migrations/migration_script.test.js.map +1 -0
  383. package/dist/src/store/mutations.d.ts +209 -0
  384. package/dist/src/store/mutations.js +348 -0
  385. package/dist/src/store/mutations.js.map +1 -0
  386. package/dist/src/store/state.d.ts +3 -0
  387. package/dist/src/store/state.js +46 -0
  388. package/dist/src/store/state.js.map +1 -0
  389. package/dist/src/store/types.d.ts +249 -0
  390. package/dist/src/store/types.js +64 -0
  391. package/dist/src/store/types.js.map +1 -0
  392. package/dist/src/store/utils.d.ts +38 -0
  393. package/dist/src/store/utils.js +194 -0
  394. package/dist/src/store/utils.js.map +1 -0
  395. package/dist/src/swaps/EvmSwapProvider.d.ts +32 -0
  396. package/dist/src/swaps/EvmSwapProvider.js +118 -0
  397. package/dist/src/swaps/EvmSwapProvider.js.map +1 -0
  398. package/dist/src/swaps/SwapProvider.d.ts +35 -0
  399. package/dist/src/swaps/SwapProvider.js +89 -0
  400. package/dist/src/swaps/SwapProvider.js.map +1 -0
  401. package/dist/src/swaps/astroport/AstroportSwapProvider.d.ts +67 -0
  402. package/dist/src/swaps/astroport/AstroportSwapProvider.js +251 -0
  403. package/dist/src/swaps/astroport/AstroportSwapProvider.js.map +1 -0
  404. package/dist/src/swaps/astroport/info.json +7 -0
  405. package/dist/src/swaps/astroport/queries.d.ts +108 -0
  406. package/dist/src/swaps/astroport/queries.js +227 -0
  407. package/dist/src/swaps/astroport/queries.js.map +1 -0
  408. package/dist/src/swaps/debridge/DeBridgeSwapProvider.d.ts +98 -0
  409. package/dist/src/swaps/debridge/DeBridgeSwapProvider.js +553 -0
  410. package/dist/src/swaps/debridge/DeBridgeSwapProvider.js.map +1 -0
  411. package/dist/src/swaps/debridge/abi/DeBridgeGate.json +1958 -0
  412. package/dist/src/swaps/debridge/abi/SignatureVerifier.json +925 -0
  413. package/dist/src/swaps/debridge/info.json +13 -0
  414. package/dist/src/swaps/fastbtc/FastBTCDepositSwapProvider.d.ts +103 -0
  415. package/dist/src/swaps/fastbtc/FastBTCDepositSwapProvider.js +292 -0
  416. package/dist/src/swaps/fastbtc/FastBTCDepositSwapProvider.js.map +1 -0
  417. package/dist/src/swaps/fastbtc/FastBTCWithdrawSwapProvider.d.ts +108 -0
  418. package/dist/src/swaps/fastbtc/FastBTCWithdrawSwapProvider.js +306 -0
  419. package/dist/src/swaps/fastbtc/FastBTCWithdrawSwapProvider.js.map +1 -0
  420. package/dist/src/swaps/fastbtc/fastBtcBridgeContract.d.ts +19 -0
  421. package/dist/src/swaps/fastbtc/fastBtcBridgeContract.js +24 -0
  422. package/dist/src/swaps/fastbtc/fastBtcBridgeContract.js.map +1 -0
  423. package/dist/src/swaps/fastbtc/info.json +7 -0
  424. package/dist/src/swaps/hop/HopSwapProvider.d.ts +124 -0
  425. package/dist/src/swaps/hop/HopSwapProvider.js +479 -0
  426. package/dist/src/swaps/hop/HopSwapProvider.js.map +1 -0
  427. package/dist/src/swaps/hop/info.json +12 -0
  428. package/dist/src/swaps/hop/queries.d.ts +2 -0
  429. package/dist/src/swaps/hop/queries.js +61 -0
  430. package/dist/src/swaps/hop/queries.js.map +1 -0
  431. package/dist/src/swaps/jupiter/JupiterSwapProvider.d.ts +46 -0
  432. package/dist/src/swaps/jupiter/JupiterSwapProvider.js +189 -0
  433. package/dist/src/swaps/jupiter/JupiterSwapProvider.js.map +1 -0
  434. package/dist/src/swaps/jupiter/info.json +7 -0
  435. package/dist/src/swaps/lifi/LifiSwapProvider.d.ts +76 -0
  436. package/dist/src/swaps/lifi/LifiSwapProvider.js +313 -0
  437. package/dist/src/swaps/lifi/LifiSwapProvider.js.map +1 -0
  438. package/dist/src/swaps/lifi/info.json +7 -0
  439. package/dist/src/swaps/liquality/LiqualitySwapProvider.d.ts +104 -0
  440. package/dist/src/swaps/liquality/LiqualitySwapProvider.js +704 -0
  441. package/dist/src/swaps/liquality/LiqualitySwapProvider.js.map +1 -0
  442. package/dist/src/swaps/liquality/info.json +7 -0
  443. package/dist/src/swaps/liqualityboost/liqualityBoostERC20toNative/LiqualityBoostERC20toNative.d.ts +124 -0
  444. package/dist/src/swaps/liqualityboost/liqualityBoostERC20toNative/LiqualityBoostERC20toNative.js +239 -0
  445. package/dist/src/swaps/liqualityboost/liqualityBoostERC20toNative/LiqualityBoostERC20toNative.js.map +1 -0
  446. package/dist/src/swaps/liqualityboost/liqualityBoostERC20toNative/info.json +7 -0
  447. package/dist/src/swaps/liqualityboost/liqualityBoostNativeToERC20/LiqualityBoostNativeToERC20.d.ts +52 -0
  448. package/dist/src/swaps/liqualityboost/liqualityBoostNativeToERC20/LiqualityBoostNativeToERC20.js +213 -0
  449. package/dist/src/swaps/liqualityboost/liqualityBoostNativeToERC20/LiqualityBoostNativeToERC20.js.map +1 -0
  450. package/dist/src/swaps/liqualityboost/liqualityBoostNativeToERC20/info.json +7 -0
  451. package/dist/src/swaps/liqualityboost/types.d.ts +17 -0
  452. package/dist/src/swaps/liqualityboost/types.js +3 -0
  453. package/dist/src/swaps/liqualityboost/types.js.map +1 -0
  454. package/dist/src/swaps/oneinch/OneinchSwapProvider.d.ts +86 -0
  455. package/dist/src/swaps/oneinch/OneinchSwapProvider.js +369 -0
  456. package/dist/src/swaps/oneinch/OneinchSwapProvider.js.map +1 -0
  457. package/dist/src/swaps/oneinch/info.json +13 -0
  458. package/dist/src/swaps/sovryn/SovrynSwapProvider.d.ts +110 -0
  459. package/dist/src/swaps/sovryn/SovrynSwapProvider.js +369 -0
  460. package/dist/src/swaps/sovryn/SovrynSwapProvider.js.map +1 -0
  461. package/dist/src/swaps/sovryn/info.json +7 -0
  462. package/dist/src/swaps/teleswap/TeleSwapSwapProvider.d.ts +167 -0
  463. package/dist/src/swaps/teleswap/TeleSwapSwapProvider.js +874 -0
  464. package/dist/src/swaps/teleswap/TeleSwapSwapProvider.js.map +1 -0
  465. package/dist/src/swaps/teleswap/info.json +7 -0
  466. package/dist/src/swaps/thorchain/ThorchainSwapProvider.d.ts +194 -0
  467. package/dist/src/swaps/thorchain/ThorchainSwapProvider.js +534 -0
  468. package/dist/src/swaps/thorchain/ThorchainSwapProvider.js.map +1 -0
  469. package/dist/src/swaps/thorchain/info.json +7 -0
  470. package/dist/src/swaps/types.d.ts +87 -0
  471. package/dist/src/swaps/types.js +9 -0
  472. package/dist/src/swaps/types.js.map +1 -0
  473. package/dist/src/swaps/uniswap/UniswapSwapProvider.d.ts +117 -0
  474. package/dist/src/swaps/uniswap/UniswapSwapProvider.js +438 -0
  475. package/dist/src/swaps/uniswap/UniswapSwapProvider.js.map +1 -0
  476. package/dist/src/swaps/uniswap/info.json +7 -0
  477. package/dist/src/swaps/utils.d.ts +92 -0
  478. package/dist/src/swaps/utils.js +57 -0
  479. package/dist/src/swaps/utils.js.map +1 -0
  480. package/dist/src/tsconfig.json +30 -0
  481. package/dist/src/types.d.ts +29 -0
  482. package/dist/src/types.js +3 -0
  483. package/dist/src/types.js.map +1 -0
  484. package/dist/src/utils/accounts.d.ts +16 -0
  485. package/dist/src/utils/accounts.js +89 -0
  486. package/dist/src/utils/accounts.js.map +1 -0
  487. package/dist/src/utils/address.d.ts +8 -0
  488. package/dist/src/utils/address.js +17 -0
  489. package/dist/src/utils/address.js.map +1 -0
  490. package/dist/src/utils/address.test.d.ts +1 -0
  491. package/dist/src/utils/address.test.js +12 -0
  492. package/dist/src/utils/address.test.js.map +1 -0
  493. package/dist/src/utils/asset.d.ts +22 -0
  494. package/dist/src/utils/asset.js +198 -0
  495. package/dist/src/utils/asset.js.map +1 -0
  496. package/dist/src/utils/asset.test.d.ts +1 -0
  497. package/dist/src/utils/asset.test.js +42 -0
  498. package/dist/src/utils/asset.test.js.map +1 -0
  499. package/dist/src/utils/chainify.d.ts +3 -0
  500. package/dist/src/utils/chainify.js +41 -0
  501. package/dist/src/utils/chainify.js.map +1 -0
  502. package/dist/src/utils/coinFormatter.d.ts +13 -0
  503. package/dist/src/utils/coinFormatter.js +58 -0
  504. package/dist/src/utils/coinFormatter.js.map +1 -0
  505. package/dist/src/utils/crypto.d.ts +6 -0
  506. package/dist/src/utils/crypto.js +70 -0
  507. package/dist/src/utils/crypto.js.map +1 -0
  508. package/dist/src/utils/cryptoassets.d.ts +5 -0
  509. package/dist/src/utils/cryptoassets.js +26 -0
  510. package/dist/src/utils/cryptoassets.js.map +1 -0
  511. package/dist/src/utils/derivationPath.d.ts +6 -0
  512. package/dist/src/utils/derivationPath.js +75 -0
  513. package/dist/src/utils/derivationPath.js.map +1 -0
  514. package/dist/src/utils/derivationPath.spec.d.ts +1 -0
  515. package/dist/src/utils/derivationPath.spec.js +37 -0
  516. package/dist/src/utils/derivationPath.spec.js.map +1 -0
  517. package/dist/src/utils/export.d.ts +5 -0
  518. package/dist/src/utils/export.js +24 -0
  519. package/dist/src/utils/export.js.map +1 -0
  520. package/dist/src/utils/fees.d.ts +43 -0
  521. package/dist/src/utils/fees.js +222 -0
  522. package/dist/src/utils/fees.js.map +1 -0
  523. package/dist/src/utils/fees.test.d.ts +1 -0
  524. package/dist/src/utils/fees.test.js +40 -0
  525. package/dist/src/utils/fees.test.js.map +1 -0
  526. package/dist/src/utils/fetchTokenDetails.d.ts +1 -0
  527. package/dist/src/utils/fetchTokenDetails.js +19 -0
  528. package/dist/src/utils/fetchTokenDetails.js.map +1 -0
  529. package/dist/src/utils/history.d.ts +66 -0
  530. package/dist/src/utils/history.js +135 -0
  531. package/dist/src/utils/history.js.map +1 -0
  532. package/dist/src/utils/isTransactionNotFoundError.d.ts +1 -0
  533. package/dist/src/utils/isTransactionNotFoundError.js +16 -0
  534. package/dist/src/utils/isTransactionNotFoundError.js.map +1 -0
  535. package/dist/src/utils/ledger.d.ts +12 -0
  536. package/dist/src/utils/ledger.js +38 -0
  537. package/dist/src/utils/ledger.js.map +1 -0
  538. package/dist/src/utils/moment.d.ts +2 -0
  539. package/dist/src/utils/moment.js +8 -0
  540. package/dist/src/utils/moment.js.map +1 -0
  541. package/dist/src/utils/networks.d.ts +10 -0
  542. package/dist/src/utils/networks.js +43 -0
  543. package/dist/src/utils/networks.js.map +1 -0
  544. package/dist/src/utils/parseTokenTx.d.ts +2 -0
  545. package/dist/src/utils/parseTokenTx.js +10 -0
  546. package/dist/src/utils/parseTokenTx.js.map +1 -0
  547. package/dist/src/utils/quotes.d.ts +5 -0
  548. package/dist/src/utils/quotes.js +20 -0
  549. package/dist/src/utils/quotes.js.map +1 -0
  550. package/dist/src/utils/quotes.test.d.ts +1 -0
  551. package/dist/src/utils/quotes.test.js +85 -0
  552. package/dist/src/utils/quotes.test.js.map +1 -0
  553. package/dist/src/utils/timeline.d.ts +71 -0
  554. package/dist/src/utils/timeline.js +176 -0
  555. package/dist/src/utils/timeline.js.map +1 -0
  556. package/dist/src/walletOptions/defaultOptions.d.ts +3 -0
  557. package/dist/src/walletOptions/defaultOptions.js +36 -0
  558. package/dist/src/walletOptions/defaultOptions.js.map +1 -0
  559. package/dist/src/walletOptions/index.d.ts +7 -0
  560. package/dist/src/walletOptions/index.js +11 -0
  561. package/dist/src/walletOptions/index.js.map +1 -0
  562. package/dist/tsconfig.tsbuildinfo +1 -0
  563. package/package.json +76 -0
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const index_1 = require("../../../index");
5
+ const defaultOptions_1 = tslib_1.__importDefault(require("../../../walletOptions/defaultOptions"));
6
+ const types_1 = require("../../types");
7
+ describe('Remove account', () => {
8
+ test.skip('should be able to remove account', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
9
+ var _a;
10
+ const wallet = yield (0, index_1.setupWallet)(defaultOptions_1.default);
11
+ yield wallet.dispatch.createWallet({
12
+ key: '0x1234567890123456789012345678901234567890',
13
+ mnemonic: 'rough symbol license spirit advance pact catalog vibrant dream great usage empty',
14
+ imported: true,
15
+ });
16
+ yield wallet.dispatch.unlockWallet({
17
+ key: '0x1234567890123456789012345678901234567890',
18
+ });
19
+ yield wallet.dispatch.setWhatsNewModalVersion({
20
+ version: '1.0.0',
21
+ });
22
+ const walletId = wallet.state.activeWalletId;
23
+ const account = (_a = wallet.state.accounts) === null || _a === void 0 ? void 0 : _a[walletId];
24
+ const btcMainnetAccountId = account === null || account === void 0 ? void 0 : account.mainnet[0].id;
25
+ const ethMainnetAccountId = account === null || account === void 0 ? void 0 : account.mainnet[1].id;
26
+ const btcTestnetAccountId = account === null || account === void 0 ? void 0 : account.testnet[0].id;
27
+ const ethTestnetAccountId = account === null || account === void 0 ? void 0 : account.testnet[1].id;
28
+ yield wallet.dispatch.removeAccount({
29
+ network: types_1.Network.Mainnet,
30
+ walletId: walletId,
31
+ id: btcMainnetAccountId,
32
+ });
33
+ yield wallet.dispatch.removeAccount({
34
+ network: types_1.Network.Mainnet,
35
+ walletId: walletId,
36
+ id: ethMainnetAccountId,
37
+ });
38
+ yield wallet.dispatch.removeAccount({
39
+ network: types_1.Network.Testnet,
40
+ walletId: walletId,
41
+ id: ethTestnetAccountId,
42
+ });
43
+ yield wallet.dispatch.removeAccount({
44
+ network: types_1.Network.Testnet,
45
+ walletId: walletId,
46
+ id: btcTestnetAccountId,
47
+ });
48
+ expect(account === null || account === void 0 ? void 0 : account.mainnet[0].id).not.toBe(btcMainnetAccountId);
49
+ expect(account === null || account === void 0 ? void 0 : account.mainnet.length).toBe(5);
50
+ expect(account === null || account === void 0 ? void 0 : account.testnet.length).toBe(5);
51
+ }));
52
+ });
53
+ //# sourceMappingURL=removeAccount.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeAccount.test.js","sourceRoot":"","sources":["../../../../../src/store/actions/accounts/removeAccount.test.ts"],"names":[],"mappings":";;;AAAA,0CAA6C;AAC7C,mGAAyE;AACzE,uCAAsC;AAEtC,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,IAAI,CAAC,IAAI,CAAC,k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AQ,EAAE,QAAQ;YAClB,EAAE,EAAE,mBAAoB;SACzB,CAAC,CAAC;QAEH,MAAM,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC;YAClC,OAAO,EAAE,eAAO,CAAC,OAAO;YACxB,QAAQ,EAAE,QAAQ;YAClB,EAAE,EAAE,mBAAoB;SACzB,CAAC,CAAC;QACH,MAAM,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC;YAClC,OAAO,EAAE,eAAO,CAAC,OAAO;YACxB,QAAQ,EAAE,QAAQ;YAClB,EAAE,EAAE,mBAAoB;SACzB,CAAC,CAAC;QAEH,MAAM,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC7D,MAAM,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACxC,MAAM,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { ActionContext } from '../..';
2
+ import { AccountId, Network, WalletId } from '../../types';
3
+ export declare const toggleAccount: (context: ActionContext, { network, walletId, accounts, enable, }: {
4
+ network: Network;
5
+ walletId: WalletId;
6
+ accounts: AccountId[];
7
+ enable: boolean;
8
+ }) => void;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toggleAccount = void 0;
4
+ const __1 = require("../..");
5
+ const toggleAccount = (context, { network, walletId, accounts, enable, }) => {
6
+ const { commit, dispatch } = (0, __1.rootActionContext)(context);
7
+ accounts.forEach((accountId) => {
8
+ commit.TOGGLE_ACCOUNT({ network, walletId, accountId, enable });
9
+ if (enable) {
10
+ dispatch.updateAccountBalance({
11
+ network,
12
+ walletId,
13
+ accountId,
14
+ });
15
+ }
16
+ });
17
+ };
18
+ exports.toggleAccount = toggleAccount;
19
+ //# sourceMappingURL=toggleAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toggleAccount.js","sourceRoot":"","sources":["../../../../../src/store/actions/accounts/toggleAccount.ts"],"names":[],"mappings":";;;AAAA,6BAAyD;AAGlD,MAAM,aAAa,GAAG,CAC3B,OAAsB,EACtB,EACE,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,GAC2E,EACnF,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IACxD,QAAQ,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;QAC7B,MAAM,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;QAChE,IAAI,MAAM,EAAE;YACV,QAAQ,CAAC,oBAAoB,CAAC;gBAC5B,OAAO;gBACP,QAAQ;gBACR,SAAS;aACV,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AApBW,QAAA,aAAa,iBAoBxB"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const index_1 = require("../../../index");
5
+ const defaultOptions_1 = tslib_1.__importDefault(require("../../../walletOptions/defaultOptions"));
6
+ const types_1 = require("../../types");
7
+ let wallet;
8
+ beforeEach(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
9
+ wallet = yield (0, index_1.setupWallet)(defaultOptions_1.default);
10
+ yield wallet.dispatch.createWallet({
11
+ key: '0x1234567890123456789012345678901234567890',
12
+ mnemonic: 'rough symbol license spirit advance pact catalog vibrant dream great usage empty',
13
+ imported: true,
14
+ });
15
+ yield wallet.dispatch.unlockWallet({
16
+ key: '0x1234567890123456789012345678901234567890',
17
+ });
18
+ yield wallet.dispatch.setWhatsNewModalVersion({
19
+ version: '1.0.0',
20
+ });
21
+ }));
22
+ test.skip('should be able to toggle account', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
23
+ var _a, _b, _c, _d, _e, _f;
24
+ const walletId = wallet.state.activeWalletId;
25
+ const btcMainnetAccountId = (_a = wallet.state.accounts) === null || _a === void 0 ? void 0 : _a[walletId].mainnet[0].id;
26
+ const ethMainnetAccountId = (_b = wallet.state.accounts) === null || _b === void 0 ? void 0 : _b[walletId].mainnet[1].id;
27
+ yield wallet.dispatch.toggleAccount({
28
+ network: types_1.Network.Mainnet,
29
+ walletId: walletId,
30
+ accounts: [btcMainnetAccountId, ethMainnetAccountId],
31
+ enable: false,
32
+ });
33
+ expect((_c = wallet.state.accounts) === null || _c === void 0 ? void 0 : _c[walletId].mainnet[0].enabled).toBe(false);
34
+ expect((_d = wallet.state.accounts) === null || _d === void 0 ? void 0 : _d[walletId].mainnet[1].enabled).toBe(false);
35
+ yield wallet.dispatch.toggleAccount({
36
+ network: types_1.Network.Mainnet,
37
+ walletId: walletId,
38
+ accounts: [btcMainnetAccountId, ethMainnetAccountId],
39
+ enable: true,
40
+ });
41
+ expect((_e = wallet.state.accounts) === null || _e === void 0 ? void 0 : _e[walletId].mainnet[0].enabled).toBe(true);
42
+ expect((_f = wallet.state.accounts) === null || _f === void 0 ? void 0 : _f[walletId].mainnet[1].enabled).toBe(true);
43
+ }));
44
+ //# sourceMappingURL=toggleAccount.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toggleAccount.test.js","sourceRoot":"","sources":["../../../../../src/store/actions/accounts/toggleAccount.test.ts"],"names":[],"mappings":";;;AAAA,0CAA6C;AAC7C,mGAAyE;AACzE,uCAAsC;AAEtC,IAAI,MAAW,CAAC;AAEhB,UAAU,CAAC,GAAS,EAAE;IACpB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,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAGzE,MAAM,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC;QAClC,OAAO,EAAE,eAAO,CAAC,OAAO;QACxB,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;QACpD,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;IAEH,MAAM,CAAC,MAAA,MAAM,CAAC,KAAK,CAAC,QAAQ,0CAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxE,MAAM,CAAC,MAAA,MAAM,CAAC,KAAK,CAAC,QAAQ,0CAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1E,CAAC,CAAA,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { ChainId } from '@yaswap/cryptoassets';
2
+ import { ActionContext } from '../..';
3
+ import { Network, WalletId } from '../../types';
4
+ export declare const toggleBlockchain: (context: ActionContext, { network, walletId, chainId, enable }: {
5
+ network: Network;
6
+ walletId: WalletId;
7
+ chainId: ChainId;
8
+ enable: boolean;
9
+ }) => Promise<void>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toggleBlockchain = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const __1 = require("../..");
6
+ const build_config_1 = tslib_1.__importDefault(require("../../../build.config"));
7
+ const toggleBlockchain = (context, { network, walletId, chainId, enable }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
8
+ const { commit } = (0, __1.rootActionContext)(context);
9
+ if (build_config_1.default.chains.includes(chainId)) {
10
+ commit.TOGGLE_BLOCKCHAIN({ network, walletId, chainId, enable });
11
+ }
12
+ });
13
+ exports.toggleBlockchain = toggleBlockchain;
14
+ //# sourceMappingURL=toggleBlockchain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toggleBlockchain.js","sourceRoot":"","sources":["../../../../../src/store/actions/accounts/toggleBlockchain.ts"],"names":[],"mappings":";;;;AACA,6BAAyD;AACzD,iFAAgD;AAGzC,MAAM,gBAAgB,GAAG,CAC9B,OAAsB,EACtB,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAA+E,EACnH,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IAC9C,IAAI,sBAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QACxC,MAAM,CAAC,iBAAiB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;KAClE;AACH,CAAC,CAAA,CAAC;AARW,QAAA,gBAAgB,oBAQ3B"}
@@ -0,0 +1,26 @@
1
+ import { ActionContext } from '../..';
2
+ import { Account, Network, WalletId } from '../../types';
3
+ export declare const updateAccount: (context: ActionContext, { network, walletId, account }: {
4
+ network: Network;
5
+ walletId: WalletId;
6
+ account: Account;
7
+ }) => Promise<{
8
+ updatedAt: number;
9
+ id: string;
10
+ walletId: string;
11
+ createdAt: number;
12
+ enabled: boolean;
13
+ derivationPath: string;
14
+ chainCode?: string | undefined;
15
+ publicKey?: string | undefined;
16
+ nfts?: import("../../types").NFT[] | undefined;
17
+ type: import("../../types").AccountType;
18
+ name: string;
19
+ alias?: string | undefined;
20
+ chain: import("@yaswap/cryptoassets").ChainId;
21
+ index: number;
22
+ addresses: string[];
23
+ assets: string[];
24
+ balances: Record<string, string>;
25
+ color: string;
26
+ }>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateAccount = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const __1 = require("../..");
6
+ const updateAccount = (context, { network, walletId, account }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
7
+ const { commit } = (0, __1.rootActionContext)(context);
8
+ const updatedAt = Date.now();
9
+ const updatedAccount = Object.assign(Object.assign({}, account), { updatedAt });
10
+ commit.UPDATE_ACCOUNT({ network, walletId, account: updatedAccount });
11
+ return updatedAccount;
12
+ });
13
+ exports.updateAccount = updateAccount;
14
+ //# sourceMappingURL=updateAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateAccount.js","sourceRoot":"","sources":["../../../../../src/store/actions/accounts/updateAccount.ts"],"names":[],"mappings":";;;;AAAA,6BAAyD;AAGlD,MAAM,aAAa,GAAG,CAC3B,OAAsB,EACtB,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAA8D,EAC1F,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,MAAM,cAAc,mCACf,OAAO,KACV,SAAS,GACV,CAAC;IACF,MAAM,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;IACtE,OAAO,cAAc,CAAC;AACxB,CAAC,CAAA,CAAC;AAZW,QAAA,aAAa,iBAYxB"}
@@ -0,0 +1,12 @@
1
+ import { ChainId } from '@yaswap/cryptoassets';
2
+ import { ActionContext } from '..';
3
+ import { Network, WalletId } from '../types';
4
+ export declare const addCustomToken: (context: ActionContext, { network, walletId, chain, symbol, name, contractAddress, decimals, }: {
5
+ network: Network;
6
+ walletId: WalletId;
7
+ chain: ChainId;
8
+ symbol: string;
9
+ name: string;
10
+ contractAddress: string;
11
+ decimals: number;
12
+ }) => Promise<void>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addCustomToken = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const __1 = require("..");
6
+ const addCustomToken = (context, { network, walletId, chain, symbol, name, contractAddress, decimals, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
7
+ const { commit } = (0, __1.rootActionContext)(context);
8
+ const customToken = { symbol, name, contractAddress, decimals, chain: chain };
9
+ commit.ADD_CUSTOM_TOKEN({ network, walletId, customToken });
10
+ });
11
+ exports.addCustomToken = addCustomToken;
12
+ //# sourceMappingURL=addCustomToken.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addCustomToken.js","sourceRoot":"","sources":["../../../../src/store/actions/addCustomToken.ts"],"names":[],"mappings":";;;;AACA,0BAAsD;AAG/C,MAAM,cAAc,GAAG,CAC5B,OAAsB,EACtB,EACE,OAAO,EACP,QAAQ,EACR,KAAK,EACL,MAAM,EACN,IAAI,EACJ,eAAe,EACf,QAAQ,GAST,EACD,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,WAAW,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC9E,MAAM,CAAC,gBAAgB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;AAC9D,CAAC,CAAA,CAAC;AAvBW,QAAA,cAAc,kBAuBzB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const cryptoassets_1 = require("@yaswap/cryptoassets");
5
+ const index_1 = require("../../index");
6
+ const defaultOptions_1 = tslib_1.__importDefault(require("../../walletOptions/defaultOptions"));
7
+ const types_1 = require("../types");
8
+ test('Should be able create wallet and add custom tokens', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
9
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
10
+ const wallet = yield (0, index_1.setupWallet)(defaultOptions_1.default);
11
+ yield wallet.dispatch.createWallet({
12
+ key: '0x1234567890123456789012345678901234567890',
13
+ mnemonic: 'test',
14
+ imported: true,
15
+ });
16
+ yield wallet.dispatch.unlockWallet({
17
+ key: '0x1234567890123456789012345678901234567890',
18
+ });
19
+ expect(wallet.state.wallets.length).toBe(1);
20
+ expect(wallet.state.wallets[0].imported).toBe(true);
21
+ expect(wallet.state.unlockedAt).not.toBe(0);
22
+ yield wallet.dispatch.initializeAnalyticsPreferences({
23
+ accepted: true,
24
+ });
25
+ expect(wallet.state.analytics.userId).not.toBe(null);
26
+ expect(wallet.state.analytics.acceptedDate).not.toBe(0);
27
+ expect(wallet.state.analytics.askedDate).not.toBe(0);
28
+ expect(wallet.state.analytics.askedTimes).toBe(0);
29
+ expect(wallet.state.analytics.notAskAgain).toBe(false);
30
+ yield wallet.dispatch.addCustomToken({
31
+ network: types_1.Network.Mainnet,
32
+ walletId: wallet.state.activeWalletId,
33
+ chain: cryptoassets_1.ChainId.Ethereum,
34
+ symbol: 'TST',
35
+ name: 'Test Token',
36
+ contractAddress: '0x1234567890123456789012345678901234567890',
37
+ decimals: 18,
38
+ });
39
+ expect((_a = wallet.state.customTokens.mainnet) === null || _a === void 0 ? void 0 : _a[wallet.state.activeWalletId][0].symbol).toBe('TST');
40
+ expect((_b = wallet.state.customTokens.mainnet) === null || _b === void 0 ? void 0 : _b[wallet.state.activeWalletId][0].name).toBe('Test Token');
41
+ expect((_c = wallet.state.customTokens.mainnet) === null || _c === void 0 ? void 0 : _c[wallet.state.activeWalletId][0].contractAddress).toBe('0x1234567890123456789012345678901234567890');
42
+ expect((_d = wallet.state.customTokens.mainnet) === null || _d === void 0 ? void 0 : _d[wallet.state.activeWalletId][0].decimals).toBe(18);
43
+ expect((_e = wallet.state.customTokens.mainnet) === null || _e === void 0 ? void 0 : _e[wallet.state.activeWalletId][0].chain).toBe('ethereum');
44
+ yield wallet.dispatch.addCustomToken({
45
+ network: types_1.Network.Testnet,
46
+ walletId: wallet.state.activeWalletId,
47
+ chain: cryptoassets_1.ChainId.Bitcoin,
48
+ symbol: 'BCTS',
49
+ name: 'Test Bitcoin',
50
+ contractAddress: '0x1234567890123456789012343333378901234567890',
51
+ decimals: 11,
52
+ });
53
+ expect((_f = wallet.state.customTokens.testnet) === null || _f === void 0 ? void 0 : _f[wallet.state.activeWalletId][0].symbol).toBe('BCTS');
54
+ expect((_g = wallet.state.customTokens.testnet) === null || _g === void 0 ? void 0 : _g[wallet.state.activeWalletId][0].name).toBe('Test Bitcoin');
55
+ expect((_h = wallet.state.customTokens.testnet) === null || _h === void 0 ? void 0 : _h[wallet.state.activeWalletId][0].contractAddress).toBe('0x1234567890123456789012343333378901234567890');
56
+ expect((_j = wallet.state.customTokens.testnet) === null || _j === void 0 ? void 0 : _j[wallet.state.activeWalletId][0].decimals).toBe(11);
57
+ expect((_k = wallet.state.customTokens.testnet) === null || _k === void 0 ? void 0 : _k[wallet.state.activeWalletId][0].chain).toBe('bitcoin');
58
+ }));
59
+ //# sourceMappingURL=addCustomToken.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addCustomToken.test.js","sourceRoot":"","sources":["../../../../src/store/actions/addCustomToken.test.ts"],"names":[],"mappings":";;;AAAA,uDAA+C;AAC/C,uCAA0C;AAC1C,gGAAsE;AACtE,oCAAmC;AAEnC,IAAI,CAAC,oDAAoD,EAAE,GAAS,EAAE;;IACpE,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAW,EAAC,wBAAoB,CAAC,CAAC;IACvD,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;QACjC,GAAG,EAAE,4CAA4C;QACjD,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IACH,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;QACjC,GAAG,EAAE,4CAA4C;KAClD,CAAC,CAAC;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,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,cAAc,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChG,MAAM,CAAC,MAAA,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,0CAAG,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACtG,MAAM,CAAC,MAAA,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,0CAAG,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC,IAAI,CAC9F,+CAA+C,CAChD,CAAC;IACF,MAAM,CAAC,MAAA,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,0CAAG,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9F,MAAM,CAAC,MAAA,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,0CAAG,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACpG,CAAC,CAAA,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { ChainId } from '@yaswap/cryptoassets';
2
+ import { ActionContext } from '..';
3
+ import { AccountId } from '../types';
4
+ export declare const addExternalConnection: (context: ActionContext, { origin, chain, accountId, setDefaultEthereum, }: {
5
+ origin: string;
6
+ chain: ChainId;
7
+ accountId: AccountId;
8
+ setDefaultEthereum: boolean;
9
+ }) => void;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addExternalConnection = void 0;
4
+ const __1 = require("..");
5
+ const addExternalConnection = (context, { origin, chain, accountId, setDefaultEthereum, }) => {
6
+ const { state, commit } = (0, __1.rootActionContext)(context);
7
+ const { activeWalletId } = state;
8
+ commit.ADD_EXTERNAL_CONNECTION({ origin, activeWalletId, accountId, chain });
9
+ if (setDefaultEthereum)
10
+ commit.SET_EXTERNAL_CONNECTION_DEFAULT({ origin, activeWalletId, accountId });
11
+ };
12
+ exports.addExternalConnection = addExternalConnection;
13
+ //# sourceMappingURL=addExternalConnection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addExternalConnection.js","sourceRoot":"","sources":["../../../../src/store/actions/addExternalConnection.ts"],"names":[],"mappings":";;;AACA,0BAAsD;AAG/C,MAAM,qBAAqB,GAAG,CACnC,OAAsB,EACtB,EACE,MAAM,EACN,KAAK,EACL,SAAS,EACT,kBAAkB,GACoE,EACxF,EAAE;IACF,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IACrD,MAAM,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACjC,MAAM,CAAC,uBAAuB,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7E,IAAI,kBAAkB;QAAE,MAAM,CAAC,+BAA+B,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC,CAAC;AACxG,CAAC,CAAC;AAbW,QAAA,qBAAqB,yBAahC"}
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const cryptoassets_1 = require("@yaswap/cryptoassets");
5
+ const index_1 = require("../../index");
6
+ const defaultOptions_1 = tslib_1.__importDefault(require("../../walletOptions/defaultOptions"));
7
+ describe('add external connection', () => {
8
+ jest.setTimeout(60000);
9
+ test('should be able validate externalConnections & forgetDappConnections', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
10
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
11
+ const wallet = yield (0, index_1.setupWallet)(defaultOptions_1.default);
12
+ yield wallet.dispatch.createWallet({
13
+ key: '0x1234567890123456789012345678901234567890',
14
+ mnemonic: 'test',
15
+ imported: true,
16
+ });
17
+ yield wallet.dispatch.unlockWallet({
18
+ key: '0x1234567890123456789012345678901234567890',
19
+ });
20
+ const walletId = wallet.state.activeWalletId;
21
+ expect(walletId).not.toBeNull();
22
+ const mainnetAccounts = (_c = (_b = (_a = wallet === null || wallet === void 0 ? void 0 : wallet.state) === null || _a === void 0 ? void 0 : _a.enabledAssets) === null || _b === void 0 ? void 0 : _b.mainnet) === null || _c === void 0 ? void 0 : _c[walletId];
23
+ expect(mainnetAccounts).not.toBeNull();
24
+ const account = (_f = (_e = (_d = wallet.state.accounts) === null || _d === void 0 ? void 0 : _d[walletId]) === null || _e === void 0 ? void 0 : _e.mainnet) === null || _f === void 0 ? void 0 : _f[1];
25
+ expect(account === null || account === void 0 ? void 0 : account.chain).toBe(cryptoassets_1.ChainId.Ethereum);
26
+ const ethAccountId = account === null || account === void 0 ? void 0 : account.id;
27
+ const ethereumAddress = account === null || account === void 0 ? void 0 : account.addresses[0];
28
+ expect(ethereumAddress).not.toBeNull();
29
+ const originName = 'https://uniswap.org/';
30
+ const externalConnection = {
31
+ origin: originName,
32
+ chain: cryptoassets_1.ChainId.Ethereum,
33
+ accountId: ethAccountId,
34
+ setDefaultEthereum: true,
35
+ };
36
+ yield wallet.dispatch.addExternalConnection(externalConnection);
37
+ expect(Object.keys(wallet.state.externalConnections[walletId]).length).toEqual(1);
38
+ expect((_h = (_g = wallet.state.externalConnections[walletId]) === null || _g === void 0 ? void 0 : _g[originName]) === null || _h === void 0 ? void 0 : _h.defaultEthereum).toEqual(ethAccountId);
39
+ expect(Object.keys((_k = (_j = wallet.state.externalConnections[walletId]) === null || _j === void 0 ? void 0 : _j[originName]) === null || _k === void 0 ? void 0 : _k.ethereum).length).toBeGreaterThan(0);
40
+ expect((_m = (_l = wallet.state.externalConnections[walletId]) === null || _l === void 0 ? void 0 : _l[originName]) === null || _m === void 0 ? void 0 : _m.ethereum[0]).toEqual(ethAccountId);
41
+ yield wallet.dispatch.forgetDappConnections();
42
+ expect(Object.keys(wallet.state.externalConnections[walletId]).length).toEqual(0);
43
+ }));
44
+ test('should be able validate externalConnections for multiple origins', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
45
+ var _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
46
+ const wallet = yield (0, index_1.setupWallet)(defaultOptions_1.default);
47
+ yield wallet.dispatch.createWallet({
48
+ key: '0x1234567890123456789012345678901234567890',
49
+ mnemonic: 'test',
50
+ imported: true,
51
+ });
52
+ yield wallet.dispatch.unlockWallet({
53
+ key: '0x1234567890123456789012345678901234567890',
54
+ });
55
+ const walletId = wallet.state.activeWalletId;
56
+ const mainnetAccounts = (_q = (_p = (_o = wallet === null || wallet === void 0 ? void 0 : wallet.state) === null || _o === void 0 ? void 0 : _o.enabledAssets) === null || _p === void 0 ? void 0 : _p.mainnet) === null || _q === void 0 ? void 0 : _q[walletId];
57
+ expect(mainnetAccounts).not.toBeNull();
58
+ const account = (_s = (_r = wallet.state.accounts) === null || _r === void 0 ? void 0 : _r[walletId]) === null || _s === void 0 ? void 0 : _s.mainnet;
59
+ const ethAccountId = account === null || account === void 0 ? void 0 : account[1].id;
60
+ const btcAccountId = account === null || account === void 0 ? void 0 : account[0].id;
61
+ const ethereumAddress = account === null || account === void 0 ? void 0 : account[1].addresses[0];
62
+ const bitcoinAddress = account === null || account === void 0 ? void 0 : account[0].addresses[0];
63
+ expect(account === null || account === void 0 ? void 0 : account[1].chain).toBe(cryptoassets_1.ChainId.Ethereum);
64
+ expect(account === null || account === void 0 ? void 0 : account[0].chain).toBe(cryptoassets_1.ChainId.Bitcoin);
65
+ expect(ethereumAddress).not.toBeNull();
66
+ expect(bitcoinAddress).not.toBeNull();
67
+ const originNameOne = 'https://app.uniswap.org';
68
+ const originNameTwo = 'https://app.aave.com';
69
+ const externalConnection = {
70
+ origin: originNameOne,
71
+ chain: cryptoassets_1.ChainId.Ethereum,
72
+ accountId: ethAccountId,
73
+ setDefaultEthereum: true,
74
+ };
75
+ yield wallet.dispatch.addExternalConnection(externalConnection);
76
+ yield wallet.dispatch.addExternalConnection({
77
+ origin: originNameTwo,
78
+ chain: cryptoassets_1.ChainId.Ethereum,
79
+ accountId: ethAccountId,
80
+ setDefaultEthereum: true,
81
+ });
82
+ expect(Object.keys(wallet.state.externalConnections[walletId]).length).toEqual(2);
83
+ expect((_u = (_t = wallet.state.externalConnections[walletId]) === null || _t === void 0 ? void 0 : _t[originNameOne]) === null || _u === void 0 ? void 0 : _u.defaultEthereum).toEqual(ethAccountId);
84
+ expect((_w = (_v = wallet.state.externalConnections[walletId]) === null || _v === void 0 ? void 0 : _v[originNameTwo]) === null || _w === void 0 ? void 0 : _w.defaultEthereum).toEqual(ethAccountId);
85
+ expect(Object.keys((_y = (_x = wallet.state.externalConnections[walletId]) === null || _x === void 0 ? void 0 : _x[originNameOne]) === null || _y === void 0 ? void 0 : _y.ethereum).length).toBeGreaterThan(0);
86
+ expect(Object.keys((_0 = (_z = wallet.state.externalConnections[walletId]) === null || _z === void 0 ? void 0 : _z[originNameTwo]) === null || _0 === void 0 ? void 0 : _0.ethereum).length).toBeGreaterThan(0);
87
+ expect((_2 = (_1 = wallet.state.externalConnections[walletId]) === null || _1 === void 0 ? void 0 : _1[originNameOne]) === null || _2 === void 0 ? void 0 : _2.ethereum[0]).toEqual(ethAccountId);
88
+ expect((_4 = (_3 = wallet.state.externalConnections[walletId]) === null || _3 === void 0 ? void 0 : _3[originNameTwo]) === null || _4 === void 0 ? void 0 : _4.ethereum[0]).toEqual(ethAccountId);
89
+ yield wallet.dispatch.addExternalConnection({
90
+ origin: originNameTwo,
91
+ chain: cryptoassets_1.ChainId.Bitcoin,
92
+ accountId: btcAccountId,
93
+ setDefaultEthereum: false,
94
+ });
95
+ expect(Object.keys(wallet.state.externalConnections[walletId]).length).toEqual(2);
96
+ expect((_6 = (_5 = wallet.state.externalConnections[walletId]) === null || _5 === void 0 ? void 0 : _5[originNameTwo]) === null || _6 === void 0 ? void 0 : _6.ethereum[0]).toEqual(ethAccountId);
97
+ expect((_8 = (_7 = wallet.state.externalConnections[walletId]) === null || _7 === void 0 ? void 0 : _7[originNameTwo]) === null || _8 === void 0 ? void 0 : _8.bitcoin[0]).toEqual(btcAccountId);
98
+ }));
99
+ });
100
+ //# sourceMappingURL=addExternalConnection.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addExternalConnection.test.js","sourceRoot":"","sources":["../../../../src/store/actions/addExternalConnection.test.ts"],"names":[],"mappings":";;;AAAA,uDAA+C;AAC/C,uCAA0C;AAC1C,gGAAsE;AAEtE,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACvB,IAAI,CAAC,qEAAqE,EAAE,GAAS,EAAE;;QACrF,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAW,EAAC,wBAAoB,CAAC,CAAC;QACvD,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;YACjC,GAAG,EAAE,4CAA4C;YACjD,QAAQ,EAAE,MAAM;YAChB,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QACH,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;YACjC,GAAG,EAAE,4CAA4C;SAClD,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC;QAC7C,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QAChC,MAAM,eAAe,GAAG,MAAA,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,0CAAE,aAAa,0CAAE,OAAO,0CAAG,QAAQ,CAAC,CAAC;QAC1E,MAAM,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CA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qBAAqB,CAAC;YAC1C,MAAM,EAAE,aAAa;YACrB,KAAK,EAAE,sBAAO,CAAC,OAAO;YACtB,SAAS,EAAE,YAAa;YACxB,kBAAkB,EAAE,KAAK;SAC1B,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAClF,MAAM,CAAC,MAAA,MAAA,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC,0CAAG,aAAa,CAAC,0CAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACvG,MAAM,CAAC,MAAA,MAAA,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC,0CAAG,aAAa,CAAC,0CAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACxG,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import amplitude from 'amplitude-js';
2
+ import { ActionContext } from '..';
3
+ import { AnalyticsState } from '../types';
4
+ export interface AmplitudeProperties {
5
+ category?: string;
6
+ action?: string;
7
+ label?: string;
8
+ [key: string]: any;
9
+ }
10
+ export declare const initializeAnalyticsPreferences: (context: ActionContext, { accepted }: {
11
+ accepted: boolean;
12
+ }) => void;
13
+ export declare const updateAnalyticsPreferences: (context: ActionContext, payload: AnalyticsState) => void;
14
+ export declare const setAnalyticsResponse: (context: ActionContext, { accepted }: {
15
+ accepted: boolean;
16
+ }) => Promise<void>;
17
+ export declare const initializeAnalytics: (context: ActionContext) => Promise<boolean>;
18
+ export declare const trackAnalytics: (context: ActionContext, { event, properties }: {
19
+ event: string;
20
+ properties: AmplitudeProperties;
21
+ }) => amplitude.LogReturn;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.trackAnalytics = exports.initializeAnalytics = exports.setAnalyticsResponse = exports.updateAnalyticsPreferences = exports.initializeAnalyticsPreferences = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const amplitude_js_1 = tslib_1.__importDefault(require("amplitude-js"));
6
+ const uuid_1 = require("uuid");
7
+ const __1 = require("..");
8
+ const package_json_1 = require("../../../package.json");
9
+ const useAnalytics = !!process.env.VUE_APP_AMPLITUDE_API_KEY;
10
+ const initializeAnalyticsPreferences = (context, { accepted }) => {
11
+ const { commit } = (0, __1.rootActionContext)(context);
12
+ commit.SET_ANALYTICS_PREFERENCES({
13
+ userId: (0, uuid_1.v4)(),
14
+ acceptedDate: accepted ? Date.now() : 0,
15
+ askedTimes: 0,
16
+ askedDate: Date.now(),
17
+ notAskAgain: false,
18
+ });
19
+ };
20
+ exports.initializeAnalyticsPreferences = initializeAnalyticsPreferences;
21
+ const updateAnalyticsPreferences = (context, payload) => {
22
+ const { commit } = (0, __1.rootActionContext)(context);
23
+ commit.SET_ANALYTICS_PREFERENCES(Object.assign({}, payload));
24
+ };
25
+ exports.updateAnalyticsPreferences = updateAnalyticsPreferences;
26
+ const setAnalyticsResponse = (context, { accepted }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
27
+ const { commit } = (0, __1.rootActionContext)(context);
28
+ if (accepted) {
29
+ commit.SET_ANALYTICS_PREFERENCES({ acceptedDate: Date.now() });
30
+ }
31
+ else {
32
+ commit.SET_ANALYTICS_PREFERENCES({ acceptedDate: 0 });
33
+ }
34
+ });
35
+ exports.setAnalyticsResponse = setAnalyticsResponse;
36
+ const initializeAnalytics = (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
37
+ var _a, _b;
38
+ const { state, dispatch } = (0, __1.rootActionContext)(context);
39
+ if (!state.analytics || !state.analytics.userId) {
40
+ yield dispatch.initializeAnalyticsPreferences({ accepted: false });
41
+ return false;
42
+ }
43
+ else if (((_a = state.analytics) === null || _a === void 0 ? void 0 : _a.acceptedDate) && useAnalytics) {
44
+ amplitude_js_1.default.getInstance().init(process.env.VUE_APP_AMPLITUDE_API_KEY, (_b = state.analytics) === null || _b === void 0 ? void 0 : _b.userId);
45
+ return true;
46
+ }
47
+ return false;
48
+ });
49
+ exports.initializeAnalytics = initializeAnalytics;
50
+ const trackAnalytics = (context, { event, properties = {} }) => {
51
+ const { state } = (0, __1.rootActionContext)(context);
52
+ if (useAnalytics && state.analytics && state.analytics.acceptedDate && state.analytics.userId) {
53
+ const { activeNetwork, activeWalletId, version } = state;
54
+ return amplitude_js_1.default.getInstance().logEvent(event, Object.assign(Object.assign({}, properties), { network: activeNetwork, walletId: activeWalletId, migrationVersion: version, walletCoreVersion: package_json_1.version }));
55
+ }
56
+ };
57
+ exports.trackAnalytics = trackAnalytics;
58
+ //# sourceMappingURL=analytics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../../src/store/actions/analytics.ts"],"names":[],"mappings":";;;;AAAA,wEAAqC;AACrC,+BAAoC;AACpC,0BAAsD;AACtD,wDAAqE;AAUrE,MAAM,YAAY,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC;AAEtD,MAAM,8BAA8B,GAAG,CAAC,OAAsB,EAAE,EAAE,QAAQ,EAAyB,EAAE,EAAE;IAC5G,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,CAAC,yBAAyB,CAAC;QAC/B,MAAM,EAAE,IAAA,SAAM,GAAE;QAChB,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QACvC,UAAU,EAAE,CAAC;QACb,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,WAAW,EAAE,KAAK;KACnB,CAAC,CAAC;AACL,CAAC,CAAC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;QAC9F,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAA,CAAC;AAVW,QAAA,mBAAmB,uBAU9B;AAEK,MAAM,cAAc,GAAG,CAC5B,OAAsB,EACtB,EAAE,KAAK,EAAE,UAAU,GAAG,EAAE,EAAsD,EACzD,EAAE;IACvB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IAC7C,IAAI,YAAY,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,CAAC,YAAY,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE;QAC7F,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;QACzD,OAAO,sBAAS,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,kCACxC,UAAU,KACb,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,cAAc,EACxB,gBAAgB,EAAE,OAAO,EACzB,iBAAiB,EAAjB,sBAAiB,IACjB,CAAC;KACJ;AACH,CAAC,CAAC;AAfW,QAAA,cAAc,kBAezB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const index_1 = require("../../index");
5
+ const defaultOptions_1 = tslib_1.__importDefault(require("../../walletOptions/defaultOptions"));
6
+ test('should be able to enable analytics', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
7
+ const wallet = yield (0, index_1.setupWallet)(defaultOptions_1.default);
8
+ yield wallet.dispatch.createWallet({
9
+ key: '0x1234567890123456789012345678901234567890',
10
+ mnemonic: 'test',
11
+ imported: true,
12
+ });
13
+ yield wallet.dispatch.unlockWallet({
14
+ key: '0x1234567890123456789012345678901234567890',
15
+ });
16
+ const walletId = wallet.state.activeWalletId;
17
+ expect(walletId).not.toBeNull();
18
+ yield wallet.dispatch.initializeAnalyticsPreferences({ accepted: true });
19
+ expect(wallet.state.analytics).not.toBe({});
20
+ yield wallet.dispatch.updateAnalyticsPreferences(Object.assign(Object.assign({}, wallet.state.analytics), { notAskAgain: true }));
21
+ expect(wallet.state.analytics.notAskAgain).toBe(true);
22
+ yield wallet.dispatch.setAnalyticsResponse({ accepted: true });
23
+ expect(wallet.state.analytics.acceptedDate).not.toBe(0);
24
+ yield wallet.dispatch.setAnalyticsResponse({ accepted: false });
25
+ expect(wallet.state.analytics.acceptedDate).toBe(0);
26
+ yield wallet.dispatch.trackAnalytics({
27
+ event: 'test',
28
+ properties: {
29
+ test: 'test',
30
+ },
31
+ });
32
+ }));
33
+ //# sourceMappingURL=analytics.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analytics.test.js","sourceRoot":"","sources":["../../../../src/store/actions/analytics.test.ts"],"names":[],"mappings":";;;AAAA,uCAA0C;AAC1C,gGAAsE;AAEtE,IAAI,CAAC,oCAAoC,EAAE,GAAS,EAAE;IACpD,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAW,EAAC,wBAAoB,CAAC,CAAC;IACvD,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;QACjC,GAAG,EAAE,4CAA4C;QACjD,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IACH,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;QACjC,GAAG,EAAE,4CAA4C;KAClD,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC;IAC7C,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAEhC,MAAM,MAAM,CAAC,QAAQ,CAAC,8BAA8B,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACzE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAE5C,MAAM,MAAM,CAAC,QAAQ,CAAC,0BAA0B,iCAC3C,MAAM,CAAC,KAAK,CAAC,SAAS,KACzB,WAAW,EAAE,IAAI,IACjB,CAAC;IAEH,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEtD,MAAM,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/D,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACxD,MAAM,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;IAChE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEpD,MAAM,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC;QACnC,KAAK,EAAE,MAAM;QACb,UAAU,EAAE;YACV,IAAI,EAAE,MAAM;SACb;KACF,CAAC,CAAC;AACL,CAAC,CAAA,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ActionContext } from '..';
2
+ import { Network } from '../types';
3
+ export declare const changeActiveNetwork: (context: ActionContext, { network }: {
4
+ network: Network;
5
+ }) => Promise<void>;