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

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 (234) hide show
  1. package/README.md +13 -10
  2. package/dist/bluefin7k-I6ZCDWDN.js +2 -0
  3. package/dist/bluefin7k-I6ZCDWDN.js.map +1 -0
  4. package/dist/bluefin7k-TERLUCNL.mjs +2 -0
  5. package/dist/bluefin7k-TERLUCNL.mjs.map +1 -0
  6. package/dist/cetus-AU3OMWOY.mjs +2 -0
  7. package/dist/cetus-AU3OMWOY.mjs.map +1 -0
  8. package/dist/cetus-SIPX6FYL.js +2 -0
  9. package/dist/cetus-SIPX6FYL.js.map +1 -0
  10. package/dist/chunk-ETQEI4QC.mjs +2 -0
  11. package/dist/chunk-ETQEI4QC.mjs.map +1 -0
  12. package/dist/chunk-KVGSSW22.js +2 -0
  13. package/dist/chunk-KVGSSW22.js.map +1 -0
  14. package/dist/flowx-6M54WFWO.js +2 -0
  15. package/dist/flowx-6M54WFWO.js.map +1 -0
  16. package/dist/flowx-OXZZX5FD.mjs +2 -0
  17. package/dist/flowx-OXZZX5FD.mjs.map +1 -0
  18. package/dist/index.d.mts +536 -0
  19. package/dist/index.d.ts +536 -0
  20. package/dist/index.js +2 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/index.mjs +2 -0
  23. package/dist/index.mjs.map +1 -0
  24. package/package.json +12 -20
  25. package/lib/cjs/config/fetchClient.js +0 -12
  26. package/lib/cjs/constants/_7k.js +0 -20
  27. package/lib/cjs/constants/apiEndpoints.js +0 -9
  28. package/lib/cjs/constants/sui.js +0 -4
  29. package/lib/cjs/constants/tokens.js +0 -7
  30. package/lib/cjs/features/limitDca/cancelDcaOrder.js +0 -14
  31. package/lib/cjs/features/limitDca/cancelLimitOrder.js +0 -14
  32. package/lib/cjs/features/limitDca/claimExpiredLimitOrder.js +0 -14
  33. package/lib/cjs/features/limitDca/constants.js +0 -13
  34. package/lib/cjs/features/limitDca/getClosedDcaOrders.js +0 -23
  35. package/lib/cjs/features/limitDca/getClosedLimitOrders.js +0 -22
  36. package/lib/cjs/features/limitDca/getDcaOrderExecutions.js +0 -23
  37. package/lib/cjs/features/limitDca/getOpenDcaOrders.js +0 -22
  38. package/lib/cjs/features/limitDca/getOpenLimitOrders.js +0 -22
  39. package/lib/cjs/features/limitDca/index.js +0 -26
  40. package/lib/cjs/features/limitDca/placeDcaOrder.js +0 -33
  41. package/lib/cjs/features/limitDca/placeLimitOrder.js +0 -27
  42. package/lib/cjs/features/limitDca/types.js +0 -16
  43. package/lib/cjs/features/metaAg/common.js +0 -103
  44. package/lib/cjs/features/metaAg/error.js +0 -31
  45. package/lib/cjs/features/metaAg/index.js +0 -268
  46. package/lib/cjs/features/metaAg/providers/bluefin7k.js +0 -57
  47. package/lib/cjs/features/metaAg/providers/cetus.js +0 -59
  48. package/lib/cjs/features/metaAg/providers/flowx.js +0 -52
  49. package/lib/cjs/features/metaAg/providers/okx.js +0 -182
  50. package/lib/cjs/features/prices/index.js +0 -99
  51. package/lib/cjs/index.js +0 -55
  52. package/lib/cjs/libs/url.js +0 -17
  53. package/lib/cjs/types/config/fetchClient.d.ts +0 -2
  54. package/lib/cjs/types/config/fetchClient.d.ts.map +0 -1
  55. package/lib/cjs/types/constants/_7k.d.ts +0 -6
  56. package/lib/cjs/types/constants/_7k.d.ts.map +0 -1
  57. package/lib/cjs/types/constants/apiEndpoints.d.ts +0 -7
  58. package/lib/cjs/types/constants/apiEndpoints.d.ts.map +0 -1
  59. package/lib/cjs/types/constants/sui.d.ts +0 -2
  60. package/lib/cjs/types/constants/sui.d.ts.map +0 -1
  61. package/lib/cjs/types/constants/tokens.d.ts +0 -5
  62. package/lib/cjs/types/constants/tokens.d.ts.map +0 -1
  63. package/lib/cjs/types/features/limitDca/cancelDcaOrder.d.ts +0 -9
  64. package/lib/cjs/types/features/limitDca/cancelDcaOrder.d.ts.map +0 -1
  65. package/lib/cjs/types/features/limitDca/cancelLimitOrder.d.ts +0 -9
  66. package/lib/cjs/types/features/limitDca/cancelLimitOrder.d.ts.map +0 -1
  67. package/lib/cjs/types/features/limitDca/claimExpiredLimitOrder.d.ts +0 -9
  68. package/lib/cjs/types/features/limitDca/claimExpiredLimitOrder.d.ts.map +0 -1
  69. package/lib/cjs/types/features/limitDca/constants.d.ts +0 -10
  70. package/lib/cjs/types/features/limitDca/constants.d.ts.map +0 -1
  71. package/lib/cjs/types/features/limitDca/getClosedDcaOrders.d.ts +0 -10
  72. package/lib/cjs/types/features/limitDca/getClosedDcaOrders.d.ts.map +0 -1
  73. package/lib/cjs/types/features/limitDca/getClosedLimitOrders.d.ts +0 -10
  74. package/lib/cjs/types/features/limitDca/getClosedLimitOrders.d.ts.map +0 -1
  75. package/lib/cjs/types/features/limitDca/getDcaOrderExecutions.d.ts +0 -10
  76. package/lib/cjs/types/features/limitDca/getDcaOrderExecutions.d.ts.map +0 -1
  77. package/lib/cjs/types/features/limitDca/getOpenDcaOrders.d.ts +0 -10
  78. package/lib/cjs/types/features/limitDca/getOpenDcaOrders.d.ts.map +0 -1
  79. package/lib/cjs/types/features/limitDca/getOpenLimitOrders.d.ts +0 -10
  80. package/lib/cjs/types/features/limitDca/getOpenLimitOrders.d.ts.map +0 -1
  81. package/lib/cjs/types/features/limitDca/index.d.ts +0 -11
  82. package/lib/cjs/types/features/limitDca/index.d.ts.map +0 -1
  83. package/lib/cjs/types/features/limitDca/placeDcaOrder.d.ts +0 -14
  84. package/lib/cjs/types/features/limitDca/placeDcaOrder.d.ts.map +0 -1
  85. package/lib/cjs/types/features/limitDca/placeLimitOrder.d.ts +0 -13
  86. package/lib/cjs/types/features/limitDca/placeLimitOrder.d.ts.map +0 -1
  87. package/lib/cjs/types/features/limitDca/types.d.ts +0 -98
  88. package/lib/cjs/types/features/limitDca/types.d.ts.map +0 -1
  89. package/lib/cjs/types/features/metaAg/common.d.ts +0 -24
  90. package/lib/cjs/types/features/metaAg/common.d.ts.map +0 -1
  91. package/lib/cjs/types/features/metaAg/error.d.ts +0 -54
  92. package/lib/cjs/types/features/metaAg/error.d.ts.map +0 -1
  93. package/lib/cjs/types/features/metaAg/index.d.ts +0 -42
  94. package/lib/cjs/types/features/metaAg/index.d.ts.map +0 -1
  95. package/lib/cjs/types/features/metaAg/providers/bluefin7k.d.ts +0 -11
  96. package/lib/cjs/types/features/metaAg/providers/bluefin7k.d.ts.map +0 -1
  97. package/lib/cjs/types/features/metaAg/providers/cetus.d.ts +0 -11
  98. package/lib/cjs/types/features/metaAg/providers/cetus.d.ts.map +0 -1
  99. package/lib/cjs/types/features/metaAg/providers/flowx.d.ts +0 -13
  100. package/lib/cjs/types/features/metaAg/providers/flowx.d.ts.map +0 -1
  101. package/lib/cjs/types/features/metaAg/providers/okx.d.ts +0 -21
  102. package/lib/cjs/types/features/metaAg/providers/okx.d.ts.map +0 -1
  103. package/lib/cjs/types/features/prices/index.d.ts +0 -18
  104. package/lib/cjs/types/features/prices/index.d.ts.map +0 -1
  105. package/lib/cjs/types/index.d.ts +0 -23
  106. package/lib/cjs/types/index.d.ts.map +0 -1
  107. package/lib/cjs/types/libs/url.d.ts +0 -2
  108. package/lib/cjs/types/libs/url.d.ts.map +0 -1
  109. package/lib/cjs/types/metaAg.js +0 -16
  110. package/lib/cjs/types/okx.js +0 -6
  111. package/lib/cjs/types/types/metaAg.d.ts +0 -165
  112. package/lib/cjs/types/types/metaAg.d.ts.map +0 -1
  113. package/lib/cjs/types/types/okx.d.ts +0 -206
  114. package/lib/cjs/types/types/okx.d.ts.map +0 -1
  115. package/lib/cjs/types/utils/ObjectCache.d.ts +0 -87
  116. package/lib/cjs/types/utils/ObjectCache.d.ts.map +0 -1
  117. package/lib/cjs/types/utils/SuiClientUtils.d.ts +0 -15
  118. package/lib/cjs/types/utils/SuiClientUtils.d.ts.map +0 -1
  119. package/lib/cjs/types/utils/sui.d.ts +0 -27
  120. package/lib/cjs/types/utils/sui.d.ts.map +0 -1
  121. package/lib/cjs/types/utils/swap.d.ts +0 -15
  122. package/lib/cjs/types/utils/swap.d.ts.map +0 -1
  123. package/lib/cjs/types/utils/token.d.ts +0 -4
  124. package/lib/cjs/types/utils/token.d.ts.map +0 -1
  125. package/lib/cjs/utils/ObjectCache.js +0 -273
  126. package/lib/cjs/utils/SuiClientUtils.js +0 -50
  127. package/lib/cjs/utils/sui.js +0 -96
  128. package/lib/cjs/utils/swap.js +0 -37
  129. package/lib/cjs/utils/token.js +0 -15
  130. package/lib/esm/config/fetchClient.js +0 -9
  131. package/lib/esm/constants/_7k.js +0 -17
  132. package/lib/esm/constants/apiEndpoints.js +0 -6
  133. package/lib/esm/constants/sui.js +0 -1
  134. package/lib/esm/constants/tokens.js +0 -4
  135. package/lib/esm/features/limitDca/cancelDcaOrder.js +0 -11
  136. package/lib/esm/features/limitDca/cancelLimitOrder.js +0 -11
  137. package/lib/esm/features/limitDca/claimExpiredLimitOrder.js +0 -11
  138. package/lib/esm/features/limitDca/constants.js +0 -10
  139. package/lib/esm/features/limitDca/getClosedDcaOrders.js +0 -20
  140. package/lib/esm/features/limitDca/getClosedLimitOrders.js +0 -19
  141. package/lib/esm/features/limitDca/getDcaOrderExecutions.js +0 -20
  142. package/lib/esm/features/limitDca/getOpenDcaOrders.js +0 -19
  143. package/lib/esm/features/limitDca/getOpenLimitOrders.js +0 -19
  144. package/lib/esm/features/limitDca/index.js +0 -10
  145. package/lib/esm/features/limitDca/placeDcaOrder.js +0 -30
  146. package/lib/esm/features/limitDca/placeLimitOrder.js +0 -24
  147. package/lib/esm/features/limitDca/types.js +0 -13
  148. package/lib/esm/features/metaAg/common.js +0 -96
  149. package/lib/esm/features/metaAg/error.js +0 -29
  150. package/lib/esm/features/metaAg/index.js +0 -234
  151. package/lib/esm/features/metaAg/providers/bluefin7k.js +0 -55
  152. package/lib/esm/features/metaAg/providers/cetus.js +0 -57
  153. package/lib/esm/features/metaAg/providers/flowx.js +0 -51
  154. package/lib/esm/features/metaAg/providers/okx.js +0 -147
  155. package/lib/esm/features/prices/index.js +0 -94
  156. package/lib/esm/index.mjs +0 -31
  157. package/lib/esm/libs/url.js +0 -14
  158. package/lib/esm/types/config/fetchClient.d.ts +0 -2
  159. package/lib/esm/types/config/fetchClient.d.ts.map +0 -1
  160. package/lib/esm/types/constants/_7k.d.ts +0 -6
  161. package/lib/esm/types/constants/_7k.d.ts.map +0 -1
  162. package/lib/esm/types/constants/apiEndpoints.d.ts +0 -7
  163. package/lib/esm/types/constants/apiEndpoints.d.ts.map +0 -1
  164. package/lib/esm/types/constants/sui.d.ts +0 -2
  165. package/lib/esm/types/constants/sui.d.ts.map +0 -1
  166. package/lib/esm/types/constants/tokens.d.ts +0 -5
  167. package/lib/esm/types/constants/tokens.d.ts.map +0 -1
  168. package/lib/esm/types/features/limitDca/cancelDcaOrder.d.ts +0 -9
  169. package/lib/esm/types/features/limitDca/cancelDcaOrder.d.ts.map +0 -1
  170. package/lib/esm/types/features/limitDca/cancelLimitOrder.d.ts +0 -9
  171. package/lib/esm/types/features/limitDca/cancelLimitOrder.d.ts.map +0 -1
  172. package/lib/esm/types/features/limitDca/claimExpiredLimitOrder.d.ts +0 -9
  173. package/lib/esm/types/features/limitDca/claimExpiredLimitOrder.d.ts.map +0 -1
  174. package/lib/esm/types/features/limitDca/constants.d.ts +0 -10
  175. package/lib/esm/types/features/limitDca/constants.d.ts.map +0 -1
  176. package/lib/esm/types/features/limitDca/getClosedDcaOrders.d.ts +0 -10
  177. package/lib/esm/types/features/limitDca/getClosedDcaOrders.d.ts.map +0 -1
  178. package/lib/esm/types/features/limitDca/getClosedLimitOrders.d.ts +0 -10
  179. package/lib/esm/types/features/limitDca/getClosedLimitOrders.d.ts.map +0 -1
  180. package/lib/esm/types/features/limitDca/getDcaOrderExecutions.d.ts +0 -10
  181. package/lib/esm/types/features/limitDca/getDcaOrderExecutions.d.ts.map +0 -1
  182. package/lib/esm/types/features/limitDca/getOpenDcaOrders.d.ts +0 -10
  183. package/lib/esm/types/features/limitDca/getOpenDcaOrders.d.ts.map +0 -1
  184. package/lib/esm/types/features/limitDca/getOpenLimitOrders.d.ts +0 -10
  185. package/lib/esm/types/features/limitDca/getOpenLimitOrders.d.ts.map +0 -1
  186. package/lib/esm/types/features/limitDca/index.d.ts +0 -11
  187. package/lib/esm/types/features/limitDca/index.d.ts.map +0 -1
  188. package/lib/esm/types/features/limitDca/placeDcaOrder.d.ts +0 -14
  189. package/lib/esm/types/features/limitDca/placeDcaOrder.d.ts.map +0 -1
  190. package/lib/esm/types/features/limitDca/placeLimitOrder.d.ts +0 -13
  191. package/lib/esm/types/features/limitDca/placeLimitOrder.d.ts.map +0 -1
  192. package/lib/esm/types/features/limitDca/types.d.ts +0 -98
  193. package/lib/esm/types/features/limitDca/types.d.ts.map +0 -1
  194. package/lib/esm/types/features/metaAg/common.d.ts +0 -24
  195. package/lib/esm/types/features/metaAg/common.d.ts.map +0 -1
  196. package/lib/esm/types/features/metaAg/error.d.ts +0 -54
  197. package/lib/esm/types/features/metaAg/error.d.ts.map +0 -1
  198. package/lib/esm/types/features/metaAg/index.d.ts +0 -42
  199. package/lib/esm/types/features/metaAg/index.d.ts.map +0 -1
  200. package/lib/esm/types/features/metaAg/providers/bluefin7k.d.ts +0 -11
  201. package/lib/esm/types/features/metaAg/providers/bluefin7k.d.ts.map +0 -1
  202. package/lib/esm/types/features/metaAg/providers/cetus.d.ts +0 -11
  203. package/lib/esm/types/features/metaAg/providers/cetus.d.ts.map +0 -1
  204. package/lib/esm/types/features/metaAg/providers/flowx.d.ts +0 -13
  205. package/lib/esm/types/features/metaAg/providers/flowx.d.ts.map +0 -1
  206. package/lib/esm/types/features/metaAg/providers/okx.d.ts +0 -21
  207. package/lib/esm/types/features/metaAg/providers/okx.d.ts.map +0 -1
  208. package/lib/esm/types/features/prices/index.d.ts +0 -18
  209. package/lib/esm/types/features/prices/index.d.ts.map +0 -1
  210. package/lib/esm/types/index.d.ts +0 -23
  211. package/lib/esm/types/index.d.ts.map +0 -1
  212. package/lib/esm/types/libs/url.d.ts +0 -2
  213. package/lib/esm/types/libs/url.d.ts.map +0 -1
  214. package/lib/esm/types/metaAg.js +0 -11
  215. package/lib/esm/types/okx.js +0 -5
  216. package/lib/esm/types/types/metaAg.d.ts +0 -165
  217. package/lib/esm/types/types/metaAg.d.ts.map +0 -1
  218. package/lib/esm/types/types/okx.d.ts +0 -206
  219. package/lib/esm/types/types/okx.d.ts.map +0 -1
  220. package/lib/esm/types/utils/ObjectCache.d.ts +0 -87
  221. package/lib/esm/types/utils/ObjectCache.d.ts.map +0 -1
  222. package/lib/esm/types/utils/SuiClientUtils.d.ts +0 -15
  223. package/lib/esm/types/utils/SuiClientUtils.d.ts.map +0 -1
  224. package/lib/esm/types/utils/sui.d.ts +0 -27
  225. package/lib/esm/types/utils/sui.d.ts.map +0 -1
  226. package/lib/esm/types/utils/swap.d.ts +0 -15
  227. package/lib/esm/types/utils/swap.d.ts.map +0 -1
  228. package/lib/esm/types/utils/token.d.ts +0 -4
  229. package/lib/esm/types/utils/token.d.ts.map +0 -1
  230. package/lib/esm/utils/ObjectCache.js +0 -250
  231. package/lib/esm/utils/SuiClientUtils.js +0 -34
  232. package/lib/esm/utils/sui.js +0 -92
  233. package/lib/esm/utils/swap.js +0 -33
  234. package/lib/esm/utils/token.js +0 -10
