@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,222 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.estimateTransferNFT = exports.newSendFees = exports.feePerUnit = exports.maxFeePerUnitEIP1559 = exports.probableFeePerUnitEIP1559 = exports.sendBitcoinTxFees = exports.sendTxFeesInNativeAsset = exports.getSendTxFees = exports.isEIP1559Fees = exports.getFeeLabel = exports.getTxFee = exports.getSendFee = exports.FEE_OPTIONS = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const evm_1 = require("@yaswap/evm");
6
+ const types_1 = require("@yaswap/types");
7
+ const cryptoassets_1 = require("@yaswap/cryptoassets");
8
+ const error_parser_1 = require("@yaswap/error-parser");
9
+ const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
10
+ const store_1 = tslib_1.__importDefault(require("../store"));
11
+ const types_2 = require("../store/types");
12
+ const asset_1 = require("./asset");
13
+ const cryptoassets_2 = tslib_1.__importDefault(require("./cryptoassets"));
14
+ function newSendFees() {
15
+ return { slow: new bignumber_js_1.default(0), average: new bignumber_js_1.default(0), fast: new bignumber_js_1.default(0), custom: new bignumber_js_1.default(0) };
16
+ }
17
+ exports.newSendFees = newSendFees;
18
+ const FEE_OPTIONS = {
19
+ SLOW: { name: 'Slow', label: 'Slow' },
20
+ AVERAGE: { name: 'Average', label: 'Avg' },
21
+ FAST: { name: 'Fast', label: 'Fast' },
22
+ CUSTOM: { name: 'Custom', label: 'Custom' },
23
+ };
24
+ exports.FEE_OPTIONS = FEE_OPTIONS;
25
+ const feePriceInUnit = (asset, feePrice, network = types_2.Network.Mainnet) => {
26
+ return (0, asset_1.isChainEvmCompatible)(asset, network) ? evm_1.EvmUtils.fromGwei(feePrice) : feePrice;
27
+ };
28
+ function getSendFee(asset, feePrice, l1FeePrice, network = types_2.Network.Mainnet) {
29
+ const assetInfo = cryptoassets_2.default[asset];
30
+ const nativeAssetInfo = cryptoassets_2.default[(0, asset_1.getNativeAsset)(asset)];
31
+ if (assetInfo.chain === 'optimism') {
32
+ const gasLimitL1 = (0, cryptoassets_1.getAssetSendL1GasLimit)(assetInfo, network);
33
+ if (!gasLimitL1) {
34
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.Chain.L1GasLimit(assetInfo.chain));
35
+ }
36
+ if (!l1FeePrice) {
37
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.Chain.L1FeePrice);
38
+ }
39
+ const feeL1 = new bignumber_js_1.default(gasLimitL1).times(feePriceInUnit(nativeAssetInfo.code, l1FeePrice, network));
40
+ const gasLimitL2 = (0, cryptoassets_1.getAssetSendGasLimit)(assetInfo, network);
41
+ if (!gasLimitL2) {
42
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.Chain.GasLimit(assetInfo.chain));
43
+ }
44
+ const feeL2 = new bignumber_js_1.default(gasLimitL2).times(feePriceInUnit(nativeAssetInfo.code, feePrice, network));
45
+ return (0, cryptoassets_1.unitToCurrency)(nativeAssetInfo, feeL1.plus(feeL2));
46
+ }
47
+ else {
48
+ const gasLimitL = (0, cryptoassets_1.getAssetSendGasLimit)(assetInfo, network);
49
+ if (!gasLimitL) {
50
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.Chain.GasLimit(assetInfo.chain));
51
+ }
52
+ const fee = new bignumber_js_1.default(gasLimitL).times(feePriceInUnit(nativeAssetInfo.code, feePrice, network));
53
+ return (0, cryptoassets_1.unitToCurrency)(nativeAssetInfo, fee);
54
+ }
55
+ }
56
+ exports.getSendFee = getSendFee;
57
+ function getTxFee(units, _asset, _feePrice) {
58
+ const chainId = cryptoassets_2.default[_asset].chain;
59
+ const asset = (0, asset_1.isERC20)(_asset) ? 'ERC20' : _asset;
60
+ const feeUnits = chainId === 'terra' ? units['LUNA'] : units[asset];
61
+ const fee = new bignumber_js_1.default(feeUnits).times(feePriceInUnit(_asset, _feePrice));
62
+ return (0, cryptoassets_1.unitToCurrency)(cryptoassets_2.default[(0, asset_1.getNativeAsset)(_asset)], fee);
63
+ }
64
+ exports.getTxFee = getTxFee;
65
+ function getFeeLabel(fee) {
66
+ var _a;
67
+ const name = ((fee === null || fee === void 0 ? void 0 : fee.toUpperCase()) || '');
68
+ return ((_a = FEE_OPTIONS[name]) === null || _a === void 0 ? void 0 : _a.label) || '';
69
+ }
70
+ exports.getFeeLabel = getFeeLabel;
71
+ function isEIP1559Fees(chain) {
72
+ return chain === types_1.ChainId.Ethereum || chain === types_1.ChainId.Polygon || chain === 'avalanche';
73
+ }
74
+ exports.isEIP1559Fees = isEIP1559Fees;
75
+ function probableFeePerUnitEIP1559(suggestedGasFee) {
76
+ if (suggestedGasFee.suggestedBaseFeePerGas === undefined) {
77
+ return suggestedGasFee.maxPriorityFeePerGas;
78
+ }
79
+ return suggestedGasFee.suggestedBaseFeePerGas + suggestedGasFee.maxPriorityFeePerGas;
80
+ }
81
+ exports.probableFeePerUnitEIP1559 = probableFeePerUnitEIP1559;
82
+ function maxFeePerUnitEIP1559(suggestedGasFee) {
83
+ return suggestedGasFee.maxFeePerGas;
84
+ }
85
+ exports.maxFeePerUnitEIP1559 = maxFeePerUnitEIP1559;
86
+ function feePerUnit(suggestedGasFee, chain) {
87
+ if (suggestedGasFee === undefined || chain === undefined) {
88
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.Invalid.Default);
89
+ }
90
+ if (!isEIP1559Fees(chain) && typeof suggestedGasFee === 'number') {
91
+ return suggestedGasFee;
92
+ }
93
+ if (isEIP1559Fees(chain) && typeof suggestedGasFee === 'object') {
94
+ return maxFeePerUnitEIP1559(suggestedGasFee);
95
+ }
96
+ if (typeof suggestedGasFee === 'number') {
97
+ return suggestedGasFee;
98
+ }
99
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.Invalid.ChainGasFeeMisMatch);
100
+ }
101
+ exports.feePerUnit = feePerUnit;
102
+ function getSendTxFees(accountId, asset, amount, customFee) {
103
+ var _a;
104
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
105
+ const assetChain = (_a = cryptoassets_2.default[asset]) === null || _a === void 0 ? void 0 : _a.chain;
106
+ if (!assetChain) {
107
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.Asset.Chain(asset));
108
+ }
109
+ const feeAsset = (0, asset_1.getFeeAsset)(asset) || (0, asset_1.getNativeAsset)(asset);
110
+ if (!feeAsset) {
111
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.Asset.FeeAsset(asset));
112
+ }
113
+ const suggestedGasFees = store_1.default.getters.suggestedFeePrices(feeAsset);
114
+ if (!suggestedGasFees) {
115
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.Asset.Fees(feeAsset));
116
+ }
117
+ const _suggestedGasFees = suggestedGasFees;
118
+ if (customFee) {
119
+ _suggestedGasFees.custom = { fee: customFee };
120
+ }
121
+ if (assetChain === 'bitcoin') {
122
+ return sendBitcoinTxFees(accountId, asset, _suggestedGasFees, amount);
123
+ }
124
+ else {
125
+ return sendTxFeesInNativeAsset(asset, _suggestedGasFees);
126
+ }
127
+ });
128
+ }
129
+ exports.getSendTxFees = getSendTxFees;
130
+ function sendTxFeesInNativeAsset(asset, suggestedGasFees, sendFees) {
131
+ var _a, _b;
132
+ const assetChain = (_a = cryptoassets_2.default[asset]) === null || _a === void 0 ? void 0 : _a.chain;
133
+ const _sendFees = sendFees !== null && sendFees !== void 0 ? sendFees : newSendFees();
134
+ for (const [speed, fee] of Object.entries(suggestedGasFees)) {
135
+ const _speed = speed;
136
+ const _fee = feePerUnit(fee.fee, assetChain);
137
+ _sendFees[_speed] = _sendFees[_speed].plus(getSendFee(asset, _fee, (_b = fee.multilayerFee) === null || _b === void 0 ? void 0 : _b.l1));
138
+ }
139
+ return _sendFees;
140
+ }
141
+ exports.sendTxFeesInNativeAsset = sendTxFeesInNativeAsset;
142
+ function sendBitcoinTxFees(accountId, asset, suggestedGasFees, amount, sendFees) {
143
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
144
+ if (asset != 'BTC') {
145
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.Invalid.Default);
146
+ }
147
+ const isMax = amount === undefined;
148
+ const _sendFees = sendFees !== null && sendFees !== void 0 ? sendFees : newSendFees();
149
+ const account = store_1.default.getters.accountItem(accountId);
150
+ const client = store_1.default.getters.client({
151
+ network: store_1.default.state.activeNetwork,
152
+ walletId: store_1.default.state.activeWalletId,
153
+ chainId: account.chain,
154
+ accountId: accountId,
155
+ });
156
+ const feePerBytes = Object.values(suggestedGasFees).map((fee) => fee.fee);
157
+ const value = isMax ? undefined : (0, cryptoassets_1.currencyToUnit)(cryptoassets_2.default[asset], amount);
158
+ try {
159
+ const txs = feePerBytes.map((fee) => ({ value, fee }));
160
+ const totalFees = yield client.wallet.getTotalFees(txs, isMax);
161
+ for (const [speed, fee] of Object.entries(suggestedGasFees)) {
162
+ const totalFee = (0, cryptoassets_1.unitToCurrency)(cryptoassets_2.default[asset], totalFees[fee.fee]);
163
+ _sendFees[speed] = totalFee;
164
+ }
165
+ }
166
+ catch (e) {
167
+ console.error(e);
168
+ }
169
+ return _sendFees;
170
+ });
171
+ }
172
+ exports.sendBitcoinTxFees = sendBitcoinTxFees;
173
+ function estimateTransferNFT(accountId, network, receiver, values, nft, customFee) {
174
+ var _a;
175
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
176
+ const account = store_1.default.getters.accountItem(accountId);
177
+ const feeAsset = (0, cryptoassets_1.getNativeAssetCode)(network, account.chain);
178
+ if (!feeAsset) {
179
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.Asset.FeeAsset());
180
+ }
181
+ const suggestedGasFees = store_1.default.getters.suggestedFeePrices(feeAsset);
182
+ if (!suggestedGasFees) {
183
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.Asset.Fees(feeAsset));
184
+ }
185
+ const _suggestedGasFees = suggestedGasFees;
186
+ if (customFee) {
187
+ _suggestedGasFees.custom = { fee: customFee };
188
+ }
189
+ const client = store_1.default.getters.client({
190
+ network: store_1.default.state.activeNetwork,
191
+ walletId: store_1.default.state.activeWalletId,
192
+ chainId: account.chain,
193
+ accountId: accountId,
194
+ });
195
+ let _receiver = receiver;
196
+ if (!receiver && (0, asset_1.isChainEvmCompatible)(feeAsset, network)) {
197
+ _receiver = '0x' + 'f'.repeat(40);
198
+ }
199
+ const _sendFees = newSendFees();
200
+ try {
201
+ const estimation = yield client.nft.estimateTransfer(nft.asset_contract.address, _receiver, [nft.token_id], values);
202
+ for (const [speed, fee] of Object.entries(suggestedGasFees)) {
203
+ const _speed = speed;
204
+ const _fee = feePerUnit(fee.fee, account.chain);
205
+ _sendFees[_speed] = new bignumber_js_1.default(estimation).times(_fee).div(1e9);
206
+ }
207
+ return _sendFees;
208
+ }
209
+ catch (e) {
210
+ if (e.name === 'UnsupportedMethodError' || ((_a = e.rawError) === null || _a === void 0 ? void 0 : _a.name) === 'UnsupportedMethodError') {
211
+ for (const [speed, fee] of Object.entries(suggestedGasFees)) {
212
+ const _speed = speed;
213
+ _sendFees[_speed] = new bignumber_js_1.default(feePerUnit(fee.fee, account.chain));
214
+ }
215
+ return _sendFees;
216
+ }
217
+ throw e;
218
+ }
219
+ });
220
+ }
221
+ exports.estimateTransferNFT = estimateTransferNFT;
222
+ //# sourceMappingURL=fees.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fees.js","sourceRoot":"","sources":["../../../src/utils/fees.ts"],"names":[],"mappings":";;;;AAEA,qCAAuC;AACvC,yCAAoF;AACpF,uDAM8B;AAC9B,uDAA0E;AAC1E,wEAA8B;AAC9B,6DAA6B;AAC7B,0CAAyE;AACzE,mCAAqF;AACrF,0EAA0C;AAU1C,SAAS,WAAW;IAClB,OAAO,EAAE,IAAI,EAAE,IAAI,sBAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,sBAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,sBAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,sBAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACrF,CAAC;AAuSC,kCAAW;AArSb,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;IACrC,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE;IAC1C,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;IAC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ports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const fees_1 = require("./fees");
5
+ describe('fees tests', () => {
6
+ test('should be able to validate ETH getSendFee', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
7
+ const result = (0, fees_1.getSendFee)('ETH', 1);
8
+ expect(result).not.toBeUndefined();
9
+ }));
10
+ test('should be able to validate BTC getSendFee', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
11
+ const result = (0, fees_1.getSendFee)('BTC', 1);
12
+ expect(result).not.toBeUndefined();
13
+ }));
14
+ test('should be able to validate getFeeLabel', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
15
+ let result = (0, fees_1.getFeeLabel)('test');
16
+ expect(result).toBe('');
17
+ result = (0, fees_1.getFeeLabel)('slow');
18
+ expect(result).toBe('Slow');
19
+ result = (0, fees_1.getFeeLabel)('Average');
20
+ expect(result).toBe('Avg');
21
+ }));
22
+ test('should be able to validate getTxFee', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
23
+ let result = (0, fees_1.getTxFee)({
24
+ ETH: 1,
25
+ }, 'ETH', 1);
26
+ expect(result).not.toBeUndefined();
27
+ expect(result).not.toBe(NaN);
28
+ result = (0, fees_1.getTxFee)({
29
+ DAI: 1,
30
+ }, 'DAI', 1);
31
+ expect(result).not.toBeUndefined();
32
+ expect(result).not.toBe(NaN);
33
+ result = (0, fees_1.getTxFee)({
34
+ UST: 1,
35
+ }, 'UST', 1);
36
+ expect(result).not.toBeUndefined();
37
+ expect(result).not.toBe(NaN);
38
+ }));
39
+ });
40
+ //# sourceMappingURL=fees.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fees.test.js","sourceRoot":"","sources":["../../../src/utils/fees.test.ts"],"names":[],"mappings":";;;AAAA,iCAA2D;AAE3D,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,IAAI,CAAC,2CAA2C,EAAE,GAAS,EAAE;QAC3D,MAAM,MAAM,GAAG,IAAA,iBA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AC,aAAa,EAAE,CAAC;QACnC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE7B,MAAM,GAAG,IAAA,eAAQ,EACf;YACE,GAAG,EAAE,CAAC;SACP,EACD,KAAK,EACL,CAAC,CACF,CAAC;QACF,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;QACnC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const CHAINS_WITH_FETCH_TOKEN_DETAILS: any[];
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CHAINS_WITH_FETCH_TOKEN_DETAILS = void 0;
4
+ const cryptoassets_1 = require("@yaswap/cryptoassets");
5
+ const types_1 = require("../store/types");
6
+ exports.CHAINS_WITH_FETCH_TOKEN_DETAILS = Object.values(cryptoassets_1.ChainId).reduce((result, chainId) => {
7
+ const chain = (0, cryptoassets_1.getChain)(types_1.Network.Mainnet, chainId);
8
+ if (chain.hasTokens) {
9
+ result.push({
10
+ chainId,
11
+ label: `${capitalizeFirstLetter(chain.name)} (${chain.nativeAsset[0].code.toUpperCase()})`,
12
+ });
13
+ }
14
+ return result;
15
+ }, []);
16
+ function capitalizeFirstLetter(str) {
17
+ return str.charAt(0).toUpperCase() + str.slice(1);
18
+ }
19
+ //# sourceMappingURL=fetchTokenDetails.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchTokenDetails.js","sourceRoot":"","sources":["../../../src/utils/fetchTokenDetails.ts"],"names":[],"mappings":";;;AAAA,uDAAyD;AACzD,0CAAyC;AAE5B,QAAA,+BAA+B,GAAG,MAAM,CAAC,MAAM,CAAC,sBAAO,CAAC,CAAC,MAAM,CAAC,CAAC,MAAkB,EAAE,OAAgB,EAAE,EAAE;IACpH,MAAM,KAAK,GAAG,IAAA,uBAAQ,EAAC,eAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAEjD,IAAI,KAAK,CAAC,SAAS,EAAE;QACnB,MAAM,CAAC,IAAI,CAAC;YACV,OAAO;YACP,KAAK,EAAE,GAAG,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG;SAC3F,CAAC,CAAC;KACJ;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,EAAE,EAAE,CAAC,CAAC;AAEP,SAAS,qBAAqB,CAAC,GAAW;IACxC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,66 @@
1
+ import { HistoryItem, TransactionType } from '../store/types';
2
+ export declare const SEND_STATUS_STEP_MAP: {
3
+ WAITING_FOR_CONFIRMATIONS: number;
4
+ SUCCESS: number;
5
+ FAILED: number;
6
+ };
7
+ export declare const SEND_STATUS_LABEL_MAP: {
8
+ WAITING_FOR_CONFIRMATIONS: string;
9
+ SUCCESS: string;
10
+ FAILED: string;
11
+ };
12
+ export declare function getStatusLabel(item: HistoryItem): string | undefined;
13
+ export declare function getStep(item: HistoryItem): number;
14
+ export declare const ACTIVITY_FILTER_TYPES: {
15
+ SWAP: {
16
+ label: string;
17
+ icon: string;
18
+ };
19
+ NFT: {
20
+ label: string;
21
+ icon: string;
22
+ };
23
+ SEND: {
24
+ label: string;
25
+ icon: string;
26
+ };
27
+ RECEIVE: {
28
+ label: string;
29
+ icon: string;
30
+ };
31
+ };
32
+ export declare const ACTIVITY_STATUSES: {
33
+ PENDING: {
34
+ label: string;
35
+ icon: string;
36
+ };
37
+ COMPLETED: {
38
+ label: string;
39
+ icon: string;
40
+ };
41
+ FAILED: {
42
+ label: string;
43
+ icon: string;
44
+ };
45
+ NEEDS_ATTENTION: {
46
+ label: string;
47
+ icon: string;
48
+ };
49
+ REFUNDED: {
50
+ label: string;
51
+ icon: string;
52
+ };
53
+ };
54
+ export declare const SEND_STATUS_FILTER_MAP: {
55
+ WAITING_FOR_CONFIRMATIONS: string;
56
+ SUCCESS: string;
57
+ FAILED: string;
58
+ };
59
+ export declare const applyActivityFilters: (activity: HistoryItem[], filters: {
60
+ types: TransactionType[];
61
+ statuses: string[];
62
+ dates: {
63
+ start: string;
64
+ end: string;
65
+ };
66
+ }) => HistoryItem[];
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applyActivityFilters = exports.SEND_STATUS_FILTER_MAP = exports.ACTIVITY_STATUSES = exports.ACTIVITY_FILTER_TYPES = exports.getStep = exports.getStatusLabel = exports.SEND_STATUS_LABEL_MAP = exports.SEND_STATUS_STEP_MAP = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const moment_1 = tslib_1.__importDefault(require("moment"));
6
+ const error_parser_1 = require("@yaswap/error-parser");
7
+ const swap_1 = require("../factory/swap");
8
+ const types_1 = require("../store/types");
9
+ exports.SEND_STATUS_STEP_MAP = {
10
+ [types_1.SendStatus.WAITING_FOR_CONFIRMATIONS]: 0,
11
+ [types_1.SendStatus.SUCCESS]: 1,
12
+ [types_1.SendStatus.FAILED]: 2,
13
+ };
14
+ exports.SEND_STATUS_LABEL_MAP = {
15
+ [types_1.SendStatus.WAITING_FOR_CONFIRMATIONS]: 'Pending',
16
+ [types_1.SendStatus.SUCCESS]: 'Completed',
17
+ [types_1.SendStatus.FAILED]: 'Failed',
18
+ };
19
+ function getStatusLabel(item) {
20
+ if (item.type === types_1.TransactionType.NFT) {
21
+ return exports.SEND_STATUS_LABEL_MAP[item.status] || '';
22
+ }
23
+ if (item.type === types_1.TransactionType.Send) {
24
+ return exports.SEND_STATUS_LABEL_MAP[item.status] || '';
25
+ }
26
+ if (item.type === types_1.TransactionType.Swap) {
27
+ const swapProvider = (0, swap_1.getSwapProvider)(item.network, item.provider);
28
+ return (swapProvider.statuses[item.status].label
29
+ .replace('{from}', item.from)
30
+ .replace('{to}', item.to)
31
+ .replace('{bridgeAsset}', item.bridgeAsset || '') || '');
32
+ }
33
+ }
34
+ exports.getStatusLabel = getStatusLabel;
35
+ function getStep(item) {
36
+ const itemType = item.type;
37
+ if (itemType === types_1.TransactionType.NFT) {
38
+ return exports.SEND_STATUS_STEP_MAP[item.status];
39
+ }
40
+ if (itemType === types_1.TransactionType.Send) {
41
+ return exports.SEND_STATUS_STEP_MAP[item.status];
42
+ }
43
+ if (itemType === types_1.TransactionType.Swap) {
44
+ const swapProvider = (0, swap_1.getSwapProvider)(item.network, item.provider);
45
+ return swapProvider.statuses[item.status].step;
46
+ }
47
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.Invalid.TransactionType(itemType));
48
+ }
49
+ exports.getStep = getStep;
50
+ exports.ACTIVITY_FILTER_TYPES = {
51
+ SWAP: {
52
+ label: 'Swap',
53
+ icon: 'swap',
54
+ },
55
+ NFT: {
56
+ label: 'NFT',
57
+ icon: 'nft',
58
+ },
59
+ SEND: {
60
+ label: 'Send',
61
+ icon: 'send',
62
+ },
63
+ RECEIVE: {
64
+ label: 'Receive',
65
+ icon: 'receive',
66
+ },
67
+ };
68
+ exports.ACTIVITY_STATUSES = {
69
+ PENDING: {
70
+ label: 'Pending',
71
+ icon: 'pending',
72
+ },
73
+ COMPLETED: {
74
+ label: 'Completed',
75
+ icon: 'completed',
76
+ },
77
+ FAILED: {
78
+ label: 'Failed',
79
+ icon: 'failed',
80
+ },
81
+ NEEDS_ATTENTION: {
82
+ label: 'Needs Attention',
83
+ icon: 'needs_attention',
84
+ },
85
+ REFUNDED: {
86
+ label: 'Refunded',
87
+ icon: 'refunded',
88
+ },
89
+ };
90
+ exports.SEND_STATUS_FILTER_MAP = {
91
+ WAITING_FOR_CONFIRMATIONS: 'PENDING',
92
+ SUCCESS: 'COMPLETED',
93
+ FAILED: 'FAILED',
94
+ };
95
+ const applyActivityFilters = (activity, filters) => {
96
+ const { types, statuses, dates } = filters;
97
+ let filteredByType = [...activity];
98
+ if (types.length > 0) {
99
+ filteredByType = [...filteredByType].filter((i) => types.includes(i.type));
100
+ }
101
+ let fiteredByStatus = [...filteredByType];
102
+ if (statuses.length > 0) {
103
+ fiteredByStatus = [...fiteredByStatus].filter((i) => {
104
+ if (i.type === 'SWAP') {
105
+ const swapProvider = (0, swap_1.getSwapProvider)(i.network, i.provider);
106
+ return statuses.includes(swapProvider.statuses[i.status].filterStatus);
107
+ }
108
+ if (i.type === 'SEND') {
109
+ return statuses.includes(exports.SEND_STATUS_FILTER_MAP[i.status]);
110
+ }
111
+ return true;
112
+ });
113
+ }
114
+ let filteredByStartDate = [...fiteredByStatus];
115
+ if (dates.start) {
116
+ const startDateFilter = (0, moment_1.default)(dates.start);
117
+ filteredByStartDate = [...filteredByStartDate].filter((i) => {
118
+ const start = (0, moment_1.default)(i.startTime);
119
+ const diffInDays = start.diff(startDateFilter, 'days');
120
+ return diffInDays >= 0;
121
+ });
122
+ }
123
+ let filteredByEndDate = [...filteredByStartDate];
124
+ if (dates.end) {
125
+ const endDateFilter = (0, moment_1.default)(dates.end);
126
+ filteredByEndDate = [...filteredByEndDate].filter((i) => {
127
+ const end = (0, moment_1.default)(i.startTime);
128
+ const diffInDays = end.diff(endDateFilter, 'days');
129
+ return diffInDays <= 0;
130
+ });
131
+ }
132
+ return filteredByEndDate;
133
+ };
134
+ exports.applyActivityFilters = applyActivityFilters;
135
+ //# sourceMappingURL=history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/utils/history.ts"],"names":[],"mappings":";;;;AAAA,4DAA4B;AAC5B,uDAA0E;AAC1E,0CAAkD;AAClD,0CAA0E;AAE7D,QAAA,oBAAoB,GAAG;IAClC,C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G,eAAe,CAAC,CAAC;IAC/C,IAAI,KAAK,CAAC,KAAK,EAAE;QACf,MAAM,eAAe,GAAG,IAAA,gBAAM,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5C,mBAAmB,GAAG,CAAC,GAAG,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;YAC1D,MAAM,KAAK,GAAG,IAAA,gBAAM,EAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAClC,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;YAEvD,OAAO,UAAU,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;KACJ;IAED,IAAI,iBAAiB,GAAG,CAAC,GAAG,mBAAmB,CAAC,CAAC;IACjD,IAAI,KAAK,CAAC,GAAG,EAAE;QACb,MAAM,aAAa,GAAG,IAAA,gBAAM,EAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxC,iBAAiB,GAAG,CAAC,GAAG,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;YACtD,MAAM,GAAG,GAAG,IAAA,gBAAM,EAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAChC,MAAM,UAAU,GAAG,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;YAEnD,OAAO,UAAU,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAlDW,QAAA,oBAAoB,wBAkD/B"}
@@ -0,0 +1 @@
1
+ export declare function isTransactionNotFoundError(error: Error): boolean;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isTransactionNotFoundError = void 0;
4
+ const errors_1 = require("@yaswap/errors");
5
+ const error_parser_1 = require("@yaswap/error-parser");
6
+ function isTransactionNotFoundError(error) {
7
+ var _a;
8
+ if (error instanceof error_parser_1.LiqualityError) {
9
+ return ((_a = error.rawError) === null || _a === void 0 ? void 0 : _a.name) === errors_1.TxNotFoundError.prototype.name;
10
+ }
11
+ else {
12
+ return error.name === errors_1.TxNotFoundError.prototype.name;
13
+ }
14
+ }
15
+ exports.isTransactionNotFoundError = isTransactionNotFoundError;
16
+ //# sourceMappingURL=isTransactionNotFoundError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isTransactionNotFoundError.js","sourceRoot":"","sources":["../../../src/utils/isTransactionNotFoundError.ts"],"names":[],"mappings":";;;AAAA,2CAAiD;AACjD,uDAAsD;AAEtD,SAAgB,0BAA0B,CAAC,KAAY;;IACrD,IAAI,KAAK,YAAY,6BAAc,EAAE;QACnC,OAAO,CAAA,MAAE,KAAwB,CAAC,QAAkB,0CAAE,IAAI,MAAK,wBAAe,CAAC,SAAS,CAAC,IAAI,CAAC;KAC/F;SAAM;QACL,OAAO,KAAK,CAAC,IAAI,KAAK,wBAAe,CAAC,SAAS,CAAC,IAAI,CAAC;KACtD;AACH,CAAC;AAND,gEAMC"}
@@ -0,0 +1,12 @@
1
+ import { AccountType } from '../store/types';
2
+ export declare const LEDGER_BITCOIN_OPTIONS: {
3
+ name: AccountType;
4
+ label: string;
5
+ addressType: import("@yaswap/bitcoin/dist/lib/types").AddressType;
6
+ }[];
7
+ export declare const LEDGER_OPTIONS: {
8
+ name: string;
9
+ label: string;
10
+ types: AccountType[];
11
+ chain: string;
12
+ }[];
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LEDGER_OPTIONS = exports.LEDGER_BITCOIN_OPTIONS = void 0;
4
+ const types_1 = require("../store/types");
5
+ const address_1 = require("./address");
6
+ exports.LEDGER_BITCOIN_OPTIONS = [
7
+ {
8
+ name: types_1.AccountType.BitcoinLedgerNativeSegwit,
9
+ label: 'Segwit',
10
+ addressType: address_1.BitcoinAddressType.BECH32,
11
+ },
12
+ {
13
+ name: types_1.AccountType.BitcoinLedgerLegacy,
14
+ label: 'Legacy',
15
+ addressType: address_1.BitcoinAddressType.LEGACY,
16
+ },
17
+ ];
18
+ exports.LEDGER_OPTIONS = [
19
+ {
20
+ name: 'ETH',
21
+ label: 'ETH',
22
+ types: [types_1.AccountType.EthereumLedger],
23
+ chain: 'ethereum',
24
+ },
25
+ {
26
+ name: 'BTC',
27
+ label: 'BTC',
28
+ types: [types_1.AccountType.BitcoinLedgerNativeSegwit, types_1.AccountType.BitcoinLedgerLegacy],
29
+ chain: 'bitcoin',
30
+ },
31
+ {
32
+ name: 'RBTC',
33
+ label: 'RSK',
34
+ types: [types_1.AccountType.RskLedger],
35
+ chain: 'rsk',
36
+ },
37
+ ];
38
+ //# sourceMappingURL=ledger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ledger.js","sourceRoot":"","sources":["../../../src/utils/ledger.ts"],"names":[],"mappings":";;;AAAA,0CAA6C;AAC7C,uCAA+C;AAElC,QAAA,sBAAsB,GAAG;IACpC;QACE,IAAI,EAAE,mBAAW,CAAC,yBAAyB;QAC3C,KAAK,EAAE,QAAQ;QACf,WAAW,EAAE,4BAAkB,CAAC,MAAM;KACvC;IACD;QACE,IAAI,EAAE,mBAAW,CAAC,mBAAmB;QACrC,KAAK,EAAE,QAAQ;QACf,WAAW,EAAE,4BAAkB,CAAC,MAAM;KACvC;CACF,CAAC;AAEW,QAAA,cAAc,GAAG;IAC5B;QACE,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,CAAC,mBAAW,CAAC,cAAc,CAAC;QACnC,KAAK,EAAE,UAAU;KAClB;IACD;QACE,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,CAAC,mBAAW,CAAC,yBAAyB,EAAE,mBAAW,CAAC,mBAAmB,CAAC;QAC/E,KAAK,EAAE,SAAS;KACjB;IACD;QACE,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,CAAC,mBAAW,CAAC,SAAS,CAAC;QAC9B,KAAK,EAAE,KAAK;KACb;CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import moment from 'moment';
2
+ export default moment;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const moment_1 = tslib_1.__importDefault(require("moment"));
5
+ const locale = window.navigator.userLanguage || window.navigator.language;
6
+ moment_1.default.locale(locale);
7
+ exports.default = moment_1.default;
8
+ //# sourceMappingURL=moment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moment.js","sourceRoot":"","sources":["../../../src/utils/moment.ts"],"names":[],"mappings":";;;AAAA,4DAA4B;AAI5B,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,YAAY,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;AAC1E,gBAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAEtB,kBAAe,gBAAM,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Network as ChainifyNetwork } from '@yaswap/types';
2
+ import { ChainId } from '@yaswap/cryptoassets';
3
+ import { Network } from '../store/types';
4
+ export declare const Networks: Network[];
5
+ export declare type ChainNetworksType = Record<string, {
6
+ mainnet: ChainifyNetwork;
7
+ testnet: ChainifyNetwork;
8
+ }>;
9
+ export declare const ChainNetworks: ChainNetworksType;
10
+ export declare function getRpcUrl(chainId: ChainId, network?: Network): string;