@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,479 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HopSwapProvider = exports.HopTxTypes = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const utils_1 = require("@yaswap/utils");
6
+ const sdk_1 = require("@hop-protocol/sdk");
7
+ const cryptoassets_1 = require("@yaswap/cryptoassets");
8
+ const isTransactionNotFoundError_1 = require("../../utils/isTransactionNotFoundError");
9
+ const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
10
+ const ethers_1 = require("ethers");
11
+ const urql_1 = require("urql");
12
+ const uuid_1 = require("uuid");
13
+ const utils_2 = require("../../store/actions/performNextAction/utils");
14
+ const asset_1 = require("../../utils/asset");
15
+ const coinFormatter_1 = require("../../utils/coinFormatter");
16
+ const cryptoassets_2 = tslib_1.__importDefault(require("../../utils/cryptoassets"));
17
+ const SwapProvider_1 = require("../SwapProvider");
18
+ const queries_1 = require("./queries");
19
+ const error_parser_1 = require("@yaswap/error-parser");
20
+ var HopTxTypes;
21
+ (function (HopTxTypes) {
22
+ HopTxTypes["SWAP"] = "SWAP";
23
+ })(HopTxTypes = exports.HopTxTypes || (exports.HopTxTypes = {}));
24
+ class HopSwapProvider extends SwapProvider_1.SwapProvider {
25
+ constructor(config) {
26
+ super(config);
27
+ this.graphqlURLs = {
28
+ url: this.config.graphqlBaseURL,
29
+ ethereum: 'hop-mainnet',
30
+ xdai: 'hop-xdai',
31
+ arbitrum: 'hop-arbitrum',
32
+ polygon: 'hop-polygon',
33
+ optimism: 'hop-optimism',
34
+ };
35
+ }
36
+ getSupportedPairs() {
37
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
38
+ return [];
39
+ });
40
+ }
41
+ gasLimit(networkName) {
42
+ const networkToGasLimit = {
43
+ arbitrum: {
44
+ send: 9000000,
45
+ approve: 1000000,
46
+ },
47
+ polygon: {
48
+ send: 300000,
49
+ approve: 300000,
50
+ },
51
+ ethereum: {
52
+ send: 300000,
53
+ approve: 300000,
54
+ },
55
+ optimism: {
56
+ send: 345000,
57
+ sendL1: 6500,
58
+ approve: 65000,
59
+ approveL1: 5600,
60
+ },
61
+ };
62
+ return networkToGasLimit[networkName];
63
+ }
64
+ getChain(chainName) {
65
+ const slugToChain = {
66
+ [sdk_1.Hop.Chain.Ethereum.slug]: sdk_1.Hop.Chain.Ethereum,
67
+ [sdk_1.Hop.Chain.Arbitrum.slug]: sdk_1.Hop.Chain.Arbitrum,
68
+ [sdk_1.Hop.Chain.Gnosis.slug]: sdk_1.Hop.Chain.Gnosis,
69
+ [sdk_1.Hop.Chain.Optimism.slug]: sdk_1.Hop.Chain.Optimism,
70
+ [sdk_1.Hop.Chain.Polygon.slug]: sdk_1.Hop.Chain.Polygon,
71
+ };
72
+ return slugToChain[chainName];
73
+ }
74
+ _getHop(network, signer = undefined) {
75
+ return new sdk_1.Hop(network === 'mainnet' ? 'mainnet' : 'kovan', signer);
76
+ }
77
+ _getAllTokens(hop) {
78
+ const bridge = hop.bridge('ETH');
79
+ const token = bridge.getCanonicalToken(sdk_1.Chain.Ethereum);
80
+ return token.addresses;
81
+ }
82
+ _getClient(network, walletId, from, fromAccountId) {
83
+ return this.getClient(network, walletId, from, fromAccountId);
84
+ }
85
+ _getSigner(network, walletId, from, fromAccountId, provider) {
86
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
87
+ const client = this._getClient(network, walletId, from, fromAccountId);
88
+ const privKey = yield client.wallet.exportPrivateKey();
89
+ return new ethers_1.Wallet(privKey, provider);
90
+ });
91
+ }
92
+ _getBridgeWithSigner(hopAsset, hopChainFrom, network, walletId, from, fromAccountId) {
93
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
94
+ try {
95
+ const chainFrom = this.getChain(hopChainFrom.slug);
96
+ const client = this._getClient(network, walletId, from, fromAccountId);
97
+ const privKey = yield client.wallet.exportPrivateKey();
98
+ const hop = this._getHop(network);
99
+ const signer = new ethers_1.Wallet(privKey, hop.getChainProvider(chainFrom));
100
+ const bridge = hop.connect(signer).bridge(hopAsset);
101
+ return bridge;
102
+ }
103
+ catch (err) {
104
+ console.warn('Hop network or Hop assets is invalid');
105
+ throw err;
106
+ }
107
+ });
108
+ }
109
+ _findAsset(asset, chain, tokens, tokenName) {
110
+ var _a, _b;
111
+ if (asset.type === 'native') {
112
+ if (asset.code === tokenName || asset.matchingAsset === tokenName) {
113
+ return tokenName;
114
+ }
115
+ }
116
+ else {
117
+ if (asset.contractAddress &&
118
+ tokens[chain] &&
119
+ (((_a = tokens[chain].l1CanonicalToken) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === asset.contractAddress.toLowerCase() ||
120
+ ((_b = tokens[chain].l2CanonicalToken) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === asset.contractAddress.toLowerCase())) {
121
+ return tokenName;
122
+ }
123
+ }
124
+ }
125
+ _getSendInfo(assetFrom, assetTo, hop) {
126
+ if (!assetFrom || !assetTo)
127
+ return null;
128
+ const _chainFrom = this.getChain(assetFrom.chain);
129
+ const _chainTo = this.getChain(assetTo.chain);
130
+ if (!_chainFrom || !_chainTo)
131
+ return null;
132
+ const availableTokens = this._getAllTokens(hop);
133
+ let _from, _to;
134
+ for (const token in availableTokens) {
135
+ if (!_from)
136
+ _from = this._findAsset(assetFrom, _chainFrom.slug, availableTokens[token], token);
137
+ if (!_to)
138
+ _to = this._findAsset(assetTo, _chainTo.slug, availableTokens[token], token);
139
+ }
140
+ if (!_from || !_to || _from !== _to)
141
+ return null;
142
+ const supportedAssetsFrom = hop.getSupportedAssetsForChain(_chainFrom.slug);
143
+ const supportedAssetsTo = hop.getSupportedAssetsForChain(_chainTo.slug);
144
+ if (!supportedAssetsFrom[_from] || !supportedAssetsTo[_to])
145
+ return null;
146
+ return { bridgeAsset: _from, chainFrom: _chainFrom, chainTo: _chainTo };
147
+ }
148
+ getQuote({ network, from, to, amount }) {
149
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
150
+ if (amount <= new bignumber_js_1.default(0))
151
+ return null;
152
+ const assetFrom = cryptoassets_2.default[from];
153
+ const assetTo = cryptoassets_2.default[to];
154
+ const fromAmountInUnit = (0, cryptoassets_1.currencyToUnit)(cryptoassets_2.default[from], new bignumber_js_1.default(amount));
155
+ const hop = this._getHop(network);
156
+ const info = this._getSendInfo(assetFrom, assetTo, hop);
157
+ if (!info)
158
+ return null;
159
+ const { bridgeAsset, chainFrom, chainTo } = info;
160
+ const bridge = hop.bridge(bridgeAsset);
161
+ const sendData = yield bridge.getSendData(fromAmountInUnit.toString(), chainFrom, chainTo);
162
+ if (!sendData)
163
+ return null;
164
+ return {
165
+ fromAmount: fromAmountInUnit.toFixed(),
166
+ toAmount: new bignumber_js_1.default(sendData.amountOut.toString()).toFixed(),
167
+ hopAsset: bridgeAsset,
168
+ hopChainFrom: chainFrom,
169
+ hopChainTo: chainTo,
170
+ receiveFee: new bignumber_js_1.default(sendData.adjustedBonderFee.toString())
171
+ .plus(new bignumber_js_1.default(sendData.adjustedDestinationTxFee.toString()))
172
+ .toString(),
173
+ };
174
+ });
175
+ }
176
+ _formatFee(fee, networkName, type) {
177
+ if (typeof fee === 'number') {
178
+ return {
179
+ gasPrice: '0x' + new bignumber_js_1.default(fee).times(1e9).decimalPlaces(0).toString(16),
180
+ gasLimit: this.gasLimit(networkName)[type],
181
+ };
182
+ }
183
+ return {
184
+ maxFeePerGas: '0x' + new bignumber_js_1.default(fee.maxFeePerGas).times(1e9).decimalPlaces(0).toString(16),
185
+ maxPriorityFeePerGas: '0x' + new bignumber_js_1.default(fee.maxPriorityFeePerGas).times(1e9).decimalPlaces(0).toString(16),
186
+ gasLimit: this.gasLimit(networkName)[type],
187
+ };
188
+ }
189
+ _approveToken(bridge, chainFrom, fromAmount, signer, fee) {
190
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
191
+ const txData = yield bridge.populateSendApprovalTx(fromAmount, chainFrom);
192
+ const feeFormated = this._formatFee(fee, chainFrom.name.toLowerCase(), 'approve');
193
+ const approveTx = yield signer.sendTransaction(Object.assign(Object.assign({}, txData), feeFormated));
194
+ return {
195
+ status: 'WAITING_FOR_APPROVE_CONFIRMATIONS',
196
+ approveTx,
197
+ approveTxHash: approveTx === null || approveTx === void 0 ? void 0 : approveTx.hash,
198
+ };
199
+ });
200
+ }
201
+ sendSwap({ network, walletId, quote }) {
202
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
203
+ const { hopAsset, hopChainFrom, hopChainTo, from, fromAccountId, fromAmount } = quote;
204
+ const chainFrom = this.getChain(hopChainFrom.slug);
205
+ const chainTo = this.getChain(hopChainTo.slug);
206
+ const bridge = yield this._getBridgeWithSigner(hopAsset, hopChainFrom, network, walletId, from, fromAccountId);
207
+ const hop = this._getHop(network);
208
+ const signer = yield this._getSigner(network, walletId, from, fromAccountId, hop === null || hop === void 0 ? void 0 : hop.getChainProvider(chainFrom));
209
+ const txData = yield (bridge === null || bridge === void 0 ? void 0 : bridge.populateSendTx(fromAmount, chainFrom, chainTo));
210
+ const feeFormated = this._formatFee(quote.fee, chainFrom.name.toLowerCase(), 'send');
211
+ const fromFundTx = yield signer.sendTransaction(Object.assign(Object.assign({}, txData), feeFormated));
212
+ return {
213
+ status: 'WAITING_FOR_SEND_SWAP_CONFIRMATIONS',
214
+ fromFundTx,
215
+ fromFundHash: fromFundTx.hash,
216
+ };
217
+ });
218
+ }
219
+ newSwap({ network, walletId, quote }) {
220
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
221
+ const { hopAsset, hopChainFrom, hopChainTo, from, fromAccountId, fromAmount } = quote;
222
+ const chainFrom = this.getChain(hopChainFrom.slug);
223
+ const chainTo = this.getChain(hopChainTo.slug);
224
+ const bridge = yield this._getBridgeWithSigner(hopAsset, hopChainFrom, network, walletId, from, fromAccountId);
225
+ const hop = this._getHop(network);
226
+ const signer = yield this._getSigner(network, walletId, from, fromAccountId, hop === null || hop === void 0 ? void 0 : hop.getChainProvider(chainFrom));
227
+ let updates;
228
+ if ((0, asset_1.isERC20)(quote.from)) {
229
+ updates = yield this._approveToken(bridge, chainFrom, fromAmount, signer, quote.fee);
230
+ }
231
+ else {
232
+ updates = {
233
+ endTime: Date.now(),
234
+ status: 'APPROVE_CONFIRMED',
235
+ };
236
+ }
237
+ return Object.assign({ id: (0, uuid_1.v4)(), fee: quote.fee, slippage: 50, hopAsset: hopAsset, hopChainFrom: chainFrom, hopChainTo: chainTo }, updates);
238
+ });
239
+ }
240
+ estimateFees({ asset, txType, quote, network, feePrices, feePricesL1, }) {
241
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
242
+ if (txType !== this.fromTxType) {
243
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.Invalid.TransactionType(txType));
244
+ }
245
+ const chainId = cryptoassets_2.default[asset].chain;
246
+ const nativeAsset = (0, cryptoassets_1.getNativeAssetCode)(network, cryptoassets_2.default[asset].chain);
247
+ const quoteFromStr = quote.hopChainFrom.slug || '';
248
+ const limits = this.gasLimit(quoteFromStr);
249
+ let gasLimit = limits.send;
250
+ if ((0, asset_1.isERC20)(quote.from)) {
251
+ gasLimit += limits.approve;
252
+ }
253
+ const isMultiLayered = (0, cryptoassets_1.getChain)(network, chainId).isMultiLayered;
254
+ if (isMultiLayered && (!feePricesL1 || !limits.sendL1 || !limits.approveL1)) {
255
+ if (!feePricesL1)
256
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.Chain.FeePrice);
257
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.Chain.L1GasLimit);
258
+ }
259
+ let gasLimitL1 = 0;
260
+ if (isMultiLayered) {
261
+ gasLimitL1 = limits.sendL1;
262
+ if ((0, asset_1.isERC20)(quote.from)) {
263
+ gasLimitL1 += limits.approveL1;
264
+ }
265
+ }
266
+ const fees = {};
267
+ feePrices.forEach((feePrice, index) => {
268
+ const gasPrice = new bignumber_js_1.default(feePrice).times(1e9);
269
+ let fee = new bignumber_js_1.default(gasLimit).times(1.1).times(gasPrice);
270
+ if (isMultiLayered) {
271
+ const gasPriceL1 = new bignumber_js_1.default(feePricesL1[index]).times(1e9);
272
+ fee = fee.plus(new bignumber_js_1.default(gasLimitL1).times(1.1).times(gasPriceL1));
273
+ }
274
+ fees[feePrice] = (0, cryptoassets_1.unitToCurrency)(cryptoassets_2.default[nativeAsset], fee);
275
+ });
276
+ return fees;
277
+ });
278
+ }
279
+ getMin(_quoteRequest) {
280
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
281
+ return new bignumber_js_1.default(0);
282
+ });
283
+ }
284
+ waitForApproveConfirmations({ swap, network, walletId }) {
285
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
286
+ const client = this._getClient(network, walletId, swap.from, swap.fromAccountId);
287
+ try {
288
+ const tx = yield client.chain.getTransactionByHash(swap.approveTxHash);
289
+ if (tx && tx.confirmations && tx.confirmations >= 1) {
290
+ return {
291
+ endTime: Date.now(),
292
+ status: 'APPROVE_CONFIRMED',
293
+ };
294
+ }
295
+ }
296
+ catch (e) {
297
+ if ((0, isTransactionNotFoundError_1.isTransactionNotFoundError)(e))
298
+ console.warn(e);
299
+ else
300
+ throw e;
301
+ }
302
+ });
303
+ }
304
+ waitForSendSwapConfirmations({ swap, network, walletId }) {
305
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
306
+ const client = this._getClient(network, walletId, swap.from, swap.fromAccountId);
307
+ try {
308
+ const tx = yield client.chain.getTransactionByHash(swap.fromFundHash);
309
+ const chainId = swap.hopChainFrom.slug.toString();
310
+ if (tx && tx.confirmations && tx.confirmations >= (0, cryptoassets_1.getChain)(network, chainId).safeConfirmations) {
311
+ this.updateBalances(network, walletId, [swap.fromAccountId]);
312
+ return {
313
+ endTime: Date.now(),
314
+ status: tx.status === 'SUCCESS' || Number(tx.status) === 1 ? 'WAITING_FOR_RECEIVE_SWAP_CONFIRMATIONS' : 'FAILED',
315
+ };
316
+ }
317
+ }
318
+ catch (e) {
319
+ if (e.name === 'TxNotFoundError')
320
+ console.warn(e);
321
+ else
322
+ throw e;
323
+ }
324
+ });
325
+ }
326
+ waitForRecieveSwapConfirmations({ swap, network, walletId }) {
327
+ var _a, _b, _c, _d, _e, _f;
328
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
329
+ const { hopChainFrom, hopChainTo, fromFundHash, from, to, fromAccountId, toAccountId } = swap;
330
+ const client = this._getClient(network, walletId, from, fromAccountId);
331
+ const privKey = yield client.wallet.exportPrivateKey();
332
+ const signer = new ethers_1.Wallet(privKey);
333
+ const chainFrom = this.getChain(hopChainFrom.slug);
334
+ const chainTo = this.getChain(hopChainTo.slug);
335
+ const isFromL1Source = chainFrom.isL1 && !chainTo.isL1;
336
+ try {
337
+ let clientGQL;
338
+ let transferId = '';
339
+ if (!isFromL1Source) {
340
+ clientGQL = (0, urql_1.createClient)({
341
+ url: `${this.graphqlURLs.url}/${this.graphqlURLs[chainFrom.slug]}`,
342
+ });
343
+ const { data } = yield clientGQL.query((0, queries_1.getTransferIdByTxHash)((0, utils_1.ensure0x)(fromFundHash))).toPromise();
344
+ transferId = (_b = (_a = data.transferSents) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.transferId;
345
+ if (!transferId)
346
+ return;
347
+ }
348
+ clientGQL = (0, urql_1.createClient)({
349
+ url: `${this.graphqlURLs.url}/${this.graphqlURLs[chainTo.slug]}`,
350
+ });
351
+ const { data } = yield clientGQL
352
+ .query((0, queries_1.getDestinationTxGQL)(transferId, signer.address.toLowerCase(), isFromL1Source))
353
+ .toPromise();
354
+ const methodName = !isFromL1Source ? 'withdrawalBondeds' : 'transferFromL1Completeds';
355
+ const destinationTxHash = (_d = (_c = data[methodName]) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.transactionHash;
356
+ if (!destinationTxHash)
357
+ return;
358
+ const client = this._getClient(network, walletId, to, toAccountId);
359
+ const tx = yield client.chain.getTransactionByHash((_f = (_e = data[methodName]) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.transactionHash);
360
+ if (tx && tx.confirmations && tx.confirmations >= 1) {
361
+ const isSuccessful = tx.status === 'SUCCESS' || Number(tx.status) === 1;
362
+ if (isSuccessful) {
363
+ this.updateBalances(network, walletId, [swap.toAccountId]);
364
+ }
365
+ return {
366
+ receiveTxHash: tx.hash,
367
+ receiveTx: tx,
368
+ endTime: Date.now(),
369
+ status: isSuccessful ? 'SUCCESS' : 'FAILED',
370
+ };
371
+ }
372
+ }
373
+ catch (e) {
374
+ if ((0, isTransactionNotFoundError_1.isTransactionNotFoundError)(e))
375
+ console.warn(e);
376
+ else
377
+ throw e;
378
+ }
379
+ });
380
+ }
381
+ performNextSwapAction(store, { network, walletId, swap }) {
382
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
383
+ let updates;
384
+ switch (swap.status) {
385
+ case 'WAITING_FOR_APPROVE_CONFIRMATIONS':
386
+ updates = yield (0, utils_2.withInterval)(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.waitForApproveConfirmations({ swap, network, walletId }); }));
387
+ break;
388
+ case 'APPROVE_CONFIRMED':
389
+ updates = yield (0, utils_2.withLock)(store, { item: swap, network, walletId, asset: swap.from }, () => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.sendSwap({ quote: swap, network, walletId }); }));
390
+ break;
391
+ case 'WAITING_FOR_SEND_SWAP_CONFIRMATIONS':
392
+ updates = yield (0, utils_2.withInterval)(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.waitForSendSwapConfirmations({ swap, network, walletId }); }));
393
+ break;
394
+ case 'WAITING_FOR_RECEIVE_SWAP_CONFIRMATIONS':
395
+ updates = yield (0, utils_2.withInterval)(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.waitForRecieveSwapConfirmations({ swap, network, walletId }); }));
396
+ break;
397
+ }
398
+ return updates;
399
+ });
400
+ }
401
+ _getStatuses() {
402
+ return {
403
+ WAITING_FOR_APPROVE_CONFIRMATIONS: {
404
+ step: 0,
405
+ label: 'Approving {from}',
406
+ filterStatus: 'PENDING',
407
+ notification(swap) {
408
+ return {
409
+ message: `Approving ${swap.from}`,
410
+ };
411
+ },
412
+ },
413
+ APPROVE_CONFIRMED: {
414
+ step: 1,
415
+ label: 'Swapping {from}',
416
+ filterStatus: 'PENDING',
417
+ },
418
+ WAITING_FOR_SEND_SWAP_CONFIRMATIONS: {
419
+ step: 1,
420
+ label: 'Swapping {from}',
421
+ filterStatus: 'PENDING',
422
+ notification() {
423
+ return {
424
+ message: 'Engaging the hop.exchange',
425
+ };
426
+ },
427
+ },
428
+ WAITING_FOR_RECEIVE_SWAP_CONFIRMATIONS: {
429
+ step: 2,
430
+ label: 'Swapping {to}',
431
+ filterStatus: 'PENDING',
432
+ notification() {
433
+ return {
434
+ message: 'Engaging the hop.exchange',
435
+ };
436
+ },
437
+ },
438
+ SUCCESS: {
439
+ step: 3,
440
+ label: 'Completed',
441
+ filterStatus: 'COMPLETED',
442
+ notification(swap) {
443
+ return {
444
+ message: `Swap completed, ${(0, coinFormatter_1.prettyBalance)(swap.toAmount, swap.to)} ${swap.to} ready to use`,
445
+ };
446
+ },
447
+ },
448
+ FAILED: {
449
+ step: 3,
450
+ label: 'Swap Failed',
451
+ filterStatus: 'REFUNDED',
452
+ notification() {
453
+ return {
454
+ message: 'Swap failed',
455
+ };
456
+ },
457
+ },
458
+ };
459
+ }
460
+ _txTypes() {
461
+ return {
462
+ SWAP: 'SWAP',
463
+ };
464
+ }
465
+ _fromTxType() {
466
+ return this._txTypes().SWAP;
467
+ }
468
+ _toTxType() {
469
+ return null;
470
+ }
471
+ _totalSteps() {
472
+ return 4;
473
+ }
474
+ _timelineDiagramSteps() {
475
+ return ['APPROVE', 'INITIATION', 'RECEIVE'];
476
+ }
477
+ }
478
+ exports.HopSwapProvider = HopSwapProvider;
479
+ //# sourceMappingURL=HopSwapProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HopSwapProvider.js","sourceRoot":"","sources":["../../../../src/swaps/hop/HopSwapProvider.ts"],"names":[],"mappings":";;;;AACA,yCAAyC;AACzC,2CAAkE;AAClE,uDAAqH;AACrH,uFAAoF;AACpF,wEAA8B;AAC9B,mCAAwC;AACxC,+BAAoC;AACpC,+BAAoC;AAEpC,uEAAqF;AAErF,6CAA4C;AAC5C,6DAA0D;AAC1D,oFAAoD;AACpD,kDAA+C;AAW/C,uCAAuE;AACvE,uDAA0E;AAU1E,IAAY,UAEX;AAFD,WAAY,UAAU;IACpB,2BAAa,CAAA;AACf,CAAC,EAFW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAErB;AAWD,MAAM,eAAgB,SAAQ,2BAAY;IAIxC,YAAY,MAA6B;QACvC,KAAK,CAAC,MA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AAE,CAAC;gBACP,KAAK,EAAE,eAAe;gBACtB,YAAY,EAAE,SAAS;gBACvB,YAAY;oBACV,OAAO;wBACL,OAAO,EAAE,2BAA2B;qBACrC,CAAC;gBACJ,CAAC;aACF;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,CAAC;gBACP,KAAK,EAAE,WAAW;gBAClB,YAAY,EAAE,WAAW;gBACzB,YAAY,CAAC,IAAoD;oBAC/D,OAAO;wBACL,OAAO,EAAE,mBAAmB,IAAA,6BAAa,EAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,eAAe;qBAC5F,CAAC;gBACJ,CAAC;aACF;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,CAAC;gBACP,KAAK,EAAE,aAAa;gBACpB,YAAY,EAAE,UAAU;gBACxB,YAAY;oBACV,OAAO;wBACL,OAAO,EAAE,aAAa;qBACvB,CAAC;gBACJ,CAAC;aACF;SACF,CAAC;IACJ,CAAC;IACS,QAAQ;QAChB,OAAO;YACL,IAAI,EAAE,MAAM;SACb,CAAC;IACJ,CAAC;IACS,WAAW;QACnB,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;IAC9B,CAAC;IACS,SAAS;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IACS,WAAW;QACnB,OAAO,CAAC,CAAC;IACX,CAAC;IACS,qBAAqB;QAC7B,OAAO,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAC9C,CAAC;CACF;AAEQ,0CAAe"}
@@ -0,0 +1,12 @@
1
+ {
2
+ "title": "Hop Exchange Cross-chain Swaps",
3
+ "description": "Hop Exchange Cross-chain Swaps",
4
+ "pros": [
5
+ "Ethereum, Polygon, Binance Smart Chain, Arbitrum, Optimism",
6
+ "Best exchange rates",
7
+ "High liquidity",
8
+ "Fast"
9
+ ],
10
+ "cons": ["Slippage"],
11
+ "fees": ["Additional aggregator fees", "Slippage (up to 3%)"]
12
+ }
@@ -0,0 +1,2 @@
1
+ export declare function getTransferIdByTxHash(txHash: string): string;
2
+ export declare function getDestinationTxGQL(transferId: string, recipient: string, isFromL1Source: boolean): string;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDestinationTxGQL = exports.getTransferIdByTxHash = void 0;
4
+ function getDestinationTxHashFromL1Source(recipient) {
5
+ return `query {
6
+ transferFromL1Completeds(
7
+ where: {
8
+ recipient: "${recipient}"
9
+ },
10
+ orderBy: timestamp,
11
+ orderDirection: desc
12
+ ) {
13
+ timestamp
14
+ amount
15
+ transactionHash
16
+ token
17
+ timestamp
18
+ }
19
+ }
20
+ `;
21
+ }
22
+ function getDestinationTxHashFromL2Source(transferId) {
23
+ return `query {
24
+ withdrawalBondeds(
25
+ where: {
26
+ transferId: "${transferId}"
27
+ }
28
+ ) {
29
+ timestamp
30
+ amount
31
+ transactionHash
32
+ token
33
+ timestamp
34
+ }
35
+ }
36
+ `;
37
+ }
38
+ function getTransferIdByTxHash(txHash) {
39
+ return `query {
40
+ transferSents(
41
+ where: {
42
+ transactionHash: "${txHash}"
43
+ }
44
+ ) {
45
+ timestamp
46
+ transferId
47
+ amount
48
+ bonderFee
49
+ transactionHash
50
+ token
51
+ timestamp
52
+ }
53
+ }
54
+ `;
55
+ }
56
+ exports.getTransferIdByTxHash = getTransferIdByTxHash;
57
+ function getDestinationTxGQL(transferId, recipient, isFromL1Source) {
58
+ return isFromL1Source ? getDestinationTxHashFromL1Source(recipient) : getDestinationTxHashFromL2Source(transferId);
59
+ }
60
+ exports.getDestinationTxGQL = getDestinationTxGQL;
61
+ //# sourceMappingURL=queries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../../src/swaps/hop/queries.ts"],"names":[],"mappings":";;;AACA,SAAS,gCAAgC,CAAC,SAAiB;IACzD,OAAO;;;wBAGe,SAAS;;;;;;;;;;;;GAY9B,CAAC;AACJ,CAAC;AAGD,SAAS,gCAAgC,CAAC,UAAkB;IAC1D,OAAO;;;yBAGgB,UAAU;;;;;;;;;;GAUhC,CAAC;AACJ,CAAC;AAED,SAAgB,qBAAqB,CAAC,MAAc;IAClD,OAAO;;;8BAGqB,MAAM;;;;;;;;;;;;GAYjC,CAAC;AACJ,CAAC;AAjBD,sDAiBC;AAED,SAAgB,mBAAmB,CAAC,UAAkB,EAAE,SAAiB,EAAE,cAAuB;IAChG,OAAO,cAAc,CAAC,CAAC,CAAC,gCAAgC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,gCAAgC,CAAC,UAAU,CAAC,CAAC;AACrH,CAAC;AAFD,kDAEC"}
@@ -0,0 +1,46 @@
1
+ import BN from 'bignumber.js';
2
+ import { ActionContext } from '../../store';
3
+ import { SwapHistoryItem } from '../../store/types';
4
+ import { SwapProvider } from '../SwapProvider';
5
+ import { EstimateFeeRequest, EstimateFeeResponse, NextSwapActionRequest, QuoteRequest, SwapRequest, SwapStatus } from '../types';
6
+ export interface JupiterSwapHistoryItem extends SwapHistoryItem {
7
+ info: object;
8
+ swapTxHash: string;
9
+ }
10
+ declare class JupiterSwapProvider extends SwapProvider {
11
+ protected _getStatuses(): Record<string, SwapStatus>;
12
+ protected _txTypes(): Record<string, string | null>;
13
+ protected _fromTxType(): string | null;
14
+ protected _toTxType(): string | null;
15
+ protected _totalSteps(): number;
16
+ protected _timelineDiagramSteps(): string[];
17
+ getSupportedPairs(): Promise<never[]>;
18
+ getQuote(quoteRequest: QuoteRequest): Promise<{
19
+ from: string;
20
+ to: string;
21
+ fromAmount: string;
22
+ toAmount: any;
23
+ info: any;
24
+ } | null>;
25
+ newSwap(quoteInput: SwapRequest<JupiterSwapHistoryItem>): Promise<{
26
+ status: string;
27
+ swapTx: import("@yaswap/types").Transaction<any> | undefined;
28
+ swapTxHash: string | undefined;
29
+ id: string;
30
+ fee: number;
31
+ slippage: number;
32
+ }>;
33
+ estimateFees({ txType, feePrices, asset, network, }: EstimateFeeRequest<string, JupiterSwapHistoryItem>): Promise<EstimateFeeResponse | null>;
34
+ getExtraAmountToExtractFromBalance(): number;
35
+ performNextSwapAction(_store: ActionContext, { network, walletId, swap }: NextSwapActionRequest<JupiterSwapHistoryItem>): Promise<Partial<{
36
+ endTime: number;
37
+ status: string;
38
+ }> | undefined>;
39
+ getMin(_quoteRequest: QuoteRequest): Promise<BN>;
40
+ waitForSwapConfirmations({ swap, network, walletId }: NextSwapActionRequest<JupiterSwapHistoryItem>): Promise<{
41
+ endTime: number;
42
+ status: string;
43
+ } | undefined>;
44
+ private _getTransactions;
45
+ }
46
+ export { JupiterSwapProvider };