@cetusprotocol/aggregator-sdk 0.3.18 → 0.3.19

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.
package/dist/index.d.mts CHANGED
@@ -78,6 +78,7 @@ declare const SUILEND = "SUILEND";
78
78
  declare const BLUEFIN = "BLUEFIN";
79
79
  declare const HAEDALPMM = "HAEDALPMM";
80
80
  declare const ALPHAFI = "ALPHAFI";
81
+ declare const SPRINGSUI = "SPRINGSUI";
81
82
  declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
82
83
  type BuildRouterSwapParams = {
83
84
  routers: Router[];
@@ -292,4 +293,4 @@ declare enum Env {
292
293
  Testnet = 1
293
294
  }
294
295
 
295
- export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, ALPHAFI, AggregatorClient, type AggregatorResponse, BLUEFIN, BLUEMOVE, type BuildCoinResult, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, HAEDALPMM, KRIYA, KRIYAV3, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, SUILEND, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, buildInputCoin, checkInvalidSuiAddress, compareCoins, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
296
+ export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, ALPHAFI, AggregatorClient, type AggregatorResponse, BLUEFIN, BLUEMOVE, type BuildCoinResult, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, HAEDALPMM, KRIYA, KRIYAV3, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, SPRINGSUI, SUILEND, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, buildInputCoin, checkInvalidSuiAddress, compareCoins, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
package/dist/index.d.ts CHANGED
@@ -78,6 +78,7 @@ declare const SUILEND = "SUILEND";
78
78
  declare const BLUEFIN = "BLUEFIN";
79
79
  declare const HAEDALPMM = "HAEDALPMM";
80
80
  declare const ALPHAFI = "ALPHAFI";
81
+ declare const SPRINGSUI = "SPRINGSUI";
81
82
  declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
82
83
  type BuildRouterSwapParams = {
83
84
  routers: Router[];
@@ -292,4 +293,4 @@ declare enum Env {
292
293
  Testnet = 1
293
294
  }
294
295
 
295
- export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, ALPHAFI, AggregatorClient, type AggregatorResponse, BLUEFIN, BLUEMOVE, type BuildCoinResult, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, HAEDALPMM, KRIYA, KRIYAV3, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, SUILEND, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, buildInputCoin, checkInvalidSuiAddress, compareCoins, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
296
+ export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, ALPHAFI, AggregatorClient, type AggregatorResponse, BLUEFIN, BLUEMOVE, type BuildCoinResult, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, HAEDALPMM, KRIYA, KRIYAV3, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, SPRINGSUI, SUILEND, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, buildInputCoin, checkInvalidSuiAddress, compareCoins, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
package/dist/index.js CHANGED
@@ -6270,6 +6270,7 @@ var SUILEND = "SUILEND";
6270
6270
  var BLUEFIN = "BLUEFIN";
6271
6271
  var HAEDALPMM = "HAEDALPMM";
6272
6272
  var ALPHAFI = "ALPHAFI";
6273
+ var SPRINGSUI = "SPRINGSUI";
6273
6274
  var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
6274
6275
  function isBuilderRouterSwapParams(params) {
6275
6276
  return Array.isArray(params.routers);
@@ -6643,6 +6644,8 @@ var AggregatorClient19 = class {
6643
6644
  return new Scallop(this.env);
6644
6645
  case SUILEND:
6645
6646
  return new Suilend(this.env);
6647
+ case SPRINGSUI:
6648
+ return new Suilend(this.env);
6646
6649
  case BLUEFIN:
6647
6650
  return new Bluefin(this.env);
6648
6651
  case HAEDALPMM:
@@ -6910,7 +6913,7 @@ function getRouter(endpoint, params) {
6910
6913
  url += `&providers=${providers.join(",")}`;
6911
6914
  }
6912
6915
  }
6913
- url += "&v=1000318";
6916
+ url += "&v=1000319";
6914
6917
  const response = yield fetch(url);
6915
6918
  return response;
6916
6919
  } catch (error) {
@@ -7022,6 +7025,7 @@ exports.KRIYA = KRIYA;
7022
7025
  exports.KRIYAV3 = KRIYAV3;
7023
7026
  exports.ONE = ONE;
7024
7027
  exports.SCALLOP = SCALLOP;
7028
+ exports.SPRINGSUI = SPRINGSUI;
7025
7029
  exports.SUILEND = SUILEND;
7026
7030
  exports.TEN_POW_NINE = TEN_POW_NINE;
7027
7031
  exports.TURBOS = TURBOS;
package/dist/index.mjs CHANGED
@@ -6268,6 +6268,7 @@ var SUILEND = "SUILEND";
6268
6268
  var BLUEFIN = "BLUEFIN";
6269
6269
  var HAEDALPMM = "HAEDALPMM";
6270
6270
  var ALPHAFI = "ALPHAFI";
6271
+ var SPRINGSUI = "SPRINGSUI";
6271
6272
  var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
6272
6273
  function isBuilderRouterSwapParams(params) {
6273
6274
  return Array.isArray(params.routers);
@@ -6641,6 +6642,8 @@ var AggregatorClient19 = class {
6641
6642
  return new Scallop(this.env);
6642
6643
  case SUILEND:
6643
6644
  return new Suilend(this.env);
6645
+ case SPRINGSUI:
6646
+ return new Suilend(this.env);
6644
6647
  case BLUEFIN:
6645
6648
  return new Bluefin(this.env);
6646
6649
  case HAEDALPMM:
@@ -6908,7 +6911,7 @@ function getRouter(endpoint, params) {
6908
6911
  url += `&providers=${providers.join(",")}`;
6909
6912
  }
6910
6913
  }
6911
- url += "&v=1000318";
6914
+ url += "&v=1000319";
6912
6915
  const response = yield fetch(url);
6913
6916
  return response;
6914
6917
  } catch (error) {
@@ -6998,4 +7001,4 @@ decimal.js/decimal.mjs:
6998
7001
  *)
6999
7002
  */
7000
7003
 
7001
- export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, ALPHAFI, AggregatorClient19 as AggregatorClient, BLUEFIN, BLUEMOVE, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, Env, FLOWXV2, FLOWXV3, HAEDAL, HAEDALPMM, KRIYA, KRIYAV3, ONE, SCALLOP, SUILEND, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, buildInputCoin, checkInvalidSuiAddress, compareCoins, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
7004
+ export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, ALPHAFI, AggregatorClient19 as AggregatorClient, BLUEFIN, BLUEMOVE, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, Env, FLOWXV2, FLOWXV3, HAEDAL, HAEDALPMM, KRIYA, KRIYAV3, ONE, SCALLOP, SPRINGSUI, SUILEND, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, buildInputCoin, checkInvalidSuiAddress, compareCoins, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
@@ -22,6 +22,7 @@ export declare const SUILEND = "SUILEND";
22
22
  export declare const BLUEFIN = "BLUEFIN";
23
23
  export declare const HAEDALPMM = "HAEDALPMM";
24
24
  export declare const ALPHAFI = "ALPHAFI";
25
+ export declare const SPRINGSUI = "SPRINGSUI";
25
26
  export declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
26
27
  export type BuildRouterSwapParams = {
27
28
  routers: Router[];
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "aggregator-example",
3
+ "version": "1.0.0",
4
+ "description": "Cetus Aggregator SDK usage example",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "swap": "ts-node swap.ts"
8
+ },
9
+ "dependencies": {
10
+ "@cetusprotocol/aggregator-sdk": "^0.3.18",
11
+ "@mysten/sui.js": "^0.49.1"
12
+ },
13
+ "devDependencies": {
14
+ "typescript": "^5.0.0",
15
+ "ts-node": "^10.9.1"
16
+ }
17
+ }
@@ -0,0 +1,21 @@
1
+ import { AggregatorClient } from "@cetusprotocol/aggregator-sdk"
2
+ import BN from "bn.js"
3
+
4
+ async function main() {
5
+ // default to mainnet
6
+ const client = new AggregatorClient()
7
+
8
+ const from = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"
9
+ const target = "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS"
10
+
11
+ const routers = await client.findRouters({
12
+ from,
13
+ target,
14
+ amount: new BN(1000000000),
15
+ byAmountIn: true,
16
+ })
17
+
18
+ console.log(routers)
19
+ }
20
+
21
+ main()
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2020",
4
+ "module": "commonjs",
5
+ "strict": true,
6
+ "esModuleInterop": true,
7
+ "skipLibCheck": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "outDir": "./dist"
10
+ },
11
+ "include": ["examples/**/*"]
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cetusprotocol/aggregator-sdk",
3
- "version": "0.3.18",
3
+ "version": "0.3.19",
4
4
  "sideEffects": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/api.ts CHANGED
@@ -190,7 +190,7 @@ async function getRouter(endpoint: string, params: FindRouterParams) {
190
190
  }
191
191
 
192
192
  // set newest sdk version
193
- url += "&v=1000318"
193
+ url += "&v=1000319"
194
194
 
195
195
  const response = await fetch(url)
196
196
  return response
package/src/client.ts CHANGED
@@ -63,6 +63,7 @@ export const SUILEND = "SUILEND"
63
63
  export const BLUEFIN = "BLUEFIN"
64
64
  export const HAEDALPMM = "HAEDALPMM"
65
65
  export const ALPHAFI = "ALPHAFI"
66
+ export const SPRINGSUI = "SPRINGSUI"
66
67
  export const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2"
67
68
 
68
69
  export type BuildRouterSwapParams = {
@@ -581,6 +582,8 @@ export class AggregatorClient {
581
582
  return new Scallop(this.env)
582
583
  case SUILEND:
583
584
  return new Suilend(this.env)
585
+ case SPRINGSUI:
586
+ return new Suilend(this.env)
584
587
  case BLUEFIN:
585
588
  return new Bluefin(this.env)
586
589
  case HAEDALPMM: