@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
package/README.md ADDED
@@ -0,0 +1,163 @@
1
+ # Wallet Core
2
+
3
+ <pre>
4
+ _ __ ____ __ ______
5
+ | | / /___ _/ / /__ / /_ / ____/___ ________
6
+ | | /| / / __ `/ / / _ \/ __/ / / / __ \/ ___/ _ \
7
+ | |/ |/ / /_/ / / / __/ /_ / /___/ /_/ / / / __/
8
+ |__/|__/\__,_/_/_/\___/\__/ \____/\____/_/ \___/
9
+ </pre>
10
+
11
+ ![](https://img.shields.io/npm/v/@yaswap/wallet-core?label=wallet-core)
12
+ ![master](https://github.com/liquality/wallet-core/actions/workflows/build-test.yml/badge.svg?branch=master)
13
+
14
+ Wallet Core is a cryptocurrency wallet library in Typescript. It provides an abstracted interface that handles all the necessary internals of a muilti chain wallet. Featuring:
15
+
16
+ - State management
17
+ - Seed management and security
18
+ - Account management
19
+ - Blockchain communication under a common interface, powered by [Chainify](https://github.com/liquality/chainify)
20
+ - Retriving balances
21
+ - Sending transactions
22
+ - Intra and cross chain swaps supporting a host of decentralised exchanges - Liquality, Thorchain, Uniswap, 1inch, Sovryn, Astroport etc.
23
+ - Hardware wallet support
24
+
25
+ # Install
26
+
27
+ `npm install @yaswap/wallet-core`
28
+
29
+ `yarn add @yaswap/wallet-core`
30
+
31
+ ## Usage
32
+
33
+ ```typescript
34
+ import { setupWallet } from '@yaswap/wallet-core';
35
+ import defaultOptions from '@yaswap/wallet-core/dist/src/walletOptions/defaultOptions'; // Default options
36
+
37
+ const wallet = setupWallet({
38
+ ...defaultOptions,
39
+ });
40
+
41
+ (async () => {
42
+ await wallet.dispatch.createWallet({
43
+ key: 'satoshi',
44
+ mnemonic: 'never gonna give you up never gonna let you down never gonna',
45
+ imported: true,
46
+ });
47
+ await wallet.dispatch.unlockWallet({ key: 'satoshi' });
48
+ await wallet.dispatch.changeActiveNetwork({ network: 'mainnet' });
49
+ console.log(wallet.state); // State will include default accounts
50
+ })();
51
+ ```
52
+
53
+ ## Options
54
+
55
+ See `WalletOptions` in [types](src/types.ts)
56
+
57
+ ```typescript
58
+ {
59
+ initialState?: RootState; // The initial state of the wallet
60
+ crypto: { // Implmenetation for platform specific crypto
61
+ pbkdf2(password: string, salt: string, iterations: number, length: number, digest: string): Promise<string>;
62
+ encrypt(value: string, key: string): Promise<any>;
63
+ decrypt(value: any, key: string): Promise<any>;
64
+ };
65
+ // Handle notifications
66
+ createNotification(notification: Notification): void;
67
+ ...
68
+ }
69
+ ```
70
+
71
+ ## Examples
72
+
73
+ - [Add Custom Token](https://github.com/liquality/wallet-core/blob/develop/packages/wallet-core/src/store/actions/addCustomToken.test.ts)
74
+ - [Export Private Key](https://github.com/liquality/wallet-core/blob/develop/packages/wallet-core/src/store/actions/exportPrivateKey.test.ts)
75
+ - [Send Transaction](https://github.com/liquality/wallet-core/blob/develop/packages/wallet-core/src/store/actions/sendTransaction.test.ts)
76
+ - [Update Fees](https://github.com/liquality/wallet-core/blob/develop/packages/wallet-core/src/store/actions/updateFees.test.ts)
77
+ - [Update Balance](https://github.com/liquality/wallet-core/blob/develop/packages/wallet-core/src/store/actions/updateBalances.test.ts)
78
+
79
+ ## How to run tests
80
+
81
+ Integration tests are written in [Jest](https://jestjs.io/).
82
+
83
+ ```angular2html
84
+ yarn test
85
+ ```
86
+
87
+ ## How to Contribute
88
+
89
+ ### Swap Providers
90
+
91
+ **To add a new swap provider, you should clone this repo first and then use the develop branch as a base.**
92
+
93
+ 1. Add the New Swap Provider type: https://github.com/liquality/wallet-core/blob/develop/packages/wallet-core/src/store/types.ts
94
+
95
+ 2. Add the config or settings that you need inside the [build.config](https://github.com/liquality/wallet-core/blob/develop/packages/wallet-core/src/build.config.ts) file using the new type added in `SwapProviderType` enum, this should be inside the field `swapProviders` and then you can add different settings for `testnet` and `mainnet`. For example, if your swap provider will need to make some http calls and if you want to set the root url for it.
96
+
97
+ 3. Create a new folder for your new provider inside `packages/wallet-core/src/swaps`, then add a new file named `info.json` whith a content like (you can check the other providers to get an example):
98
+
99
+ ```
100
+ {
101
+ "title": "Your title",
102
+ "description": "Your description",
103
+ "pros": [
104
+ "Ethereum, Polygon, Binance Smart Chain, Avalanche",
105
+ "Best exchange rates",
106
+ "High liquidity",
107
+ "Many pairs",
108
+ "Fast"
109
+ ],
110
+ "cons": ["Slippage"],
111
+ "fees": ["Additional aggregator fees", "Slippage (up to 0.6% in Liquality)"]
112
+ }
113
+
114
+ ```
115
+
116
+ 4. Add the swap provider info for your new provider, editing the file [/packages/wallet-core/src/swaps/utils.ts](https://github.com/liquality/wallet-core/blob/develop/packages/wallet-core/src/swaps/utils.ts).
117
+
118
+ - You should import the json file first `import yourProviderInfo from '../swaps/YOUR_PROVIDER/info.json';`
119
+ - Then add it to the `swapProviderInfo` variable
120
+
121
+ This will add metadata/info for your new provider to the available providers info/details.
122
+
123
+ 5. Create a new file for your new provider inside `packages/wallet-core/src/swaps/YOUR_PROVIDER`. You can create any separated clases or files if you need. Please check the folder `packages/wallet-core/src/swaps/` and the other providers to get an example.
124
+
125
+ 6. Implement the provider: your new provider should extend the class [SwapProvider](https://github.com/liquality/wallet-core/blob/develop/packages/wallet-core/src/swaps/SwapProvider.ts), it is an abtract class so you should implement at least these methods:
126
+
127
+ - \_getStatuses(): Record<string, SwapStatus>;
128
+ - \_txTypes(): Record<string, string | null>;
129
+ - \_fromTxType(): string | null;
130
+ - \_toTxType(): string | null; // replace with Enum
131
+ - \_totalSteps(): number;
132
+ - \_timelineDiagramSteps(): string[];
133
+
134
+ - getSupportedPairs({ network }: { network: Network }): Promise<PairData[]>;
135
+
136
+ - getMin(quoteRequest: QuoteRequest): Promise<BigNumber>;
137
+
138
+ - getQuote(quoteRequest: QuoteRequest): Promise<GetQuoteResult | null>;
139
+
140
+ - newSwap(swapRequest: SwapRequest): Promise<Partial<SwapHistoryItem>>;
141
+
142
+ - estimateFees(estimateFeeRequest: EstimateFeeRequest): Promise<EstimateFeeResponse | null>;
143
+
144
+ - performNextSwapAction(
145
+ store: ActionContext,
146
+ nextSwapAction: NextSwapActionRequest
147
+ ): Promise<Partial<SwapHistoryItem> | undefined>;
148
+
149
+ - waitForSwapConfirmations(
150
+ \_nextSwapActionRequest: NextSwapActionRequest
151
+ ): Promise<ActionStatus | undefined> {
152
+ return;
153
+ }
154
+
155
+ 7. Add the new provider to the list of providers [/packages/wallet-core/src/factory/swap/index.ts]https://github.com/liquality/wallet-core/blob/develop/packages/wallet-core/src/factory/swap/index.ts) and map it with the `SwapProviderType` enum. This will add the provider to the available providers when the user wants to swap.
156
+
157
+ 8. Test using the local wallet environment:
158
+
159
+ - Clone the wallet repo and use the develop branch [https://github.com/liquality/wallet](https://github.com/liquality/wallet)
160
+ - Select the node version using nvm and install all dependencies. Run `nvm use && yarn`
161
+ - Link your local wallet-core package. Run `yarn link ../wallet-core --all`.
162
+ - Open the package.json file and replace the `portal` protocol inside the `resolutions` field at the end of the file, to use `link` (instead of `portal:...`, should be `link:`) then run `yarn`
163
+ - To run the wallet just run `yarn dev`
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@yaswap/wallet-core",
3
+ "version": "2.0.0",
4
+ "description": "Common library for liquality wallet",
5
+ "repository": "git@github.com:liquality/wallet-core.git",
6
+ "author": "monokh <mnokhb@gmail.com>",
7
+ "license": "MIT",
8
+ "main": "./dist/src/index.js",
9
+ "types": "./dist/src/index.d.ts",
10
+ "files": [
11
+ "dist/**"
12
+ ],
13
+ "dependencies": {
14
+ "@blobfishkate/sovryncontracts": "1.3.27",
15
+ "@eth-optimism/sdk": "1.1.5",
16
+ "@ethersproject/abstract-provider": "5.7.0",
17
+ "@ethersproject/abstract-signer": "5.7.0",
18
+ "@ethersproject/address": "5.7.0",
19
+ "@ethersproject/providers": "5.7.0",
20
+ "@ethersproject/transactions": "5.7.0",
21
+ "@hop-protocol/sdk": "0.0.1-beta.314",
22
+ "@lifi/sdk": "1.0.2",
23
+ "@metamask/eth-sig-util": "^4.0.1",
24
+ "@teleportdao/bitcoin": "^1.0.3",
25
+ "@teleportdao/configs": "^1.0.3",
26
+ "@teleportdao/scripts": "^1.0.3",
27
+ "@terra-money/terra.js": "3.1.6",
28
+ "@thorchain/asgardex-util": "^0.10.0",
29
+ "@types/lodash": "^4.14.182",
30
+ "@uniswap/sdk-core": "^3.0.1",
31
+ "@uniswap/v2-core": "^1.0.1",
32
+ "@uniswap/v2-periphery": "^1.1.0-beta.0",
33
+ "@uniswap/v2-sdk": "^3.0.1",
34
+ "@unstoppabledomains/resolution": "8.3.1",
35
+ "@xchainjs/xchain-util": "^0.6.0",
36
+ "@yaswap/bitcoin": "2.0.0",
37
+ "@yaswap/bitcoin-ledger": "2.0.0",
38
+ "@yaswap/client": "2.0.0",
39
+ "@yaswap/cryptoassets": "workspace:*",
40
+ "@yaswap/error-parser": "workspace:*",
41
+ "@yaswap/errors": "2.0.0",
42
+ "@yaswap/evm": "2.0.0",
43
+ "@yaswap/evm-ledger": "2.0.0",
44
+ "@yaswap/hw-ledger": "2.0.0",
45
+ "@yaswap/near": "2.0.0",
46
+ "@yaswap/solana": "2.0.0",
47
+ "@yaswap/terra": "2.0.0",
48
+ "@yaswap/types": "2.0.0",
49
+ "@yaswap/utils": "2.0.0",
50
+ "@yaswap/yacoin": "2.0.0",
51
+ "amplitude-js": "8.18.2",
52
+ "bignumber.js": "^9.0.2",
53
+ "detect-circular-deps": "^3.0.0",
54
+ "direct-vuex": "^0.12.1",
55
+ "ethers": "5.7.0",
56
+ "graphql": "^16.4.0",
57
+ "human-standard-token-abi": "^2.0.0",
58
+ "lodash": "^4.17.21",
59
+ "moment": "^2.29.1",
60
+ "react": "^18.1.0",
61
+ "socket.io-client": "4.6.1",
62
+ "tslib": "^2.3.1",
63
+ "urql": "^2.2.0",
64
+ "vue": "^2.6.11",
65
+ "vuex": "^3.1.3"
66
+ },
67
+ "scripts": {
68
+ "build": "tsc",
69
+ "clean": "rm -rf node_modules .turbo dist",
70
+ "watch": "tsc -w",
71
+ "test": "jest --coverage"
72
+ },
73
+ "publishConfig": {
74
+ "access": "public"
75
+ }
76
+ }
@@ -0,0 +1,46 @@
1
+ import { ChainId } from '@yaswap/cryptoassets';
2
+ import { Asset, Network, SwapProviderType } from './store/types';
3
+ export interface SwapProviderDefinition {
4
+ name: string;
5
+ icon: string;
6
+ type: SwapProviderType;
7
+ [x: string | number | symbol]: unknown;
8
+ }
9
+ export interface WalletCoreConfig {
10
+ defaultAssets: {
11
+ [key in Network]: Asset[];
12
+ };
13
+ swapProviders: {
14
+ [key in Network]: {
15
+ [providerType in SwapProviderType]?: SwapProviderDefinition;
16
+ };
17
+ };
18
+ networks: Network[];
19
+ chains: ChainId[];
20
+ supportedBridgeAssets: Asset[];
21
+ discordUrl: string;
22
+ infuraApiKey: string;
23
+ yacEsploraApis: {
24
+ esploraUrl: {
25
+ [key in Network]: string;
26
+ };
27
+ esploraSwapUrl: {
28
+ [key in Network]: string;
29
+ };
30
+ };
31
+ btcEsploraApis: {
32
+ [key in Network]: string;
33
+ };
34
+ btcBatchEsploraApis: {
35
+ [key in Network]: string;
36
+ };
37
+ nameResolvers: {
38
+ uns: {
39
+ resolutionService: string;
40
+ tldAPI: string;
41
+ alchemyKey: string;
42
+ };
43
+ };
44
+ }
45
+ declare const config: WalletCoreConfig;
46
+ export default config;
@@ -0,0 +1,237 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const contracts_mainnet_json_1 = tslib_1.__importDefault(require("@blobfishkate/sovryncontracts/contracts-mainnet.json"));
5
+ const contracts_testnet_json_1 = tslib_1.__importDefault(require("@blobfishkate/sovryncontracts/contracts-testnet.json"));
6
+ const cryptoassets_1 = require("@yaswap/cryptoassets");
7
+ const types_1 = require("./store/types");
8
+ const config = {
9
+ defaultAssets: {
10
+ mainnet: [
11
+ 'YAC',
12
+ 'BTC',
13
+ 'ETH',
14
+ 'DAI',
15
+ 'USDC',
16
+ 'USDT',
17
+ 'WBTC',
18
+ 'UNI',
19
+ 'RBTC',
20
+ 'SOV',
21
+ 'BNB',
22
+ 'SOL',
23
+ 'MATIC',
24
+ 'PWETH',
25
+ 'ARBETH',
26
+ 'AVAX',
27
+ 'FISH',
28
+ 'LUNA',
29
+ 'UST',
30
+ 'OPTETH',
31
+ 'ARBDAI',
32
+ 'OPDAI',
33
+ 'PDAI',
34
+ 'OPTUSDC',
35
+ 'ARBUSDC',
36
+ 'PUSDC',
37
+ 'sUSDC',
38
+ 'USDC.e',
39
+ 'ARBUSDT',
40
+ 'OPUSDT',
41
+ 'PUSDT',
42
+ 'sUSDT',
43
+ 'USDT.e',
44
+ 'TELEBTC',
45
+ ],
46
+ testnet: [
47
+ 'YAC',
48
+ 'BTC',
49
+ 'ETH',
50
+ 'DAI',
51
+ 'RBTC',
52
+ 'BNB',
53
+ 'SOL',
54
+ 'SOV',
55
+ 'MATIC',
56
+ 'PWETH',
57
+ 'ARBETH',
58
+ 'AVAX',
59
+ 'LUNA',
60
+ 'UST',
61
+ 'OPTETH',
62
+ 'OPTUSDC',
63
+ 'TELEBTC',
64
+ ],
65
+ },
66
+ infuraApiKey: 'da99ebc8c0964bb8bb757b6f8cc40f1f',
67
+ yacEsploraApis: {
68
+ esploraUrl: {
69
+ testnet: 'https://yaswap.yacoin.org/api',
70
+ mainnet: 'https://yaswap.yacoin.org/api'
71
+ },
72
+ esploraSwapUrl: {
73
+ testnet: 'https://yaswap.yacoin.org',
74
+ mainnet: 'https://yaswap.yacoin.org'
75
+ }
76
+ },
77
+ btcEsploraApis: {
78
+ testnet: 'https://electrs-testnet-api.liq-chainhub.net/',
79
+ mainnet: 'https://electrs-mainnet-api.liq-chainhub.net/',
80
+ },
81
+ btcBatchEsploraApis: {
82
+ testnet: 'https://electrs-batch-testnet-api.liq-chainhub.net/',
83
+ mainnet: 'https://electrs-batch-mainnet-api.liq-chainhub.net/',
84
+ },
85
+ swapProviders: {
86
+ testnet: {
87
+ [types_1.SwapProviderType.Liquality]: {
88
+ name: 'Liquality',
89
+ icon: 'liquality.svg',
90
+ type: types_1.SwapProviderType.Liquality,
91
+ agent: 'http://192.168.0.220:3030',
92
+ },
93
+ [types_1.SwapProviderType.UniswapV2]: {
94
+ name: 'Uniswap V2',
95
+ icon: 'uniswap.svg',
96
+ type: types_1.SwapProviderType.UniswapV2,
97
+ routerAddress: '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
98
+ },
99
+ [types_1.SwapProviderType.Sovryn]: {
100
+ name: 'Sovryn',
101
+ icon: 'sovryn.svg',
102
+ type: types_1.SwapProviderType.Sovryn,
103
+ routerAddress: contracts_testnet_json_1.default.swapNetwork,
104
+ routerAddressRBTC: contracts_testnet_json_1.default.proxy3,
105
+ rpcURL: 'https://testnet.sovryn.app/rpc',
106
+ },
107
+ [types_1.SwapProviderType.FastBTCWithdraw]: {
108
+ name: 'FastBTC',
109
+ icon: 'sovryn.svg',
110
+ type: types_1.SwapProviderType.FastBTCWithdraw,
111
+ network: types_1.Network.Testnet,
112
+ routerAddress: '0x10C848e9495a32acA95F6c23C92eCA2b2bE9903A',
113
+ },
114
+ },
115
+ mainnet: {
116
+ [types_1.SwapProviderType.Liquality]: {
117
+ name: 'Liquality',
118
+ icon: 'liquality.svg',
119
+ type: types_1.SwapProviderType.Liquality,
120
+ agent: 'http://192.168.0.220:3030',
121
+ },
122
+ [types_1.SwapProviderType.UniswapV2]: {
123
+ name: 'Uniswap V2',
124
+ icon: 'uniswap.svg',
125
+ type: types_1.SwapProviderType.UniswapV2,
126
+ routerAddress: '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
127
+ },
128
+ [types_1.SwapProviderType.OneInch]: {
129
+ name: 'Oneinch V4',
130
+ icon: 'oneinch.svg',
131
+ type: types_1.SwapProviderType.OneInch,
132
+ agent: 'https://api.1inch.exchange/v4.0',
133
+ routerAddress: '0x1111111254fb6c44bac0bed2854e76f90643097d',
134
+ referrerAddress: {
135
+ ethereum: '0x3a712CC47aeb0F20A7C9dE157c05d74B11F172f5',
136
+ polygon: '0x3a712CC47aeb0F20A7C9dE157c05d74B11F172f5',
137
+ bsc: '0x3a712CC47aeb0F20A7C9dE157c05d74B11F172f5',
138
+ avalanche: '0x3a712CC47aeb0F20A7C9dE157c05d74B11F172f5',
139
+ },
140
+ referrerFee: 0.3,
141
+ },
142
+ [types_1.SwapProviderType.FastBTCDeposit]: {
143
+ name: 'FastBTC',
144
+ icon: 'sovryn.svg',
145
+ type: types_1.SwapProviderType.FastBTCDeposit,
146
+ bridgeEndpoint: 'https://fastbtc.sovryn.app',
147
+ },
148
+ [types_1.SwapProviderType.FastBTCWithdraw]: {
149
+ name: 'FastBTC',
150
+ icon: 'sovryn.svg',
151
+ type: types_1.SwapProviderType.FastBTCWithdraw,
152
+ network: types_1.Network.Mainnet,
153
+ routerAddress: '0x0D5006330289336ebdF9d0AC9E0674f91b4851eA',
154
+ },
155
+ [types_1.SwapProviderType.Sovryn]: {
156
+ name: 'Sovryn',
157
+ icon: 'sovryn.svg',
158
+ type: types_1.SwapProviderType.Sovryn,
159
+ routerAddress: contracts_mainnet_json_1.default.swapNetwork,
160
+ routerAddressRBTC: contracts_mainnet_json_1.default.proxy3,
161
+ rpcURL: 'https://mainnet.sovryn.app/rpc',
162
+ },
163
+ [types_1.SwapProviderType.Thorchain]: {
164
+ name: 'Thorchain',
165
+ icon: 'thorchain.svg',
166
+ type: types_1.SwapProviderType.Thorchain,
167
+ thornode: 'https://thornode.ninerealms.com',
168
+ },
169
+ [types_1.SwapProviderType.Astroport]: {
170
+ name: 'Astroport',
171
+ icon: 'astroport.svg',
172
+ type: types_1.SwapProviderType.Astroport,
173
+ URL: 'https://lcd.terra.dev',
174
+ chainID: 'columbus-5',
175
+ },
176
+ [types_1.SwapProviderType.Jupiter]: {
177
+ name: 'Jupiter',
178
+ icon: 'jupiter.svg',
179
+ type: types_1.SwapProviderType.Jupiter,
180
+ },
181
+ [types_1.SwapProviderType.DeBridge]: {
182
+ name: 'DeBridge',
183
+ icon: 'debridge.svg',
184
+ type: types_1.SwapProviderType.DeBridge,
185
+ url: 'https://deswap.debridge.finance/v1.0/',
186
+ api: 'https://api.debridge.finance/api/',
187
+ routerAddress: '0x663DC15D3C1aC63ff12E45Ab68FeA3F0a883C251',
188
+ chains: {
189
+ 1: {
190
+ deBridgeGateAddress: '0x43dE2d77BF8027e25dBD179B491e8d64f38398aA',
191
+ signatureVerifier: '0x949b3B3c098348b879C9e4F15cecc8046d9C8A8c',
192
+ minBlockConfirmation: 12,
193
+ },
194
+ 56: {
195
+ deBridgeGateAddress: '0x43dE2d77BF8027e25dBD179B491e8d64f38398aA',
196
+ signatureVerifier: '0x949b3B3c098348b879C9e4F15cecc8046d9C8A8c',
197
+ minBlockConfirmation: 12,
198
+ },
199
+ 42161: {
200
+ deBridgeGateAddress: '0x43dE2d77BF8027e25dBD179B491e8d64f38398aA',
201
+ signatureVerifier: '0x949b3B3c098348b879C9e4F15cecc8046d9C8A8c',
202
+ minBlockConfirmation: 12,
203
+ },
204
+ 137: {
205
+ deBridgeGateAddress: '0x43dE2d77BF8027e25dBD179B491e8d64f38398aA',
206
+ signatureVerifier: '0x949b3B3c098348b879C9e4F15cecc8046d9C8A8c',
207
+ minBlockConfirmation: 256,
208
+ },
209
+ 43114: {
210
+ deBridgeGateAddress: '0x43dE2d77BF8027e25dBD179B491e8d64f38398aA',
211
+ signatureVerifier: '0x949b3B3c098348b879C9e4F15cecc8046d9C8A8c',
212
+ minBlockConfirmation: 12,
213
+ },
214
+ },
215
+ },
216
+ [types_1.SwapProviderType.LiFi]: {
217
+ name: 'LiFi',
218
+ icon: 'lifi.svg',
219
+ type: types_1.SwapProviderType.LiFi,
220
+ apiURL: 'https://li.quest/v1/',
221
+ },
222
+ },
223
+ },
224
+ discordUrl: 'https://discord.gg/Xsqw7PW8wk',
225
+ networks: [types_1.Network.Mainnet, types_1.Network.Testnet],
226
+ chains: Object.values(cryptoassets_1.ChainId),
227
+ supportedBridgeAssets: ['RBTC', 'AVAX'],
228
+ nameResolvers: {
229
+ uns: {
230
+ resolutionService: 'https://unstoppabledomains.g.alchemy.com/domains/',
231
+ tldAPI: 'https://resolve.unstoppabledomains.com/supported_tlds',
232
+ alchemyKey: 'bKmEKAC4HJUEDNlnoYITvXYuhrIshFsa',
233
+ },
234
+ },
235
+ };
236
+ exports.default = config;
237
+ //# sourceMappingURL=build.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.config.js","sourceRoot":"","sources":["../../src/build.config.ts"],"names":[],"mappings":";;;AAAA,0HAA0F;AAC1F,0HAA0F;AAC1F,uDAA+C;AAC/C,yCAAiE;AA8CjE,MAAM,MAAM,GAAqB;IAC/B,aAAa,EAAE;QACb,OAAO,EAAE;YACP,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;YACL,MAAM;YACN,MAAM;YACN,MAAM;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,0 +1,11 @@
1
+ import { Chain, Client, Swap, Wallet } from '@yaswap/client';
2
+ import { ChainifyNetwork } from '../../types';
3
+ import { NearTypes } from '@yaswap/near';
4
+ import { TerraTypes } from '@yaswap/terra';
5
+ import { AccountInfo, ClientSettings } from '../../store/types';
6
+ import { Network } from '@yaswap/types';
7
+ export declare function createBtcClient(settings: ClientSettings<ChainifyNetwork>, mnemonic: string, accountInfo: AccountInfo): Client<Chain<any, Network>, Wallet<any, any>, Swap<any, any, Wallet<any, any>>>;
8
+ export declare function createYacClient(settings: ClientSettings<ChainifyNetwork>, mnemonic: string, accountInfo: AccountInfo): Client<Chain<any, Network>, Wallet<any, any>, Swap<any, any, Wallet<any, any>>>;
9
+ export declare function createNearClient(settings: ClientSettings<NearTypes.NearNetwork>, mnemonic: string, accountInfo: AccountInfo): Client<Chain<any, Network>, Wallet<any, any>, Swap<any, any, Wallet<any, any>>>;
10
+ export declare function createTerraClient(settings: ClientSettings<TerraTypes.TerraNetwork>, mnemonic: string, accountInfo: AccountInfo): Client<Chain<any, Network>, Wallet<any, any>, Swap<any, any, Wallet<any, any>>>;
11
+ export declare function createSolanaClient(settings: ClientSettings<ChainifyNetwork>, mnemonic: string, accountInfo: AccountInfo): Client<Chain<any, Network>, Wallet<any, any>, Swap<any, any, Wallet<any, any>>>;
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSolanaClient = exports.createTerraClient = exports.createNearClient = exports.createYacClient = exports.createBtcClient = void 0;
4
+ const client_1 = require("@yaswap/client");
5
+ const bitcoin_1 = require("@yaswap/bitcoin");
6
+ const yacoin_1 = require("@yaswap/yacoin");
7
+ const bitcoin_ledger_1 = require("@yaswap/bitcoin-ledger");
8
+ const near_1 = require("@yaswap/near");
9
+ const solana_1 = require("@yaswap/solana");
10
+ const terra_1 = require("@yaswap/terra");
11
+ const ledger_1 = require("../../utils/ledger");
12
+ const walletOptions_1 = require("../../walletOptions");
13
+ const error_parser_1 = require("@yaswap/error-parser");
14
+ function createBtcClient(settings, mnemonic, accountInfo) {
15
+ const isMainnet = settings.network === 'mainnet';
16
+ const { chainifyNetwork } = settings;
17
+ const chainProvider = new bitcoin_1.BitcoinEsploraApiProvider({
18
+ batchUrl: chainifyNetwork.batchScraperUrl,
19
+ url: chainifyNetwork.scraperUrl,
20
+ network: chainifyNetwork,
21
+ numberOfBlockConfirmation: 2,
22
+ });
23
+ if (isMainnet) {
24
+ const feeProvider = new bitcoin_1.BitcoinFeeApiProvider(chainifyNetwork.feeProviderUrl);
25
+ chainProvider.setFeeProvider(feeProvider);
26
+ }
27
+ const swapProvider = new bitcoin_1.BitcoinSwapEsploraProvider({
28
+ network: chainifyNetwork,
29
+ scraperUrl: chainifyNetwork.scraperUrl,
30
+ });
31
+ if (accountInfo.type.includes('bitcoin_ledger')) {
32
+ const option = ledger_1.LEDGER_BITCOIN_OPTIONS.find((o) => o.name === accountInfo.type);
33
+ if (!option) {
34
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.AccountTypeOption(accountInfo.type));
35
+ }
36
+ const { addressType } = option;
37
+ if (!walletOptions_1.walletOptionsStore.walletOptions.ledgerTransportCreator) {
38
+ throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.LedgerTransportCreator);
39
+ }
40
+ const ledgerProvider = new bitcoin_ledger_1.BitcoinLedgerProvider({
41
+ network: chainifyNetwork,
42
+ addressType,
43
+ baseDerivationPath: accountInfo.derivationPath,
44
+ basePublicKey: accountInfo === null || accountInfo === void 0 ? void 0 : accountInfo.publicKey,
45
+ baseChainCode: accountInfo === null || accountInfo === void 0 ? void 0 : accountInfo.chainCode,
46
+ transportCreator: walletOptions_1.walletOptionsStore.walletOptions.ledgerTransportCreator,
47
+ createLedgerApp: bitcoin_ledger_1.CreateBitcoinLedgerApp,
48
+ }, chainProvider);
49
+ swapProvider.setWallet(ledgerProvider);
50
+ }
51
+ else {
52
+ const walletOptions = {
53
+ network: chainifyNetwork,
54
+ baseDerivationPath: accountInfo.derivationPath,
55
+ mnemonic,
56
+ };
57
+ const walletProvider = new bitcoin_1.BitcoinHDWalletProvider(walletOptions, chainProvider);
58
+ swapProvider.setWallet(walletProvider);
59
+ }
60
+ return new client_1.Client().connect(swapProvider);
61
+ }
62
+ exports.createBtcClient = createBtcClient;
63
+ function createYacClient(settings, mnemonic, accountInfo) {
64
+ const isMainnet = settings.network === 'mainnet';
65
+ const { chainifyNetwork } = settings;
66
+ const chainProvider = new yacoin_1.YacoinEsploraApiProvider({
67
+ batchUrl: chainifyNetwork.yacoinEsploraApis,
68
+ url: chainifyNetwork.yacoinEsploraApis,
69
+ network: chainifyNetwork,
70
+ numberOfBlockConfirmation: 1,
71
+ });
72
+ if (isMainnet) {
73
+ const feeProvider = new yacoin_1.YacoinFeeApiProvider(chainifyNetwork.feeProviderUrl);
74
+ chainProvider.setFeeProvider(feeProvider);
75
+ }
76
+ const swapProvider = new yacoin_1.YacoinSwapEsploraProvider({
77
+ network: chainifyNetwork,
78
+ scraperUrl: chainifyNetwork.yacoinEsploraSwapApis,
79
+ });
80
+ const walletOptions = {
81
+ network: chainifyNetwork,
82
+ baseDerivationPath: accountInfo.derivationPath,
83
+ mnemonic,
84
+ };
85
+ const walletProvider = new yacoin_1.YacoinHDWalletProvider(walletOptions, chainProvider);
86
+ swapProvider.setWallet(walletProvider);
87
+ return new client_1.Client().connect(swapProvider);
88
+ }
89
+ exports.createYacClient = createYacClient;
90
+ function createNearClient(settings, mnemonic, accountInfo) {
91
+ const walletOptions = {
92
+ mnemonic,
93
+ derivationPath: accountInfo.derivationPath,
94
+ helperUrl: settings.chainifyNetwork.helperUrl,
95
+ };
96
+ const chainProvider = new near_1.NearChainProvider(settings.chainifyNetwork);
97
+ const walletProvider = new near_1.NearWalletProvider(walletOptions, chainProvider);
98
+ const swapProvider = new near_1.NearSwapProvider(settings.chainifyNetwork.helperUrl, walletProvider);
99
+ return new client_1.Client(chainProvider, walletProvider).connect(swapProvider);
100
+ }
101
+ exports.createNearClient = createNearClient;
102
+ function createTerraClient(settings, mnemonic, accountInfo) {
103
+ const { helperUrl } = settings.chainifyNetwork;
104
+ const walletOptions = { mnemonic, derivationPath: accountInfo.derivationPath, helperUrl };
105
+ const chainProvider = new terra_1.TerraChainProvider(settings.chainifyNetwork);
106
+ const walletProvider = new terra_1.TerraWalletProvider(walletOptions, chainProvider);
107
+ const swapProvider = new terra_1.TerraSwapProvider(helperUrl, walletProvider);
108
+ return new client_1.Client(chainProvider, walletProvider).connect(swapProvider);
109
+ }
110
+ exports.createTerraClient = createTerraClient;
111
+ function createSolanaClient(settings, mnemonic, accountInfo) {
112
+ const walletOptions = { mnemonic, derivationPath: accountInfo.derivationPath };
113
+ const chainProvider = new solana_1.SolanaChainProvider(settings.chainifyNetwork);
114
+ const walletProvider = new solana_1.SolanaWalletProvider(walletOptions, chainProvider);
115
+ const nftProvider = new solana_1.SolanaNftProvider(walletProvider);
116
+ return new client_1.Client(chainProvider, walletProvider).connect(nftProvider);
117
+ }
118
+ exports.createSolanaClient = createSolanaClient;
119
+ //# sourceMappingURL=clients.js.map