@7kprotocol/sdk-ts 3.6.0 → 3.6.1-beta.1

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 (342) hide show
  1. package/README.md +1 -11
  2. package/lib/cjs/config/fetchClient.js +1 -9
  3. package/lib/cjs/constants/_7k.js +13 -10
  4. package/lib/cjs/constants/apiEndpoints.js +1 -1
  5. package/lib/cjs/features/metaAg/common.js +2 -2
  6. package/lib/cjs/features/metaAg/error.js +0 -4
  7. package/lib/cjs/features/metaAg/index.js +3 -8
  8. package/lib/cjs/features/prices/index.js +51 -20
  9. package/lib/cjs/index.js +1 -35
  10. package/lib/cjs/types/config/fetchClient.d.ts.map +1 -1
  11. package/lib/cjs/types/constants/_7k.d.ts +0 -3
  12. package/lib/cjs/types/constants/_7k.d.ts.map +1 -1
  13. package/lib/cjs/types/features/metaAg/common.d.ts +1 -1
  14. package/lib/cjs/types/features/metaAg/error.d.ts +1 -7
  15. package/lib/cjs/types/features/metaAg/error.d.ts.map +1 -1
  16. package/lib/cjs/types/features/metaAg/index.d.ts +1 -1
  17. package/lib/cjs/types/features/metaAg/index.d.ts.map +1 -1
  18. package/lib/cjs/types/features/prices/index.d.ts +16 -2
  19. package/lib/cjs/types/features/prices/index.d.ts.map +1 -1
  20. package/lib/cjs/types/index.d.ts +1 -32
  21. package/lib/cjs/types/index.d.ts.map +1 -1
  22. package/lib/cjs/types/metaAg.js +1 -3
  23. package/lib/cjs/types/types/metaAg.d.ts +2 -14
  24. package/lib/cjs/types/types/metaAg.d.ts.map +1 -1
  25. package/lib/cjs/types/utils/sui.d.ts +0 -31
  26. package/lib/cjs/types/utils/sui.d.ts.map +1 -1
  27. package/lib/cjs/types/utils/swap.d.ts +15 -0
  28. package/lib/cjs/types/utils/swap.d.ts.map +1 -0
  29. package/lib/cjs/utils/sui.js +15 -154
  30. package/lib/cjs/utils/swap.js +37 -0
  31. package/lib/esm/config/fetchClient.js +1 -9
  32. package/lib/esm/constants/_7k.js +12 -9
  33. package/lib/esm/constants/apiEndpoints.js +1 -1
  34. package/lib/esm/features/metaAg/common.js +1 -1
  35. package/lib/esm/features/metaAg/error.js +0 -4
  36. package/lib/esm/features/metaAg/index.js +2 -7
  37. package/lib/esm/features/prices/index.js +52 -21
  38. package/lib/esm/index.mjs +3 -31
  39. package/lib/esm/types/config/fetchClient.d.ts.map +1 -1
  40. package/lib/esm/types/constants/_7k.d.ts +0 -3
  41. package/lib/esm/types/constants/_7k.d.ts.map +1 -1
  42. package/lib/esm/types/features/metaAg/common.d.ts +1 -1
  43. package/lib/esm/types/features/metaAg/error.d.ts +1 -7
  44. package/lib/esm/types/features/metaAg/error.d.ts.map +1 -1
  45. package/lib/esm/types/features/metaAg/index.d.ts +1 -1
  46. package/lib/esm/types/features/metaAg/index.d.ts.map +1 -1
  47. package/lib/esm/types/features/prices/index.d.ts +16 -2
  48. package/lib/esm/types/features/prices/index.d.ts.map +1 -1
  49. package/lib/esm/types/index.d.ts +1 -32
  50. package/lib/esm/types/index.d.ts.map +1 -1
  51. package/lib/esm/types/metaAg.js +1 -3
  52. package/lib/esm/types/types/metaAg.d.ts +2 -14
  53. package/lib/esm/types/types/metaAg.d.ts.map +1 -1
  54. package/lib/esm/types/utils/sui.d.ts +0 -31
  55. package/lib/esm/types/utils/sui.d.ts.map +1 -1
  56. package/lib/esm/types/utils/swap.d.ts +15 -0
  57. package/lib/esm/types/utils/swap.d.ts.map +1 -0
  58. package/lib/esm/utils/sui.js +17 -156
  59. package/lib/esm/utils/swap.js +33 -0
  60. package/package.json +1 -1
  61. package/lib/cjs/config/index.js +0 -67
  62. package/lib/cjs/features/metaAg/providers/bluefin7kLegacy.js +0 -68
  63. package/lib/cjs/features/swap/buildTx.js +0 -198
  64. package/lib/cjs/features/swap/buildTxV2.js +0 -229
  65. package/lib/cjs/features/swap/config.js +0 -154
  66. package/lib/cjs/features/swap/estimateGasFee.js +0 -44
  67. package/lib/cjs/features/swap/executeTx.js +0 -52
  68. package/lib/cjs/features/swap/getQuote.js +0 -95
  69. package/lib/cjs/features/swap/getSwapHistory.js +0 -21
  70. package/lib/cjs/features/swap/index.js +0 -22
  71. package/lib/cjs/libs/groupSwapRoutes.js +0 -60
  72. package/lib/cjs/libs/protocols/aftermath/index.js +0 -35
  73. package/lib/cjs/libs/protocols/base.js +0 -41
  74. package/lib/cjs/libs/protocols/bluefin/index.js +0 -38
  75. package/lib/cjs/libs/protocols/bluefinx/client.js +0 -41
  76. package/lib/cjs/libs/protocols/bluefinx/index.js +0 -48
  77. package/lib/cjs/libs/protocols/bluefinx/types.js +0 -10
  78. package/lib/cjs/libs/protocols/bluemove/index.js +0 -24
  79. package/lib/cjs/libs/protocols/cetus/index.js +0 -44
  80. package/lib/cjs/libs/protocols/cetus_dlmm.js +0 -48
  81. package/lib/cjs/libs/protocols/constants.js +0 -5
  82. package/lib/cjs/libs/protocols/deepbookV3/sponsored.js +0 -30
  83. package/lib/cjs/libs/protocols/ferra_clmm.js +0 -44
  84. package/lib/cjs/libs/protocols/ferra_dlmm.js +0 -30
  85. package/lib/cjs/libs/protocols/flowx/index.js +0 -18
  86. package/lib/cjs/libs/protocols/flowxV3/index.js +0 -36
  87. package/lib/cjs/libs/protocols/fullsail/index.js +0 -39
  88. package/lib/cjs/libs/protocols/haedal_pmm/index.js +0 -31
  89. package/lib/cjs/libs/protocols/index.js +0 -55
  90. package/lib/cjs/libs/protocols/kriya/index.js +0 -30
  91. package/lib/cjs/libs/protocols/kriyaV3/index.js +0 -65
  92. package/lib/cjs/libs/protocols/magma/index.js +0 -40
  93. package/lib/cjs/libs/protocols/momentum/index.js +0 -49
  94. package/lib/cjs/libs/protocols/obric/index.js +0 -28
  95. package/lib/cjs/libs/protocols/sevenk/index.js +0 -55
  96. package/lib/cjs/libs/protocols/springsui/index.js +0 -24
  97. package/lib/cjs/libs/protocols/steamm/index.js +0 -160
  98. package/lib/cjs/libs/protocols/stsui/index.js +0 -24
  99. package/lib/cjs/libs/protocols/suiswap/index.js +0 -34
  100. package/lib/cjs/libs/protocols/turbos/index.js +0 -36
  101. package/lib/cjs/libs/protocols/utils.js +0 -7
  102. package/lib/cjs/libs/swapWithRoute.js +0 -22
  103. package/lib/cjs/types/aggregator.js +0 -19
  104. package/lib/cjs/types/config/index.d.ts +0 -30
  105. package/lib/cjs/types/config/index.d.ts.map +0 -1
  106. package/lib/cjs/types/features/metaAg/providers/bluefin7kLegacy.d.ts +0 -11
  107. package/lib/cjs/types/features/metaAg/providers/bluefin7kLegacy.d.ts.map +0 -1
  108. package/lib/cjs/types/features/swap/buildTx.d.ts +0 -17
  109. package/lib/cjs/types/features/swap/buildTx.d.ts.map +0 -1
  110. package/lib/cjs/types/features/swap/buildTxV2.d.ts +0 -20
  111. package/lib/cjs/types/features/swap/buildTxV2.d.ts.map +0 -1
  112. package/lib/cjs/types/features/swap/config.d.ts +0 -4
  113. package/lib/cjs/types/features/swap/config.d.ts.map +0 -1
  114. package/lib/cjs/types/features/swap/estimateGasFee.d.ts +0 -3
  115. package/lib/cjs/types/features/swap/estimateGasFee.d.ts.map +0 -1
  116. package/lib/cjs/types/features/swap/executeTx.d.ts +0 -24
  117. package/lib/cjs/types/features/swap/executeTx.d.ts.map +0 -1
  118. package/lib/cjs/types/features/swap/getQuote.d.ts +0 -27
  119. package/lib/cjs/types/features/swap/getQuote.d.ts.map +0 -1
  120. package/lib/cjs/types/features/swap/getSwapHistory.d.ts +0 -22
  121. package/lib/cjs/types/features/swap/getSwapHistory.d.ts.map +0 -1
  122. package/lib/cjs/types/features/swap/index.d.ts +0 -7
  123. package/lib/cjs/types/features/swap/index.d.ts.map +0 -1
  124. package/lib/cjs/types/libs/groupSwapRoutes.d.ts +0 -3
  125. package/lib/cjs/types/libs/groupSwapRoutes.d.ts.map +0 -1
  126. package/lib/cjs/types/libs/protocols/aftermath/index.d.ts +0 -9
  127. package/lib/cjs/types/libs/protocols/aftermath/index.d.ts.map +0 -1
  128. package/lib/cjs/types/libs/protocols/base.d.ts +0 -24
  129. package/lib/cjs/types/libs/protocols/base.d.ts.map +0 -1
  130. package/lib/cjs/types/libs/protocols/bluefin/index.d.ts +0 -9
  131. package/lib/cjs/types/libs/protocols/bluefin/index.d.ts.map +0 -1
  132. package/lib/cjs/types/libs/protocols/bluefinx/client.d.ts +0 -13
  133. package/lib/cjs/types/libs/protocols/bluefinx/client.d.ts.map +0 -1
  134. package/lib/cjs/types/libs/protocols/bluefinx/index.d.ts +0 -17
  135. package/lib/cjs/types/libs/protocols/bluefinx/index.d.ts.map +0 -1
  136. package/lib/cjs/types/libs/protocols/bluefinx/types.d.ts +0 -34
  137. package/lib/cjs/types/libs/protocols/bluefinx/types.d.ts.map +0 -1
  138. package/lib/cjs/types/libs/protocols/bluemove/index.d.ts +0 -9
  139. package/lib/cjs/types/libs/protocols/bluemove/index.d.ts.map +0 -1
  140. package/lib/cjs/types/libs/protocols/cetus/index.d.ts +0 -9
  141. package/lib/cjs/types/libs/protocols/cetus/index.d.ts.map +0 -1
  142. package/lib/cjs/types/libs/protocols/cetus_dlmm.d.ts +0 -9
  143. package/lib/cjs/types/libs/protocols/cetus_dlmm.d.ts.map +0 -1
  144. package/lib/cjs/types/libs/protocols/constants.d.ts +0 -3
  145. package/lib/cjs/types/libs/protocols/constants.d.ts.map +0 -1
  146. package/lib/cjs/types/libs/protocols/deepbookV3/sponsored.d.ts +0 -7
  147. package/lib/cjs/types/libs/protocols/deepbookV3/sponsored.d.ts.map +0 -1
  148. package/lib/cjs/types/libs/protocols/ferra_clmm.d.ts +0 -9
  149. package/lib/cjs/types/libs/protocols/ferra_clmm.d.ts.map +0 -1
  150. package/lib/cjs/types/libs/protocols/ferra_dlmm.d.ts +0 -9
  151. package/lib/cjs/types/libs/protocols/ferra_dlmm.d.ts.map +0 -1
  152. package/lib/cjs/types/libs/protocols/flowx/index.d.ts +0 -9
  153. package/lib/cjs/types/libs/protocols/flowx/index.d.ts.map +0 -1
  154. package/lib/cjs/types/libs/protocols/flowxV3/index.d.ts +0 -9
  155. package/lib/cjs/types/libs/protocols/flowxV3/index.d.ts.map +0 -1
  156. package/lib/cjs/types/libs/protocols/fullsail/index.d.ts +0 -9
  157. package/lib/cjs/types/libs/protocols/fullsail/index.d.ts.map +0 -1
  158. package/lib/cjs/types/libs/protocols/haedal_pmm/index.d.ts +0 -14
  159. package/lib/cjs/types/libs/protocols/haedal_pmm/index.d.ts.map +0 -1
  160. package/lib/cjs/types/libs/protocols/index.d.ts +0 -53
  161. package/lib/cjs/types/libs/protocols/index.d.ts.map +0 -1
  162. package/lib/cjs/types/libs/protocols/kriya/index.d.ts +0 -9
  163. package/lib/cjs/types/libs/protocols/kriya/index.d.ts.map +0 -1
  164. package/lib/cjs/types/libs/protocols/kriyaV3/index.d.ts +0 -9
  165. package/lib/cjs/types/libs/protocols/kriyaV3/index.d.ts.map +0 -1
  166. package/lib/cjs/types/libs/protocols/magma/index.d.ts +0 -9
  167. package/lib/cjs/types/libs/protocols/magma/index.d.ts.map +0 -1
  168. package/lib/cjs/types/libs/protocols/momentum/index.d.ts +0 -9
  169. package/lib/cjs/types/libs/protocols/momentum/index.d.ts.map +0 -1
  170. package/lib/cjs/types/libs/protocols/obric/index.d.ts +0 -14
  171. package/lib/cjs/types/libs/protocols/obric/index.d.ts.map +0 -1
  172. package/lib/cjs/types/libs/protocols/sevenk/index.d.ts +0 -18
  173. package/lib/cjs/types/libs/protocols/sevenk/index.d.ts.map +0 -1
  174. package/lib/cjs/types/libs/protocols/springsui/index.d.ts +0 -9
  175. package/lib/cjs/types/libs/protocols/springsui/index.d.ts.map +0 -1
  176. package/lib/cjs/types/libs/protocols/steamm/index.d.ts +0 -28
  177. package/lib/cjs/types/libs/protocols/steamm/index.d.ts.map +0 -1
  178. package/lib/cjs/types/libs/protocols/stsui/index.d.ts +0 -9
  179. package/lib/cjs/types/libs/protocols/stsui/index.d.ts.map +0 -1
  180. package/lib/cjs/types/libs/protocols/suiswap/index.d.ts +0 -9
  181. package/lib/cjs/types/libs/protocols/suiswap/index.d.ts.map +0 -1
  182. package/lib/cjs/types/libs/protocols/turbos/index.d.ts +0 -9
  183. package/lib/cjs/types/libs/protocols/turbos/index.d.ts.map +0 -1
  184. package/lib/cjs/types/libs/protocols/utils.d.ts +0 -2
  185. package/lib/cjs/types/libs/protocols/utils.d.ts.map +0 -1
  186. package/lib/cjs/types/libs/swapWithRoute.d.ts +0 -12
  187. package/lib/cjs/types/libs/swapWithRoute.d.ts.map +0 -1
  188. package/lib/cjs/types/sui.js +0 -2
  189. package/lib/cjs/types/tx.js +0 -2
  190. package/lib/cjs/types/types/aggregator.d.ts +0 -173
  191. package/lib/cjs/types/types/aggregator.d.ts.map +0 -1
  192. package/lib/cjs/types/types/sui.d.ts +0 -4
  193. package/lib/cjs/types/types/sui.d.ts.map +0 -1
  194. package/lib/cjs/types/types/tx.d.ts +0 -67
  195. package/lib/cjs/types/types/tx.d.ts.map +0 -1
  196. package/lib/cjs/types/types/utilities.d.ts +0 -5
  197. package/lib/cjs/types/types/utilities.d.ts.map +0 -1
  198. package/lib/cjs/types/utilities.js +0 -2
  199. package/lib/cjs/types/utils/number.d.ts +0 -2
  200. package/lib/cjs/types/utils/number.d.ts.map +0 -1
  201. package/lib/cjs/utils/number.js +0 -9
  202. package/lib/esm/config/index.js +0 -64
  203. package/lib/esm/features/metaAg/providers/bluefin7kLegacy.js +0 -66
  204. package/lib/esm/features/swap/buildTx.js +0 -188
  205. package/lib/esm/features/swap/buildTxV2.js +0 -223
  206. package/lib/esm/features/swap/config.js +0 -150
  207. package/lib/esm/features/swap/estimateGasFee.js +0 -41
  208. package/lib/esm/features/swap/executeTx.js +0 -48
  209. package/lib/esm/features/swap/getQuote.js +0 -91
  210. package/lib/esm/features/swap/getSwapHistory.js +0 -18
  211. package/lib/esm/features/swap/index.js +0 -6
  212. package/lib/esm/libs/groupSwapRoutes.js +0 -57
  213. package/lib/esm/libs/protocols/aftermath/index.js +0 -31
  214. package/lib/esm/libs/protocols/base.js +0 -42
  215. package/lib/esm/libs/protocols/bluefin/index.js +0 -34
  216. package/lib/esm/libs/protocols/bluefinx/client.js +0 -36
  217. package/lib/esm/libs/protocols/bluefinx/index.js +0 -44
  218. package/lib/esm/libs/protocols/bluefinx/types.js +0 -8
  219. package/lib/esm/libs/protocols/bluemove/index.js +0 -20
  220. package/lib/esm/libs/protocols/cetus/index.js +0 -40
  221. package/lib/esm/libs/protocols/cetus_dlmm.js +0 -44
  222. package/lib/esm/libs/protocols/constants.js +0 -2
  223. package/lib/esm/libs/protocols/deepbookV3/sponsored.js +0 -26
  224. package/lib/esm/libs/protocols/ferra_clmm.js +0 -40
  225. package/lib/esm/libs/protocols/ferra_dlmm.js +0 -26
  226. package/lib/esm/libs/protocols/flowx/index.js +0 -14
  227. package/lib/esm/libs/protocols/flowxV3/index.js +0 -32
  228. package/lib/esm/libs/protocols/fullsail/index.js +0 -35
  229. package/lib/esm/libs/protocols/haedal_pmm/index.js +0 -27
  230. package/lib/esm/libs/protocols/index.js +0 -52
  231. package/lib/esm/libs/protocols/kriya/index.js +0 -26
  232. package/lib/esm/libs/protocols/kriyaV3/index.js +0 -61
  233. package/lib/esm/libs/protocols/magma/index.js +0 -36
  234. package/lib/esm/libs/protocols/momentum/index.js +0 -45
  235. package/lib/esm/libs/protocols/obric/index.js +0 -24
  236. package/lib/esm/libs/protocols/sevenk/index.js +0 -51
  237. package/lib/esm/libs/protocols/springsui/index.js +0 -20
  238. package/lib/esm/libs/protocols/steamm/index.js +0 -156
  239. package/lib/esm/libs/protocols/stsui/index.js +0 -20
  240. package/lib/esm/libs/protocols/suiswap/index.js +0 -30
  241. package/lib/esm/libs/protocols/turbos/index.js +0 -32
  242. package/lib/esm/libs/protocols/utils.js +0 -4
  243. package/lib/esm/libs/swapWithRoute.js +0 -19
  244. package/lib/esm/types/aggregator.js +0 -14
  245. package/lib/esm/types/config/index.d.ts +0 -30
  246. package/lib/esm/types/config/index.d.ts.map +0 -1
  247. package/lib/esm/types/features/metaAg/providers/bluefin7kLegacy.d.ts +0 -11
  248. package/lib/esm/types/features/metaAg/providers/bluefin7kLegacy.d.ts.map +0 -1
  249. package/lib/esm/types/features/swap/buildTx.d.ts +0 -17
  250. package/lib/esm/types/features/swap/buildTx.d.ts.map +0 -1
  251. package/lib/esm/types/features/swap/buildTxV2.d.ts +0 -20
  252. package/lib/esm/types/features/swap/buildTxV2.d.ts.map +0 -1
  253. package/lib/esm/types/features/swap/config.d.ts +0 -4
  254. package/lib/esm/types/features/swap/config.d.ts.map +0 -1
  255. package/lib/esm/types/features/swap/estimateGasFee.d.ts +0 -3
  256. package/lib/esm/types/features/swap/estimateGasFee.d.ts.map +0 -1
  257. package/lib/esm/types/features/swap/executeTx.d.ts +0 -24
  258. package/lib/esm/types/features/swap/executeTx.d.ts.map +0 -1
  259. package/lib/esm/types/features/swap/getQuote.d.ts +0 -27
  260. package/lib/esm/types/features/swap/getQuote.d.ts.map +0 -1
  261. package/lib/esm/types/features/swap/getSwapHistory.d.ts +0 -22
  262. package/lib/esm/types/features/swap/getSwapHistory.d.ts.map +0 -1
  263. package/lib/esm/types/features/swap/index.d.ts +0 -7
  264. package/lib/esm/types/features/swap/index.d.ts.map +0 -1
  265. package/lib/esm/types/libs/groupSwapRoutes.d.ts +0 -3
  266. package/lib/esm/types/libs/groupSwapRoutes.d.ts.map +0 -1
  267. package/lib/esm/types/libs/protocols/aftermath/index.d.ts +0 -9
  268. package/lib/esm/types/libs/protocols/aftermath/index.d.ts.map +0 -1
  269. package/lib/esm/types/libs/protocols/base.d.ts +0 -24
  270. package/lib/esm/types/libs/protocols/base.d.ts.map +0 -1
  271. package/lib/esm/types/libs/protocols/bluefin/index.d.ts +0 -9
  272. package/lib/esm/types/libs/protocols/bluefin/index.d.ts.map +0 -1
  273. package/lib/esm/types/libs/protocols/bluefinx/client.d.ts +0 -13
  274. package/lib/esm/types/libs/protocols/bluefinx/client.d.ts.map +0 -1
  275. package/lib/esm/types/libs/protocols/bluefinx/index.d.ts +0 -17
  276. package/lib/esm/types/libs/protocols/bluefinx/index.d.ts.map +0 -1
  277. package/lib/esm/types/libs/protocols/bluefinx/types.d.ts +0 -34
  278. package/lib/esm/types/libs/protocols/bluefinx/types.d.ts.map +0 -1
  279. package/lib/esm/types/libs/protocols/bluemove/index.d.ts +0 -9
  280. package/lib/esm/types/libs/protocols/bluemove/index.d.ts.map +0 -1
  281. package/lib/esm/types/libs/protocols/cetus/index.d.ts +0 -9
  282. package/lib/esm/types/libs/protocols/cetus/index.d.ts.map +0 -1
  283. package/lib/esm/types/libs/protocols/cetus_dlmm.d.ts +0 -9
  284. package/lib/esm/types/libs/protocols/cetus_dlmm.d.ts.map +0 -1
  285. package/lib/esm/types/libs/protocols/constants.d.ts +0 -3
  286. package/lib/esm/types/libs/protocols/constants.d.ts.map +0 -1
  287. package/lib/esm/types/libs/protocols/deepbookV3/sponsored.d.ts +0 -7
  288. package/lib/esm/types/libs/protocols/deepbookV3/sponsored.d.ts.map +0 -1
  289. package/lib/esm/types/libs/protocols/ferra_clmm.d.ts +0 -9
  290. package/lib/esm/types/libs/protocols/ferra_clmm.d.ts.map +0 -1
  291. package/lib/esm/types/libs/protocols/ferra_dlmm.d.ts +0 -9
  292. package/lib/esm/types/libs/protocols/ferra_dlmm.d.ts.map +0 -1
  293. package/lib/esm/types/libs/protocols/flowx/index.d.ts +0 -9
  294. package/lib/esm/types/libs/protocols/flowx/index.d.ts.map +0 -1
  295. package/lib/esm/types/libs/protocols/flowxV3/index.d.ts +0 -9
  296. package/lib/esm/types/libs/protocols/flowxV3/index.d.ts.map +0 -1
  297. package/lib/esm/types/libs/protocols/fullsail/index.d.ts +0 -9
  298. package/lib/esm/types/libs/protocols/fullsail/index.d.ts.map +0 -1
  299. package/lib/esm/types/libs/protocols/haedal_pmm/index.d.ts +0 -14
  300. package/lib/esm/types/libs/protocols/haedal_pmm/index.d.ts.map +0 -1
  301. package/lib/esm/types/libs/protocols/index.d.ts +0 -53
  302. package/lib/esm/types/libs/protocols/index.d.ts.map +0 -1
  303. package/lib/esm/types/libs/protocols/kriya/index.d.ts +0 -9
  304. package/lib/esm/types/libs/protocols/kriya/index.d.ts.map +0 -1
  305. package/lib/esm/types/libs/protocols/kriyaV3/index.d.ts +0 -9
  306. package/lib/esm/types/libs/protocols/kriyaV3/index.d.ts.map +0 -1
  307. package/lib/esm/types/libs/protocols/magma/index.d.ts +0 -9
  308. package/lib/esm/types/libs/protocols/magma/index.d.ts.map +0 -1
  309. package/lib/esm/types/libs/protocols/momentum/index.d.ts +0 -9
  310. package/lib/esm/types/libs/protocols/momentum/index.d.ts.map +0 -1
  311. package/lib/esm/types/libs/protocols/obric/index.d.ts +0 -14
  312. package/lib/esm/types/libs/protocols/obric/index.d.ts.map +0 -1
  313. package/lib/esm/types/libs/protocols/sevenk/index.d.ts +0 -18
  314. package/lib/esm/types/libs/protocols/sevenk/index.d.ts.map +0 -1
  315. package/lib/esm/types/libs/protocols/springsui/index.d.ts +0 -9
  316. package/lib/esm/types/libs/protocols/springsui/index.d.ts.map +0 -1
  317. package/lib/esm/types/libs/protocols/steamm/index.d.ts +0 -28
  318. package/lib/esm/types/libs/protocols/steamm/index.d.ts.map +0 -1
  319. package/lib/esm/types/libs/protocols/stsui/index.d.ts +0 -9
  320. package/lib/esm/types/libs/protocols/stsui/index.d.ts.map +0 -1
  321. package/lib/esm/types/libs/protocols/suiswap/index.d.ts +0 -9
  322. package/lib/esm/types/libs/protocols/suiswap/index.d.ts.map +0 -1
  323. package/lib/esm/types/libs/protocols/turbos/index.d.ts +0 -9
  324. package/lib/esm/types/libs/protocols/turbos/index.d.ts.map +0 -1
  325. package/lib/esm/types/libs/protocols/utils.d.ts +0 -2
  326. package/lib/esm/types/libs/protocols/utils.d.ts.map +0 -1
  327. package/lib/esm/types/libs/swapWithRoute.d.ts +0 -12
  328. package/lib/esm/types/libs/swapWithRoute.d.ts.map +0 -1
  329. package/lib/esm/types/sui.js +0 -1
  330. package/lib/esm/types/tx.js +0 -1
  331. package/lib/esm/types/types/aggregator.d.ts +0 -173
  332. package/lib/esm/types/types/aggregator.d.ts.map +0 -1
  333. package/lib/esm/types/types/sui.d.ts +0 -4
  334. package/lib/esm/types/types/sui.d.ts.map +0 -1
  335. package/lib/esm/types/types/tx.d.ts +0 -67
  336. package/lib/esm/types/types/tx.d.ts.map +0 -1
  337. package/lib/esm/types/types/utilities.d.ts +0 -5
  338. package/lib/esm/types/types/utilities.d.ts.map +0 -1
  339. package/lib/esm/types/utilities.js +0 -1
  340. package/lib/esm/types/utils/number.d.ts +0 -2
  341. package/lib/esm/types/utils/number.d.ts.map +0 -1
  342. package/lib/esm/utils/number.js +0 -6
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SponsoredDeepBookV3Contract = void 0;
4
- const base_1 = require("../base");
5
- const utils_1 = require("@mysten/sui/utils");
6
- const sui_1 = require("../../../utils/sui");
7
- class SponsoredDeepBookV3Contract extends base_1.BaseContract {
8
- async swap(tx) {
9
- const [coinX] = this.swapInfo.pool.allTokens;
10
- const swapXtoY = (0, utils_1.normalizeStructTag)(coinX.address) ===
11
- (0, utils_1.normalizeStructTag)(this.swapInfo.assetIn);
12
- const config = this.config.deepbook_v3;
13
- const [base, quote] = tx.moveCall({
14
- target: `${config.sponsor}::sponsored::${swapXtoY ? "swap_exact_base_for_quote" : "swap_exact_quote_for_base"}`,
15
- typeArguments: this.getTypeParams(),
16
- arguments: [
17
- tx.object(config.sponsorFund),
18
- tx.object(this.swapInfo.poolId),
19
- this.inputCoinObject,
20
- tx.pure.u64(0),
21
- tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
22
- ],
23
- });
24
- const coinIn = swapXtoY ? base : quote;
25
- const coinOut = swapXtoY ? quote : base;
26
- sui_1.SuiUtils.collectDust(tx, this.swapInfo.assetIn, coinIn);
27
- return coinOut;
28
- }
29
- }
30
- exports.SponsoredDeepBookV3Contract = SponsoredDeepBookV3Contract;
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FerraCLMMContract = void 0;
4
- const utils_1 = require("@mysten/sui/utils");
5
- const sui_1 = require("../../utils/sui");
6
- const base_1 = require("./base");
7
- const utils_2 = require("./utils");
8
- class FerraCLMMContract extends base_1.BaseContract {
9
- async swap(tx) {
10
- const sqrtPriceLimit = (0, utils_2.getDefaultSqrtPriceLimit)(this.swapInfo.swapXtoY);
11
- const typeArguments = [this.swapInfo.coinX.type, this.swapInfo.coinY.type];
12
- const [zeroOut] = tx.moveCall({
13
- target: "0x2::coin::zero",
14
- typeArguments: [
15
- this.swapInfo.swapXtoY
16
- ? this.swapInfo.coinY.type
17
- : this.swapInfo.coinX.type,
18
- ],
19
- });
20
- const amountIn = sui_1.SuiUtils.getCoinValue(this.swapInfo.swapXtoY
21
- ? this.swapInfo.coinX.type
22
- : this.swapInfo.coinY.type, this.inputCoinObject, tx);
23
- const config = this.config.ferra_clmm;
24
- const [receiveA, receiveB] = tx.moveCall({
25
- target: `${config.integrate}::router::swap`,
26
- typeArguments,
27
- arguments: [
28
- tx.object(config.globalConfig),
29
- tx.object(this.swapInfo.poolId),
30
- this.swapInfo.swapXtoY ? this.inputCoinObject : zeroOut, // coin A
31
- this.swapInfo.swapXtoY ? zeroOut : this.inputCoinObject, // coin B
32
- tx.pure.bool(this.swapInfo.swapXtoY), // a to b or b to a
33
- tx.pure.bool(true), // exact in or out
34
- amountIn, // swap amount
35
- tx.pure.u128(sqrtPriceLimit.toString()), // sqrt price limit
36
- tx.pure.bool(false),
37
- tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
38
- ],
39
- });
40
- sui_1.SuiUtils.collectDust(tx, this.swapInfo.assetIn, this.swapInfo.swapXtoY ? receiveA : receiveB);
41
- return this.swapInfo.swapXtoY ? receiveB : receiveA;
42
- }
43
- }
44
- exports.FerraCLMMContract = FerraCLMMContract;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FerraDLMMContract = void 0;
4
- const utils_1 = require("@mysten/sui/utils");
5
- const sui_1 = require("../../utils/sui");
6
- const base_1 = require("./base");
7
- class FerraDLMMContract extends base_1.BaseContract {
8
- async swap(tx) {
9
- const config = this.config.ferra_dlmm;
10
- const [xIn, yIn] = this.swapInfo.swapXtoY
11
- ? [this.inputCoinObject, sui_1.SuiUtils.zeroCoin(tx, this.swapInfo.coinY.type)]
12
- : [sui_1.SuiUtils.zeroCoin(tx, this.swapInfo.coinX.type), this.inputCoinObject];
13
- const [x, y] = tx.moveCall({
14
- target: `${config.package}::lb_pair::swap`,
15
- typeArguments: [this.swapInfo.coinX.type, this.swapInfo.coinY.type],
16
- arguments: [
17
- tx.object(config.globalConfig),
18
- tx.object(this.swapInfo.poolId),
19
- tx.pure.bool(this.swapInfo.swapXtoY),
20
- tx.pure.u64(0), // min output amount
21
- xIn,
22
- yIn,
23
- tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
24
- ],
25
- });
26
- sui_1.SuiUtils.transferOrDestroyZeroCoin(tx, this.swapInfo.assetIn, this.swapInfo.swapXtoY ? x : y, this.currentAccount);
27
- return this.swapInfo.swapXtoY ? y : x;
28
- }
29
- }
30
- exports.FerraDLMMContract = FerraDLMMContract;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FlowXContract = void 0;
4
- const base_1 = require("../base");
5
- class FlowXContract extends base_1.BaseContract {
6
- async swap(tx) {
7
- const coinInType = this.swapInfo.assetIn;
8
- const coinOutType = this.swapInfo.assetOut;
9
- const config = this.config.flowx;
10
- const [tokenOut] = tx.moveCall({
11
- target: `${config.package}::router::swap_exact_input_direct`,
12
- typeArguments: [coinInType, coinOutType],
13
- arguments: [tx.object(config.container), this.inputCoinObject],
14
- });
15
- return tokenOut;
16
- }
17
- }
18
- exports.FlowXContract = FlowXContract;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FlowxV3Contract = void 0;
4
- const utils_1 = require("@mysten/sui/utils");
5
- const base_1 = require("../base");
6
- const utils_2 = require("../utils");
7
- class FlowxV3Contract extends base_1.BaseContract {
8
- async swap(tx) {
9
- const [coinX, coinY] = this.swapInfo.pool.allTokens;
10
- const swapXtoY = this.swapInfo.swapXtoY;
11
- const swapFeeRate = this.swapInfo.extra.swapFeeRate;
12
- if (!swapFeeRate) {
13
- throw new Error("swapFeeRate is required");
14
- }
15
- const config = this.config.flowx_v3;
16
- const [coinOut] = tx.moveCall({
17
- target: `${config.package}::swap_router::swap_exact_input`,
18
- typeArguments: [
19
- swapXtoY ? coinX.address : coinY.address,
20
- swapXtoY ? coinY.address : coinX.address,
21
- ],
22
- arguments: [
23
- tx.object(config.registry),
24
- tx.pure.u64(swapFeeRate), // swap fee rate to lookup pool in the registry
25
- this.inputCoinObject,
26
- tx.pure.u64(0), // min amount out
27
- tx.pure.u128((0, utils_2.getDefaultSqrtPriceLimit)(swapXtoY) + (swapXtoY ? 1n : -1n)), // sqrt price limit
28
- tx.pure.u64("18446744073709551615"), // u64 max value
29
- tx.object(config.version),
30
- tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
31
- ],
32
- });
33
- return coinOut;
34
- }
35
- }
36
- exports.FlowxV3Contract = FlowxV3Contract;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FullsailContract = void 0;
4
- const base_1 = require("../base");
5
- const utils_1 = require("@mysten/sui/utils");
6
- const sui_1 = require("../../../utils/sui");
7
- const utils_2 = require("../utils");
8
- class FullsailContract extends base_1.BaseContract {
9
- async swap(tx) {
10
- const [coinX, coinY] = this.swapInfo.pool.allTokens;
11
- const swapXtoY = this.swapInfo.swapXtoY;
12
- const sqrtPriceLimit = (0, utils_2.getDefaultSqrtPriceLimit)(swapXtoY);
13
- const typeArguments = [coinX.address, coinY.address];
14
- const zeroOut = sui_1.SuiUtils.zeroCoin(tx, swapXtoY ? coinY.address : coinX.address);
15
- const config = this.config.fullsail;
16
- const [receiveA, receiveB] = tx.moveCall({
17
- target: `${config.package}::router::swap`,
18
- typeArguments,
19
- arguments: [
20
- tx.object(config.globalConfig),
21
- tx.object(config.rewarderGlobalVault),
22
- tx.object(this.swapInfo.poolId),
23
- swapXtoY ? this.inputCoinObject : zeroOut, // coin A
24
- swapXtoY ? zeroOut : this.inputCoinObject, // coin B
25
- tx.pure.bool(swapXtoY), // a to b or b to a
26
- tx.pure.bool(true), // exact in or out
27
- this.getInputCoinValue(tx), // swap amount
28
- tx.pure.u128(sqrtPriceLimit.toString()), // sqrt price limit
29
- tx.pure.bool(false),
30
- tx.object(config.stats),
31
- tx.object(config.priceProvider),
32
- tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
33
- ],
34
- });
35
- sui_1.SuiUtils.collectDust(tx, this.swapInfo.assetIn, swapXtoY ? receiveA : receiveB);
36
- return swapXtoY ? receiveB : receiveA;
37
- }
38
- }
39
- exports.FullsailContract = FullsailContract;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HaedalPMMContract = void 0;
4
- const utils_1 = require("@mysten/sui/utils");
5
- const sui_1 = require("../../../utils/sui");
6
- const base_1 = require("../base");
7
- class HaedalPMMContract extends base_1.BaseContract {
8
- async swap(tx) {
9
- const [coinX, coinY] = this.swapInfo.pool.allTokens;
10
- const xToY = this.swapInfo.swapXtoY;
11
- const oracleX = this.getPythPriceInfoId(this.extra.oracles?.[0]);
12
- const oracleY = this.getPythPriceInfoId(this.extra.oracles?.[1]);
13
- const config = this.config.haedal_pmm;
14
- const [coinOut] = tx.moveCall({
15
- target: `${config.package}::trader::${xToY ? "sell_base_coin" : "sell_quote_coin"}`,
16
- typeArguments: [coinX.address, coinY.address],
17
- arguments: [
18
- tx.object(this.swapInfo.poolId),
19
- tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
20
- tx.object(oracleX), // pyth pricefeed for x
21
- tx.object(oracleY), // pyth pricefeed for y
22
- this.inputCoinObject, // mutable coin
23
- this.getInputCoinValue(tx), // swap amount
24
- tx.pure.u64(0), // min output amount
25
- ],
26
- });
27
- sui_1.SuiUtils.collectDust(tx, this.swapInfo.assetIn, this.inputCoinObject);
28
- return coinOut;
29
- }
30
- }
31
- exports.HaedalPMMContract = HaedalPMMContract;
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProtocolContract = void 0;
4
- const aftermath_1 = require("./aftermath");
5
- const bluefin_1 = require("./bluefin");
6
- const bluefinx_1 = require("./bluefinx");
7
- const bluemove_1 = require("./bluemove");
8
- const cetus_1 = require("./cetus");
9
- const cetus_dlmm_1 = require("./cetus_dlmm");
10
- const sponsored_1 = require("./deepbookV3/sponsored");
11
- const ferra_clmm_1 = require("./ferra_clmm");
12
- const ferra_dlmm_1 = require("./ferra_dlmm");
13
- const flowx_1 = require("./flowx");
14
- const flowxV3_1 = require("./flowxV3");
15
- const fullsail_1 = require("./fullsail");
16
- const haedal_pmm_1 = require("./haedal_pmm");
17
- const kriya_1 = require("./kriya");
18
- const kriyaV3_1 = require("./kriyaV3");
19
- const magma_1 = require("./magma");
20
- const momentum_1 = require("./momentum");
21
- const obric_1 = require("./obric");
22
- const sevenk_1 = require("./sevenk");
23
- const springsui_1 = require("./springsui");
24
- const steamm_1 = require("./steamm");
25
- const stsui_1 = require("./stsui");
26
- const suiswap_1 = require("./suiswap");
27
- const turbos_1 = require("./turbos");
28
- exports.ProtocolContract = {
29
- cetus: cetus_1.CetusContract,
30
- turbos: turbos_1.TurbosContract,
31
- bluemove: bluemove_1.BluemoveContract,
32
- kriya: kriya_1.KriyaContract,
33
- suiswap: suiswap_1.SuiswapContract,
34
- aftermath: aftermath_1.AfterMathContract,
35
- deepbook_v3: sponsored_1.SponsoredDeepBookV3Contract,
36
- flowx: flowx_1.FlowXContract,
37
- flowx_v3: flowxV3_1.FlowxV3Contract,
38
- kriya_v3: kriyaV3_1.KriyaV3Contract,
39
- bluefin: bluefin_1.BluefinContract,
40
- springsui: springsui_1.SpringSuiContract,
41
- obric: obric_1.ObricContract,
42
- stsui: stsui_1.StSuiContract,
43
- steamm: steamm_1.SteammContract,
44
- steamm_oracle_quoter: steamm_1.SteammContract,
45
- steamm_oracle_quoter_v2: steamm_1.SteammContract,
46
- magma: magma_1.MagmaContract,
47
- haedal_pmm: haedal_pmm_1.HaedalPMMContract,
48
- momentum: momentum_1.MomentumContract,
49
- bluefinx: bluefinx_1.BluefinXContract,
50
- sevenk_v1: sevenk_1.SevenKV1,
51
- fullsail: fullsail_1.FullsailContract,
52
- cetus_dlmm: cetus_dlmm_1.CetusDLMMContract,
53
- ferra_dlmm: ferra_dlmm_1.FerraDLMMContract,
54
- ferra_clmm: ferra_clmm_1.FerraCLMMContract,
55
- };
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KriyaContract = void 0;
4
- const base_1 = require("../base");
5
- const token_1 = require("../../../utils/token");
6
- class KriyaContract extends base_1.BaseContract {
7
- async swap(tx) {
8
- const swapXtoY = this.swapInfo.swapXtoY;
9
- const coinInType = (0, token_1.normalizeTokenType)(this.swapInfo.assetIn);
10
- const coinOutType = (0, token_1.normalizeTokenType)(this.swapInfo.assetOut);
11
- const poolId = this.swapInfo.poolId;
12
- const inputCoinObject = this.inputCoinObject;
13
- const config = this.config.kriya;
14
- const [tokenOut] = tx.moveCall({
15
- target: `${config.package}::spot_dex::${swapXtoY ? "swap_token_x" : "swap_token_y"}`,
16
- typeArguments: [
17
- swapXtoY ? coinInType : coinOutType,
18
- swapXtoY ? coinOutType : coinInType,
19
- ],
20
- arguments: [
21
- tx.object(poolId),
22
- inputCoinObject,
23
- this.getInputCoinValue(tx),
24
- tx.pure.u64(0),
25
- ],
26
- });
27
- return tokenOut;
28
- }
29
- }
30
- exports.KriyaContract = KriyaContract;
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KriyaV3Contract = void 0;
4
- const base_1 = require("../base");
5
- const utils_1 = require("@mysten/sui/utils");
6
- const token_1 = require("../../../utils/token");
7
- class KriyaV3Contract extends base_1.BaseContract {
8
- async swap(tx) {
9
- const swapXtoY = this.swapInfo.swapXtoY;
10
- const coinInType = (0, token_1.normalizeTokenType)(this.swapInfo.assetIn);
11
- const coinOutType = (0, token_1.normalizeTokenType)(this.swapInfo.assetOut);
12
- const poolId = this.swapInfo.poolId;
13
- const LowLimitPrice = 4295048017;
14
- const limitPrice = BigInt("79226673515401279992447579050");
15
- const { package: PACKAGE_ID, version: VERSION_ID } = this.config.kriya_v3;
16
- const [receive_a, receive_b, flash_receipt] = tx.moveCall({
17
- target: `${PACKAGE_ID}::trade::flash_swap`,
18
- typeArguments: this.getTypeParams(),
19
- arguments: [
20
- tx.object(poolId),
21
- tx.pure.bool(swapXtoY),
22
- tx.pure.bool(true),
23
- this.getInputCoinValue(tx),
24
- tx.pure.u128(swapXtoY ? LowLimitPrice : limitPrice),
25
- tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
26
- tx.object(VERSION_ID),
27
- ],
28
- });
29
- tx.moveCall({
30
- target: `0x2::balance::destroy_zero`,
31
- arguments: [swapXtoY ? receive_a : receive_b],
32
- typeArguments: [coinInType],
33
- });
34
- const [zeroOutCoin] = tx.moveCall({
35
- target: `0x2::balance::zero`,
36
- arguments: [],
37
- typeArguments: [coinOutType],
38
- });
39
- const inputCoinBalance = tx.moveCall({
40
- target: `0x2::coin::into_balance`,
41
- typeArguments: [coinInType],
42
- arguments: [this.inputCoinObject],
43
- });
44
- const pay_coin_a = swapXtoY ? inputCoinBalance : zeroOutCoin;
45
- const pay_coin_b = swapXtoY ? zeroOutCoin : inputCoinBalance;
46
- tx.moveCall({
47
- target: `${PACKAGE_ID}::trade::repay_flash_swap`,
48
- typeArguments: this.getTypeParams(),
49
- arguments: [
50
- tx.object(poolId),
51
- flash_receipt,
52
- pay_coin_a,
53
- pay_coin_b,
54
- tx.object(VERSION_ID),
55
- ],
56
- });
57
- const [tokenOut] = tx.moveCall({
58
- target: `0x2::coin::from_balance`,
59
- typeArguments: [coinOutType],
60
- arguments: [swapXtoY ? receive_b : receive_a],
61
- });
62
- return tokenOut;
63
- }
64
- }
65
- exports.KriyaV3Contract = KriyaV3Contract;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MagmaContract = void 0;
4
- const base_1 = require("../base");
5
- const utils_1 = require("@mysten/sui/utils");
6
- const utils_2 = require("../utils");
7
- const sui_1 = require("../../../utils/sui");
8
- class MagmaContract extends base_1.BaseContract {
9
- async swap(tx) {
10
- const [coinX, coinY] = this.swapInfo.pool.allTokens;
11
- const swapXtoY = this.swapInfo.swapXtoY;
12
- const sqrtPriceLimit = (0, utils_2.getDefaultSqrtPriceLimit)(swapXtoY);
13
- const typeArguments = [coinX.address, coinY.address];
14
- const [zeroOut] = tx.moveCall({
15
- target: "0x2::coin::zero",
16
- typeArguments: [swapXtoY ? coinY.address : coinX.address],
17
- });
18
- const amountIn = sui_1.SuiUtils.getCoinValue(swapXtoY ? coinX.address : coinY.address, this.inputCoinObject, tx);
19
- const config = this.config.magma;
20
- const [receiveA, receiveB] = tx.moveCall({
21
- target: `${config.package}::router::swap`,
22
- typeArguments,
23
- arguments: [
24
- tx.object(config.globalConfig),
25
- tx.object(this.swapInfo.poolId),
26
- swapXtoY ? this.inputCoinObject : zeroOut, // coin A
27
- swapXtoY ? zeroOut : this.inputCoinObject, // coin B
28
- tx.pure.bool(swapXtoY), // a to b or b to a
29
- tx.pure.bool(true), // exact in or out
30
- amountIn, // swap amount
31
- tx.pure.u128(sqrtPriceLimit.toString()), // sqrt price limit
32
- tx.pure.bool(false),
33
- tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
34
- ],
35
- });
36
- sui_1.SuiUtils.collectDust(tx, this.swapInfo.assetIn, swapXtoY ? receiveA : receiveB);
37
- return swapXtoY ? receiveB : receiveA;
38
- }
39
- }
40
- exports.MagmaContract = MagmaContract;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MomentumContract = void 0;
4
- const base_1 = require("../base");
5
- const utils_1 = require("@mysten/sui/utils");
6
- const utils_2 = require("../utils");
7
- const sui_1 = require("../../../utils/sui");
8
- class MomentumContract extends base_1.BaseContract {
9
- async swap(tx) {
10
- const [coinX, coinY] = this.swapInfo.pool.allTokens;
11
- const swapXtoY = this.swapInfo.swapXtoY;
12
- const sqrtPriceLimit = (0, utils_2.getDefaultSqrtPriceLimit)(swapXtoY);
13
- const typeArguments = [coinX.address, coinY.address];
14
- const { package: packageId, version } = this.config.momentum;
15
- const [receiveA, receiveB, debt] = tx.moveCall({
16
- target: `${packageId}::trade::flash_swap`,
17
- typeArguments,
18
- arguments: [
19
- tx.object(this.swapInfo.poolId),
20
- tx.pure.bool(swapXtoY), // a2b
21
- tx.pure.bool(true), // exact in
22
- this.getInputCoinValue(tx),
23
- tx.pure.u128(sqrtPriceLimit.toString()), // sqrt price limit
24
- tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
25
- tx.object(version),
26
- ],
27
- });
28
- tx.moveCall({
29
- target: `${packageId}::trade::repay_flash_swap`,
30
- typeArguments,
31
- arguments: [
32
- tx.object(this.swapInfo.poolId),
33
- debt,
34
- swapXtoY
35
- ? sui_1.SuiUtils.coinIntoBalance(tx, coinX.address, this.inputCoinObject)
36
- : sui_1.SuiUtils.zeroBalance(tx, coinX.address),
37
- swapXtoY
38
- ? sui_1.SuiUtils.zeroBalance(tx, coinY.address)
39
- : sui_1.SuiUtils.coinIntoBalance(tx, coinY.address, this.inputCoinObject),
40
- tx.object(version),
41
- ],
42
- });
43
- const receiveACoin = sui_1.SuiUtils.coinFromBalance(tx, coinX.address, receiveA);
44
- const receiveBCoin = sui_1.SuiUtils.coinFromBalance(tx, coinY.address, receiveB);
45
- sui_1.SuiUtils.collectDust(tx, this.swapInfo.assetIn, swapXtoY ? receiveACoin : receiveBCoin);
46
- return swapXtoY ? receiveBCoin : receiveACoin;
47
- }
48
- }
49
- exports.MomentumContract = MomentumContract;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ObricContract = void 0;
4
- const utils_1 = require("@mysten/sui/utils");
5
- const base_1 = require("../base");
6
- class ObricContract extends base_1.BaseContract {
7
- async swap(tx) {
8
- const [coinX, coinY] = this.swapInfo.pool.allTokens;
9
- const xToY = this.swapInfo.swapXtoY;
10
- const oracleX = this.getPythPriceInfoId(this.extra.oracles?.[0]);
11
- const oracleY = this.getPythPriceInfoId(this.extra.oracles?.[1]);
12
- const { package: PACKAGE_ID, pythState: PYTH_STATE } = this.config.obric;
13
- const [coinOut] = tx.moveCall({
14
- target: `${PACKAGE_ID}::v2::${xToY ? "swap_x_to_y" : "swap_y_to_x"}`,
15
- typeArguments: [coinX.address, coinY.address],
16
- arguments: [
17
- tx.object(this.swapInfo.poolId),
18
- tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
19
- tx.object(PYTH_STATE),
20
- tx.object(oracleX), // pyth pricefeed for x
21
- tx.object(oracleY), // pyth pricefeed for y
22
- this.inputCoinObject,
23
- ],
24
- });
25
- return coinOut;
26
- }
27
- }
28
- exports.ObricContract = ObricContract;
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SevenKV1 = void 0;
4
- const utils_1 = require("@mysten/sui/utils");
5
- const base_1 = require("../base");
6
- class SevenKV1 extends base_1.BaseContract {
7
- async swap(tx) {
8
- const x2y = this.swapInfo.swapXtoY;
9
- const config = this.config.sevenk_v1;
10
- const [coinOut] = tx.moveCall({
11
- target: `${config.package}::pool_v1::${x2y ? "swap_x_to_y" : "swap_y_to_x"}`,
12
- typeArguments: (0, utils_1.parseStructTag)(this.extra.poolStructTag).typeParams.map(utils_1.normalizeStructTag),
13
- arguments: [
14
- tx.object(this.swapInfo.poolId),
15
- this.getOraclePriceUpdate(tx),
16
- this.inputCoinObject,
17
- tx.pure.u64(0),
18
- ],
19
- });
20
- return coinOut;
21
- }
22
- getOraclePriceUpdate(tx) {
23
- const oracleX = this.extra.oracles?.[0]?.Pyth?.bytes;
24
- const oracleY = this.extra.oracles?.[1]?.Pyth?.bytes;
25
- if (!oracleX ||
26
- !oracleY ||
27
- !this.extra.oracleConfigX ||
28
- !this.extra.oracleConfigY) {
29
- throw new Error(`Invalid oracle info for getOraclePriceUpdate`);
30
- }
31
- const [holder] = tx.moveCall({
32
- target: `${this.config.sevenk_v1.oracle}::oracle::new_holder`,
33
- });
34
- tx.moveCall({
35
- target: `${this.config.sevenk_v1.oracle}::pyth::get_price`,
36
- arguments: [
37
- tx.object(this.extra.oracleConfigX),
38
- holder,
39
- tx.object(this.pythMap["0x" + (0, utils_1.toHex)(Uint8Array.from(oracleX))]),
40
- tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
41
- ],
42
- });
43
- tx.moveCall({
44
- target: `${this.config.sevenk_v1.oracle}::pyth::get_price`,
45
- arguments: [
46
- tx.object(this.extra.oracleConfigY),
47
- holder,
48
- tx.object(this.pythMap["0x" + (0, utils_1.toHex)(Uint8Array.from(oracleY))]),
49
- tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
50
- ],
51
- });
52
- return holder;
53
- }
54
- }
55
- exports.SevenKV1 = SevenKV1;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SpringSuiContract = void 0;
4
- const utils_1 = require("@mysten/sui/utils");
5
- const base_1 = require("../base");
6
- class SpringSuiContract extends base_1.BaseContract {
7
- async swap(tx) {
8
- // coinX is always SUI
9
- const coinY = this.swapInfo.pool.allTokens[1];
10
- const isStake = this.swapInfo.swapXtoY;
11
- const { package: PACKAGE_ID } = this.config.springsui;
12
- const [coinOut] = tx.moveCall({
13
- target: `${PACKAGE_ID}::liquid_staking::${isStake ? "mint" : "redeem"}`,
14
- typeArguments: [coinY.address],
15
- arguments: [
16
- tx.object(this.swapInfo.poolId),
17
- isStake ? tx.object(utils_1.SUI_SYSTEM_STATE_OBJECT_ID) : this.inputCoinObject,
18
- isStake ? this.inputCoinObject : tx.object(utils_1.SUI_SYSTEM_STATE_OBJECT_ID),
19
- ],
20
- });
21
- return coinOut;
22
- }
23
- }
24
- exports.SpringSuiContract = SpringSuiContract;