@shapeshiftoss/swapper 17.6.9 → 17.6.11

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 (324) hide show
  1. package/LICENSE.md +21 -0
  2. package/dist/cjs/.tsbuildinfo +1 -1
  3. package/dist/cjs/constants.js +72 -43
  4. package/dist/cjs/cowswap-utils/constants.js +3 -0
  5. package/dist/cjs/cowswap-utils/index.js +6 -0
  6. package/dist/cjs/index.d.ts +1 -0
  7. package/dist/cjs/index.js +1 -0
  8. package/dist/cjs/swappers/AcrossSwapper/AcrossSwapper.d.ts +2 -0
  9. package/dist/cjs/swappers/AcrossSwapper/AcrossSwapper.js +8 -0
  10. package/dist/cjs/swappers/AcrossSwapper/constant.d.ts +9 -0
  11. package/dist/cjs/swappers/AcrossSwapper/constant.js +50 -0
  12. package/dist/cjs/swappers/AcrossSwapper/endpoints.d.ts +2 -0
  13. package/dist/cjs/swappers/AcrossSwapper/endpoints.js +113 -0
  14. package/dist/cjs/swappers/AcrossSwapper/getTradeQuote/getTradeQuote.d.ts +3 -0
  15. package/dist/cjs/swappers/AcrossSwapper/getTradeQuote/getTradeQuote.js +31 -0
  16. package/dist/cjs/swappers/AcrossSwapper/getTradeRate/getTradeRate.d.ts +3 -0
  17. package/dist/cjs/swappers/AcrossSwapper/getTradeRate/getTradeRate.js +19 -0
  18. package/dist/cjs/swappers/AcrossSwapper/index.d.ts +1 -0
  19. package/dist/cjs/swappers/AcrossSwapper/index.js +5 -0
  20. package/dist/cjs/swappers/AcrossSwapper/utils/acrossService.d.ts +5 -0
  21. package/dist/cjs/swappers/AcrossSwapper/utils/acrossService.js +17 -0
  22. package/dist/cjs/swappers/AcrossSwapper/utils/fetchAcrossTrade.d.ts +19 -0
  23. package/dist/cjs/swappers/AcrossSwapper/utils/fetchAcrossTrade.js +27 -0
  24. package/dist/cjs/swappers/AcrossSwapper/utils/getTrade.d.ts +11 -0
  25. package/dist/cjs/swappers/AcrossSwapper/utils/getTrade.js +349 -0
  26. package/dist/cjs/swappers/AcrossSwapper/utils/types.d.ts +177 -0
  27. package/dist/cjs/swappers/AcrossSwapper/utils/types.js +17 -0
  28. package/dist/cjs/swappers/AvnuSwapper/endpoints.js +42 -14
  29. package/dist/cjs/swappers/AvnuSwapper/swapperApi/getTradeQuote.js +19 -5
  30. package/dist/cjs/swappers/AvnuSwapper/swapperApi/getTradeRate.js +17 -4
  31. package/dist/cjs/swappers/BebopSwapper/BebopSwapper.js +2 -0
  32. package/dist/cjs/swappers/BebopSwapper/endpoints.js +35 -2
  33. package/dist/cjs/swappers/BebopSwapper/executeSolanaMessage.d.ts +2 -0
  34. package/dist/cjs/swappers/BebopSwapper/executeSolanaMessage.js +47 -0
  35. package/dist/cjs/swappers/BebopSwapper/getBebopSolanaTradeQuote/getBebopSolanaTradeQuote.d.ts +4 -0
  36. package/dist/cjs/swappers/BebopSwapper/getBebopSolanaTradeQuote/getBebopSolanaTradeQuote.js +91 -0
  37. package/dist/cjs/swappers/BebopSwapper/getBebopSolanaTradeRate/getBebopSolanaTradeRate.d.ts +4 -0
  38. package/dist/cjs/swappers/BebopSwapper/getBebopSolanaTradeRate/getBebopSolanaTradeRate.js +88 -0
  39. package/dist/cjs/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.js +10 -0
  40. package/dist/cjs/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.js +10 -0
  41. package/dist/cjs/swappers/BebopSwapper/types.d.ts +49 -1
  42. package/dist/cjs/swappers/BebopSwapper/types.js +9 -2
  43. package/dist/cjs/swappers/BebopSwapper/utils/fetchFromBebop.d.ts +19 -1
  44. package/dist/cjs/swappers/BebopSwapper/utils/fetchFromBebop.js +86 -1
  45. package/dist/cjs/swappers/BebopSwapper/utils/helpers/helpers.d.ts +14 -2
  46. package/dist/cjs/swappers/BebopSwapper/utils/helpers/helpers.js +47 -1
  47. package/dist/cjs/swappers/ButterSwap/ButterSwap.js +1 -0
  48. package/dist/cjs/swappers/ButterSwap/endpoints.js +56 -0
  49. package/dist/cjs/swappers/ButterSwap/swapperApi/checkTradeStatus.js +19 -0
  50. package/dist/cjs/swappers/ButterSwap/swapperApi/getTradeQuote.js +44 -15
  51. package/dist/cjs/swappers/ButterSwap/swapperApi/getTradeQuote.test.js +1 -0
  52. package/dist/cjs/swappers/ButterSwap/swapperApi/getTradeRate.js +33 -16
  53. package/dist/cjs/swappers/ButterSwap/swapperApi/getTradeRate.test.js +2 -0
  54. package/dist/cjs/swappers/ButterSwap/types.d.ts +1 -0
  55. package/dist/cjs/swappers/ButterSwap/utils/helpers.js +1 -0
  56. package/dist/cjs/swappers/ButterSwap/xhr.d.ts +2 -2
  57. package/dist/cjs/swappers/ButterSwap/xhr.js +7 -2
  58. package/dist/cjs/swappers/CetusSwapper/endpoints.js +3 -8
  59. package/dist/cjs/swappers/CetusSwapper/swapperApi/getTradeQuote.js +11 -1
  60. package/dist/cjs/swappers/CetusSwapper/swapperApi/getTradeRate.js +11 -1
  61. package/dist/cjs/swappers/CetusSwapper/utils/helpers.d.ts +1 -1
  62. package/dist/cjs/swappers/CetusSwapper/utils/helpers.js +1 -1
  63. package/dist/cjs/swappers/ChainflipSwapper/constants.js +7 -3
  64. package/dist/cjs/swappers/ChainflipSwapper/utils/getQuoteOrRate.js +28 -5
  65. package/dist/cjs/swappers/ChainflipSwapper/utils/helpers.js +8 -2
  66. package/dist/cjs/swappers/CowSwapper/CowSwapper.js +1 -1
  67. package/dist/cjs/swappers/CowSwapper/getCowSwapTradeQuote/getCowSwapTradeQuote.js +11 -1
  68. package/dist/cjs/swappers/CowSwapper/getCowSwapTradeQuote/getCowSwapTradeQuote.test.js +5 -5
  69. package/dist/cjs/swappers/CowSwapper/getCowSwapTradeRate/getCowSwapTradeRate.js +10 -1
  70. package/dist/cjs/swappers/CowSwapper/utils/helpers/helpers.js +8 -2
  71. package/dist/cjs/swappers/DebridgeSwapper/DebridgeSwapper.d.ts +2 -0
  72. package/dist/cjs/swappers/DebridgeSwapper/DebridgeSwapper.js +7 -0
  73. package/dist/cjs/swappers/DebridgeSwapper/constant.d.ts +5 -0
  74. package/dist/cjs/swappers/DebridgeSwapper/constant.js +36 -0
  75. package/dist/cjs/swappers/DebridgeSwapper/endpoints.d.ts +2 -0
  76. package/dist/cjs/swappers/DebridgeSwapper/endpoints.js +217 -0
  77. package/dist/cjs/swappers/DebridgeSwapper/getTradeQuote/getTradeQuote.d.ts +3 -0
  78. package/dist/cjs/swappers/DebridgeSwapper/getTradeQuote/getTradeQuote.js +31 -0
  79. package/dist/cjs/swappers/DebridgeSwapper/getTradeRate/getTradeRate.d.ts +3 -0
  80. package/dist/cjs/swappers/DebridgeSwapper/getTradeRate/getTradeRate.js +19 -0
  81. package/dist/cjs/swappers/DebridgeSwapper/index.d.ts +1 -0
  82. package/dist/cjs/swappers/DebridgeSwapper/index.js +5 -0
  83. package/dist/cjs/swappers/DebridgeSwapper/utils/debridgeService.d.ts +5 -0
  84. package/dist/cjs/swappers/DebridgeSwapper/utils/debridgeService.js +17 -0
  85. package/dist/cjs/swappers/DebridgeSwapper/utils/fetchDebridgeSingleChainTrade.d.ts +16 -0
  86. package/dist/cjs/swappers/DebridgeSwapper/utils/fetchDebridgeSingleChainTrade.js +23 -0
  87. package/dist/cjs/swappers/DebridgeSwapper/utils/fetchDebridgeTrade.d.ts +20 -0
  88. package/dist/cjs/swappers/DebridgeSwapper/utils/fetchDebridgeTrade.js +29 -0
  89. package/dist/cjs/swappers/DebridgeSwapper/utils/getTrade.d.ts +11 -0
  90. package/dist/cjs/swappers/DebridgeSwapper/utils/getTrade.js +369 -0
  91. package/dist/cjs/swappers/DebridgeSwapper/utils/types.d.ts +155 -0
  92. package/dist/cjs/swappers/DebridgeSwapper/utils/types.js +9 -0
  93. package/dist/cjs/swappers/JupiterSwapper/swapperApi/getTradeQuote.js +32 -0
  94. package/dist/cjs/swappers/JupiterSwapper/swapperApi/getTradeRate.js +9 -0
  95. package/dist/cjs/swappers/MayachainSwapper/utils/poolAssetHelpers/poolAssetHelpers.js +1 -1
  96. package/dist/cjs/swappers/NearIntentsSwapper/NearIntentsSwapper.js +1 -0
  97. package/dist/cjs/swappers/NearIntentsSwapper/endpoints.js +31 -0
  98. package/dist/cjs/swappers/NearIntentsSwapper/swapperApi/getTradeQuote.js +48 -1
  99. package/dist/cjs/swappers/NearIntentsSwapper/swapperApi/getTradeRate.js +73 -1
  100. package/dist/cjs/swappers/NearIntentsSwapper/types.d.ts +1 -1
  101. package/dist/cjs/swappers/NearIntentsSwapper/types.js +6 -0
  102. package/dist/cjs/swappers/NearIntentsSwapper/utils/helpers/helpers.js +23 -4
  103. package/dist/cjs/swappers/PortalsSwapper/getPortalsTradeQuote/getPortalsTradeQuote.js +10 -0
  104. package/dist/cjs/swappers/PortalsSwapper/getPortalsTradeRate/getPortalsTradeRate.js +8 -3
  105. package/dist/cjs/swappers/RelaySwapper/constant.js +27 -1
  106. package/dist/cjs/swappers/RelaySwapper/utils/getRelayDefaultUserAddress.d.ts +1 -1
  107. package/dist/cjs/swappers/RelaySwapper/utils/getTrade.js +57 -7
  108. package/dist/cjs/swappers/RelaySwapper/utils/relayTokenToAssetId.js +110 -0
  109. package/dist/cjs/swappers/RelaySwapper/utils/types.d.ts +15 -0
  110. package/dist/cjs/swappers/StonfiSwapper/StonfiSwapper.d.ts +2 -0
  111. package/dist/cjs/swappers/StonfiSwapper/StonfiSwapper.js +8 -0
  112. package/dist/cjs/swappers/StonfiSwapper/endpoints.d.ts +2 -0
  113. package/dist/cjs/swappers/StonfiSwapper/endpoints.js +227 -0
  114. package/dist/cjs/swappers/StonfiSwapper/index.d.ts +4 -0
  115. package/dist/cjs/swappers/StonfiSwapper/index.js +25 -0
  116. package/dist/cjs/swappers/StonfiSwapper/swapperApi/getTradeQuote.d.ts +2 -0
  117. package/dist/cjs/swappers/StonfiSwapper/swapperApi/getTradeQuote.js +129 -0
  118. package/dist/cjs/swappers/StonfiSwapper/swapperApi/getTradeRate.d.ts +2 -0
  119. package/dist/cjs/swappers/StonfiSwapper/swapperApi/getTradeRate.js +115 -0
  120. package/dist/cjs/swappers/StonfiSwapper/types.d.ts +60 -0
  121. package/dist/cjs/swappers/StonfiSwapper/types.js +5 -0
  122. package/dist/cjs/swappers/StonfiSwapper/utils/constants.d.ts +5 -0
  123. package/dist/cjs/swappers/StonfiSwapper/utils/constants.js +8 -0
  124. package/dist/cjs/swappers/StonfiSwapper/utils/helpers.d.ts +11 -0
  125. package/dist/cjs/swappers/StonfiSwapper/utils/helpers.js +135 -0
  126. package/dist/cjs/swappers/StonfiSwapper/utils/omnistonManager.d.ts +5 -0
  127. package/dist/cjs/swappers/StonfiSwapper/utils/omnistonManager.js +20 -0
  128. package/dist/cjs/swappers/SunioSwapper/endpoints.js +1 -1
  129. package/dist/cjs/swappers/SunioSwapper/utils/getQuoteOrRate.js +14 -3
  130. package/dist/cjs/swappers/ThorchainSwapper/ThorchainSwapper.js +3 -0
  131. package/dist/cjs/swappers/ThorchainSwapper/endpoints.js +2 -0
  132. package/dist/cjs/swappers/ThorchainSwapper/generated/generatedTradableAssetMap.json +1 -0
  133. package/dist/cjs/swappers/ThorchainSwapper/utils/poolAssetHelpers/poolAssetHelpers.d.ts +1 -1
  134. package/dist/cjs/swappers/ThorchainSwapper/utils/poolAssetHelpers/poolAssetHelpers.js +2 -1
  135. package/dist/cjs/swappers/ThorchainSwapper/utils/poolAssetHelpers/poolAssetHelpers.test.js +10 -0
  136. package/dist/cjs/swappers/ZrxSwapper/getZrxTradeQuote/getZrxTradeQuote.js +9 -0
  137. package/dist/cjs/swappers/ZrxSwapper/getZrxTradeRate/getZrxTradeRate.js +9 -0
  138. package/dist/cjs/swappers/ZrxSwapper/utils/helpers/helpers.d.ts +1 -1
  139. package/dist/cjs/swappers/utils/affiliateFee.d.ts +17 -0
  140. package/dist/cjs/swappers/utils/affiliateFee.js +43 -0
  141. package/dist/cjs/swappers/utils/filterBuyAssetsBySellAssetId/filterBuyAssetsBySellAssetId.js +2 -5
  142. package/dist/cjs/swappers/utils/helpers/helpers.js +3 -0
  143. package/dist/cjs/thorchain-utils/getCallDataFromQuote.d.ts +1 -1
  144. package/dist/cjs/thorchain-utils/getL1RateOrQuote.js +87 -9
  145. package/dist/cjs/thorchain-utils/getQuote.js +8 -2
  146. package/dist/cjs/thorchain-utils/index.d.ts +2 -1
  147. package/dist/cjs/thorchain-utils/index.js +2 -1
  148. package/dist/cjs/thorchain-utils/solana/constants.d.ts +1 -0
  149. package/dist/cjs/thorchain-utils/solana/constants.js +6 -0
  150. package/dist/cjs/thorchain-utils/solana/getSolanaTransactionFees.d.ts +2 -0
  151. package/dist/cjs/thorchain-utils/solana/getSolanaTransactionFees.js +41 -0
  152. package/dist/cjs/thorchain-utils/solana/getThorTxData.d.ts +12 -0
  153. package/dist/cjs/thorchain-utils/solana/getThorTxData.js +14 -0
  154. package/dist/cjs/thorchain-utils/solana/getUnsignedSolanaTransaction.d.ts +3 -0
  155. package/dist/cjs/thorchain-utils/solana/getUnsignedSolanaTransaction.js +64 -0
  156. package/dist/cjs/thorchain-utils/solana/index.d.ts +3 -0
  157. package/dist/cjs/thorchain-utils/solana/index.js +19 -0
  158. package/dist/cjs/tron-utils/getUnsignedTronTransaction.js +22 -2
  159. package/dist/cjs/types.d.ts +118 -8
  160. package/dist/cjs/types.js +3 -0
  161. package/dist/cjs/utils.d.ts +4 -3
  162. package/dist/cjs/utils.js +35 -7
  163. package/dist/esm/.tsbuildinfo +1 -1
  164. package/dist/esm/constants.js +42 -13
  165. package/dist/esm/cowswap-utils/constants.js +3 -0
  166. package/dist/esm/cowswap-utils/index.js +6 -0
  167. package/dist/esm/index.d.ts +1 -0
  168. package/dist/esm/index.js +1 -0
  169. package/dist/esm/swappers/AcrossSwapper/AcrossSwapper.d.ts +2 -0
  170. package/dist/esm/swappers/AcrossSwapper/AcrossSwapper.js +5 -0
  171. package/dist/esm/swappers/AcrossSwapper/constant.d.ts +9 -0
  172. package/dist/esm/swappers/AcrossSwapper/constant.js +44 -0
  173. package/dist/esm/swappers/AcrossSwapper/endpoints.d.ts +2 -0
  174. package/dist/esm/swappers/AcrossSwapper/endpoints.js +107 -0
  175. package/dist/esm/swappers/AcrossSwapper/getTradeQuote/getTradeQuote.d.ts +3 -0
  176. package/dist/esm/swappers/AcrossSwapper/getTradeQuote/getTradeQuote.js +27 -0
  177. package/dist/esm/swappers/AcrossSwapper/getTradeRate/getTradeRate.d.ts +3 -0
  178. package/dist/esm/swappers/AcrossSwapper/getTradeRate/getTradeRate.js +15 -0
  179. package/dist/esm/swappers/AcrossSwapper/index.d.ts +1 -0
  180. package/dist/esm/swappers/AcrossSwapper/index.js +1 -0
  181. package/dist/esm/swappers/AcrossSwapper/utils/acrossService.d.ts +5 -0
  182. package/dist/esm/swappers/AcrossSwapper/utils/acrossService.js +11 -0
  183. package/dist/esm/swappers/AcrossSwapper/utils/fetchAcrossTrade.d.ts +19 -0
  184. package/dist/esm/swappers/AcrossSwapper/utils/fetchAcrossTrade.js +23 -0
  185. package/dist/esm/swappers/AcrossSwapper/utils/getTrade.d.ts +11 -0
  186. package/dist/esm/swappers/AcrossSwapper/utils/getTrade.js +342 -0
  187. package/dist/esm/swappers/AcrossSwapper/utils/types.d.ts +177 -0
  188. package/dist/esm/swappers/AcrossSwapper/utils/types.js +13 -0
  189. package/dist/esm/swappers/AvnuSwapper/endpoints.js +43 -15
  190. package/dist/esm/swappers/AvnuSwapper/swapperApi/getTradeQuote.js +19 -5
  191. package/dist/esm/swappers/AvnuSwapper/swapperApi/getTradeRate.js +17 -4
  192. package/dist/esm/swappers/BebopSwapper/BebopSwapper.js +2 -0
  193. package/dist/esm/swappers/BebopSwapper/endpoints.js +36 -3
  194. package/dist/esm/swappers/BebopSwapper/executeSolanaMessage.d.ts +2 -0
  195. package/dist/esm/swappers/BebopSwapper/executeSolanaMessage.js +40 -0
  196. package/dist/esm/swappers/BebopSwapper/getBebopSolanaTradeQuote/getBebopSolanaTradeQuote.d.ts +4 -0
  197. package/dist/esm/swappers/BebopSwapper/getBebopSolanaTradeQuote/getBebopSolanaTradeQuote.js +87 -0
  198. package/dist/esm/swappers/BebopSwapper/getBebopSolanaTradeRate/getBebopSolanaTradeRate.d.ts +4 -0
  199. package/dist/esm/swappers/BebopSwapper/getBebopSolanaTradeRate/getBebopSolanaTradeRate.js +84 -0
  200. package/dist/esm/swappers/BebopSwapper/getBebopTradeQuote/getBebopTradeQuote.js +10 -0
  201. package/dist/esm/swappers/BebopSwapper/getBebopTradeRate/getBebopTradeRate.js +10 -0
  202. package/dist/esm/swappers/BebopSwapper/types.d.ts +49 -1
  203. package/dist/esm/swappers/BebopSwapper/types.js +8 -1
  204. package/dist/esm/swappers/BebopSwapper/utils/fetchFromBebop.d.ts +19 -1
  205. package/dist/esm/swappers/BebopSwapper/utils/fetchFromBebop.js +85 -2
  206. package/dist/esm/swappers/BebopSwapper/utils/helpers/helpers.d.ts +14 -2
  207. package/dist/esm/swappers/BebopSwapper/utils/helpers/helpers.js +44 -1
  208. package/dist/esm/swappers/ButterSwap/ButterSwap.js +2 -1
  209. package/dist/esm/swappers/ButterSwap/endpoints.js +56 -0
  210. package/dist/esm/swappers/ButterSwap/swapperApi/checkTradeStatus.js +20 -1
  211. package/dist/esm/swappers/ButterSwap/swapperApi/getTradeQuote.js +46 -17
  212. package/dist/esm/swappers/ButterSwap/swapperApi/getTradeQuote.test.js +1 -0
  213. package/dist/esm/swappers/ButterSwap/swapperApi/getTradeRate.js +35 -18
  214. package/dist/esm/swappers/ButterSwap/swapperApi/getTradeRate.test.js +2 -0
  215. package/dist/esm/swappers/ButterSwap/types.d.ts +1 -0
  216. package/dist/esm/swappers/ButterSwap/utils/helpers.js +1 -0
  217. package/dist/esm/swappers/ButterSwap/xhr.d.ts +2 -2
  218. package/dist/esm/swappers/ButterSwap/xhr.js +8 -3
  219. package/dist/esm/swappers/CetusSwapper/endpoints.js +3 -8
  220. package/dist/esm/swappers/CetusSwapper/swapperApi/getTradeQuote.js +11 -1
  221. package/dist/esm/swappers/CetusSwapper/swapperApi/getTradeRate.js +11 -1
  222. package/dist/esm/swappers/CetusSwapper/utils/helpers.d.ts +1 -1
  223. package/dist/esm/swappers/CetusSwapper/utils/helpers.js +1 -1
  224. package/dist/esm/swappers/ChainflipSwapper/constants.js +8 -4
  225. package/dist/esm/swappers/ChainflipSwapper/utils/getQuoteOrRate.js +29 -6
  226. package/dist/esm/swappers/ChainflipSwapper/utils/helpers.js +9 -3
  227. package/dist/esm/swappers/CowSwapper/CowSwapper.js +1 -1
  228. package/dist/esm/swappers/CowSwapper/getCowSwapTradeQuote/getCowSwapTradeQuote.js +11 -1
  229. package/dist/esm/swappers/CowSwapper/getCowSwapTradeQuote/getCowSwapTradeQuote.test.js +5 -5
  230. package/dist/esm/swappers/CowSwapper/getCowSwapTradeRate/getCowSwapTradeRate.js +10 -1
  231. package/dist/esm/swappers/CowSwapper/utils/helpers/helpers.js +9 -3
  232. package/dist/esm/swappers/DebridgeSwapper/DebridgeSwapper.d.ts +2 -0
  233. package/dist/esm/swappers/DebridgeSwapper/DebridgeSwapper.js +4 -0
  234. package/dist/esm/swappers/DebridgeSwapper/constant.d.ts +5 -0
  235. package/dist/esm/swappers/DebridgeSwapper/constant.js +30 -0
  236. package/dist/esm/swappers/DebridgeSwapper/endpoints.d.ts +2 -0
  237. package/dist/esm/swappers/DebridgeSwapper/endpoints.js +211 -0
  238. package/dist/esm/swappers/DebridgeSwapper/getTradeQuote/getTradeQuote.d.ts +3 -0
  239. package/dist/esm/swappers/DebridgeSwapper/getTradeQuote/getTradeQuote.js +27 -0
  240. package/dist/esm/swappers/DebridgeSwapper/getTradeRate/getTradeRate.d.ts +3 -0
  241. package/dist/esm/swappers/DebridgeSwapper/getTradeRate/getTradeRate.js +15 -0
  242. package/dist/esm/swappers/DebridgeSwapper/index.d.ts +1 -0
  243. package/dist/esm/swappers/DebridgeSwapper/index.js +1 -0
  244. package/dist/esm/swappers/DebridgeSwapper/utils/debridgeService.d.ts +5 -0
  245. package/dist/esm/swappers/DebridgeSwapper/utils/debridgeService.js +11 -0
  246. package/dist/esm/swappers/DebridgeSwapper/utils/fetchDebridgeSingleChainTrade.d.ts +16 -0
  247. package/dist/esm/swappers/DebridgeSwapper/utils/fetchDebridgeSingleChainTrade.js +19 -0
  248. package/dist/esm/swappers/DebridgeSwapper/utils/fetchDebridgeTrade.d.ts +20 -0
  249. package/dist/esm/swappers/DebridgeSwapper/utils/fetchDebridgeTrade.js +25 -0
  250. package/dist/esm/swappers/DebridgeSwapper/utils/getTrade.d.ts +11 -0
  251. package/dist/esm/swappers/DebridgeSwapper/utils/getTrade.js +362 -0
  252. package/dist/esm/swappers/DebridgeSwapper/utils/types.d.ts +155 -0
  253. package/dist/esm/swappers/DebridgeSwapper/utils/types.js +5 -0
  254. package/dist/esm/swappers/JupiterSwapper/swapperApi/getTradeQuote.js +33 -1
  255. package/dist/esm/swappers/JupiterSwapper/swapperApi/getTradeRate.js +9 -0
  256. package/dist/esm/swappers/MayachainSwapper/utils/poolAssetHelpers/poolAssetHelpers.js +1 -1
  257. package/dist/esm/swappers/NearIntentsSwapper/NearIntentsSwapper.js +2 -1
  258. package/dist/esm/swappers/NearIntentsSwapper/endpoints.js +31 -0
  259. package/dist/esm/swappers/NearIntentsSwapper/swapperApi/getTradeQuote.js +50 -3
  260. package/dist/esm/swappers/NearIntentsSwapper/swapperApi/getTradeRate.js +75 -3
  261. package/dist/esm/swappers/NearIntentsSwapper/types.d.ts +1 -1
  262. package/dist/esm/swappers/NearIntentsSwapper/types.js +6 -0
  263. package/dist/esm/swappers/NearIntentsSwapper/utils/helpers/helpers.js +23 -4
  264. package/dist/esm/swappers/PortalsSwapper/getPortalsTradeQuote/getPortalsTradeQuote.js +10 -0
  265. package/dist/esm/swappers/PortalsSwapper/getPortalsTradeRate/getPortalsTradeRate.js +8 -3
  266. package/dist/esm/swappers/RelaySwapper/constant.js +29 -3
  267. package/dist/esm/swappers/RelaySwapper/utils/getRelayDefaultUserAddress.d.ts +1 -1
  268. package/dist/esm/swappers/RelaySwapper/utils/getTrade.js +60 -10
  269. package/dist/esm/swappers/RelaySwapper/utils/relayTokenToAssetId.js +110 -0
  270. package/dist/esm/swappers/RelaySwapper/utils/types.d.ts +15 -0
  271. package/dist/esm/swappers/StonfiSwapper/StonfiSwapper.d.ts +2 -0
  272. package/dist/esm/swappers/StonfiSwapper/StonfiSwapper.js +5 -0
  273. package/dist/esm/swappers/StonfiSwapper/endpoints.d.ts +2 -0
  274. package/dist/esm/swappers/StonfiSwapper/endpoints.js +224 -0
  275. package/dist/esm/swappers/StonfiSwapper/index.d.ts +4 -0
  276. package/dist/esm/swappers/StonfiSwapper/index.js +4 -0
  277. package/dist/esm/swappers/StonfiSwapper/swapperApi/getTradeQuote.d.ts +2 -0
  278. package/dist/esm/swappers/StonfiSwapper/swapperApi/getTradeQuote.js +125 -0
  279. package/dist/esm/swappers/StonfiSwapper/swapperApi/getTradeRate.d.ts +2 -0
  280. package/dist/esm/swappers/StonfiSwapper/swapperApi/getTradeRate.js +111 -0
  281. package/dist/esm/swappers/StonfiSwapper/types.d.ts +60 -0
  282. package/dist/esm/swappers/StonfiSwapper/types.js +2 -0
  283. package/dist/esm/swappers/StonfiSwapper/utils/constants.d.ts +5 -0
  284. package/dist/esm/swappers/StonfiSwapper/utils/constants.js +5 -0
  285. package/dist/esm/swappers/StonfiSwapper/utils/helpers.d.ts +11 -0
  286. package/dist/esm/swappers/StonfiSwapper/utils/helpers.js +124 -0
  287. package/dist/esm/swappers/StonfiSwapper/utils/omnistonManager.d.ts +5 -0
  288. package/dist/esm/swappers/StonfiSwapper/utils/omnistonManager.js +17 -0
  289. package/dist/esm/swappers/SunioSwapper/endpoints.js +1 -1
  290. package/dist/esm/swappers/SunioSwapper/utils/getQuoteOrRate.js +15 -4
  291. package/dist/esm/swappers/ThorchainSwapper/ThorchainSwapper.js +3 -0
  292. package/dist/esm/swappers/ThorchainSwapper/endpoints.js +3 -1
  293. package/dist/esm/swappers/ThorchainSwapper/generated/generatedTradableAssetMap.json +1 -0
  294. package/dist/esm/swappers/ThorchainSwapper/utils/poolAssetHelpers/poolAssetHelpers.d.ts +1 -1
  295. package/dist/esm/swappers/ThorchainSwapper/utils/poolAssetHelpers/poolAssetHelpers.js +2 -1
  296. package/dist/esm/swappers/ThorchainSwapper/utils/poolAssetHelpers/poolAssetHelpers.test.js +11 -1
  297. package/dist/esm/swappers/ZrxSwapper/getZrxTradeQuote/getZrxTradeQuote.js +9 -0
  298. package/dist/esm/swappers/ZrxSwapper/getZrxTradeRate/getZrxTradeRate.js +9 -0
  299. package/dist/esm/swappers/ZrxSwapper/utils/helpers/helpers.d.ts +1 -1
  300. package/dist/esm/swappers/utils/affiliateFee.d.ts +17 -0
  301. package/dist/esm/swappers/utils/affiliateFee.js +39 -0
  302. package/dist/esm/swappers/utils/filterBuyAssetsBySellAssetId/filterBuyAssetsBySellAssetId.js +2 -5
  303. package/dist/esm/swappers/utils/helpers/helpers.js +4 -1
  304. package/dist/esm/thorchain-utils/getCallDataFromQuote.d.ts +1 -1
  305. package/dist/esm/thorchain-utils/getL1RateOrQuote.js +88 -10
  306. package/dist/esm/thorchain-utils/getQuote.js +9 -3
  307. package/dist/esm/thorchain-utils/index.d.ts +2 -1
  308. package/dist/esm/thorchain-utils/index.js +1 -0
  309. package/dist/esm/thorchain-utils/solana/constants.d.ts +1 -0
  310. package/dist/esm/thorchain-utils/solana/constants.js +3 -0
  311. package/dist/esm/thorchain-utils/solana/getSolanaTransactionFees.d.ts +2 -0
  312. package/dist/esm/thorchain-utils/solana/getSolanaTransactionFees.js +37 -0
  313. package/dist/esm/thorchain-utils/solana/getThorTxData.d.ts +12 -0
  314. package/dist/esm/thorchain-utils/solana/getThorTxData.js +10 -0
  315. package/dist/esm/thorchain-utils/solana/getUnsignedSolanaTransaction.d.ts +3 -0
  316. package/dist/esm/thorchain-utils/solana/getUnsignedSolanaTransaction.js +60 -0
  317. package/dist/esm/thorchain-utils/solana/index.d.ts +3 -0
  318. package/dist/esm/thorchain-utils/solana/index.js +3 -0
  319. package/dist/esm/tron-utils/getUnsignedTronTransaction.js +22 -2
  320. package/dist/esm/types.d.ts +118 -8
  321. package/dist/esm/types.js +3 -0
  322. package/dist/esm/utils.d.ts +4 -3
  323. package/dist/esm/utils.js +34 -7
  324. package/package.json +27 -24