@@ -1,234 +0,0 @@
1
- import { getFullnodeUrl, SuiClient, } from "@mysten/sui/client";
2
- import { coinWithBalance, Transaction, } from "@mysten/sui/transactions";
3
- import { normalizeStructTag, toBase64 } from "@mysten/sui/utils";
4
- import { SUI_ADDRESS_ZERO } from "../../constants/sui";
5
- import { EProvider, isAggregatorProvider, isSwapAPIProvider, } from "../../types/metaAg";
6
- import { isSystemAddress } from "../../utils/sui";
7
- import { SuiClientUtils } from "../../utils/SuiClientUtils";
8
- import { getExpectedReturn } from "../../utils/swap";
9
- import { metaSettle, simulateAggregator, timeout } from "./common";
10
- import { MetaAgError, MetaAgErrorCode } from "./error";
11
- import { OkxProvider, simulateOKXSwap } from "./providers/okx";
12
- const HERMES_API = "https://hermes.pyth.network";
13
- const DEFAULT_PROVIDERS = {
14
- [EProvider.BLUEFIN7K]: {},
15
- [EProvider.FLOWX]: {},
16
- [EProvider.CETUS]: {},
17
- };
18
- export class MetaAg {
19
- client;
20
- providers = {};
21
- inspector;
22
- options;
23
- constructor(options) {
24
- this.options = {
25
- providers: { ...DEFAULT_PROVIDERS, ...options?.providers },
26
- slippageBps: options?.slippageBps ?? 100,
27
- fullnodeUrl: options?.fullnodeUrl ?? getFullnodeUrl("mainnet"),
28
- hermesApi: options?.hermesApi ?? HERMES_API,
29
- partner: options?.partner ?? SUI_ADDRESS_ZERO,
30
- partnerCommissionBps: options?.partnerCommissionBps ?? 0,
31
- tipBps: options?.tipBps ?? 0,
32
- };
33
- this.client = new SuiClient({
34
- url: this.options.fullnodeUrl,
35
- });
36
- this.inspector = new SuiClientUtils(this.client);
37
- }
38
- async _getProvider(provider) {
39
- const p = this.providers[provider];
40
- if (p)
41
- return p;
42
- const providerOptions = this.options.providers[provider];
43
- MetaAgError.assert(!!providerOptions, `Provider not found: ${provider}`, MetaAgErrorCode.PROVIDER_NOT_FOUND, { provider });
44
- switch (provider) {
45
- case EProvider.BLUEFIN7K:
46
- const { Bluefin7kProvider } = await import("./providers/bluefin7k").catch(catchImportError(EProvider.BLUEFIN7K));
47
- this.providers[EProvider.BLUEFIN7K] = new Bluefin7kProvider(providerOptions, this.options, this.client);
48
- break;
49
- case EProvider.FLOWX:
50
- const { FlowxProvider } = await import("./providers/flowx").catch(catchImportError(EProvider.FLOWX));
51
- this.providers[EProvider.FLOWX] = new FlowxProvider(providerOptions, this.client);
52
- break;
53
- case EProvider.CETUS:
54
- const { CetusProvider } = await import("./providers/cetus").catch(catchImportError(EProvider.CETUS));
55
- this.providers[EProvider.CETUS] = new CetusProvider(providerOptions, this.options, this.client);
56
- break;
57
- case EProvider.OKX:
58
- this.providers[EProvider.OKX] = new OkxProvider(providerOptions, this.options, this.client);
59
- break;
60
- default:
61
- throw new MetaAgError(`Provider not supported: ${provider}`, MetaAgErrorCode.PROVIDER_NOT_SUPPORTED, { provider });
62
- }
63
- return this.providers[provider];
64
- }
65
- async _simulate(provider, quote, simulation) {
66
- try {
67
- if (isAggregatorProvider(provider)) {
68
- return simulateAggregator(provider, quote, simulation, this.inspector, this.options);
69
- }
70
- switch (quote.provider) {
71
- case EProvider.OKX:
72
- return simulateOKXSwap(quote, this.inspector, simulation, this.options);
73
- default:
74
- throw new MetaAgError(`Provider not supported: ${provider.kind}`, MetaAgErrorCode.PROVIDER_NOT_SUPPORTED, { provider: provider.kind });
75
- }
76
- }
77
- catch (error) {
78
- console.warn(error, { provider: provider.kind, quote: quote.id });
79
- }
80
- }
81
- async _quote(provider, options) {
82
- const quote = await timeout(async () => {
83
- const quote = await provider.quote(options);
84
- if (!quote)
85
- return null;
86
- const { expectedAmount } = getExpectedReturn(quote.rawAmountOut, 0, this.options.partnerCommissionBps, this.options.tipBps);
87
- quote.amountOut = expectedAmount;
88
- return quote;
89
- }, options.timeout ?? 2000, `quote for ${provider.kind} provider from ${options.coinTypeIn} to ${options.coinTypeOut}`);
90
- return quote;
91
- }
92
- async _fastSwap({ quote, signer, useGasCoin, signTransaction }, getTransactionBlockParams) {
93
- const tx = new Transaction();
94
- const coin = await this.swap({
95
- quote,
96
- signer,
97
- tx,
98
- coinIn: coinWithBalance({
99
- type: quote.coinTypeIn,
100
- balance: BigInt(quote.amountIn),
101
- useGasCoin,
102
- }),
103
- });
104
- tx.transferObjects([coin], signer);
105
- tx.setSenderIfNotSet(signer);
106
- const txBytes = await tx.build({ client: this.client });
107
- const { signature, bytes } = await signTransaction(toBase64(txBytes));
108
- return this.client.executeTransactionBlock({
109
- transactionBlock: bytes,
110
- signature,
111
- options: getTransactionBlockParams?.options,
112
- signal: getTransactionBlockParams?.signal,
113
- });
114
- }
115
- /**
116
- * Get quotes from all providers
117
- * @param options - quote options
118
- * @param simulation - if present, the quote will be simulated
119
- * @returns quotes from all providers
120
- */
121
- async quote(options, simulation) {
122
- const opts = {
123
- ...options,
124
- coinTypeIn: normalizeStructTag(options.coinTypeIn),
125
- coinTypeOut: normalizeStructTag(options.coinTypeOut),
126
- };
127
- const quotes = await Promise.allSettled(Object.entries(this.options.providers)
128
- .filter(([_k, v]) => !v.disabled)
129
- .map(async ([provider]) => {
130
- const p = await this._getProvider(provider);
131
- return this._quote(p, opts);
132
- }));
133
- const result = quotes
134
- .map((quote) => quote.status === "fulfilled"
135
- ? quote.value
136
- : (console.log(quote.reason), null))
137
- .filter((quote) => quote !== null);
138
- if (simulation) {
139
- const requests = result.map(async (quote) => {
140
- const provider = await this._getProvider(quote.provider);
141
- const updated = await this._simulate(provider, quote, simulation);
142
- quote.simulatedAmountOut = updated?.simulatedAmountOut;
143
- quote.gasUsed = updated?.gasUsed;
144
- simulation?.onSimulated?.({ ...quote });
145
- });
146
- if (!simulation.onSimulated) {
147
- await Promise.all(requests);
148
- }
149
- }
150
- return result;
151
- }
152
- /**
153
- * Build transaction from quote
154
- * @info Use this function to build composable transaction (ie: add more commands after the swap, consume the coin out object)
155
- * @warning Providers that build transaction on the fly (typically RFQ, Swap-API providers ie: Okx, ...) are not supported, please use `fastSwap` instead
156
- * @param options - build tx options
157
- * @param slippageBps - slippage bps if not specified, fallback to global slippage bps, if none of them specified, default to 100
158
- * @returns coin out object, you must consume it by transferObjects, or other sub sequence commands
159
- */
160
- async swap(options, slippageBps) {
161
- const provider = await this._getProvider(options.quote.provider);
162
- MetaAgError.assert(!!provider, `Provider not found: ${options.quote.provider}`, MetaAgErrorCode.PROVIDER_NOT_FOUND, { provider: options.quote.provider });
163
- MetaAgError.assert(isAggregatorProvider(provider), `Provider does not support swap: ${provider.kind}, use fastSwap instead`, MetaAgErrorCode.PROVIDER_NOT_SUPPORT_SWAP, { provider: provider.kind });
164
- MetaAgError.assert(!isSystemAddress(options.signer), "Invalid signer address", MetaAgErrorCode.INVALID_SIGNER_ADDRESS, { signer: options.signer });
165
- const coinOut = await provider.swap(options);
166
- options.tx.add(metaSettle(options.quote, coinOut, slippageBps ?? this.options.slippageBps ?? 100, this.options.tipBps, this.options.partner, this.options.partnerCommissionBps));
167
- options.tx.setSenderIfNotSet(options.signer);
168
- return coinOut;
169
- }
170
- /**
171
- * Build, Sign, and Execute transaction in one step
172
- * @param options - fast swap options
173
- * @returns - txDigest of the transaction
174
- */
175
- async fastSwap(options, getTransactionBlockParams) {
176
- MetaAgError.assert(!isSystemAddress(options.signer), "Invalid signer address", MetaAgErrorCode.INVALID_SIGNER_ADDRESS, { signer: options.signer });
177
- const provider = await this._getProvider(options.quote.provider);
178
- if (isAggregatorProvider(provider)) {
179
- return this._fastSwap(options, getTransactionBlockParams);
180
- }
181
- else if (isSwapAPIProvider(provider)) {
182
- return this.client.waitForTransaction({
183
- ...getTransactionBlockParams,
184
- digest: await provider.fastSwap(options),
185
- });
186
- }
187
- else {
188
- throw new MetaAgError(`Provider not supported: ${provider.kind}`, MetaAgErrorCode.PROVIDER_NOT_SUPPORTED, { provider: provider.kind });
189
- }
190
- }
191
- /**
192
- * Update meta aggregator options
193
- * @param options - update options payload
194
- */
195
- updateMetaAgOptions(options) {
196
- if (Object.keys(options).length === 0)
197
- return;
198
- this.options.slippageBps = options.slippageBps ?? this.options.slippageBps;
199
- this.options.partner = options.partner ?? this.options.partner;
200
- this.options.partnerCommissionBps =
201
- options.partnerCommissionBps ?? this.options.partnerCommissionBps;
202
- this.options.tipBps = options.tipBps ?? this.options.tipBps;
203
- if (options.fullnodeUrl &&
204
- options.fullnodeUrl !== this.options.fullnodeUrl) {
205
- this.client = new SuiClient({ url: options.fullnodeUrl });
206
- this.inspector = new SuiClientUtils(this.client);
207
- this.options.fullnodeUrl = options.fullnodeUrl;
208
- }
209
- if (options.hermesApi && options.hermesApi !== this.options.hermesApi) {
210
- this.providers = {};
211
- this.options.hermesApi = options.hermesApi;
212
- }
213
- // if update provider's options, we need to re-initialize the provider
214
- for (const [provider, opt] of Object.entries(options.providers || {})) {
215
- this.options.providers[provider] = {
216
- ...opt,
217
- ...this.options.providers[provider],
218
- };
219
- delete this.providers[provider];
220
- }
221
- }
222
- }
223
- const catchImportError = (provider) => {
224
- return (e) => {
225
- const map = {
226
- [EProvider.CETUS]: "@cetusprotocol/aggregator-sdk",
227
- [EProvider.FLOWX]: "@flowx-finance/sdk",
228
- [EProvider.BLUEFIN7K]: "@bluefin-exchange/bluefin7k-aggregator-sdk",
229
- [EProvider.OKX]: "",
230
- };
231
- console.warn(`Please install ${map[provider]} to use ${provider} provider`);
232
- throw e;
233
- };
234
- };
@@ -1,55 +0,0 @@
1
- import { buildTx, Config, getQuote, } from "@bluefin-exchange/bluefin7k-aggregator-sdk";
2
- import { v4 } from "uuid";
3
- import { _7K_PARTNER_ADDRESS } from "../../../constants/_7k";
4
- import { EProvider, } from "../../../types/metaAg";
5
- import { MetaAgError, MetaAgErrorCode } from "../error";
6
- export class Bluefin7kProvider {
7
- options;
8
- metaOptions;
9
- kind = EProvider.BLUEFIN7K;
10
- constructor(options, metaOptions, client) {
11
- this.options = options;
12
- this.metaOptions = metaOptions;
13
- if (options.apiKey)
14
- Config.setApiKey(options.apiKey);
15
- Config.setSuiClient(client);
16
- }
17
- async quote(quoteOptions) {
18
- const quote = await getQuote({
19
- tokenIn: quoteOptions.coinTypeIn,
20
- tokenOut: quoteOptions.coinTypeOut,
21
- amountIn: quoteOptions.amountIn,
22
- sources: this.options.sources,
23
- excludedPools: this.options.excludedPools,
24
- targetPools: this.options.targetPools,
25
- });
26
- MetaAgError.assert(!!quote, "No quote found", MetaAgErrorCode.QUOTE_NOT_FOUND, { provider: this.kind });
27
- return {
28
- id: v4(),
29
- provider: EProvider.BLUEFIN7K,
30
- quote,
31
- amountIn: quote.swapAmountWithDecimal,
32
- rawAmountOut: quote.returnAmountWithDecimal,
33
- amountOut: quote.returnAmountWithDecimal,
34
- coinTypeIn: quoteOptions.coinTypeIn,
35
- coinTypeOut: quoteOptions.coinTypeOut,
36
- };
37
- }
38
- async swap({ quote, signer, tx, coinIn }) {
39
- MetaAgError.assert(quote.provider === EProvider.BLUEFIN7K, "Invalid quote", MetaAgErrorCode.INVALID_QUOTE, { quote, expectedProvider: EProvider.BLUEFIN7K });
40
- const { coinOut } = await buildTx({
41
- quoteResponse: quote.quote,
42
- accountAddress: signer,
43
- commission: {
44
- commissionBps: 0,
45
- partner: _7K_PARTNER_ADDRESS,
46
- },
47
- slippage: 1,
48
- extendTx: {
49
- tx,
50
- coinIn,
51
- },
52
- });
53
- return coinOut;
54
- }
55
- }
@@ -1,57 +0,0 @@
1
- import { AggregatorClient, Env } from "@cetusprotocol/aggregator-sdk";
2
- import { v4 } from "uuid";
3
- import { _7K_PARTNER_ADDRESS } from "../../../constants/_7k";
4
- import { EProvider, } from "../../../types/metaAg";
5
- import { MetaAgError, MetaAgErrorCode } from "../error";
6
- export class CetusProvider {
7
- options;
8
- kind = EProvider.CETUS;
9
- cetusClient;
10
- constructor(options, metaOptions, client) {
11
- this.options = options;
12
- this.cetusClient = new AggregatorClient({
13
- apiKey: options.apiKey,
14
- client,
15
- endpoint: options.api,
16
- env: Env.Mainnet,
17
- pythUrls: metaOptions.hermesApi ? [metaOptions.hermesApi] : [],
18
- overlayFeeRate: 0,
19
- overlayFeeReceiver: _7K_PARTNER_ADDRESS,
20
- });
21
- }
22
- async quote(quoteOptions) {
23
- const quote = await this.cetusClient.findRouters({
24
- amount: quoteOptions.amountIn,
25
- byAmountIn: true,
26
- from: quoteOptions.coinTypeIn,
27
- target: quoteOptions.coinTypeOut,
28
- providers: this.options.sources,
29
- splitCount: this.options.splitCount,
30
- splitAlgorithm: this.options.splitAlgorithm,
31
- splitFactor: this.options.splitFactor,
32
- depth: this.options.depth,
33
- liquidityChanges: this.options.liquidityChanges,
34
- });
35
- MetaAgError.assert(!!quote, "No quote found", MetaAgErrorCode.QUOTE_NOT_FOUND, { provider: this.kind });
36
- return {
37
- id: v4(),
38
- provider: EProvider.CETUS,
39
- quote,
40
- amountIn: quote.amountIn.toString() || "0",
41
- rawAmountOut: quote.amountOut.toString() || "0",
42
- amountOut: quote.amountOut.toString() || "0",
43
- coinTypeIn: quoteOptions.coinTypeIn,
44
- coinTypeOut: quoteOptions.coinTypeOut,
45
- };
46
- }
47
- async swap(options) {
48
- MetaAgError.assert(options.quote.provider === EProvider.CETUS, "Expect Cetus quote", MetaAgErrorCode.INVALID_QUOTE, { quote: options.quote, expectedProvider: EProvider.CETUS });
49
- const coinOut = await this.cetusClient.routerSwap({
50
- inputCoin: options.coinIn,
51
- router: options.quote.quote,
52
- slippage: 1,
53
- txb: options.tx,
54
- });
55
- return coinOut;
56
- }
57
- }
@@ -1,51 +0,0 @@
1
- import { AggregatorQuoter, Commission, CommissionType, TradeBuilder, } from "@flowx-finance/sdk";
2
- import { v4 } from "uuid";
3
- import { _7K_PARTNER_ADDRESS } from "../../../constants/_7k";
4
- import { EProvider, } from "../../../types/metaAg";
5
- import { MetaAgError, MetaAgErrorCode } from "../error";
6
- export class FlowxProvider {
7
- options;
8
- client;
9
- kind = EProvider.FLOWX;
10
- quoter;
11
- constructor(options, client) {
12
- this.options = options;
13
- this.client = client;
14
- this.quoter = new AggregatorQuoter("mainnet", options.apiKey);
15
- }
16
- async quote(quoteOptions) {
17
- const quote = await this.quoter.getRoutes({
18
- amountIn: quoteOptions.amountIn,
19
- tokenIn: quoteOptions.coinTypeIn,
20
- tokenOut: quoteOptions.coinTypeOut,
21
- includeSources: this.options.sources,
22
- excludePools: this.options.excludePools,
23
- excludeSources: this.options.excludeSources,
24
- maxHops: this.options.maxHops,
25
- splitDistributionPercent: this.options.splitDistributionPercent,
26
- });
27
- return {
28
- id: v4(),
29
- provider: EProvider.FLOWX,
30
- quote: quote,
31
- amountIn: quote.amountIn?.toString() ?? "0",
32
- rawAmountOut: quote.amountOut?.toString() ?? "0",
33
- amountOut: quote.amountOut?.toString() ?? "0",
34
- coinTypeIn: quoteOptions.coinTypeIn,
35
- coinTypeOut: quoteOptions.coinTypeOut,
36
- };
37
- }
38
- async swap(options) {
39
- MetaAgError.assert(options.quote.provider === EProvider.FLOWX, "Invalid quote", MetaAgErrorCode.INVALID_QUOTE, { quote: options.quote, expectedProvider: EProvider.FLOWX });
40
- const builder = new TradeBuilder("mainnet", options.quote.quote.routes);
41
- builder.sender(options.signer);
42
- builder.slippage(10000 * 100);
43
- builder.commission(new Commission(_7K_PARTNER_ADDRESS, options.quote.quote.coinOut, CommissionType.PERCENTAGE, 0, true));
44
- const res = await builder.build().swap({
45
- tx: options.tx,
46
- client: this.client,
47
- coinIn: options.coinIn,
48
- });
49
- return res;
50
- }
51
- }
@@ -1,147 +0,0 @@
1
- import { Commands, Transaction, TransactionDataBuilder, } from "@mysten/sui/transactions";
2
- import { normalizeStructTag, normalizeSuiAddress, toBase64, } from "@mysten/sui/utils";
3
- import { v4 } from "uuid";
4
- import { SUI_TYPE } from "../../../constants/tokens";
5
- import { EProvider, } from "../../../types/metaAg";
6
- import { isSystemAddress } from "../../../utils/sui";
7
- import { metaSettle, simulateSwapTx } from "../common";
8
- import { MetaAgError, MetaAgErrorCode } from "../error";
9
- const API = "https://web3.okx.com";
10
- const SWAP_PATH = "/api/v6/dex/aggregator/swap";
11
- const CHAIN_ID = "784";
12
- const NORMALIZED_SUI_TYPE = normalizeStructTag(SUI_TYPE);
13
- export class OkxProvider {
14
- options;
15
- metaOptions;
16
- client;
17
- kind = EProvider.OKX;
18
- constructor(options, metaOptions, client) {
19
- this.options = options;
20
- this.metaOptions = metaOptions;
21
- this.client = client;
22
- }
23
- async quote({ amountIn, coinTypeIn, coinTypeOut, signer, }) {
24
- if (!signer || isSystemAddress(signer))
25
- return null;
26
- const request = {
27
- chainIndex: CHAIN_ID,
28
- amount: amountIn,
29
- fromTokenAddress: coinTypeIn === NORMALIZED_SUI_TYPE ? SUI_TYPE : coinTypeIn,
30
- toTokenAddress: coinTypeOut === NORMALIZED_SUI_TYPE ? SUI_TYPE : coinTypeOut,
31
- slippagePercent: (this.metaOptions.slippageBps / 100).toString(),
32
- userWalletAddress: signer,
33
- };
34
- const queryString = "?" + new URLSearchParams(request).toString();
35
- const url = `${this.options.api ?? API}${SWAP_PATH}${queryString}`;
36
- const response = await fetch(url, {
37
- headers: await getHeaders(this.options, "GET", SWAP_PATH, queryString),
38
- });
39
- const quote = (await response.json());
40
- MetaAgError.assert(quote.code === "0" && quote.data.length > 0, "No quote found", MetaAgErrorCode.QUOTE_NOT_FOUND, { provider: this.kind });
41
- return {
42
- id: v4(),
43
- provider: this.kind,
44
- coinTypeIn,
45
- coinTypeOut,
46
- amountIn,
47
- amountOut: quote.data[0].routerResult.toTokenAmount,
48
- rawAmountOut: quote.data[0].routerResult.toTokenAmount,
49
- quote: quote.data[0],
50
- };
51
- }
52
- async fastSwap(options) {
53
- const { quote, signer, signTransaction } = options;
54
- MetaAgError.assert(quote.provider === EProvider.OKX, "Invalid quote", MetaAgErrorCode.INVALID_QUOTE, { quote, expectedProvider: EProvider.OKX });
55
- const { tx, coin } = buildTx({ quote, signer });
56
- tx.add(metaSettle(quote, coin, this.metaOptions.slippageBps, this.metaOptions.tipBps, this.metaOptions.partner, this.metaOptions.partnerCommissionBps));
57
- tx.transferObjects([coin], signer);
58
- const txBytes = await tx.build({ client: this.client });
59
- const { bytes, signature } = await signTransaction(toBase64(txBytes));
60
- const res = await this.client.executeTransactionBlock({
61
- signature,
62
- transactionBlock: bytes,
63
- });
64
- return res.digest;
65
- }
66
- }
67
- async function generateHmacSha256(message, secretKey) {
68
- const encoder = new TextEncoder();
69
- const encodeBase64 = (bytes) => {
70
- if (typeof Buffer !== "undefined") {
71
- return Buffer.from(bytes).toString("base64");
72
- }
73
- let binary = "";
74
- for (let i = 0; i < bytes.byteLength; i++) {
75
- binary += String.fromCharCode(bytes[i]);
76
- }
77
- if (typeof btoa !== "undefined") {
78
- return btoa(binary);
79
- }
80
- throw new MetaAgError("Base64 encoder not available in this environment");
81
- };
82
- if (typeof globalThis !== "undefined" && globalThis.crypto?.subtle) {
83
- const key = await globalThis.crypto.subtle.importKey("raw", encoder.encode(secretKey), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
84
- const signature = await globalThis.crypto.subtle.sign("HMAC", key, encoder.encode(message));
85
- return encodeBase64(new Uint8Array(signature));
86
- }
87
- const { createHmac } = await import("node:crypto");
88
- return createHmac("sha256", secretKey).update(message).digest("base64");
89
- }
90
- async function getHeaders(options, method, requestPath, queryString = "") {
91
- const { apiKey, secretKey, apiPassphrase, projectId } = options;
92
- if (!apiKey || !secretKey || !apiPassphrase || !projectId) {
93
- throw new MetaAgError("Missing required environment variables");
94
- }
95
- const timestamp = new Date().toISOString();
96
- const stringToSign = timestamp + method + requestPath + queryString;
97
- return {
98
- "Content-Type": "application/json",
99
- "OK-ACCESS-KEY": apiKey,
100
- "OK-ACCESS-SIGN": await generateHmacSha256(stringToSign, secretKey),
101
- "OK-ACCESS-TIMESTAMP": timestamp,
102
- "OK-ACCESS-PASSPHRASE": apiPassphrase,
103
- "OK-ACCESS-PROJECT": projectId,
104
- };
105
- }
106
- const replaceFinalizeCommand = (tx, packageId) => {
107
- const builder = TransactionDataBuilder.restore(tx.getData());
108
- const i = builder.commands.findIndex((cmd) => cmd.$kind === "MoveCall" &&
109
- normalizeSuiAddress(cmd.MoveCall.package) ===
110
- normalizeSuiAddress(packageId) &&
111
- cmd.MoveCall.module === "router" &&
112
- cmd.MoveCall.function === "finalize");
113
- const cmd = builder.commands[i];
114
- MetaAgError.assert(cmd.MoveCall, "OKX: Finalize command not found", MetaAgErrorCode.OKX_FINALIZE_COMMAND_NOT_FOUND, { packageId });
115
- builder.replaceCommand(i, Commands.MoveCall({
116
- package: packageId,
117
- module: "router",
118
- function: "finalize_without_transfer",
119
- typeArguments: cmd.MoveCall.typeArguments,
120
- arguments: [
121
- cmd.MoveCall.arguments[0],
122
- cmd.MoveCall.arguments[5],
123
- cmd.MoveCall.arguments[6],
124
- ],
125
- }));
126
- const tx2 = Transaction.from(builder.build());
127
- return { tx: tx2, coin: { NestedResult: [i, 0] } };
128
- };
129
- const buildTx = (options) => {
130
- const { quote, signer } = options;
131
- MetaAgError.assert(quote.provider === EProvider.OKX, "Invalid quote", MetaAgErrorCode.INVALID_QUOTE, { quote, expectedProvider: EProvider.OKX });
132
- const tx = Transaction.from(quote.quote.tx.data);
133
- tx.setSenderIfNotSet(signer);
134
- const { tx: tx2, coin } = replaceFinalizeCommand(tx, quote.quote.tx.to);
135
- return { tx: tx2, coin };
136
- };
137
- export const simulateOKXSwap = async (quote, inspector, simulation, metaOptions) => {
138
- const { tx, coin } = buildTx({ quote, signer: quote.quote.tx.from });
139
- tx.add(metaSettle(quote, coin, 10000, metaOptions.tipBps, metaOptions.partner, metaOptions.partnerCommissionBps));
140
- tx.transferObjects([coin], quote.quote.tx.from);
141
- const res = await simulateSwapTx(tx, inspector, simulation);
142
- return {
143
- id: quote.id,
144
- provider: quote.provider,
145
- ...res,
146
- };
147
- };
@@ -1,94 +0,0 @@
1
- import { fetchClient } from "../../config/fetchClient";
2
- import { API_ENDPOINTS } from "../../constants/apiEndpoints";
3
- import { SUI_FULL_TYPE } from "../../constants/tokens";
4
- import { normalizeTokenType } from "../../utils/token";
5
- const chunkArray = (array, chunkSize) => {
6
- const chunks = [];
7
- for (let i = 0; i < array.length; i += chunkSize) {
8
- chunks.push(array.slice(i, i + chunkSize));
9
- }
10
- return chunks;
11
- };
12
- const MAX_TOTAL_IDS = 500;
13
- const MAX_IDS_PER_REQUEST = 100;
14
- /**
15
- * Get the current Unix timestamp as a string
16
- */
17
- function getCurrentTimestamp() {
18
- return Math.floor(Date.now() / 1000).toString();
19
- }
20
- /**
21
- * Get price for a single token
22
- * @param id - Token ID (coin type)
23
- * @returns Token price, or 0 if not found or on error
24
- */
25
- export async function getTokenPrice(id) {
26
- try {
27
- const normalizedId = normalizeTokenType(id);
28
- const prices = await getTokenPrices([normalizedId]);
29
- return prices[normalizedId] || 0;
30
- }
31
- catch (_) {
32
- return 0;
33
- }
34
- }
35
- /**
36
- * Get prices for multiple tokens
37
- * @param ids - Array of token IDs (coin types)
38
- * @returns Record mapping token IDs to their prices
39
- */
40
- export async function getTokenPrices(ids) {
41
- try {
42
- if (ids.length === 0) {
43
- return {};
44
- }
45
- const limitedIds = ids.slice(0, MAX_TOTAL_IDS).map(normalizeTokenType);
46
- const idChunks = chunkArray(limitedIds, MAX_IDS_PER_REQUEST);
47
- const timestamp = getCurrentTimestamp();
48
- const responses = await Promise.all(idChunks.map(async (chunk) => {
49
- const requestBody = {
50
- timestamp,
51
- token_ids: chunk,
52
- };
53
- const response = await fetchClient(`${API_ENDPOINTS.PRICES}/prices/batch`, {
54
- method: "POST",
55
- headers: {
56
- "Content-Type": "application/json",
57
- },
58
- body: JSON.stringify(requestBody),
59
- });
60
- if (!response.ok) {
61
- throw new Error(`Price API returned status ${response.status}`);
62
- }
63
- const pricesRes = (await response.json());
64
- return pricesRes;
65
- }));
66
- // Combine all responses into a single record
67
- const combinedPrices = responses.reduce((acc, priceResponses) => {
68
- priceResponses.forEach((priceResponse) => {
69
- acc[priceResponse.token_id] = priceResponse.price;
70
- });
71
- return acc;
72
- }, {});
73
- // Ensure all requested IDs are in the result (set to 0 if not found)
74
- const finalPrices = limitedIds.reduce((acc, id) => {
75
- acc[id] = combinedPrices[id] || 0;
76
- return acc;
77
- }, {});
78
- return finalPrices;
79
- }
80
- catch (_) {
81
- // On error, return 0 for all requested IDs
82
- return ids.slice(0, MAX_TOTAL_IDS).reduce((acc, id) => {
83
- acc[normalizeTokenType(id)] = 0;
84
- return acc;
85
- }, {});
86
- }
87
- }
88
- /**
89
- * Get the current SUI token price
90
- * @returns SUI price, or 0 if not found or on error
91
- */
92
- export async function getSuiPrice() {
93
- return await getTokenPrice(SUI_FULL_TYPE);
94
- }
package/lib/esm/index.mjs DELETED
@@ -1,31 +0,0 @@
1
- export * from "./types/metaAg";
2
- import { MetaAg } from "./features/metaAg";
3
- import { getSuiPrice, getTokenPrice, getTokenPrices } from "./features/prices";
4
- import { cancelDcaOrder, cancelLimitOrder, claimExpiredLimitOrder, getClosedDcaOrders, getClosedLimitOrders, getDcaOrderExecutions, getOpenDcaOrders, getOpenLimitOrders, placeDcaOrder, placeLimitOrder, } from "./features/limitDca";
5
- export { MetaAg, cancelDcaOrder, cancelLimitOrder, claimExpiredLimitOrder, getClosedDcaOrders, getClosedLimitOrders, getDcaOrderExecutions, getOpenDcaOrders, getOpenLimitOrders,
6
- // prices
7
- getSuiPrice, getTokenPrice, getTokenPrices,
8
- // dca
9
- placeDcaOrder,
10
- // limit order
11
- placeLimitOrder, };
12
- export default {
13
- // prices
14
- getTokenPrice,
15
- getTokenPrices,
16
- getSuiPrice,
17
- // limit order
18
- placeLimitOrder,
19
- getOpenLimitOrders,
20
- cancelLimitOrder,
21
- claimExpiredLimitOrder,
22
- getClosedLimitOrders,
23
- // dca
24
- placeDcaOrder,
25
- getOpenDcaOrders,
26
- cancelDcaOrder,
27
- getClosedDcaOrders,
28
- getDcaOrderExecutions,
29
- // Meta aggregator
30
- MetaAg,
31
- };