@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,173 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { BluefinXTx } from "../libs/protocols/bluefinx/types";
3
- export { BluefinXTx };
4
- export type SourceDex = "suiswap" | "turbos" | "cetus" | "bluemove" | "kriya" | "kriya_v3" | "aftermath" | "deepbook_v3" | "flowx" | "flowx_v3" | "bluefin" | "bluefinx" | "springsui" | "obric" | "stsui" | "steamm" | "steamm_oracle_quoter" | "steamm_oracle_quoter_v2" | "magma" | "haedal_pmm" | "momentum" | "sevenk_v1" | "fullsail" | "cetus_dlmm" | "ferra_dlmm" | "ferra_clmm";
5
- export type SorSwap = {
6
- poolId: string;
7
- assetInIndex: number;
8
- assetOutIndex: number;
9
- amount: string;
10
- returnAmount: string;
11
- assetIn: string;
12
- assetOut: string;
13
- functionName: string;
14
- arguments: string[];
15
- extra?: any;
16
- };
17
- export type SorPool = {
18
- allTokens: Array<{
19
- address: string;
20
- decimal: number;
21
- }>;
22
- type: SourceDex;
23
- };
24
- export type SorHop = {
25
- poolId: string;
26
- tokenInAmount: string;
27
- tokenOutAmount: string;
28
- tokenIn: string;
29
- tokenOut: string;
30
- pool: SorPool;
31
- };
32
- export type SorRoute = {
33
- hops: SorHop[];
34
- share?: number;
35
- tokenIn: string;
36
- tokenInAmount: string;
37
- tokenOut: string;
38
- tokenOutAmount: string;
39
- };
40
- export type QuoteResponse = {
41
- effectivePrice: number | null;
42
- effectivePriceReserved: number | null;
43
- priceImpact: number | null;
44
- swapAmount: string;
45
- returnAmount: string;
46
- returnAmountWithDecimal: string;
47
- returnAmountAfterCommission: string;
48
- returnAmountAfterCommissionWithDecimal: string;
49
- returnAmountConsiderGasFees?: string;
50
- returnAmountWithoutSwapFees?: string;
51
- swapAmountWithDecimal: string;
52
- tokenAddresses: string[];
53
- tokenIn: string;
54
- tokenOut: string;
55
- marketSp: string;
56
- routes?: SorRoute[];
57
- swaps: SorSwap[];
58
- warning: string;
59
- };
60
- export interface Coin {
61
- type: string;
62
- decimals: number;
63
- }
64
- export interface TxSorSwap extends SorSwap {
65
- pool: SorPool;
66
- coinX: Coin;
67
- coinY: Coin;
68
- swapXtoY: boolean;
69
- }
70
- export interface Commission {
71
- partner: string;
72
- commissionBps: number;
73
- }
74
- export interface DexConfig {
75
- package: string;
76
- name: string;
77
- url?: string;
78
- image?: string;
79
- }
80
- export interface Config {
81
- aftermath: DexConfig & {
82
- poolRegistry: string;
83
- protocolFeeVault: string;
84
- treasury: string;
85
- insuranceFund: string;
86
- referralVault: string;
87
- };
88
- bluefin: DexConfig & {
89
- globalConfig: string;
90
- };
91
- bluefinx: DexConfig & {
92
- globalConfig: string;
93
- };
94
- bluemove: DexConfig & {
95
- dexInfo: string;
96
- };
97
- cetus: DexConfig & {
98
- globalConfig: string;
99
- };
100
- deepbook_v3: DexConfig & {
101
- sponsor: string;
102
- sponsorFund: string;
103
- };
104
- flowx: DexConfig & {
105
- container: string;
106
- };
107
- flowx_v3: DexConfig & {
108
- registry: string;
109
- version: string;
110
- };
111
- kriya: DexConfig;
112
- kriya_v3: DexConfig & {
113
- version: string;
114
- };
115
- obric: DexConfig & {
116
- pythState: string;
117
- };
118
- springsui: DexConfig;
119
- stsui: DexConfig;
120
- suiswap: DexConfig;
121
- turbos: DexConfig & {
122
- version: string;
123
- };
124
- steamm: DexConfig & {
125
- script: string;
126
- oracle: string;
127
- };
128
- magma: DexConfig & {
129
- globalConfig: string;
130
- };
131
- haedal_pmm: DexConfig;
132
- momentum: DexConfig & {
133
- version: string;
134
- };
135
- sevenk_v1: DexConfig & {
136
- oracle: string;
137
- };
138
- fullsail: DexConfig & {
139
- globalConfig: string;
140
- rewarderGlobalVault: string;
141
- priceProvider: string;
142
- stats: string;
143
- };
144
- cetus_dlmm: DexConfig & {
145
- globalConfig: string;
146
- version: string;
147
- };
148
- ferra_dlmm: DexConfig & {
149
- globalConfig: string;
150
- };
151
- ferra_clmm: DexConfig & {
152
- integrate: string;
153
- globalConfig: string;
154
- };
155
- }
156
- export type ExtraOracle = {
157
- Pyth?: {
158
- bytes: number[];
159
- };
160
- };
161
- export type AggregatorTx = Transaction | BluefinXTx;
162
- export declare const isSuiTransaction: (tx: AggregatorTx) => tx is Transaction;
163
- /**
164
- * Check if the sor response is a bluefinx routing
165
- * @param sor
166
- * @returns boolean
167
- */
168
- export declare const isBluefinXRouting: (sor: QuoteResponse) => boolean;
169
- export type BuildTxResult = {
170
- tx: AggregatorTx;
171
- coinOut?: TransactionObjectArgument;
172
- };
173
- //# sourceMappingURL=aggregator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aggregator.d.ts","sourceRoot":"","sources":["../../../../src/types/aggregator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,QAAQ,GACR,OAAO,GACP,UAAU,GACV,OAAO,GACP,UAAU,GACV,WAAW,GACX,aAAa,GACb,OAAO,GACP,UAAU,GACV,SAAS,GACT,UAAU,GACV,WAAW,GACX,OAAO,GACP,OAAO,GACP,QAAQ,GACR,sBAAsB,GACtB,yBAAyB,GACzB,OAAO,GACP,YAAY,GACZ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AM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,QAAQ,EAAE,SAAS,GAAG;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,mBAAmB,EAAE,MAAM,CAAC;QAC5B,aAAa,EAAE,MAAM,CAAC;QACtB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,UAAU,EAAE,SAAS,GAAG;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,UAAU,EAAE,SAAS,GAAG;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,UAAU,EAAE,SAAS,GAAG;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;CACrE;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,UAAU,CAAC;AAEpD,eAAO,MAAM,gBAAgB,GAAI,IAAI,YAAY,KAAG,EAAE,IAAI,WAC/B,CAAC;AAE5B;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,aAAa,YAMnD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,YAAY,CAAC;IACjB,OAAO,CAAC,EAAE,yBAAyB,CAAC;CACrC,CAAC"}
@@ -1,4 +0,0 @@
1
- import { TransactionResult } from "@mysten/sui/transactions";
2
- import { Unarray } from "./utilities";
3
- export type TransactionResultItem = Unarray<TransactionResult>;
4
- //# sourceMappingURL=sui.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../../../src/types/sui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC"}
@@ -1,67 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { Commission, QuoteResponse } from "./aggregator";
3
- export interface CommonParams {
4
- /** Quote response from 7k api */
5
- quoteResponse: QuoteResponse;
6
- /** User address */
7
- accountAddress: string;
8
- /** Slippage tolerance, ex: 0.01 (1%) */
9
- slippage: number | string;
10
- /** Commission for partner */
11
- commission: Commission;
12
- /**
13
- * Give Flexibility to insert custom commands before or after swap
14
- * @example
15
- * ```typescript
16
- * const rawTx = new Transaction();
17
- * // Add custom commands to rawTx
18
- * rawTx.moveCall({
19
- * target: "0x2222222::example::claim",
20
- * arguments: [],
21
- * });
22
- * const { tx, coinOut } = await buildTx({
23
- * quoteResponse,
24
- * accountAddress,
25
- * slippage,
26
- * commission,
27
- * extendTx: {
28
- * tx: rawTx,
29
- * coinIn: rawTx.object(coinObjectId),
30
- * },
31
- * });
32
- * // add more commands after the swap if needed, and remember to consume the coinOut object
33
- * tx.transferObjects([coinOut], tx.pure.address(accountAddress));
34
- * ```
35
- */
36
- extendTx?: {
37
- tx: Transaction;
38
- coinIn?: TransactionObjectArgument;
39
- };
40
- /**
41
- * If true, indicates that the transaction is sponsored and its gas object should not be modified.
42
- * In this case, the gas object is expected to be already set up correctly for the sponsored transaction.
43
- */
44
- isSponsored?: boolean;
45
- }
46
- export interface BuildTxParams extends CommonParams {
47
- /** Developer inspection mode */
48
- devInspect?: boolean;
49
- }
50
- export interface EstimateGasFeeParams extends CommonParams {
51
- /** Sui price in usd for gas estimation */
52
- suiPrice?: number;
53
- }
54
- export interface SwapInfo {
55
- quote: QuoteResponse;
56
- /** @warning this `coinIn` will be consumed completely, no `coinIn` left, user must pass the coinIn object with the balance required for the swap - ie in quote */
57
- coinIn: TransactionObjectArgument;
58
- }
59
- export interface MultiSwapParams {
60
- swaps: SwapInfo[];
61
- sender: string;
62
- slippageBps: number;
63
- tx: Transaction;
64
- /** Commission for partner */
65
- commission: Commission;
66
- }
67
- //# sourceMappingURL=tx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tx.d.ts","sourceRoot":"","sources":["../../../../src/types/tx.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC3B,iCAAiC;IACjC,aAAa,EAAE,aAAa,CAAC;IAC7B,mBAAmB;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,6BAA6B;IAC7B,UAAU,EAAE,UAAU,CAAC;IACvB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,QAAQ,CAAC,EAAE;QACT,EAAE,EAAE,WAAW,CAAC;QAChB,MAAM,CAAC,EAAE,yBAAyB,CAAC;KACpC,CAAC;IACF;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,gCAAgC;IAChC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,aAAa,CAAC;IACrB,kKAAkK;IAClK,MAAM,EAAE,yBAAyB,CAAC;CACnC;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,WAAW,CAAC;IAChB,6BAA6B;IAC7B,UAAU,EAAE,UAAU,CAAC;CACxB"}
@@ -1,5 +0,0 @@
1
- export type ValueOf<T> = T[keyof T];
2
- export type PropName<T> = keyof T;
3
- export type Unarray<T> = T extends Array<infer U> ? U : T;
4
- export type Modify<T, R extends Partial<T>> = Omit<T, keyof R> & R;
5
- //# sourceMappingURL=utilities.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../../../src/types/utilities.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACpC,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAClC,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC1D,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- export declare function formatBalance(balance: bigint, decimals: number): number;
2
- //# sourceMappingURL=number.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../../src/utils/number.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAK9D"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatBalance = formatBalance;
4
- function formatBalance(balance, decimals) {
5
- const exp = BigInt(Math.pow(10, decimals));
6
- const whole = balance / exp;
7
- const remain = balance % exp;
8
- return Number(whole) + Number(remain) / Number(exp);
9
- }
@@ -1,64 +0,0 @@
1
- import { SuiClient, getFullnodeUrl } from "@mysten/sui/client";
2
- import { SuiPriceServiceConnection, SuiPythClient, } from "@pythnetwork/pyth-sui-js";
3
- const HERMES_API = "https://hermes.pyth.network";
4
- const WORMHOLE_STATE_ID = "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c";
5
- const PYTH_STATE_ID = "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";
6
- let api = "";
7
- let apiKey = "";
8
- let bluefinXApiKey = "";
9
- let suiClient = new SuiClient({
10
- url: getFullnodeUrl("mainnet"),
11
- });
12
- let pythClient = new SuiPythClient(suiClient, PYTH_STATE_ID, WORMHOLE_STATE_ID);
13
- let pythConnection = new SuiPriceServiceConnection(HERMES_API);
14
- function setApi(url) {
15
- api = url;
16
- }
17
- function getApi() {
18
- return api;
19
- }
20
- function setApiKey(key) {
21
- apiKey = key;
22
- }
23
- function getApiKey() {
24
- return apiKey;
25
- }
26
- function setBluefinXApiKey(key) {
27
- bluefinXApiKey = key;
28
- }
29
- function getBluefinXApiKey() {
30
- return bluefinXApiKey;
31
- }
32
- function getSuiClient() {
33
- return suiClient;
34
- }
35
- function setSuiClient(client) {
36
- suiClient = client;
37
- }
38
- function setPythClient(client) {
39
- pythClient = client;
40
- }
41
- function getPythClient() {
42
- return pythClient;
43
- }
44
- function setPythConnection(connection) {
45
- pythConnection = connection;
46
- }
47
- function getPythConnection() {
48
- return pythConnection;
49
- }
50
- const Config = {
51
- setApi,
52
- getApi,
53
- setApiKey,
54
- getApiKey,
55
- setBluefinXApiKey,
56
- getBluefinXApiKey,
57
- setSuiClient,
58
- getSuiClient,
59
- setPythClient,
60
- getPythClient,
61
- setPythConnection,
62
- getPythConnection,
63
- };
64
- export { Config };
@@ -1,66 +0,0 @@
1
- import { SuiPriceServiceConnection, SuiPythClient, } from "@pythnetwork/pyth-sui-js";
2
- import { v4 } from "uuid";
3
- import { Config } from "../../../config";
4
- import { _7K_PARTNER_ADDRESS } from "../../../constants/_7k";
5
- import { EProvider, } from "../../../types/metaAg";
6
- import { buildTxV2 } from "../../swap/buildTxV2";
7
- import { getQuote } from "../../swap/getQuote";
8
- import { MetaAgError, MetaAgErrorCode } from "../error";
9
- const WORMHOLE_STATE_ID = "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c";
10
- const PYTH_STATE_ID = "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";
11
- export class BluefinLegacyProvider {
12
- options;
13
- metaOptions;
14
- kind = EProvider.BLUEFIN7K_LEGACY;
15
- constructor(options, metaOptions, client) {
16
- this.options = options;
17
- this.metaOptions = metaOptions;
18
- const pythClient = new SuiPythClient(client, PYTH_STATE_ID, WORMHOLE_STATE_ID);
19
- const pythConnection = new SuiPriceServiceConnection(this.metaOptions.hermesApi);
20
- if (options.apiKey)
21
- Config.setApiKey(options.apiKey);
22
- if (options.api)
23
- Config.setApi(options.api);
24
- Config.setSuiClient(client);
25
- Config.setPythClient(pythClient);
26
- Config.setPythConnection(pythConnection);
27
- }
28
- async quote(options) {
29
- const quote = await getQuote({
30
- amountIn: options.amountIn,
31
- tokenIn: options.coinTypeIn,
32
- tokenOut: options.coinTypeOut,
33
- sources: this.options.sources,
34
- maxPaths: this.options.maxPaths,
35
- excludedPools: this.options.excludedPools,
36
- targetPools: this.options.targetPools,
37
- });
38
- return {
39
- id: v4(),
40
- provider: EProvider.BLUEFIN7K_LEGACY,
41
- quote,
42
- amountIn: quote.swapAmountWithDecimal,
43
- rawAmountOut: quote.returnAmountWithDecimal,
44
- amountOut: quote.returnAmountWithDecimal,
45
- coinTypeIn: options.coinTypeIn,
46
- coinTypeOut: options.coinTypeOut,
47
- };
48
- }
49
- async swap({ quote, signer, tx, coinIn }) {
50
- MetaAgError.assert(quote.provider === EProvider.BLUEFIN7K_LEGACY, "Invalid quote", MetaAgErrorCode.INVALID_QUOTE, { quote, expectedProvider: EProvider.BLUEFIN7K_LEGACY });
51
- const { coinOut } = await buildTxV2({
52
- quoteResponse: quote.quote,
53
- accountAddress: signer,
54
- commission: {
55
- commissionBps: 0,
56
- partner: _7K_PARTNER_ADDRESS,
57
- },
58
- slippage: 1,
59
- extendTx: {
60
- tx,
61
- coinIn,
62
- },
63
- });
64
- return coinOut;
65
- }
66
- }
@@ -1,188 +0,0 @@
1
- import { coinWithBalance, Transaction, } from "@mysten/sui/transactions";
2
- import { isValidSuiAddress, toBase64, toHex } from "@mysten/sui/utils";
3
- import { Config } from "../../config";
4
- import { _7K_CONFIG, _7K_PACKAGE_ID, _7K_VAULT } from "../../constants/_7k";
5
- import { groupSwapRoutes } from "../../libs/groupSwapRoutes";
6
- import { sponsorBluefinX } from "../../libs/protocols/bluefinx/client";
7
- import { BluefinXTx } from "../../libs/protocols/bluefinx/types";
8
- import { swapWithRoute } from "../../libs/swapWithRoute";
9
- import { isBluefinXRouting, } from "../../types/aggregator";
10
- import { SuiUtils } from "../../utils/sui";
11
- import { getConfig } from "./config";
12
- import { ORACLE_BASED_SOURCES } from "./getQuote";
13
- export const buildTx = async ({ quoteResponse, accountAddress, slippage, commission: __commission, devInspect, extendTx, isSponsored, }) => {
14
- const isBluefinX = isBluefinXRouting(quoteResponse);
15
- const _commission = {
16
- ...__commission,
17
- // commission is ignored for bluefinx
18
- commissionBps: isBluefinX ? 0 : __commission.commissionBps,
19
- };
20
- const { tx: _tx, coinIn: _coinIn } = extendTx || {};
21
- let coinOut;
22
- if (isBluefinX && devInspect) {
23
- throw new Error("BluefinX tx is sponsored, skip devInspect");
24
- }
25
- if (!accountAddress) {
26
- throw new Error("Sender address is required");
27
- }
28
- if (!quoteResponse.routes) {
29
- throw new Error("Invalid quote response: 'routes' are required");
30
- }
31
- if (!isValidSuiAddress(_commission.partner)) {
32
- throw new Error("Invalid commission partner address");
33
- }
34
- const tx = _tx || new Transaction();
35
- const routes = groupSwapRoutes(quoteResponse);
36
- validateRoutes(routes, isSponsored);
37
- const splits = routes.map((group) => group[0]?.amount ?? "0");
38
- const coinIn = _coinIn ||
39
- tx.add(coinWithBalance({
40
- type: quoteResponse.tokenIn,
41
- balance: BigInt(quoteResponse.swapAmountWithDecimal),
42
- useGasCoin: !isSponsored && !isBluefinX,
43
- }));
44
- const coinData = tx.splitCoins(coinIn, splits);
45
- SuiUtils.transferOrDestroyZeroCoin(tx, quoteResponse.tokenIn, coinIn, accountAddress);
46
- const pythMap = await updatePythPriceFeedsIfAny(tx, [quoteResponse]);
47
- const coinObjects = [];
48
- const config = await getConfig();
49
- await Promise.all(routes.map(async (route, index) => {
50
- const inputCoinObject = coinData[index];
51
- const coinRes = await swapWithRoute({
52
- route,
53
- inputCoinObject,
54
- currentAccount: accountAddress,
55
- tx,
56
- config,
57
- pythMap,
58
- });
59
- if (coinRes) {
60
- coinObjects.push(coinRes);
61
- }
62
- }));
63
- if (coinObjects.length > 0) {
64
- const mergedCoin = tx.add(settle(coinObjects, quoteResponse, Math.floor(+slippage * 10000), _commission));
65
- if (!extendTx) {
66
- tx.transferObjects([mergedCoin], tx.pure.address(accountAddress));
67
- }
68
- else {
69
- coinOut = mergedCoin;
70
- }
71
- }
72
- if (isBluefinX) {
73
- return {
74
- tx: await buildBluefinXTx(tx, accountAddress, quoteResponse),
75
- coinOut,
76
- };
77
- }
78
- tx.setSenderIfNotSet(accountAddress);
79
- return { tx, coinOut };
80
- };
81
- export const getPythPriceFeeds = (responses) => {
82
- const ids = new Set();
83
- for (const res of responses) {
84
- for (const s of res.swaps) {
85
- for (const o of s.extra?.oracles || []) {
86
- const bytes = o.Pyth?.price_identifier?.bytes || o.Pyth?.bytes;
87
- if (bytes) {
88
- ids.add("0x" + toHex(Uint8Array.from(bytes)));
89
- }
90
- }
91
- }
92
- }
93
- return Array.from(ids);
94
- };
95
- export const updatePythPriceFeedsIfAny = async (tx, quoteResponse) => {
96
- // update oracles price if any
97
- const pythMap = {};
98
- const pythIds = getPythPriceFeeds(quoteResponse);
99
- if (pythIds.length > 0) {
100
- const prices = await Config.getPythConnection().getPriceFeedsUpdateData(pythIds);
101
- const ids = await Config.getPythClient().updatePriceFeeds(tx, prices, pythIds);
102
- pythIds.map((id, index) => {
103
- pythMap[id] = ids[index];
104
- });
105
- }
106
- return pythMap;
107
- };
108
- export const validateRoutes = (routes, isSponsored) => {
109
- if (!isSponsored) {
110
- return;
111
- }
112
- const hasOracleBasedSource = routes.some((g) => g.some((s) => ORACLE_BASED_SOURCES.has(s.pool.type)));
113
- if (hasOracleBasedSource) {
114
- throw new Error("Oracle based sources are not supported for sponsored tx");
115
- }
116
- };
117
- export const getExpectedReturn = (returnAmount, slippageBps, commissionBps, tipBps = 0) => {
118
- if (slippageBps > 10000) {
119
- throw new Error("Slippage must be less than 100%");
120
- }
121
- if (commissionBps > 10000) {
122
- throw new Error("Commission must be less than 100%");
123
- }
124
- if (tipBps > 10000) {
125
- throw new Error("Tip must be less than 100%");
126
- }
127
- const returnAmountWithDecimal = BigInt(returnAmount);
128
- const tipAmountWithDecimal = (returnAmountWithDecimal * BigInt(tipBps || 0)) / 10000n;
129
- const commissionAmountWithDecimal = ((returnAmountWithDecimal - tipAmountWithDecimal) * BigInt(commissionBps)) /
130
- 10000n;
131
- const expectedReturnWithDecimal = returnAmountWithDecimal -
132
- tipAmountWithDecimal -
133
- commissionAmountWithDecimal;
134
- const minAmountWithDecimal = (expectedReturnWithDecimal * BigInt(1e4 - slippageBps)) / 10000n;
135
- return {
136
- tipAmount: tipAmountWithDecimal,
137
- minAmount: minAmountWithDecimal,
138
- commissionAmount: commissionAmountWithDecimal,
139
- expectedAmount: expectedReturnWithDecimal.toString(10),
140
- };
141
- };
142
- export const settle = (coinObjects, quoteResponse, slippageBps, _commission) => {
143
- return (tx) => {
144
- const mergeCoin = coinObjects.length > 1
145
- ? (tx.mergeCoins(coinObjects[0], coinObjects.slice(1)), coinObjects[0])
146
- : coinObjects[0];
147
- const { minAmount, expectedAmount } = getExpectedReturn(quoteResponse.returnAmountWithDecimal, slippageBps, _commission.commissionBps);
148
- tx.moveCall({
149
- target: `${_7K_PACKAGE_ID}::settle::settle`,
150
- typeArguments: [quoteResponse.tokenIn, quoteResponse.tokenOut],
151
- arguments: [
152
- tx.object(_7K_CONFIG),
153
- tx.object(_7K_VAULT),
154
- tx.pure.u64(quoteResponse.swapAmountWithDecimal),
155
- mergeCoin,
156
- tx.pure.u64(minAmount), // minimum received
157
- tx.pure.u64(expectedAmount), // expected amount out
158
- tx.pure.option("address", isValidSuiAddress(_commission.partner) ? _commission.partner : null),
159
- tx.pure.u64(_commission.commissionBps),
160
- tx.pure.u64(0),
161
- ],
162
- });
163
- return mergeCoin;
164
- };
165
- };
166
- export const buildBluefinXTx = async (tx, accountAddress, quoteResponse) => {
167
- const extra = quoteResponse.swaps[0].extra;
168
- if (extra.quoteExpiresAtUtcMillis < Date.now()) {
169
- throw new Error("Quote expired");
170
- }
171
- if (extra.taker !== accountAddress) {
172
- throw new Error("Sender mismatch with quote");
173
- }
174
- tx.setSenderIfNotSet(accountAddress);
175
- const bytes = await tx.build({
176
- client: Config.getSuiClient(),
177
- onlyTransactionKind: true,
178
- });
179
- const res = await sponsorBluefinX({
180
- quoteId: extra.quoteId,
181
- txBytes: toBase64(bytes),
182
- sender: accountAddress,
183
- });
184
- if (!res.success) {
185
- throw new Error("Sponsor failed");
186
- }
187
- return new BluefinXTx(res.quoteId, res.data.txBytes);
188
- };