@@ -1,8 +1,8 @@
1
1
  import type { QuoteResponse } from '@jup-ag/api';
2
2
  import type { AccountId, AssetId, ChainId, Nominal } from '@shapeshiftoss/caip';
3
- import type { ChainAdapter, CosmosSdkChainAdapter, EvmChainAdapter, near, SignTx, solana, starknet, sui, tron, UtxoChainAdapter } from '@shapeshiftoss/chain-adapters';
3
+ import type { ChainAdapter, CosmosSdkChainAdapter, EvmChainAdapter, near, SignTx, solana, starknet, sui, ton, tron, UtxoChainAdapter } from '@shapeshiftoss/chain-adapters';
4
4
  import type { HDWallet, SolanaSignTx, StarknetSignTx, SuiSignTx } from '@shapeshiftoss/hdwallet-core';
5
- import type { AccountMetadata, Asset, AssetsByIdPartial, CosmosSdkChainId, EvmChainId, KnownChainIds, NearChainId, OrderQuoteResponse, PartialRecord, TronChainId, UtxoAccountType, UtxoChainId } from '@shapeshiftoss/types';
5
+ import type { AccountMetadata, Asset, AssetsByIdPartial, CosmosSdkChainId, EvmChainId, KnownChainIds, NearChainId, OrderQuoteResponse, PartialRecord, SolanaChainId, TonChainId, TronChainId, UtxoAccountType, UtxoChainId } from '@shapeshiftoss/types';
6
6
  import type { TxStatus } from '@shapeshiftoss/unchained-client';
