@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,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EvmSwapProvider = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const evm_1 = require("@yaswap/evm");
6
+ const utils_1 = require("@yaswap/evm/dist/lib/utils");
7
+ const types_1 = require("@yaswap/types");
8
+ const cryptoassets_1 = require("@yaswap/cryptoassets");
9
+ const isTransactionNotFoundError_1 = require("../utils/isTransactionNotFoundError");
10
+ const ethers = tslib_1.__importStar(require("ethers"));
11
+ const chainify_1 = require("../utils/chainify");
12
+ const types_2 = require("../store/types");
13
+ const SwapProvider_1 = require("./SwapProvider");
14
+ class EvmSwapProvider extends SwapProvider_1.SwapProvider {
15
+ constructor(config) {
16
+ super(config);
17
+ }
18
+ requiresApproval(swapRequest, approvalAddress) {
19
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
20
+ const { quote, network, walletId } = swapRequest;
21
+ const fromAsset = (0, chainify_1.assetsAdapter)(quote.from)[0];
22
+ if (!fromAsset.contractAddress) {
23
+ return false;
24
+ }
25
+ const client = this.getClient(network, walletId, quote.from, quote.fromAccountId);
26
+ const signer = client.wallet.getSigner();
27
+ const tokenContract = evm_1.Typechain.ERC20__factory.connect(fromAsset.contractAddress, signer);
28
+ const userAddressRaw = yield this.getSwapAddress(network, walletId, quote.from, quote.fromAccountId);
29
+ const userAddress = (0, cryptoassets_1.getChain)(network, fromAsset.chain).formatAddress(userAddressRaw);
30
+ const _approvalAddress = approvalAddress !== null && approvalAddress !== void 0 ? approvalAddress : this.config.routerAddress;
31
+ const allowance = yield tokenContract.allowance(userAddress.toLowerCase(), _approvalAddress);
32
+ if (allowance.gte(quote.fromAmount)) {
33
+ return false;
34
+ }
35
+ return true;
36
+ });
37
+ }
38
+ buildApprovalTx(swapRequest, approveMax = true, approvalAddress) {
39
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
40
+ const approveRequired = yield this.requiresApproval(swapRequest, approvalAddress);
41
+ if (approveRequired) {
42
+ const { quote, network, walletId } = swapRequest;
43
+ const fromAsset = (0, chainify_1.assetsAdapter)(quote.from)[0];
44
+ const client = this.getClient(network, walletId, quote.from, quote.fromAccountId);
45
+ const signer = client.wallet.getSigner();
46
+ const tokenContract = evm_1.Typechain.ERC20__factory.connect(String(fromAsset.contractAddress), signer);
47
+ const approveAmount = approveMax ? ethers.constants.MaxUint256 : ethers.BigNumber.from(quote.fromAmount);
48
+ const _approvalAddress = approvalAddress !== null && approvalAddress !== void 0 ? approvalAddress : this.config.routerAddress;
49
+ return tokenContract.populateTransaction.approve(_approvalAddress, approveAmount);
50
+ }
51
+ });
52
+ }
53
+ approve(swapRequest, approveMax = true, approvalAddress) {
54
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
55
+ const approveTxData = yield this.buildApprovalTx(swapRequest, approveMax, approvalAddress);
56
+ const { quote, network, walletId } = swapRequest;
57
+ const isLSP = swapRequest.quote.provider === types_2.SwapProviderType.Liquality;
58
+ if (approveTxData) {
59
+ const client = this.getClient(network, walletId, quote.from, quote.fromAccountId);
60
+ const approveTx = yield client.wallet.sendTransaction((0, utils_1.toEthereumTxRequest)(approveTxData, quote.fee));
61
+ return {
62
+ status: isLSP ? 'WAITING_FOR_APPROVE_CONFIRMATIONS_LSP' : 'WAITING_FOR_APPROVE_CONFIRMATIONS',
63
+ approveTx,
64
+ approveTxHash: approveTx.hash,
65
+ };
66
+ }
67
+ else {
68
+ return {
69
+ status: isLSP ? 'APPROVE_CONFIRMED_LSP' : 'APPROVE_CONFIRMED',
70
+ };
71
+ }
72
+ });
73
+ }
74
+ waitForApproveConfirmations(swapRequest) {
75
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
76
+ const { swap, network, walletId } = swapRequest;
77
+ const client = this.getClient(network, walletId, swap.from, swap.fromAccountId);
78
+ const isLSP = swapRequest.swap.provider === types_2.SwapProviderType.Liquality;
79
+ try {
80
+ const tx = yield client.chain.getTransactionByHash(swap.approveTxHash);
81
+ if (tx.status === types_1.TxStatus.Success) {
82
+ return {
83
+ endTime: Date.now(),
84
+ status: isLSP ? 'APPROVE_CONFIRMED_LSP' : 'APPROVE_CONFIRMED',
85
+ };
86
+ }
87
+ }
88
+ catch (e) {
89
+ if ((0, isTransactionNotFoundError_1.isTransactionNotFoundError)(e))
90
+ console.warn(e);
91
+ else {
92
+ throw e;
93
+ }
94
+ }
95
+ });
96
+ }
97
+ _getStatuses() {
98
+ return {
99
+ WAITING_FOR_APPROVE_CONFIRMATIONS: {
100
+ step: 0,
101
+ label: 'Approving {from}',
102
+ filterStatus: 'PENDING',
103
+ notification(swap) {
104
+ return {
105
+ message: `Approving ${swap.from}`,
106
+ };
107
+ },
108
+ },
109
+ APPROVE_CONFIRMED: {
110
+ step: 1,
111
+ label: 'Swapping {from}',
112
+ filterStatus: 'PENDING',
113
+ },
114
+ };
115
+ }
116
+ }
117
+ exports.EvmSwapProvider = EvmSwapProvider;
118
+ //# sourceMappingURL=EvmSwapProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EvmSwapProvider.js","sourceRoot":"","sources":["../../../src/swaps/EvmSwapProvider.ts"],"names":[],"mappings":";;;;AACA,qCAAoE;AACpE,sDAAiE;AACjE,yCAAsD;AACtD,uDAAgD;AAChD,oFAAiF;AACjF,uDAAiC;AAEjC,gDAAkD;AAClD,0CAAkD;AAClD,iDAA8C;AAY9C,MAAsB,eAAgB,SAAQ,2BAAY;IAGxD,YAAY,MAA6B;QACvC,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAEK,gBAAgB,CAAC,WAAwB,EAAE,eAAwB;;YACvE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC;YACjD,MAAM,SAAS,GAAG,IAAA,wBAAa,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAG/C,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE;gBAC9B,OAAO,KAAK,CAAC;aACd;YAED,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,aAAa,CAA6B,CAAC;YAC9G,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YAEzC,MAAM,aAAa,GAAG,eAAS,CAAC,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;YAE1F,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;YACrG,MAAM,WAAW,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AE,GAAG,WAAW,CAAC;YAChD,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;YAEhF,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,QAAQ,KAAK,wBAAgB,CAAC,SAAS,CAAC;YAEvE,IAAI;gBACF,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;gBACvE,IAAI,EAAE,CAAC,MAAM,KAAK,gBAAQ,CAAC,OAAO,EAAE;oBAClC,OAAO;wBACL,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE;wBACnB,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,mBAAmB;qBAC9D,CAAC;iBACH;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,IAAI,IAAA,uDAA0B,EAAC,CAAC,CAAC;oBAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;qBAC9C;oBACH,MAAM,CAAC,CAAC;iBACT;aACF;QACH,CAAC;KAAA;IAES,YAAY;QACpB,OAAO;YACL,iCAAiC,EAAE;gBACjC,IAAI,EAAE,CAAC;gBACP,KAAK,EAAE,kBAAkB;gBACzB,YAAY,EAAE,SAAS;gBACvB,YAAY,CAAC,IAAS;oBACpB,OAAO;wBACL,OAAO,EAAE,aAAa,IAAI,CAAC,IAAI,EAAE;qBAClC,CAAC;gBACJ,CAAC;aACF;YAED,iBAAiB,EAAE;gBACjB,IAAI,EAAE,CAAC;gBACP,KAAK,EAAE,iBAAiB;gBACxB,YAAY,EAAE,SAAS;aACxB;SACF,CAAC;IACJ,CAAC;CACF;AArHD,0CAqHC"}
@@ -0,0 +1,35 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { ActionContext } from '../store';
3
+ import { AccountId, MarketData, Network, PairData, SwapHistoryItem } from '../store/types';
4
+ import { ActionStatus, BaseSwapProviderConfig, EstimateFeeRequest, EstimateFeeResponse, GetQuoteResult, NextSwapActionRequest, QuoteRequest, SwapRequest, SwapStatus } from './types';
5
+ export declare abstract class SwapProvider {
6
+ config: BaseSwapProviderConfig;
7
+ constructor(config: BaseSwapProviderConfig);
8
+ protected abstract _getStatuses(): Record<string, SwapStatus>;
9
+ protected abstract _txTypes(): Record<string, string | null>;
10
+ protected abstract _fromTxType(): string | null;
11
+ protected abstract _toTxType(): string | null;
12
+ protected abstract _totalSteps(): number;
13
+ protected abstract _timelineDiagramSteps(): string[];
14
+ sendLedgerNotification(accountId: string, message: string): Promise<void>;
15
+ abstract getSupportedPairs({ network }: {
16
+ network: Network;
17
+ }): Promise<PairData[]>;
18
+ abstract getMin(quoteRequest: QuoteRequest): Promise<BigNumber>;
19
+ abstract getQuote(quoteRequest: QuoteRequest): Promise<GetQuoteResult | null>;
20
+ abstract newSwap(swapRequest: SwapRequest): Promise<Partial<SwapHistoryItem>>;
21
+ abstract estimateFees(estimateFeeRequest: EstimateFeeRequest): Promise<EstimateFeeResponse | null>;
22
+ abstract performNextSwapAction(store: ActionContext, nextSwapAction: NextSwapActionRequest): Promise<Partial<SwapHistoryItem> | undefined>;
23
+ waitForSwapConfirmations(_nextSwapActionRequest: NextSwapActionRequest): Promise<ActionStatus | undefined>;
24
+ getMarketData(network: Network): MarketData[];
25
+ getClient(network: Network, walletId: string, asset: string, accountId: string): import("@yaswap/client").Client<import("@yaswap/client").Chain<any, import("@yaswap/types").Network>, import("@yaswap/client").Wallet<any, any>, import("@yaswap/client").Swap<any, any, import("@yaswap/client").Wallet<any, any>>, import("@yaswap/client").Nft<any, any>>;
26
+ getAccount(accountId: string): import("../store/types").Account | undefined;
27
+ updateBalances(network: Network, walletId: string, accountIds: AccountId[]): Promise<void>;
28
+ getSwapAddress(network: Network, walletId: string, asset: string, accountId: string): Promise<string>;
29
+ get statuses(): Record<string, SwapStatus>;
30
+ get fromTxType(): string | null;
31
+ get toTxType(): string | null;
32
+ get timelineDiagramSteps(): string[];
33
+ get totalSteps(): number;
34
+ get txTypes(): Record<string, string | null>;
35
+ }
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SwapProvider = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const error_parser_1 = require("@yaswap/error-parser");
6
+ const store_1 = tslib_1.__importDefault(require("../store"));
7
+ const notification_1 = require("../store/broker/notification");
8
+ class SwapProvider {
9
+ constructor(config) {
10
+ this.config = config;
11
+ }
12
+ sendLedgerNotification(accountId, message) {
13
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
+ const account = store_1.default.getters.accountItem(accountId);
15
+ if (account === null || account === void 0 ? void 0 : account.type.includes('ledger')) {
16
+ yield (0, notification_1.createNotification)({ title: 'Sign with Ledger', message });
17
+ }
18
+ });
19
+ }
20
+ waitForSwapConfirmations(_nextSwapActionRequest) {
21
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
+ return;
23
+ });
24
+ }
25
+ getMarketData(network) {
26
+ return store_1.default.state.marketData[network];
27
+ }
28
+ getClient(network, walletId, asset, accountId) {
29
+ const chainId = store_1.default.getters.cryptoassets[asset].chain;
30
+ return store_1.default.getters.client({ network, walletId, chainId, accountId });
31
+ }
32
+ getAccount(accountId) {
33
+ return store_1.default.getters.accountItem(accountId);
34
+ }
35
+ updateBalances(network, walletId, accountIds) {
36
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
37
+ return store_1.default.dispatch.updateBalances({ network, walletId, accountIds });
38
+ });
39
+ }
40
+ getSwapAddress(network, walletId, asset, accountId) {
41
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
42
+ const [address] = yield store_1.default.dispatch.getUnusedAddresses({ network, walletId, assets: [asset], accountId });
43
+ return address;
44
+ });
45
+ }
46
+ get statuses() {
47
+ const statuses = this._getStatuses();
48
+ if (typeof statuses === 'undefined')
49
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.SwapProvider.Statuses);
50
+ return statuses;
51
+ }
52
+ get fromTxType() {
53
+ const fromTxType = this._fromTxType();
54
+ if (typeof fromTxType === 'undefined') {
55
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.SwapProvider.FromTxType);
56
+ }
57
+ return fromTxType;
58
+ }
59
+ get toTxType() {
60
+ const toTxType = this._toTxType();
61
+ if (typeof toTxType === 'undefined') {
62
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.SwapProvider.ToTxType);
63
+ }
64
+ return toTxType;
65
+ }
66
+ get timelineDiagramSteps() {
67
+ const timelineDiagramSteps = this._timelineDiagramSteps();
68
+ if (typeof timelineDiagramSteps === 'undefined') {
69
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.SwapProvider.timelineDiagramSteps);
70
+ }
71
+ return timelineDiagramSteps;
72
+ }
73
+ get totalSteps() {
74
+ const totalSteps = this._totalSteps();
75
+ if (typeof totalSteps === 'undefined') {
76
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.SwapProvider.totalSteps);
77
+ }
78
+ return totalSteps;
79
+ }
80
+ get txTypes() {
81
+ const totalSteps = this._txTypes();
82
+ if (typeof totalSteps === 'undefined') {
83
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.SwapProvider._txTypes);
84
+ }
85
+ return totalSteps;
86
+ }
87
+ }
88
+ exports.SwapProvider = SwapProvider;
89
+ //# sourceMappingURL=SwapProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SwapProvider.js","sourceRoot":"","sources":["../../../src/swaps/SwapProvider.ts"],"names":[],"mappings":";;;;AAAA,uDAA0E;AAE1E,6DAAgD;AAChD,+DAAkE;AAclE,MAAsB,YAAY;IAGhC,YAAY,MAA8B;QACxC,IAAI,CAAC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KAAK,WAAW,EAAE;YACrC,MAAM,IAAA,kCAAmB,EAAC,4BAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;SAC3E;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,IAAW,OAAO;QAChB,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QACnC,IAAI,OAAO,UAAU,KAAK,WAAW,EAAE;YACrC,MAAM,IAAA,kCAAmB,EAAC,4BAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;SACzE;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAnJD,oCAmJC"}
@@ -0,0 +1,67 @@
1
+ import { TerraTypes } from '@yaswap/terra';
2
+ import { Transaction } from '@yaswap/types';
3
+ import { IAsset } from '@yaswap/cryptoassets';
4
+ import { LCDClient } from '@terra-money/terra.js';
5
+ import BN from 'bignumber.js';
6
+ import { ActionContext } from '../../store';
7
+ import { SwapHistoryItem } from '../../store/types';
8
+ import { SwapProvider } from '../SwapProvider';
9
+ import { EstimateFeeRequest, EstimateFeeResponse, NextSwapActionRequest, QuoteRequest, SwapRequest, SwapStatus } from '../types';
10
+ interface RateResponse {
11
+ amount: number;
12
+ return_amount: number;
13
+ }
14
+ interface AstroportSwapHistoryItem extends SwapHistoryItem {
15
+ swapTxHash: string;
16
+ swapTx: Transaction<TerraTypes.TerraTxRequest>;
17
+ fromTokenAddress: string;
18
+ toTokenAddress: string;
19
+ pairAddress: string;
20
+ }
21
+ declare class AstroportSwapProvider extends SwapProvider {
22
+ getSupportedPairs(): Promise<never[]>;
23
+ getQuote(quoteRequest: QuoteRequest): Promise<{
24
+ fromAmount: string;
25
+ toAmount: string;
26
+ fromTokenAddress: string | undefined;
27
+ toTokenAddress: string | undefined;
28
+ pairAddress: string;
29
+ } | null>;
30
+ newSwap({ network, walletId, quote }: SwapRequest<AstroportSwapHistoryItem>): Promise<{
31
+ status: string;
32
+ swapTx: any;
33
+ swapTxHash: any;
34
+ id: string;
35
+ fee: number;
36
+ slippage: number;
37
+ }>;
38
+ waitForSwapConfirmations({ swap, network, walletId }: NextSwapActionRequest<AstroportSwapHistoryItem>): Promise<{
39
+ endTime: number;
40
+ status: string;
41
+ } | undefined>;
42
+ performNextSwapAction(_store: ActionContext, { network, walletId, swap }: NextSwapActionRequest<AstroportSwapHistoryItem>): Promise<Partial<{
43
+ endTime: number;
44
+ status: string;
45
+ }> | undefined>;
46
+ getSwapLimit(): number;
47
+ estimateFees({ asset, txType, quote, feePrices, network }: EstimateFeeRequest): Promise<EstimateFeeResponse>;
48
+ getMin(_quoteRequest: QuoteRequest): Promise<BN>;
49
+ _getRPC(): LCDClient;
50
+ _getDenom(asset: string): string | undefined;
51
+ _getSwapRate(fromAmount: string, fromInfo: IAsset, toInfo: IAsset): Promise<{
52
+ rate: RateResponse;
53
+ fromTokenAddress: string | undefined;
54
+ toTokenAddress: string | undefined;
55
+ pairAddress: string;
56
+ }>;
57
+ _getPairAddress(tokenAddress: string): Promise<string>;
58
+ protected _getStatuses(): Record<string, SwapStatus>;
59
+ protected _txTypes(): {
60
+ SWAP: string;
61
+ };
62
+ protected _fromTxType(): string;
63
+ protected _toTxType(): null;
64
+ protected _timelineDiagramSteps(): string[];
65
+ protected _totalSteps(): number;
66
+ }
67
+ export { AstroportSwapProvider };
@@ -0,0 +1,251 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AstroportSwapProvider = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const terra_1 = require("@yaswap/terra");
6
+ const types_1 = require("@yaswap/types");
7
+ const cryptoassets_1 = require("@yaswap/cryptoassets");
8
+ const terra_js_1 = require("@terra-money/terra.js");
9
+ const bignumber_js_1 = tslib_1.__importStar(require("bignumber.js"));
10
+ const uuid_1 = require("uuid");
11
+ const utils_1 = require("../../store/actions/performNextAction/utils");
12
+ const coinFormatter_1 = require("../../utils/coinFormatter");
13
+ const cryptoassets_2 = tslib_1.__importDefault(require("../../utils/cryptoassets"));
14
+ const SwapProvider_1 = require("../SwapProvider");
15
+ const queries_1 = require("./queries");
16
+ const isTransactionNotFoundError_1 = require("../../utils/isTransactionNotFoundError");
17
+ const error_parser_1 = require("@yaswap/error-parser");
18
+ class AstroportSwapProvider extends SwapProvider_1.SwapProvider {
19
+ getSupportedPairs() {
20
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
21
+ return [];
22
+ });
23
+ }
24
+ getQuote(quoteRequest) {
25
+ var _a, _b;
26
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
27
+ const { from, to, amount } = quoteRequest;
28
+ const fromInfo = cryptoassets_2.default[from];
29
+ const toInfo = cryptoassets_2.default[to];
30
+ if (fromInfo.chain !== cryptoassets_1.ChainId.Terra || toInfo.chain !== cryptoassets_1.ChainId.Terra || amount.lt(0)) {
31
+ return null;
32
+ }
33
+ const fromAmountInUnit = (0, cryptoassets_1.currencyToUnit)(fromInfo, new bignumber_js_1.default(amount).decimalPlaces(fromInfo.decimals, bignumber_js_1.default.ROUND_DOWN)).toFixed();
34
+ const { rate, fromTokenAddress, toTokenAddress, pairAddress } = yield this._getSwapRate(fromAmountInUnit, fromInfo, toInfo);
35
+ if (rate.amount === 0 || rate.return_amount === 0) {
36
+ return null;
37
+ }
38
+ return {
39
+ fromAmount: fromAmountInUnit,
40
+ toAmount: ((_a = rate.amount) === null || _a === void 0 ? void 0 : _a.toString()) || ((_b = rate.return_amount) === null || _b === void 0 ? void 0 : _b.toString()),
41
+ fromTokenAddress,
42
+ toTokenAddress,
43
+ pairAddress,
44
+ };
45
+ });
46
+ }
47
+ newSwap({ network, walletId, quote }) {
48
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
49
+ const client = this.getClient(network, walletId, quote.from, quote.fromAccountId);
50
+ const [{ address }] = yield client.wallet.getAddresses();
51
+ const denom = this._getDenom(quote.from);
52
+ const { fromTokenAddress, toTokenAddress, pairAddress } = quote;
53
+ const isFromNative = quote.from === 'UST' || (quote.from === 'LUNA' && quote.to === 'UST');
54
+ const isFromERC20ToUST = fromTokenAddress && quote.to === 'UST';
55
+ let txData;
56
+ if (isFromNative) {
57
+ if (!denom) {
58
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.AstroPortDenom);
59
+ }
60
+ txData = (0, queries_1.buildSwapFromNativeTokenMsg)(quote, denom, address, pairAddress);
61
+ }
62
+ else if (isFromERC20ToUST) {
63
+ txData = (0, queries_1.buildSwapFromContractTokenToUSTMsg)(quote, address, fromTokenAddress, pairAddress);
64
+ }
65
+ else {
66
+ txData = (0, queries_1.buildSwapFromContractTokenMsg)(quote, address, fromTokenAddress, toTokenAddress);
67
+ }
68
+ yield this.sendLedgerNotification(quote.fromAccountId, 'Signing required to complete the swap.');
69
+ const swapTx = yield client.chain.sendTransaction(Object.assign({ to: '', value: new bignumber_js_1.BigNumber(0) }, txData));
70
+ const updates = {
71
+ status: 'WAITING_FOR_SWAP_CONFIRMATIONS',
72
+ swapTx,
73
+ swapTxHash: swapTx.hash,
74
+ };
75
+ return Object.assign({ id: (0, uuid_1.v4)(), fee: quote.fee, slippage: 50 }, updates);
76
+ });
77
+ }
78
+ waitForSwapConfirmations({ swap, network, walletId }) {
79
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
80
+ const client = this.getClient(network, walletId, swap.from, swap.fromAccountId);
81
+ try {
82
+ const tx = yield client.chain.getTransactionByHash(swap.swapTxHash);
83
+ if (tx && tx.confirmations && tx.confirmations > 0) {
84
+ const { status } = tx;
85
+ this.updateBalances(network, walletId, [swap.fromAccountId]);
86
+ return {
87
+ endTime: Date.now(),
88
+ status: status === types_1.TxStatus.Success ? 'SUCCESS' : 'FAILED',
89
+ };
90
+ }
91
+ }
92
+ catch (e) {
93
+ if ((0, isTransactionNotFoundError_1.isTransactionNotFoundError)(e))
94
+ console.warn(e);
95
+ else
96
+ throw e;
97
+ }
98
+ });
99
+ }
100
+ performNextSwapAction(_store, { network, walletId, swap }) {
101
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
102
+ if (swap.status === 'WAITING_FOR_SWAP_CONFIRMATIONS') {
103
+ return (0, utils_1.withInterval)(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.waitForSwapConfirmations({ swap, network, walletId }); }));
104
+ }
105
+ });
106
+ }
107
+ getSwapLimit() {
108
+ return 2;
109
+ }
110
+ estimateFees({ asset, txType, quote, feePrices, network }) {
111
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
112
+ if (txType !== this.fromTxType) {
113
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.Invalid.TransactionType(txType));
114
+ }
115
+ const nativeAsset = (0, cryptoassets_1.getNativeAssetCode)(network, cryptoassets_2.default[asset].chain);
116
+ const gasLimit = quote.from === 'UST' || (quote.from === 'LUNA' && quote.to === 'UST') ? 400000 : 1500000;
117
+ const fees = {};
118
+ for (const feePrice of feePrices) {
119
+ const fee = new bignumber_js_1.default(gasLimit).times(feePrice);
120
+ fees[feePrice] = new bignumber_js_1.default((0, cryptoassets_1.unitToCurrency)(cryptoassets_2.default[nativeAsset], fee).toFixed());
121
+ }
122
+ return fees;
123
+ });
124
+ }
125
+ getMin(_quoteRequest) {
126
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
127
+ return new bignumber_js_1.default(0);
128
+ });
129
+ }
130
+ _getRPC() {
131
+ const { chainId, rpcUrl } = terra_1.TerraNetworks.terra_mainnet;
132
+ return new terra_js_1.LCDClient({ chainID: String(chainId), URL: String(rpcUrl) });
133
+ }
134
+ _getDenom(asset) {
135
+ return {
136
+ LUNA: 'uluna',
137
+ UST: 'uusd',
138
+ }[asset];
139
+ }
140
+ _getSwapRate(fromAmount, fromInfo, toInfo) {
141
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
142
+ const rpc = this._getRPC();
143
+ const nativeToNative = fromInfo.type === cryptoassets_1.AssetTypes.native && toInfo.type === cryptoassets_1.AssetTypes.native;
144
+ const erc20ToErc20 = fromInfo.type === cryptoassets_1.AssetTypes.erc20 && toInfo.type === cryptoassets_1.AssetTypes.erc20;
145
+ const nativeToErc20 = fromInfo.type === cryptoassets_1.AssetTypes.native && toInfo.type === cryptoassets_1.AssetTypes.erc20;
146
+ const erc20ToNative = fromInfo.type === cryptoassets_1.AssetTypes.erc20 && toInfo.type === cryptoassets_1.AssetTypes.native;
147
+ let contractData;
148
+ let fromTokenAddress, toTokenAddress;
149
+ if (nativeToNative) {
150
+ const fromDenom = this._getDenom(fromInfo.code);
151
+ contractData = (0, queries_1.getRateNativeToAsset)(fromAmount, fromDenom);
152
+ }
153
+ else if (erc20ToErc20) {
154
+ fromTokenAddress = fromInfo.contractAddress;
155
+ toTokenAddress = toInfo.contractAddress;
156
+ if (!fromTokenAddress || !toTokenAddress) {
157
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.ContractAddress);
158
+ }
159
+ contractData = (0, queries_1.getRateERC20ToERC20)(fromAmount, fromTokenAddress, toTokenAddress);
160
+ }
161
+ else if (nativeToErc20) {
162
+ toTokenAddress = toInfo.contractAddress;
163
+ if (!toTokenAddress) {
164
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.ContractAddress);
165
+ }
166
+ const fromDenom = this._getDenom(fromInfo.code);
167
+ const pairAddress = yield this._getPairAddress(toTokenAddress);
168
+ contractData =
169
+ fromInfo.code === 'LUNA'
170
+ ? (0, queries_1.getRateERC20ToERC20)(fromAmount, fromDenom, toTokenAddress)
171
+ : (0, queries_1.getRateNativeToAsset)(fromAmount, fromDenom, pairAddress);
172
+ }
173
+ else if (erc20ToNative) {
174
+ fromTokenAddress = fromInfo.contractAddress;
175
+ if (!fromTokenAddress) {
176
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.ContractAddress);
177
+ }
178
+ const toDenom = this._getDenom(toInfo.code);
179
+ const pairAddress = yield this._getPairAddress(fromTokenAddress);
180
+ contractData =
181
+ toInfo.code === 'LUNA'
182
+ ? (0, queries_1.getRateERC20ToERC20)(fromAmount, fromTokenAddress, toDenom)
183
+ : (0, queries_1.getRateNativeToAsset)(fromAmount, fromTokenAddress, pairAddress);
184
+ }
185
+ else {
186
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.Invalid.AstroPortSwapPair(fromInfo.type, toInfo.type));
187
+ }
188
+ const { address, query } = contractData;
189
+ const pairAddress = address;
190
+ const rate = yield rpc.wasm.contractQuery(address, query);
191
+ return { rate, fromTokenAddress, toTokenAddress, pairAddress };
192
+ });
193
+ }
194
+ _getPairAddress(tokenAddress) {
195
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
196
+ const rpc = this._getRPC();
197
+ const query = (0, queries_1.getPairAddressQuery)(tokenAddress);
198
+ const resp = yield rpc.wasm.contractQuery('terra1fnywlw4edny3vw44x04xd67uzkdqluymgreu7g', query);
199
+ return resp.contract_addr;
200
+ });
201
+ }
202
+ _getStatuses() {
203
+ return {
204
+ WAITING_FOR_SWAP_CONFIRMATIONS: {
205
+ step: 0,
206
+ label: 'Swapping {from}',
207
+ filterStatus: 'PENDING',
208
+ notification() {
209
+ return { message: 'Engaging Astroport' };
210
+ },
211
+ },
212
+ SUCCESS: {
213
+ step: 1,
214
+ label: 'Completed',
215
+ filterStatus: 'COMPLETED',
216
+ notification(swap) {
217
+ return {
218
+ message: `Swap completed, ${(0, coinFormatter_1.prettyBalance)(new bignumber_js_1.BigNumber(swap.toAmount), swap.to)} ${swap.to} ready to use`,
219
+ };
220
+ },
221
+ },
222
+ FAILED: {
223
+ step: 1,
224
+ label: 'Swap Failed',
225
+ filterStatus: 'REFUNDED',
226
+ notification() {
227
+ return { message: 'Swap failed' };
228
+ },
229
+ },
230
+ };
231
+ }
232
+ _txTypes() {
233
+ return {
234
+ SWAP: 'SWAP',
235
+ };
236
+ }
237
+ _fromTxType() {
238
+ return this._txTypes().SWAP;
239
+ }
240
+ _toTxType() {
241
+ return null;
242
+ }
243
+ _timelineDiagramSteps() {
244
+ return ['SWAP'];
245
+ }
246
+ _totalSteps() {
247
+ return 2;
248
+ }
249
+ }
250
+ exports.AstroportSwapProvider = AstroportSwapProvider;
251
+ //# sourceMappingURL=AstroportSwapProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AstroportSwapProvider.js","sourceRoot":"","sources":["../../../../src/swaps/astroport/AstroportSwapProvider.ts"],"names":[],"mappings":";;;;AAAA,yCAA0D;AAC1D,yCAAsD;AACtD,uDAO8B;AAC9B,oDAAkD;AAClD,qEAA6C;AAC7C,+BAAoC;AAEpC,uEAA2E;AAE3E,6DAA0D;AAC1D,oFAAoD;AACpD,kDAA+C;AAS/C,uCAOmB;AACnB,uFAAoF;AACpF,uDAA0E;AAe1E,MAAM,qBAAsB,SAAQ,2BAAY;IACxC,iBAAiB;;YACrB,OAAO,EAAE,CAAC;QACZ,CAAC;KAAA;IAEK,QAAQ,CAAC,YAA0B;;;YACvC,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC;YAC1C,MAAM,QAAQ,GAAG,sBAAY,CAAC,IAAI,CAAC,CAAC;YACpC,MAAM,MAAM,GAAG,sBAAY,CAAC,EAAE,CAAC,CAAC;YAGhC,IAAI,QAAQ,CAAC,KAAK,KAAK,sBAAO,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,KAAK,sBAAO,CAAC,KAAK,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;gBACtF,OAAO,IAAI,CAAC;aACb;YAED,MAAM,gBAAgB,GAAG,IAAA,6BAAc,EACrC,QAAQ,EACR,IAAI,sBAAE,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,QAAQ,EAAE,sBAAE,CAAC,UAAU,CAAC,CAC/D,CAAC,OAAO,EAAE,CAAC;YAEZ,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,cA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SAAS;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAES,qBAAqB;QAC7B,OAAO,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;IAES,WAAW;QACnB,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AAEQ,sDAAqB"}
@@ -0,0 +1,7 @@
1
+ {
2
+ "title": "Astroport AMM Swaps",
3
+ "description": "Decentralized, permissionless and open-source, Astroport’s marketplace is a public good governed by its community of token holders",
4
+ "pros": ["Low liquidity provider fee", "Margin Trading"],
5
+ "cons": ["Slippage"],
6
+ "fees": ["0.15% liquidity provider fee", "Slippage (up to 0.5% in Liquality)"]
7
+ }