7
7
  import type { Result } from '@sniptt/monads';
8
8
  import type { TransactionInstruction } from '@solana/web3.js';
@@ -11,7 +11,9 @@ import type { Mixpanel } from 'mixpanel-browser';
11
11
  import type Polyglot from 'node-polyglot';
12
12
  import type { InterpolationOptions } from 'node-polyglot';
13
13
  import type { Address, Hex } from 'viem';
14
+ import type { AcrossTransactionMetadata } from './swappers/AcrossSwapper/utils/types.js';
14
15
  import type { CowMessageToSign } from './swappers/CowSwapper/types.js';
16
+ import type { DebridgeTransactionMetadata } from './swappers/DebridgeSwapper/utils/types.js';
15
17
  import type { RelayTransactionMetadata } from './swappers/RelaySwapper/utils/types.js';
16
18
  import type { makeSwapperAxiosServiceMonadic } from './utils.js';
17
19
  export type SwapperConfig = {
@@ -47,6 +49,9 @@ export type SwapperConfig = {
47
49
  VITE_TENDERLY_ACCOUNT_SLUG: string;
48
50
  VITE_TENDERLY_PROJECT_SLUG: string;
49
51
  VITE_SUI_NODE_URL: string;
52
+ VITE_ACROSS_API_URL: string;
53
+ VITE_ACROSS_INTEGRATOR_ID: string;
54
+ VITE_DEBRIDGE_API_URL: string;
50
55
  };
51
56
  export declare enum SwapperName {
52
57
  Thorchain = "THORChain",
@@ -64,7 +69,10 @@ export declare enum SwapperName {
64
69
  NearIntents = "NEAR Intents",
65
70
  Cetus = "Cetus",
66
71
  Sunio = "Sun.io",
67
- Avnu = "AVNU"
72
+ Avnu = "AVNU",
73
+ Stonfi = "STON.fi",
74
+ Across = "Across",
75
+ Debridge = "deBridge"
68
76
  }
69
77
  export type SwapSource = SwapperName | `${SwapperName} • ${string}`;
70
78
  export type SwapErrorRight = {
@@ -128,6 +136,7 @@ type CommonTradeInputBase = {
128
136
  buyAsset: Asset;
129
137
  sellAmountIncludingProtocolFeesCryptoBaseUnit: string;
130
138
  affiliateBps: string;
139
+ affiliateAddress?: string;
131
140
  allowMultiHop: boolean;
132
141
  slippageTolerancePercentageDecimal?: string;
133
142
  };
@@ -183,6 +192,24 @@ export type GetNearTradeQuoteInput = CommonTradeInput & {
183
192
  export type GetNearTradeRateInput = CommonTradeRateInput & {
184
193
  chainId: NearChainId;
185
194
  };
195
+ export type GetTonTradeQuoteInputBase = CommonTradeInput & {
196
+ chainId: TonChainId;
197
+ };
198
+ export type GetTonTradeQuoteInput = CommonTradeInput & {
199
+ chainId: TonChainId;
200
+ };
201
+ export type GetTonTradeRateInput = CommonTradeRateInput & {
202
+ chainId: TonChainId;
203
+ };
204
+ export type GetSolanaTradeQuoteInputBase = CommonTradeInput & {
205
+ chainId: SolanaChainId;
206
+ };
207
+ export type GetSolanaTradeQuoteInput = CommonTradeInput & {
208
+ chainId: SolanaChainId;
209
+ };
210
+ export type GetSolanaTradeRateInput = CommonTradeRateInput & {
211
+ chainId: SolanaChainId;
212
+ };
186
213
  type GetUtxoTradeQuoteWithWallet = CommonTradeQuoteInput & {
187
214
  chainId: UtxoChainId;
188
215
  accountType: UtxoAccountType;
@@ -196,9 +223,9 @@ export type GetUtxoTradeRateInput = CommonTradeRateInput & {
196
223
  xpub: string | undefined;
197
224
  };
198
225
  export type GetUtxoTradeQuoteInput = GetUtxoTradeQuoteWithWallet;
199
- export type GetTradeQuoteInput = GetUtxoTradeQuoteInput | GetEvmTradeQuoteInput | GetCosmosSdkTradeQuoteInput | GetTronTradeQuoteInput | GetNearTradeQuoteInput;
200
- export type GetTradeRateInput = GetEvmTradeRateInput | GetCosmosSdkTradeRateInput | GetUtxoTradeRateInput | GetTronTradeRateInput | GetNearTradeRateInput;
201
- export type GetTradeQuoteInputWithWallet = GetUtxoTradeQuoteWithWallet | GetEvmTradeQuoteInputBase | GetCosmosSdkTradeQuoteInputBase | GetTronTradeQuoteInputBase | GetNearTradeQuoteInputBase;
226
+ export type GetTradeQuoteInput = GetUtxoTradeQuoteInput | GetEvmTradeQuoteInput | GetCosmosSdkTradeQuoteInput | GetTronTradeQuoteInput | GetNearTradeQuoteInput | GetTonTradeQuoteInput | GetSolanaTradeQuoteInput;
227
+ export type GetTradeRateInput = GetEvmTradeRateInput | GetCosmosSdkTradeRateInput | GetUtxoTradeRateInput | GetTronTradeRateInput | GetNearTradeRateInput | GetTonTradeRateInput | GetSolanaTradeRateInput;
228
+ export type GetTradeQuoteInputWithWallet = GetUtxoTradeQuoteWithWallet | GetEvmTradeQuoteInputBase | GetCosmosSdkTradeQuoteInputBase | GetTronTradeQuoteInputBase | GetNearTradeQuoteInputBase | GetTonTradeQuoteInputBase | GetSolanaTradeQuoteInputBase;
202
229
  export type EvmSwapperDeps = {
203
230
  assertGetEvmChainAdapter: (chainId: ChainId) => EvmChainAdapter;
204
231
  fetchIsSmartContractAddressQuery: (userAddress: string, chainId: ChainId) => Promise<boolean>;
@@ -224,12 +251,21 @@ export type NearSwapperDeps = {
224
251
  export type StarknetSwapperDeps = {
225
252
  assertGetStarknetChainAdapter: (chainId: ChainId) => starknet.ChainAdapter;
226
253
  };
254
+ export type TonSwapperDeps = {
255
+ assertGetTonChainAdapter: (chainId: ChainId) => ton.ChainAdapter;
256
+ };
227
257
  export type SwapperDeps = {
228
258
  assetsById: AssetsByIdPartial;
229
259
  config: SwapperConfig;
230
260
  mixPanel: Mixpanel | undefined;
231
261
  assertGetChainAdapter: (chainId: ChainId) => ChainAdapter<KnownChainIds>;
232
- } & EvmSwapperDeps & UtxoSwapperDeps & CosmosSdkSwapperDeps & SolanaSwapperDeps & TronSwapperDeps & SuiSwapperDeps & NearSwapperDeps & StarknetSwapperDeps;
262
+ } & EvmSwapperDeps & UtxoSwapperDeps & CosmosSdkSwapperDeps & SolanaSwapperDeps & TronSwapperDeps & SuiSwapperDeps & NearSwapperDeps & StarknetSwapperDeps & TonSwapperDeps;
263
+ export type AffiliateFee = {
264
+ assetId: AssetId;
265
+ amountCryptoBaseUnit: string;
266
+ asset: Asset;
267
+ isEstimate?: boolean;
268
+ };
233
269
  export type TradeQuoteStep = {
234
270
  buyAmountBeforeFeesCryptoBaseUnit: string;
235
271
  buyAmountAfterFeesCryptoBaseUnit: string;
@@ -269,10 +305,14 @@ export type TradeQuoteStep = {
269
305
  value: Hex;
270
306
  gas?: string;
271
307
  };
308
+ bebopSolanaSerializedTx?: string;
309
+ bebopQuoteId?: string;
272
310
  jupiterQuoteResponse?: QuoteResponse;
273
311
  solanaTransactionMetadata?: {
274
312
  addressLookupTableAddresses: string[];
275
313
  instructions?: TransactionInstruction[];
314
+ /** True when the serialized tx exceeds the 1232-byte Solana limit and needs Jito bundle splitting */
315
+ isOversized?: boolean;
276
316
  };
277
317
  cowswapQuoteResponse?: OrderQuoteResponse;
278
318
  chainflipSpecific?: {
@@ -297,6 +337,13 @@ export type TradeQuoteStep = {
297
337
  data: string;
298
338
  value: Hex;
299
339
  gasLimit: string;
340
+ method?: string;
341
+ args?: {
342
+ type: string;
343
+ value: unknown;
344
+ }[];
345
+ memo?: string;
346
+ serializedSolanaTransaction?: string;
300
347
  };
301
348
  sunioTransactionMetadata?: {
302
349
  route: {
@@ -317,6 +364,43 @@ export type TradeQuoteStep = {
317
364
  quoteId: string;
318
365
  routes: any[];
319
366
  };
367
+ stonfiSpecific?: {
368
+ quoteId: string;
369
+ resolverId: string;
370
+ resolverName: string;
371
+ tradeStartDeadline: number;
372
+ gasBudget: string;
373
+ bidAssetAddress: {
374
+ blockchain: number;
375
+ address: string;
376
+ };
377
+ askAssetAddress: {
378
+ blockchain: number;
379
+ address: string;
380
+ };
381
+ bidUnits: string;
382
+ askUnits: string;
383
+ referrerAddress?: {
384
+ blockchain: number;
385
+ address: string;
386
+ };
387
+ referrerFeeAsset?: {
388
+ blockchain: number;
389
+ address: string;
390
+ };
391
+ referrerFeeUnits: string;
392
+ protocolFeeAsset?: {
393
+ blockchain: number;
394
+ address: string;
395
+ };
396
+ protocolFeeUnits: string;
397
+ quoteTimestamp: number;
398
+ estimatedGasConsumption: string;
399
+ params?: unknown;
400
+ };
401
+ acrossTransactionMetadata?: AcrossTransactionMetadata;
402
+ debridgeTransactionMetadata?: DebridgeTransactionMetadata;
403
+ affiliateFee?: AffiliateFee;
320
404
  };
321
405
  export type TradeRateStep = Omit<TradeQuoteStep, 'accountNumber'> & {
322
406
  accountNumber: undefined;
@@ -370,6 +454,8 @@ export type SwapperSpecificMetadata = {
370
454
  deadline: string;
371
455
  };
372
456
  relayTransactionMetadata: RelayTransactionMetadata | undefined;
457
+ acrossTransactionMetadata: AcrossTransactionMetadata | undefined;
458
+ debridgeTransactionMetadata: DebridgeTransactionMetadata | undefined;
373
459
  relayerExplorerTxLink: string | undefined;
374
460
  relayerTxHash: string | undefined;
375
461
  stepIndex: SupportedTradeQuoteStepIndex;
@@ -462,6 +548,15 @@ export type CosmosSdkTransactionExecutionProps = {
462
548
  };
463
549
  export type SolanaTransactionExecutionProps = {
464
550
  signAndBroadcastTransaction: (txToSign: SolanaSignTx) => Promise<string>;
551
+ /** Sign-only callback for Jito bundle flow (sign without broadcasting) */
552
+ signTransaction?: (txToSign: SolanaSignTx) => Promise<string>;
553
+ };
554
+ export type SolanaMessageToSign = {
555
+ serializedTx: string;
556
+ quoteId: string;
557
+ };
558
+ export type SolanaMessageExecutionProps = {
559
+ signSerializedTransaction: (serializedTx: string) => Promise<string[]>;
465
560
  };
466
561
  export type TronTransactionExecutionProps = {
467
562
  signAndBroadcastTransaction: (txToSign: tron.TronSignTx) => Promise<string>;
@@ -475,6 +570,9 @@ export type NearTransactionExecutionProps = {
475
570
  export type StarknetTransactionExecutionProps = {
476
571
  signAndBroadcastTransaction: (txToSign: StarknetSignTx) => Promise<string>;
477
572
  };
573
+ export type TonTransactionExecutionProps = {
574
+ signAndBroadcastTransaction: (txToSign: ton.TonSignTx) => Promise<string>;
575
+ };
478
576
  type EvmAccountMetadata = {
479
577
  from: string;
480
578
  };
@@ -517,7 +615,12 @@ export type GetUnsignedTronTransactionArgs = CommonGetUnsignedTransactionArgs &
517
615
  export type GetUnsignedSuiTransactionArgs = CommonGetUnsignedTransactionArgs & SuiAccountMetadata & SuiSwapperDeps;
518
616
  export type GetUnsignedNearTransactionArgs = CommonGetUnsignedTransactionArgs & NearAccountMetadata & NearSwapperDeps;
519
617
  export type GetUnsignedStarknetTransactionArgs = CommonGetUnsignedTransactionArgs & StarknetAccountMetadata & StarknetSwapperDeps;
618
+ type TonAccountMetadata = {
619
+ from: string;
620
+ };
621
+ export type GetUnsignedTonTransactionArgs = CommonGetUnsignedTransactionArgs & TonAccountMetadata & TonSwapperDeps;
520
622
  export type GetUnsignedEvmMessageArgs = CommonGetUnsignedTransactionArgs & EvmAccountMetadata & Omit<EvmSwapperDeps, 'fetchIsSmartContractAddressQuery'>;
623
+ export type GetUnsignedSolanaMessageArgs = CommonGetUnsignedTransactionArgs;
521
624
  export type GetUnsignedUtxoTransactionArgs = CommonGetUnsignedTransactionArgs & UtxoAccountMetadata & UtxoSwapperDeps;
522
625
  export type GetUnsignedCosmosSdkTransactionArgs = CommonGetUnsignedTransactionArgs & CosmosSdkAccountMetadata & CosmosSdkSwapperDeps;
523
626
  export type UnsignedTx = Nominal<Record<string, any>, 'UnsignedTx'>;
@@ -535,7 +638,7 @@ export type CheckTradeStatusInput = {
535
638
  stepIndex: SupportedTradeQuoteStepIndex;
536
639
  config: SwapperConfig;
537
640
  swap: Swap | undefined;
538
- } & EvmSwapperDeps & UtxoSwapperDeps & CosmosSdkSwapperDeps & SolanaSwapperDeps & TronSwapperDeps & SuiSwapperDeps & NearSwapperDeps & StarknetSwapperDeps;
641
+ } & EvmSwapperDeps & UtxoSwapperDeps & CosmosSdkSwapperDeps & SolanaSwapperDeps & TronSwapperDeps & SuiSwapperDeps & NearSwapperDeps & StarknetSwapperDeps & TonSwapperDeps;
539
642
  export type TradeStatus = {
540
643
  status: TxStatus;
541
644
  buyTxHash: string | undefined;
@@ -554,10 +657,12 @@ export type Swapper = {
554
657
  executeUtxoTransaction?: (txToSign: SignTx<UtxoChainId>, callbacks: UtxoTransactionExecutionProps) => Promise<string>;
555
658
  executeCosmosSdkTransaction?: (txToSign: SignTx<CosmosSdkChainId>, callbacks: CosmosSdkTransactionExecutionProps) => Promise<string>;
556
659
  executeSolanaTransaction?: (txToSign: SolanaSignTx, callbacks: SolanaTransactionExecutionProps) => Promise<string>;
660
+ executeSolanaMessage?: (messageData: SolanaMessageToSign, callbacks: SolanaMessageExecutionProps, config: SwapperConfig) => Promise<string>;
557
661
  executeTronTransaction?: (txToSign: tron.TronSignTx, callbacks: TronTransactionExecutionProps) => Promise<string>;
558
662
  executeSuiTransaction?: (txToSign: SuiSignTx, callbacks: SuiTransactionExecutionProps) => Promise<string>;
559
663
  executeNearTransaction?: (txToSign: near.NearSignTx, callbacks: NearTransactionExecutionProps) => Promise<string>;
560
664
  executeStarknetTransaction?: (txToSign: StarknetSignTx, callbacks: StarknetTransactionExecutionProps) => Promise<string>;
665
+ executeTonTransaction?: (txToSign: ton.TonSignTx, callbacks: TonTransactionExecutionProps) => Promise<string>;
561
666
  };
562
667
  export type SwapperApi = {
563
668
  checkTradeStatus: (input: CheckTradeStatusInput) => Promise<TradeStatus>;
@@ -569,10 +674,12 @@ export type SwapperApi = {
569
674
  getUnsignedUtxoTransaction?: (input: GetUnsignedUtxoTransactionArgs) => Promise<SignTx<UtxoChainId>>;
570
675
  getUnsignedCosmosSdkTransaction?: (input: GetUnsignedCosmosSdkTransactionArgs) => Promise<SignTx<CosmosSdkChainId>>;
571
676
  getUnsignedSolanaTransaction?: (input: GetUnsignedSolanaTransactionArgs) => Promise<SolanaSignTx>;
677
+ getUnsignedSolanaMessage?: (input: GetUnsignedSolanaMessageArgs) => Promise<SolanaMessageToSign>;
572
678
  getUnsignedTronTransaction?: (input: GetUnsignedTronTransactionArgs) => Promise<tron.TronSignTx>;
573
679
  getUnsignedSuiTransaction?: (input: GetUnsignedSuiTransactionArgs) => Promise<SuiSignTx>;
574
680
  getUnsignedNearTransaction?: (input: GetUnsignedNearTransactionArgs) => Promise<near.NearSignTx>;
575
681
  getUnsignedStarknetTransaction?: (input: GetUnsignedStarknetTransactionArgs) => Promise<StarknetSignTx>;
682
+ getUnsignedTonTransaction?: (input: GetUnsignedTonTransactionArgs) => Promise<ton.TonSignTx>;
576
683
  getEvmTransactionFees?: (input: GetUnsignedEvmTransactionArgs) => Promise<string>;
577
684
  getSolanaTransactionFees?: (input: GetUnsignedSolanaTransactionArgs) => Promise<string>;
578
685
  getSuiTransactionFees?: (input: GetUnsignedSuiTransactionArgs) => Promise<string>;
@@ -581,6 +688,7 @@ export type SwapperApi = {
581
688
  getTronTransactionFees?: (input: GetUnsignedTronTransactionArgs) => Promise<string>;
582
689
  getNearTransactionFees?: (input: GetUnsignedNearTransactionArgs) => Promise<string>;
583
690
  getStarknetTransactionFees?: (input: GetUnsignedStarknetTransactionArgs) => Promise<string>;
691
+ getTonTransactionFees?: (input: GetUnsignedTonTransactionArgs) => Promise<string>;
584
692
  };
585
693
  export type QuoteResult = Result<TradeQuote[], SwapErrorRight> & {
586
694
  swapperName: SwapperName;
@@ -603,10 +711,12 @@ export type EvmMessageExecutionInput = CommonTradeExecutionInput & EvmMessageExe
603
711
  export type UtxoTransactionExecutionInput = CommonTradeExecutionInput & UtxoTransactionExecutionProps & UtxoAccountMetadata;
604
712
  export type CosmosSdkTransactionExecutionInput = CommonTradeExecutionInput & CosmosSdkTransactionExecutionProps & CosmosSdkAccountMetadata;
605
713
  export type SolanaTransactionExecutionInput = CommonTradeExecutionInput & SolanaTransactionExecutionProps & SolanaAccountMetadata;
714
+ export type SolanaMessageExecutionInput = CommonTradeExecutionInput & SolanaMessageExecutionProps;
606
715
  export type TronTransactionExecutionInput = CommonTradeExecutionInput & TronTransactionExecutionProps & TronAccountMetadata;
607
716
  export type SuiTransactionExecutionInput = CommonTradeExecutionInput & SuiTransactionExecutionProps & SuiAccountMetadata;
608
717
  export type NearTransactionExecutionInput = CommonTradeExecutionInput & NearTransactionExecutionProps & NearAccountMetadata;
609
718
  export type StarknetTransactionExecutionInput = CommonTradeExecutionInput & StarknetTransactionExecutionProps & StarknetAccountMetadata;
719
+ export type TonTransactionExecutionInput = CommonTradeExecutionInput & TonTransactionExecutionProps & TonAccountMetadata;
610
720
  export declare enum TradeExecutionEvent {
611
721
  SellTxHash = "sellTxHash",
612
722
  RelayerTxHash = "relayerTxHash",
package/dist/esm/types.js CHANGED
@@ -16,6 +16,9 @@ export var SwapperName;
16
16
  SwapperName["Cetus"] = "Cetus";
17
17
  SwapperName["Sunio"] = "Sun.io";
18
18
  SwapperName["Avnu"] = "AVNU";
19
+ SwapperName["Stonfi"] = "STON.fi";
20
+ SwapperName["Across"] = "Across";
21
+ SwapperName["Debridge"] = "deBridge";
19
22
  })(SwapperName || (SwapperName = {}));
20
23
  export var TradeQuoteError;
21
24
  (function (TradeQuoteError) {
@@ -1,12 +1,12 @@
1
1
  import type { AssetId, ChainId } from '@shapeshiftoss/caip';
2
- import type { EvmChainAdapter, near, SignTx, solana, starknet, sui } from '@shapeshiftoss/chain-adapters';
2
+ import type { EvmChainAdapter, near, SignTx, solana, starknet, sui, ton } from '@shapeshiftoss/chain-adapters';
3
+ import type { TronSignTx } from '@shapeshiftoss/chain-adapters/src/tron/types';
3
4
  import type { SolanaSignTx, StarknetSignTx, SuiSignTx } from '@shapeshiftoss/hdwallet-core';
4
5
  import type { Asset, EvmChainId } from '@shapeshiftoss/types';
5
6
  import { TxStatus } from '@shapeshiftoss/unchained-client';
6
7
  import type { Result } from '@sniptt/monads';
7
8
  import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
8
- import type { TronSignTx } from '@shapeshiftoss/chain-adapters/src/tron/types';
9
- import type { EvmTransactionExecutionProps, ExecutableTradeStep, NearTransactionExecutionProps, SolanaTransactionExecutionProps, StarknetTransactionExecutionProps, SuiTransactionExecutionProps, SupportedTradeQuoteStepIndex, SwapErrorRight, TradeQuote, TradeQuoteStep, TradeRate, TradeStatus, TronTransactionExecutionProps } from './types.js';
9
+ import type { EvmTransactionExecutionProps, ExecutableTradeStep, NearTransactionExecutionProps, SolanaTransactionExecutionProps, StarknetTransactionExecutionProps, SuiTransactionExecutionProps, SupportedTradeQuoteStepIndex, SwapErrorRight, TonTransactionExecutionProps, TradeQuote, TradeQuoteStep, TradeRate, TradeStatus, TronTransactionExecutionProps } from './types.js';
10
10
  import { TradeQuoteError } from './types.js';
11
11
  export declare const makeSwapErrorRight: ({ details, cause, code, message, }: {
12
12
  message: string;
@@ -32,6 +32,7 @@ export declare const executeTronTransaction: (txToSign: TronSignTx, callbacks: T
32
32
  export declare const executeSuiTransaction: (txToSign: SuiSignTx, callbacks: SuiTransactionExecutionProps) => Promise<string>;
33
33
  export declare const executeNearTransaction: (txToSign: near.NearSignTx, callbacks: NearTransactionExecutionProps) => Promise<string>;
34
34
  export declare const executeStarknetTransaction: (txToSign: StarknetSignTx, callbacks: StarknetTransactionExecutionProps) => Promise<string>;
35
+ export declare const executeTonTransaction: (txToSign: ton.TonSignTx, callbacks: TonTransactionExecutionProps) => Promise<string>;
35
36
  export declare const createDefaultStatusResponse: (buyTxHash?: string) => {
36
37
  status: TxStatus;
37
38
  buyTxHash: string | undefined;
package/dist/esm/utils.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { solanaChainId, starknetChainId, suiChainId } from '@shapeshiftoss/caip';
2
+ import { isSecondClassEvmAdapter } from '@shapeshiftoss/chain-adapters';
2
3
  import { evm, TxStatus } from '@shapeshiftoss/unchained-client';
3
- import { bn, fromBaseUnit } from '@shapeshiftoss/utils';
4
+ import { BigAmount, bn } from '@shapeshiftoss/utils';
4
5
  import { Err, Ok } from '@sniptt/monads';
5
6
  import Axios from 'axios';
6
7
  import { setupCache } from 'axios-cache-interceptor';
@@ -95,6 +96,9 @@ export const executeNearTransaction = (txToSign, callbacks) => {
95
96
  export const executeStarknetTransaction = (txToSign, callbacks) => {
96
97
  return callbacks.signAndBroadcastTransaction(txToSign);
97
98
  };
99
+ export const executeTonTransaction = (txToSign, callbacks) => {
100
+ return callbacks.signAndBroadcastTransaction(txToSign);
101
+ };
98
102
  export const createDefaultStatusResponse = (buyTxHash) => ({
99
103
  status: TxStatus.Unknown,
100
104
  buyTxHash,
@@ -126,7 +130,9 @@ export const checkSafeTransactionStatus = async ({ address, txHash, chainId, ass
126
130
  // Transaction executed on-chain
127
131
  if (isExecutedSafeTx) {
128
132
  const adapter = assertGetEvmChainAdapter(chainId);
129
- const tx = await adapter.httpProvider.getTransaction({ txid: transaction.transactionHash });
133
+ const tx = await adapter.httpProvider.getTransaction({
134
+ txid: transaction.transactionHash,
135
+ });
130
136
  const status = evm.getTxStatus(tx);
131
137
  return {
132
138
  status,
@@ -137,6 +143,15 @@ export const checkSafeTransactionStatus = async ({ address, txHash, chainId, ass
137
143
  };
138
144
  export const checkEvmSwapStatus = async ({ txHash, chainId, address, assertGetEvmChainAdapter, fetchIsSmartContractAddressQuery, }) => {
139
145
  try {
146
+ const adapter = assertGetEvmChainAdapter(chainId);
147
+ if (isSecondClassEvmAdapter(adapter)) {
148
+ const status = await adapter.getTransactionStatus(txHash);
149
+ return {
150
+ status,
151
+ buyTxHash: txHash,
152
+ message: undefined,
153
+ };
154
+ }
140
155
  const maybeSafeTransactionStatus = await checkSafeTransactionStatus({
141
156
  address,
142
157
  txHash,
@@ -146,7 +161,6 @@ export const checkEvmSwapStatus = async ({ txHash, chainId, address, assertGetEv
146
161
  });
147
162
  if (maybeSafeTransactionStatus)
148
163
  return maybeSafeTransactionStatus;
149
- const adapter = assertGetEvmChainAdapter(chainId);
150
164
  const tx = await adapter.httpProvider.getTransaction({ txid: txHash });
151
165
  const status = evm.getTxStatus(tx);
152
166
  return {
@@ -161,8 +175,14 @@ export const checkEvmSwapStatus = async ({ txHash, chainId, address, assertGetEv
161
175
  }
162
176
  };
163
177
  export const getInputOutputRate = ({ sellAmountCryptoBaseUnit, buyAmountCryptoBaseUnit, sellAsset, buyAsset, }) => {
164
- const sellAmountCryptoHuman = fromBaseUnit(sellAmountCryptoBaseUnit, sellAsset.precision);
165
- const buyAmountCryptoHuman = fromBaseUnit(buyAmountCryptoBaseUnit, buyAsset.precision);
178
+ const sellAmountCryptoHuman = BigAmount.fromBaseUnit({
179
+ value: sellAmountCryptoBaseUnit,
180
+ precision: sellAsset.precision,
181
+ }).toPrecision();
182
+ const buyAmountCryptoHuman = BigAmount.fromBaseUnit({
183
+ value: buyAmountCryptoBaseUnit,
184
+ precision: buyAsset.precision,
185
+ }).toPrecision();
166
186
  return bn(buyAmountCryptoHuman).div(sellAmountCryptoHuman).toFixed();
167
187
  };
168
188
  export const isExecutableTradeQuote = (quote) => quote.quoteOrRate === 'quote';
@@ -243,7 +263,14 @@ export const checkStarknetSwapStatus = async ({ txHash, assertGetStarknetChainAd
243
263
  try {
244
264
  const adapter = assertGetStarknetChainAdapter(starknetChainId);
245
265
  const provider = adapter.getStarknetProvider();
246
- const receipt = await provider.getTransactionReceipt(txHash);
266
+ // Use raw RPC call for better compatibility with various RPC providers
267
+ const response = await provider.fetch('starknet_getTransactionReceipt', [txHash]);
268
+ const result = await response.json();
269
+ // If there's an error or no result, transaction might still be pending
270
+ if (result.error || !result.result) {
271
+ return createDefaultStatusResponse(txHash);
272
+ }
273
+ const receipt = result.result;
247
274
  const status = receipt.execution_status === 'SUCCEEDED'
248
275
  ? TxStatus.Confirmed
249
276
  : receipt.execution_status === 'REVERTED'
@@ -256,7 +283,7 @@ export const checkStarknetSwapStatus = async ({ txHash, assertGetStarknetChainAd
256
283
  };
257
284
  }
258
285
  catch (e) {
259
- console.error(e);
286
+ // Don't log expected errors during status polling (tx might still be pending)
260
287
  return createDefaultStatusResponse(txHash);
261
288
  }
262
289
  };
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshiftoss/swapper",
3
- "version": "17.6.9",
4
- "packageManager": "yarn@3.5.0",
3
+ "version": "17.6.11",
5
4
  "repository": "https://github.com/shapeshift/web",
6
5
  "license": "MIT",
7
6
  "type": "module",
@@ -10,9 +9,9 @@
10
9
  "types": "dist/esm/index.d.ts",
11
10
  "exports": {
12
11
  ".": {
12
+ "types": "./dist/esm/index.d.ts",
13
13
  "import": "./dist/esm/index.js",
14
- "require": "./dist/cjs/index.js",
15
- "types": "./dist/esm/index.d.ts"
14
+ "require": "./dist/cjs/index.js"
16
15
  }
17
16
  },
18
17
  "files": [
@@ -21,47 +20,43 @@
21
20
  "publishConfig": {
22
21
  "access": "public"
23
22
  },
24
- "scripts": {
25
- "build": "yarn clean && yarn run -T tsc --build && yarn postbuild",
26
- "clean": "rm -rf dist",
27
- "dev": "yarn run -T tsc --build --watch",
28
- "postbuild": "yarn postbuild:esm && yarn postbuild:cjs",
29
- "postbuild:esm": "yarn run -T tsc-esm-fix --target=dist/esm --ext=.js",
30
- "postbuild:cjs": "echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json"
31
- },
32
23
  "dependencies": {
33
24
  "@arbitrum/sdk": "^4.0.1",
34
25
  "@avnu/avnu-sdk": "^4.0.1",
26
+ "@cetusprotocol/aggregator-sdk": "^1.4.2",
27
+ "@cetusprotocol/cetus-sui-clmm-sdk": "5.4.0",
35
28
  "@coral-xyz/anchor": "0.29.0",
36
29
  "@cowprotocol/app-data": "^2.3.0",
37
30
  "@defuse-protocol/one-click-sdk-typescript": "^0.1.1-0.2",
38
31
  "@jup-ag/api": "^6.0.30",
32
+ "@mysten/sui": "^1.45.2",
39
33
  "@shapeshiftoss/bitcoinjs-lib": "7.0.0-shapeshift.0",
40
- "@shapeshiftoss/caip": "^8.16.5",
41
- "@shapeshiftoss/chain-adapters": "^11.3.6",
42
- "@shapeshiftoss/contracts": "^1.0.4",
43
- "@shapeshiftoss/hdwallet-core": "1.62.39",
44
- "@shapeshiftoss/types": "^8.6.5",
45
- "@shapeshiftoss/unchained-client": "^10.14.8",
46
- "@shapeshiftoss/utils": "^1.0.4",
47
34
  "@sniptt/monads": "^0.5.10",
48
- "@solana/web3.js": "^1.98.0",
35
+ "@solana/web3.js": "1.98.0",
36
+ "@ston-fi/omniston-sdk": "^0.7.8",
49
37
  "@uniswap/sdk-core": "^5.3.1",
50
38
  "@uniswap/v3-sdk": "^3.13.1",
51
- "axios": "^1.13.0",
39
+ "axios": "^1.13.5",
52
40
  "axios-cache-interceptor": "^1.11.1",
53
41
  "bignumber.js": "^9.3.1",
54
42
  "eip-712": "^1.0.0",
55
43
  "ethers": "6.11.1",
56
44
  "ethers5": "npm:ethers@5.7.2",
57
- "lodash": "^4.17.21",
45
+ "lodash": "^4.17.23",
58
46
  "mixpanel-browser": "^2.67.0",
59
47
  "node-polyglot": "^2.4.0",
60
48
  "pretty-ms": "7.0.1",
61
- "qs": "^6.14.1",
49
+ "qs": "^6.14.2",
62
50
  "retry-axios": "^2.6.0",
63
51
  "uuid": "^9.0.0",
64
- "viem": "^2.40.3"
52
+ "viem": "2.43.5",
53
+ "@shapeshiftoss/caip": "^8.16.7",
54
+ "@shapeshiftoss/contracts": "^1.0.5-coderabbit-fix.2",
55
+ "@shapeshiftoss/hdwallet-core": "^1.62.41",
56
+ "@shapeshiftoss/types": "^8.6.7",
57
+ "@shapeshiftoss/chain-adapters": "^11.3.9",
58
+ "@shapeshiftoss/unchained-client": "^10.14.10",
59
+ "@shapeshiftoss/utils": "^1.0.5"
65
60
  },
66
61
  "devDependencies": {
67
62
  "@types/lodash": "^4.14.178",
@@ -69,5 +64,13 @@
69
64
  "@types/node-polyglot": "^2.4.2",
70
65
  "@types/qs": "^6.9.18",
71
66
  "@types/uuid": "^9.0.5"
67
+ },
68
+ "scripts": {
69
+ "build": "rm -rf dist && pnpm exec tsc --build && pnpm run postbuild",
70
+ "clean": "rm -rf dist node_modules",
71
+ "dev": "pnpm exec tsc --build --watch",
72
+ "postbuild": "pnpm run postbuild:esm && pnpm run postbuild:cjs",
73
+ "postbuild:esm": "pnpm exec tsc-esm-fix --target=dist/esm --ext=.js",
74
+ "postbuild:cjs": "echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json"
72
75
  }
73
76
  }