@7kprotocol/sdk-ts 2.2.2 → 2.3.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 (73) hide show
  1. package/lib/cjs/features/swap/buildTx.js +3 -0
  2. package/lib/cjs/features/swap/config.js +110 -0
  3. package/lib/cjs/features/swap/getQuote.js +16 -3
  4. package/lib/cjs/libs/protocols/aftermath/index.js +7 -13
  5. package/lib/cjs/libs/protocols/base.js +2 -1
  6. package/lib/cjs/libs/protocols/bluefin/index.js +3 -4
  7. package/lib/cjs/libs/protocols/bluemove/index.js +3 -4
  8. package/lib/cjs/libs/protocols/cetus/index.js +3 -4
  9. package/lib/cjs/libs/protocols/deepbook/index.js +5 -5
  10. package/lib/cjs/libs/protocols/deepbookV3/sponsored.js +3 -4
  11. package/lib/cjs/libs/protocols/flowx/index.js +3 -5
  12. package/lib/cjs/libs/protocols/flowxV3/index.js +50 -0
  13. package/lib/cjs/libs/protocols/index.js +2 -0
  14. package/lib/cjs/libs/swapWithRoute.js +2 -1
  15. package/lib/cjs/types/features/swap/buildTx.d.ts.map +1 -1
  16. package/lib/cjs/types/features/swap/config.d.ts +3 -0
  17. package/lib/cjs/types/features/swap/config.d.ts.map +1 -0
  18. package/lib/cjs/types/features/swap/getQuote.d.ts +5 -1
  19. package/lib/cjs/types/features/swap/getQuote.d.ts.map +1 -1
  20. package/lib/cjs/types/libs/protocols/aftermath/index.d.ts.map +1 -1
  21. package/lib/cjs/types/libs/protocols/base.d.ts +4 -2
  22. package/lib/cjs/types/libs/protocols/base.d.ts.map +1 -1
  23. package/lib/cjs/types/libs/protocols/bluefin/index.d.ts.map +1 -1
  24. package/lib/cjs/types/libs/protocols/bluemove/index.d.ts.map +1 -1
  25. package/lib/cjs/types/libs/protocols/cetus/index.d.ts.map +1 -1
  26. package/lib/cjs/types/libs/protocols/deepbook/index.d.ts.map +1 -1
  27. package/lib/cjs/types/libs/protocols/deepbookV3/sponsored.d.ts.map +1 -1
  28. package/lib/cjs/types/libs/protocols/flowx/index.d.ts.map +1 -1
  29. package/lib/cjs/types/libs/protocols/flowxV3/index.d.ts +9 -0
  30. package/lib/cjs/types/libs/protocols/flowxV3/index.d.ts.map +1 -0
  31. package/lib/cjs/types/libs/protocols/index.d.ts +2 -0
  32. package/lib/cjs/types/libs/protocols/index.d.ts.map +1 -1
  33. package/lib/cjs/types/libs/swapWithRoute.d.ts +3 -2
  34. package/lib/cjs/types/libs/swapWithRoute.d.ts.map +1 -1
  35. package/lib/cjs/types/types/aggregator.d.ts +50 -1
  36. package/lib/cjs/types/types/aggregator.d.ts.map +1 -1
  37. package/lib/esm/features/swap/buildTx.js +3 -0
  38. package/lib/esm/features/swap/config.js +96 -0
  39. package/lib/esm/features/swap/getQuote.js +16 -3
  40. package/lib/esm/libs/protocols/aftermath/index.js +7 -13
  41. package/lib/esm/libs/protocols/base.js +3 -1
  42. package/lib/esm/libs/protocols/bluefin/index.js +3 -4
  43. package/lib/esm/libs/protocols/bluemove/index.js +3 -4
  44. package/lib/esm/libs/protocols/cetus/index.js +3 -4
  45. package/lib/esm/libs/protocols/deepbook/index.js +5 -5
  46. package/lib/esm/libs/protocols/deepbookV3/sponsored.js +3 -4
  47. package/lib/esm/libs/protocols/flowx/index.js +3 -5
  48. package/lib/esm/libs/protocols/flowxV3/index.js +35 -0
  49. package/lib/esm/libs/protocols/index.js +2 -0
  50. package/lib/esm/libs/swapWithRoute.js +2 -1
  51. package/lib/esm/types/features/swap/buildTx.d.ts.map +1 -1
  52. package/lib/esm/types/features/swap/config.d.ts +3 -0
  53. package/lib/esm/types/features/swap/config.d.ts.map +1 -0
  54. package/lib/esm/types/features/swap/getQuote.d.ts +5 -1
  55. package/lib/esm/types/features/swap/getQuote.d.ts.map +1 -1
  56. package/lib/esm/types/libs/protocols/aftermath/index.d.ts.map +1 -1
  57. package/lib/esm/types/libs/protocols/base.d.ts +4 -2
  58. package/lib/esm/types/libs/protocols/base.d.ts.map +1 -1
  59. package/lib/esm/types/libs/protocols/bluefin/index.d.ts.map +1 -1
  60. package/lib/esm/types/libs/protocols/bluemove/index.d.ts.map +1 -1
  61. package/lib/esm/types/libs/protocols/cetus/index.d.ts.map +1 -1
  62. package/lib/esm/types/libs/protocols/deepbook/index.d.ts.map +1 -1
  63. package/lib/esm/types/libs/protocols/deepbookV3/sponsored.d.ts.map +1 -1
  64. package/lib/esm/types/libs/protocols/flowx/index.d.ts.map +1 -1
  65. package/lib/esm/types/libs/protocols/flowxV3/index.d.ts +9 -0
  66. package/lib/esm/types/libs/protocols/flowxV3/index.d.ts.map +1 -0
  67. package/lib/esm/types/libs/protocols/index.d.ts +2 -0
  68. package/lib/esm/types/libs/protocols/index.d.ts.map +1 -1
  69. package/lib/esm/types/libs/swapWithRoute.d.ts +3 -2
  70. package/lib/esm/types/libs/swapWithRoute.d.ts.map +1 -1
  71. package/lib/esm/types/types/aggregator.d.ts +50 -1
  72. package/lib/esm/types/types/aggregator.d.ts.map +1 -1
  73. package/package.json +9 -1
@@ -1,10 +1,11 @@
1
1
  import { Transaction } from "@mysten/sui/transactions";
2
- import { TxSorSwap } from "../types/aggregator";
2
+ import { Config, TxSorSwap } from "../types/aggregator";
3
3
  import { TransactionResultItem } from "../types/sui";
4
- export declare function swapWithRoute({ route, inputCoinObject, currentAccount, tx, }: {
4
+ export declare function swapWithRoute({ route, inputCoinObject, currentAccount, config, tx, }: {
5
5
  route: TxSorSwap[];
6
6
  inputCoinObject: TransactionResultItem;
7
7
  currentAccount: string;
8
+ config: Config;
8
9
  tx: Transaction;
9
10
  }): Promise<TransactionResultItem | undefined>;
10
11
  //# sourceMappingURL=swapWithRoute.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"swapWithRoute.d.ts","sourceRoot":"","sources":["../../../../src/libs/swapWithRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,wBAAsB,aAAa,CAAC,EAClC,KAAK,EACL,eAAe,EACf,cAAc,EACd,EAAE,GACH,EAAE;IACD,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,eAAe,EAAE,qBAAqB,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,EAAE,EAAE,WAAW,CAAC;CACjB,GAAG,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAiB7C"}
1
+ {"version":3,"file":"swapWithRoute.d.ts","sourceRoot":"","sources":["../../../../src/libs/swapWithRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,wBAAsB,aAAa,CAAC,EAClC,KAAK,EACL,eAAe,EACf,cAAc,EACd,MAAM,EACN,EAAE,GACH,EAAE;IACD,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,eAAe,EAAE,qBAAqB,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,WAAW,CAAC;CACjB,GAAG,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAkB7C"}
@@ -1,4 +1,4 @@
1
- export type SourceDex = "suiswap" | "turbos" | "cetus" | "bluemove" | "kriya" | "kriya_v3" | "aftermath" | "deepbook" | "deepbook_v3" | "flowx" | "bluefin" | "springsui" | "obric" | "stsui";
1
+ export type SourceDex = "suiswap" | "turbos" | "cetus" | "bluemove" | "kriya" | "kriya_v3" | "aftermath" | "deepbook" | "deepbook_v3" | "flowx" | "flowx_v3" | "bluefin" | "springsui" | "obric" | "stsui";
2
2
  export type SorSwap = {
3
3
  poolId: string;
4
4
  assetInIndex: number;
@@ -66,4 +66,53 @@ export interface Commission {
66
66
  partner: string;
67
67
  commissionBps: number;
68
68
  }
69
+ export interface DexConfig {
70
+ package: string;
71
+ name: string;
72
+ url?: string;
73
+ image?: string;
74
+ }
75
+ export interface Config {
76
+ aftermath: DexConfig & {
77
+ poolRegistry: string;
78
+ protocolFeeVault: string;
79
+ treasury: string;
80
+ insuranceFund: string;
81
+ referralVault: string;
82
+ };
83
+ bluefin: DexConfig & {
84
+ globalConfig: string;
85
+ };
86
+ bluemove: DexConfig & {
87
+ dexInfo: string;
88
+ };
89
+ cetus: DexConfig & {
90
+ globalConfig: string;
91
+ };
92
+ deepbook: DexConfig;
93
+ deepbook_v3: DexConfig & {
94
+ sponsor: string;
95
+ sponsorFund: string;
96
+ };
97
+ flowx: DexConfig & {
98
+ container: string;
99
+ };
100
+ flowx_v3: DexConfig & {
101
+ registry: string;
102
+ version: string;
103
+ };
104
+ kriya: DexConfig;
105
+ kriya_v3: DexConfig & {
106
+ version: string;
107
+ };
108
+ obric: DexConfig & {
109
+ pythState: string;
110
+ };
111
+ springsui: DexConfig;
112
+ stsui: DexConfig;
113
+ suiswap: DexConfig;
114
+ turbos: DexConfig & {
115
+ version: string;
116
+ };
117
+ }
69
118
  //# sourceMappingURL=aggregator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"aggregator.d.ts","sourceRoot":"","sources":["../../../../src/types/aggregator.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,QAAQ,GACR,OAAO,GACP,UAAU,GACV,OAAO,GACP,UAAU,GACV,WAAW,GACX,UAAU,GACV,aAAa,GACb,OAAO,GACP,SAAS,GACT,WAAW,GACX,OAAO,GACP,OAAO,CAAC;AAEZ,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM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AAS,CAAC;IACjB,QAAQ,EAAE,SAAS,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,KAAK,EAAE,SAAS,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,SAAS,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACzC"}
@@ -7,6 +7,7 @@ import { denormalizeTokenType } from "../../utils/token";
7
7
  import { SuiUtils } from "../../utils/sui";
8
8
  import { _7K_CONFIG, _7K_PACKAGE_ID, _7K_VAULT } from "../../constants/_7k";
9
9
  import { isValidSuiAddress } from "@mysten/sui/utils";
10
+ import { getConfig } from "./config";
10
11
  export const buildTx = async ({ quoteResponse, accountAddress, slippage, commission: _commission, devInspect, extendTx, }) => {
11
12
  const { tx: _tx, coinIn } = extendTx || {};
12
13
  let coinOut;
@@ -32,6 +33,7 @@ export const buildTx = async ({ quoteResponse, accountAddress, slippage, commiss
32
33
  coinData = _data;
33
34
  }
34
35
  const coinObjects = [];
36
+ const config = await getConfig();
35
37
  await Promise.all(routes.map(async (route, index) => {
36
38
  const inputCoinObject = coinData[index];
37
39
  const coinRes = await swapWithRoute({
@@ -39,6 +41,7 @@ export const buildTx = async ({ quoteResponse, accountAddress, slippage, commiss
39
41
  inputCoinObject,
40
42
  currentAccount: accountAddress,
41
43
  tx,
44
+ config,
42
45
  });
43
46
  if (coinRes) {
44
47
  coinObjects.push(coinRes);
@@ -0,0 +1,96 @@
1
+ let config = null;
2
+ let configTs = 0;
3
+ const DEFAULT_CONFIG = {
4
+ aftermath: {
5
+ name: "Aftermath",
6
+ package: "0xc4049b2d1cc0f6e017fda8260e4377cecd236bd7f56a54fee120816e72e2e0dd",
7
+ poolRegistry: "0xfcc774493db2c45c79f688f88d28023a3e7d98e4ee9f48bbf5c7990f651577ae",
8
+ protocolFeeVault: "0xf194d9b1bcad972e45a7dd67dd49b3ee1e3357a00a50850c52cd51bb450e13b4",
9
+ treasury: "0x28e499dff5e864a2eafe476269a4f5035f1c16f338da7be18b103499abf271ce",
10
+ insuranceFund: "0xf0c40d67b078000e18032334c3325c47b9ec9f3d9ae4128be820d54663d14e3b",
11
+ referralVault: "0x35d35b0e5b177593d8c3a801462485572fc30861e6ce96a55af6dc4730709278",
12
+ },
13
+ bluefin: {
14
+ name: "Bluefin",
15
+ package: "0x6c796c3ab3421a68158e0df18e4657b2827b1f8fed5ed4b82dba9c935988711b",
16
+ globalConfig: "0x03db251ba509a8d5d8777b6338836082335d93eecbdd09a11e190a1cff51c352",
17
+ },
18
+ bluemove: {
19
+ name: "Bluemove",
20
+ package: "0x08cd33481587d4c4612865b164796d937df13747d8c763b8a178c87e3244498f",
21
+ dexInfo: "0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92",
22
+ },
23
+ cetus: {
24
+ name: "Cetus",
25
+ package: "0x6f5e582ede61fe5395b50c4a449ec11479a54d7ff8e0158247adfda60d98970b",
26
+ globalConfig: "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f",
27
+ },
28
+ deepbook: {
29
+ name: "Deepbook",
30
+ package: "0xdee9",
31
+ },
32
+ deepbook_v3: {
33
+ name: "Deepbook V3",
34
+ package: "",
35
+ sponsor: "0x951a01360d85b06722edf896852bf8005b81cdb26375235c935138987f629502",
36
+ sponsorFund: "0xf245e7a4b83ed9a26622f5818a158c2ba7a03b91e62717b557a7df1d4dab38df",
37
+ },
38
+ flowx: {
39
+ name: "Flowx Finance",
40
+ package: "0xba153169476e8c3114962261d1edc70de5ad9781b83cc617ecc8c1923191cae0",
41
+ container: "0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511",
42
+ },
43
+ flowx_v3: {
44
+ name: "Flowx Finance V3",
45
+ package: "0x25929e7f29e0a30eb4e692952ba1b5b65a3a4d65ab5f2a32e1ba3edcb587f26d",
46
+ registry: "0x27565d24a4cd51127ac90e4074a841bbe356cca7bf5759ddc14a975be1632abc",
47
+ version: "0x67624a1533b5aff5d0dfcf5e598684350efd38134d2d245f475524c03a64e656",
48
+ },
49
+ kriya: {
50
+ name: "Kriya",
51
+ package: "0xa0eba10b173538c8fecca1dff298e488402cc9ff374f8a12ca7758eebe830b66",
52
+ },
53
+ kriya_v3: {
54
+ name: "Kriya V3",
55
+ package: "0xbd8d4489782042c6fafad4de4bc6a5e0b84a43c6c00647ffd7062d1e2bb7549e",
56
+ version: "0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78",
57
+ },
58
+ obric: {
59
+ name: "Obric",
60
+ package: "0xb84e63d22ea4822a0a333c250e790f69bf5c2ef0c63f4e120e05a6415991368f",
61
+ pythState: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8",
62
+ },
63
+ springsui: {
64
+ name: "SpringSui",
65
+ package: "0x82e6f4f75441eae97d2d5850f41a09d28c7b64a05b067d37748d471f43aaf3f7",
66
+ },
67
+ stsui: {
68
+ name: "AlphaFi stSUI",
69
+ package: "0x059f94b85c07eb74d2847f8255d8cc0a67c9a8dcc039eabf9f8b9e23a0de2700",
70
+ },
71
+ suiswap: {
72
+ name: "SuiSwap",
73
+ package: "0xd075d51486df71e750872b4edf82ea3409fda397ceecc0b6aedf573d923c54a0",
74
+ },
75
+ turbos: {
76
+ name: "Turbos Finance",
77
+ package: "0x1a3c42ded7b75cdf4ebc7c7b7da9d1e1db49f16fcdca934fac003f35f39ecad9",
78
+ version: "0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f",
79
+ },
80
+ };
81
+ export async function getConfig() {
82
+ const ttl = typeof window === "undefined" ? 60 : 10 * 60;
83
+ if (config && Date.now() - configTs < ttl * 1000) {
84
+ return config;
85
+ }
86
+ try {
87
+ const response = await fetch(`https://api.7k.ag/config`);
88
+ const quoteResponse = (await response.json());
89
+ config = quoteResponse;
90
+ configTs = Date.now();
91
+ return quoteResponse;
92
+ }
93
+ catch (error) {
94
+ return DEFAULT_CONFIG;
95
+ }
96
+ }
@@ -1,4 +1,4 @@
1
- import { normalizeTokenType } from "../../utils/token";
1
+ import { normalizeStructTag, normalizeSuiObjectId } from "@mysten/sui/utils";
2
2
  export const DEFAULT_SOURCES = [
3
3
  "suiswap",
4
4
  "turbos",
@@ -10,13 +10,26 @@ export const DEFAULT_SOURCES = [
10
10
  "deepbook",
11
11
  "deepbook_v3",
12
12
  "flowx",
13
+ "flowx_v3",
13
14
  "bluefin",
14
15
  "springsui",
15
16
  "obric",
16
17
  "stsui",
17
18
  ];
18
- export async function getQuote({ tokenIn, tokenOut, amountIn, sources = DEFAULT_SOURCES, }) {
19
- const response = await fetch(`https://api.7k.ag/quote?amount=${amountIn}&from=${normalizeTokenType(tokenIn)}&to=${normalizeTokenType(tokenOut)}&sources=${sources}`);
19
+ export async function getQuote({ tokenIn, tokenOut, amountIn, sources = DEFAULT_SOURCES, targetPools, excludedPools, }) {
20
+ const params = new URLSearchParams({
21
+ amount: amountIn,
22
+ from: normalizeStructTag(tokenIn),
23
+ to: normalizeStructTag(tokenOut),
24
+ sources: sources.join(","),
25
+ });
26
+ if (targetPools?.length) {
27
+ params.append("target_pools", targetPools.map((v) => normalizeSuiObjectId(v)).join(","));
28
+ }
29
+ if (excludedPools?.length) {
30
+ params.append("excluded_pools", excludedPools.map((v) => normalizeSuiObjectId(v)).join(","));
31
+ }
32
+ const response = await fetch(`https://api.7k.ag/quote?${params}`);
20
33
  if (!response.ok) {
21
34
  throw new Error("Failed to fetch aggregator quote");
22
35
  }
@@ -1,12 +1,5 @@
1
1
  import { BaseContract } from "../base";
2
2
  import { normalizeTokenType } from "../../../utils/token";
3
- const PACKAGE_ID = "0xc4049b2d1cc0f6e017fda8260e4377cecd236bd7f56a54fee120816e72e2e0dd";
4
- const MODULE_NAME = "swap";
5
- const POOL_REGISTRY = "0xfcc774493db2c45c79f688f88d28023a3e7d98e4ee9f48bbf5c7990f651577ae";
6
- const PROTOCOL_FEE_VAULT = "0xf194d9b1bcad972e45a7dd67dd49b3ee1e3357a00a50850c52cd51bb450e13b4";
7
- const TREASURY = "0x28e499dff5e864a2eafe476269a4f5035f1c16f338da7be18b103499abf271ce";
8
- const INSURANCE_FUND = "0xf0c40d67b078000e18032334c3325c47b9ec9f3d9ae4128be820d54663d14e3b";
9
- const REFERRAL_VAULT = "0x35d35b0e5b177593d8c3a801462485572fc30861e6ce96a55af6dc4730709278";
10
3
  export class AfterMathContract extends BaseContract {
11
4
  async swap(tx) {
12
5
  const poolId = this.swapInfo.poolId;
@@ -17,16 +10,17 @@ export class AfterMathContract extends BaseContract {
17
10
  const [lpCoinType] = this.getTypeParams();
18
11
  if (!lpCoinType)
19
12
  throw new Error("lpCoinType is not defined");
13
+ const config = this.config.aftermath;
20
14
  const [tokenOut] = tx.moveCall({
21
- target: `${PACKAGE_ID}::${MODULE_NAME}::swap_exact_in`,
15
+ target: `${config.package}::swap::swap_exact_in`,
22
16
  typeArguments: [lpCoinType, coinInType, coinOutType],
23
17
  arguments: [
24
18
  tx.object(poolId),
25
- tx.object(POOL_REGISTRY),
26
- tx.object(PROTOCOL_FEE_VAULT),
27
- tx.object(TREASURY),
28
- tx.object(INSURANCE_FUND),
29
- tx.object(REFERRAL_VAULT),
19
+ tx.object(config.poolRegistry),
20
+ tx.object(config.protocolFeeVault),
21
+ tx.object(config.treasury),
22
+ tx.object(config.insuranceFund),
23
+ tx.object(config.referralVault),
30
24
  inputCoinObject,
31
25
  tx.pure.u64(returnAmount),
32
26
  tx.pure.u64("1000000000000000000"), // slippage
@@ -4,10 +4,12 @@ export class BaseContract {
4
4
  swapInfo;
5
5
  inputCoinObject;
6
6
  currentAccount;
7
- constructor({ swapInfo, inputCoinObject, currentAccount, }) {
7
+ config;
8
+ constructor({ swapInfo, inputCoinObject, currentAccount, config, }) {
8
9
  this.swapInfo = swapInfo;
9
10
  this.inputCoinObject = inputCoinObject;
10
11
  this.currentAccount = currentAccount;
12
+ this.config = config;
11
13
  }
12
14
  getInputCoinValue(tx) {
13
15
  return SuiUtils.getCoinValue(this.swapInfo.assetIn, this.inputCoinObject, tx);
@@ -3,8 +3,6 @@ import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
3
3
  import { getDefaultSqrtPriceLimit } from "../utils";
4
4
  import BN from "bn.js";
5
5
  import { SuiUtils } from "../../../utils/sui";
6
- const PACKAGE_ID = "0x6c796c3ab3421a68158e0df18e4657b2827b1f8fed5ed4b82dba9c935988711b";
7
- const CONFIG_ID = "0x03db251ba509a8d5d8777b6338836082335d93eecbdd09a11e190a1cff51c352";
8
6
  export class BluefinContract extends BaseContract {
9
7
  async swap(tx) {
10
8
  const [coinX, coinY] = this.swapInfo.pool.allTokens;
@@ -12,12 +10,13 @@ export class BluefinContract extends BaseContract {
12
10
  const amountIn = this.getInputCoinValue(tx);
13
11
  const coinInBalance = SuiUtils.coinIntoBalance(tx, this.swapInfo.assetIn, this.inputCoinObject);
14
12
  const coinOutBalance = SuiUtils.zeroBalance(tx, this.swapInfo.assetOut);
13
+ const config = this.config.bluefin;
15
14
  const [balanceOutX, balanceOutY] = tx.moveCall({
16
- target: `${PACKAGE_ID}::pool::swap`,
15
+ target: `${config.package}::pool::swap`,
17
16
  typeArguments: [coinX.address, coinY.address],
18
17
  arguments: [
19
18
  tx.object(SUI_CLOCK_OBJECT_ID),
20
- tx.object(CONFIG_ID),
19
+ tx.object(config.globalConfig),
21
20
  tx.object(this.swapInfo.poolId),
22
21
  swapXtoY ? coinInBalance : coinOutBalance,
23
22
  swapXtoY ? coinOutBalance : coinInBalance,
@@ -1,11 +1,10 @@
1
1
  import { BaseContract } from "../base";
2
2
  import { SuiUtils } from "../../../utils/sui";
3
- const PACKAGE_ID = "0x08cd33481587d4c4612865b164796d937df13747d8c763b8a178c87e3244498f";
4
- const DEX_INFO_ID = "0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92";
5
3
  export class BluemoveContract extends BaseContract {
6
4
  async swap(tx) {
5
+ const config = this.config.bluemove;
7
6
  const [coinOut] = tx.moveCall({
8
- target: `${PACKAGE_ID}::router::swap_exact_input_`,
7
+ target: `${config.package}::router::swap_exact_input_`,
9
8
  typeArguments: [this.swapInfo.assetIn, this.swapInfo.assetOut],
10
9
  arguments: [
11
10
  SuiUtils.getCoinValue(this.swapInfo.swapXtoY
@@ -13,7 +12,7 @@ export class BluemoveContract extends BaseContract {
13
12
  : this.swapInfo.coinY.type, this.inputCoinObject, tx), // input amount
14
13
  this.inputCoinObject, // input coin
15
14
  tx.pure.u64(0), // min output amount
16
- tx.object(DEX_INFO_ID),
15
+ tx.object(config.dexInfo),
17
16
  ],
18
17
  });
19
18
  return coinOut;
@@ -2,8 +2,6 @@ import { BaseContract } from "../base";
2
2
  import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
3
3
  import { getDefaultSqrtPriceLimit } from "../utils";
4
4
  import { SuiUtils } from "../../../utils/sui";
5
- const GLOBAL_CONFIG_ID = "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f";
6
- const INTEGRATE_PACKAGE_ID = "0x6f5e582ede61fe5395b50c4a449ec11479a54d7ff8e0158247adfda60d98970b";
7
5
  export class CetusContract extends BaseContract {
8
6
  async swap(tx) {
9
7
  const sqrtPriceLimit = getDefaultSqrtPriceLimit(this.swapInfo.swapXtoY);
@@ -19,11 +17,12 @@ export class CetusContract extends BaseContract {
19
17
  const amountIn = SuiUtils.getCoinValue(this.swapInfo.swapXtoY
20
18
  ? this.swapInfo.coinX.type
21
19
  : this.swapInfo.coinY.type, this.inputCoinObject, tx);
20
+ const config = this.config.cetus;
22
21
  const [receiveA, receiveB] = tx.moveCall({
23
- target: `${INTEGRATE_PACKAGE_ID}::router::swap`,
22
+ target: `${config.package}::router::swap`,
24
23
  typeArguments,
25
24
  arguments: [
26
- tx.object(GLOBAL_CONFIG_ID),
25
+ tx.object(config.globalConfig),
27
26
  tx.object(this.swapInfo.poolId),
28
27
  this.swapInfo.swapXtoY ? this.inputCoinObject : zeroOut, // coin A
29
28
  this.swapInfo.swapXtoY ? zeroOut : this.inputCoinObject, // coin B
@@ -2,7 +2,6 @@ import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
2
2
  import { BaseContract } from "../base";
3
3
  import { _7K_PACKAGE_ID } from "../../../constants/_7k";
4
4
  import { SuiUtils } from "../../../utils/sui";
5
- const PACKAGE_ID = "0xdee9";
6
5
  const MODULE_NAME = "clob_v2";
7
6
  export class DeepBookContract extends BaseContract {
8
7
  async swap(tx) {
@@ -14,6 +13,7 @@ export class DeepBookContract extends BaseContract {
14
13
  const [baseAsset, quoteAsset] = typeArgs;
15
14
  const accountCap = this.createAccountCap(tx);
16
15
  const amountIn = this.getInputCoinValue(tx);
16
+ const config = this.config.deepbook;
17
17
  let result;
18
18
  if (swapXtoY) {
19
19
  const amountInRound = tx.moveCall({
@@ -24,7 +24,7 @@ export class DeepBookContract extends BaseContract {
24
24
  ],
25
25
  });
26
26
  const [base_coin_ret, quote_coin_ret] = tx.moveCall({
27
- target: `${PACKAGE_ID}::${MODULE_NAME}::swap_exact_base_for_quote`,
27
+ target: `${config.package}::${MODULE_NAME}::swap_exact_base_for_quote`,
28
28
  typeArguments: [baseAsset, quoteAsset],
29
29
  arguments: [
30
30
  tx.object(poolId),
@@ -46,7 +46,7 @@ export class DeepBookContract extends BaseContract {
46
46
  }
47
47
  else {
48
48
  const [base_coin_ret, quote_coin_ret] = tx.moveCall({
49
- target: `${PACKAGE_ID}::${MODULE_NAME}::swap_exact_quote_for_base`,
49
+ target: `${config.package}::${MODULE_NAME}::swap_exact_quote_for_base`,
50
50
  typeArguments: [baseAsset, quoteAsset],
51
51
  arguments: [
52
52
  tx.object(poolId),
@@ -66,14 +66,14 @@ export class DeepBookContract extends BaseContract {
66
66
  createAccountCap(tx) {
67
67
  const [cap] = tx.moveCall({
68
68
  typeArguments: [],
69
- target: `${PACKAGE_ID}::${MODULE_NAME}::create_account`,
69
+ target: `${this.config.deepbook.package}::${MODULE_NAME}::create_account`,
70
70
  arguments: [],
71
71
  });
72
72
  return cap;
73
73
  }
74
74
  deleteAccountCap(tx, accountCap) {
75
75
  tx.moveCall({
76
- target: `${PACKAGE_ID}::custodian_v2::delete_account_cap`,
76
+ target: `${this.config.deepbook.package}::custodian_v2::delete_account_cap`,
77
77
  arguments: [accountCap],
78
78
  });
79
79
  }
@@ -1,18 +1,17 @@
1
1
  import { BaseContract } from "../base";
2
2
  import { normalizeStructTag, SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
3
3
  import { SuiUtils } from "../../../utils/sui";
4
- const PACKAGE_ID = "0x951a01360d85b06722edf896852bf8005b81cdb26375235c935138987f629502";
5
- const FUND_ID = "0xf245e7a4b83ed9a26622f5818a158c2ba7a03b91e62717b557a7df1d4dab38df";
6
4
  export class SponsoredDeepBookV3Contract extends BaseContract {
7
5
  async swap(tx) {
8
6
  const [coinX] = this.swapInfo.pool.allTokens;
9
7
  const swapXtoY = normalizeStructTag(coinX.address) ===
10
8
  normalizeStructTag(this.swapInfo.assetIn);
9
+ const config = this.config.deepbook_v3;
11
10
  const [base, quote] = tx.moveCall({
12
- target: `${PACKAGE_ID}::sponsored::${swapXtoY ? "swap_exact_base_for_quote" : "swap_exact_quote_for_base"}`,
11
+ target: `${config.sponsor}::sponsored::${swapXtoY ? "swap_exact_base_for_quote" : "swap_exact_quote_for_base"}`,
13
12
  typeArguments: this.getTypeParams(),
14
13
  arguments: [
15
- tx.object(FUND_ID),
14
+ tx.object(config.sponsorFund),
16
15
  tx.object(this.swapInfo.poolId),
17
16
  this.inputCoinObject,
18
17
  tx.pure.u64(0),
@@ -1,15 +1,13 @@
1
1
  import { BaseContract } from "../base";
2
- const PACKAGE_ID = "0xba153169476e8c3114962261d1edc70de5ad9781b83cc617ecc8c1923191cae0";
3
- const MODULE_NAME = "router";
4
- const CONTAINER_OBJECT_ID = "0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511";
5
2
  export class FlowXContract extends BaseContract {
6
3
  async swap(tx) {
7
4
  const coinInType = this.swapInfo.assetIn;
8
5
  const coinOutType = this.swapInfo.assetOut;
6
+ const config = this.config.flowx;
9
7
  const [tokenOut] = tx.moveCall({
10
- target: `${PACKAGE_ID}::${MODULE_NAME}::swap_exact_input_direct`,
8
+ target: `${config.package}::router::swap_exact_input_direct`,
11
9
  typeArguments: [coinInType, coinOutType],
12
- arguments: [tx.object(CONTAINER_OBJECT_ID), this.inputCoinObject],
10
+ arguments: [tx.object(config.container), this.inputCoinObject],
13
11
  });
14
12
  return tokenOut;
15
13
  }
@@ -0,0 +1,35 @@
1
+ import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
2
+ import { BaseContract } from "../base";
3
+ import { getDefaultSqrtPriceLimit } from "../utils";
4
+ import { BN } from "bn.js";
5
+ export class FlowxV3Contract extends BaseContract {
6
+ async swap(tx) {
7
+ const [coinX, coinY] = this.swapInfo.pool.allTokens;
8
+ const swapXtoY = this.swapInfo.swapXtoY;
9
+ const swapFeeRate = this.swapInfo.extra.swapFeeRate;
10
+ if (!swapFeeRate) {
11
+ throw new Error("swapFeeRate is required");
12
+ }
13
+ const config = this.config.flowx_v3;
14
+ const [coinOut] = tx.moveCall({
15
+ target: `${config.package}::swap_router::swap_exact_input`,
16
+ typeArguments: [
17
+ swapXtoY ? coinX.address : coinY.address,
18
+ swapXtoY ? coinY.address : coinX.address,
19
+ ],
20
+ arguments: [
21
+ tx.object(config.registry),
22
+ tx.pure.u64(swapFeeRate), // swap fee rate to lookup pool in the registry
23
+ this.inputCoinObject,
24
+ tx.pure.u64(0), // min amount out
25
+ tx.pure.u128(getDefaultSqrtPriceLimit(swapXtoY)
26
+ .add(swapXtoY ? new BN(1) : new BN(-1))
27
+ .toString(10)), // sqrt price limit
28
+ tx.pure.u64("18446744073709551615"), // u64 max value
29
+ tx.object(config.version),
30
+ tx.object(SUI_CLOCK_OBJECT_ID),
31
+ ],
32
+ });
33
+ return coinOut;
34
+ }
35
+ }
@@ -12,6 +12,7 @@ import { BluefinContract } from "./bluefin";
12
12
  import { SpringSuiContract } from "./springsui";
13
13
  import { ObricContract } from "./obric";
14
14
  import { StSuiContract } from "./stsui";
15
+ import { FlowxV3Contract } from "./flowxV3";
15
16
  export const ProtocolContract = {
16
17
  cetus: CetusContract,
17
18
  turbos: TurbosContract,
@@ -22,6 +23,7 @@ export const ProtocolContract = {
22
23
  deepbook: DeepBookContract,
23
24
  deepbook_v3: SponsoredDeepBookV3Contract,
24
25
  flowx: FlowXContract,
26
+ flowx_v3: FlowxV3Contract,
25
27
  kriya_v3: KriyaV3Contract,
26
28
  bluefin: BluefinContract,
27
29
  springsui: SpringSuiContract,
@@ -1,5 +1,5 @@
1
1
  import { ProtocolContract } from "./protocols";
2
- export async function swapWithRoute({ route, inputCoinObject, currentAccount, tx, }) {
2
+ export async function swapWithRoute({ route, inputCoinObject, currentAccount, config, tx, }) {
3
3
  let inputTokenObject = inputCoinObject;
4
4
  let txbResultToReturn;
5
5
  for (const swap of route) {
@@ -8,6 +8,7 @@ export async function swapWithRoute({ route, inputCoinObject, currentAccount, tx
8
8
  swapInfo: swap,
9
9
  inputCoinObject: inputTokenObject,
10
10
  currentAccount,
11
+ config,
11
12
  });
12
13
  const tokenOut = await contractInstance.swap(tx);
13
14
  inputTokenObject = tokenOut;
@@ -1 +1 @@
1
- {"version":3,"file":"buildTx.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/buildTx.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,yBAAyB,EAE1B,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAI/C,eAAO,MAAM,OAAO,gGAOjB,aAAa;;;EAiGf,CAAC"}
1
+ {"version":3,"file":"buildTx.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/buildTx.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,yBAAyB,EAE1B,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAK/C,eAAO,MAAM,OAAO,gGAOjB,aAAa;;;EAmGf,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Config } from "../../types/aggregator";
2
+ export declare function getConfig(): Promise<Config>;
3
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAgHhD,wBAAsB,SAAS,oBAe9B"}
@@ -4,8 +4,12 @@ interface Params {
4
4
  tokenOut: string;
5
5
  amountIn: string;
6
6
  sources?: SourceDex[];
7
+ /** Limit the route to a specific set of pools */
8
+ targetPools?: string[];
9
+ /** Exclude a specific set of pools from the route */
10
+ excludedPools?: string[];
7
11
  }
8
12
  export declare const DEFAULT_SOURCES: SourceDex[];
9
- export declare function getQuote({ tokenIn, tokenOut, amountIn, sources, }: Params): Promise<QuoteResponse>;
13
+ export declare function getQuote({ tokenIn, tokenOut, amountIn, sources, targetPools, excludedPools, }: Params): Promise<QuoteResponse>;
10
14
  export {};
11
15
  //# sourceMappingURL=getQuote.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getQuote.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/getQuote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGlE,UAAU,MAAM;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;CACvB;AAED,eAAO,MAAM,eAAe,EAAE,SAAS,EAetC,CAAC;AAEF,wBAAsB,QAAQ,CAAC,EAC7B,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,OAAyB,GAC1B,EAAE,MAAM,0BAaR"}
1
+ {"version":3,"file":"getQuote.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/getQuote.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAElE,UAAU,MAAM;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,eAAO,MAAM,eAAe,EAAE,SAAS,EAgBtC,CAAC;AAEF,wBAAsB,QAAQ,CAAC,EAC7B,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,OAAyB,EACzB,WAAW,EACX,aAAa,GACd,EAAE,MAAM,0BA2BR"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/aftermath/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAkBvC,qBAAa,iBAAkB,SAAQ,YAAY;IAC3C,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CA2B3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/aftermath/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,qBAAa,iBAAkB,SAAQ,YAAY;IAC3C,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CA4B3B"}
@@ -1,16 +1,18 @@
1
1
  import { Transaction } from "@mysten/sui/transactions";
2
- import { TxSorSwap } from "../../types/aggregator";
2
+ import { Config, TxSorSwap } from "../../types/aggregator";
3
3
  import { TransactionResultItem } from "../../types/sui";
4
4
  export interface BaseContractParams {
5
5
  swapInfo: TxSorSwap;
6
6
  inputCoinObject: TransactionResultItem;
7
7
  currentAccount: string;
8
+ config: Config;
8
9
  }
9
10
  export declare abstract class BaseContract {
10
11
  protected swapInfo: TxSorSwap;
11
12
  protected inputCoinObject: TransactionResultItem;
12
13
  protected currentAccount: string;
13
- constructor({ swapInfo, inputCoinObject, currentAccount, }: BaseContractParams);
14
+ protected config: Config;
15
+ constructor({ swapInfo, inputCoinObject, currentAccount, config, }: BaseContractParams);
14
16
  abstract swap(tx: Transaction): Promise<TransactionResultItem>;
15
17
  protected getInputCoinValue(tx: Transaction): import("@mysten/sui/transactions").TransactionArgument;
16
18
  protected getTypeParams(): string[];
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../../src/libs/protocols/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,eAAe,EAAE,qBAAqB,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,8BAAsB,YAAY;IAChC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC9B,SAAS,CAAC,eAAe,EAAE,qBAAqB,CAAC;IACjD,SAAS,CAAC,cAAc,EAAE,MAAM,CAAC;gBAErB,EACV,QAAQ,EACR,eAAe,EACf,cAAc,GACf,EAAE,kBAAkB;IAMrB,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAE9D,SAAS,CAAC,iBAAiB,CAAC,EAAE,EAAE,WAAW;IAQ3C,SAAS,CAAC,aAAa;CAKxB"}
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../../src/libs/protocols/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAG3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,eAAe,EAAE,qBAAqB,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,8BAAsB,YAAY;IAChC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC9B,SAAS,CAAC,eAAe,EAAE,qBAAqB,CAAC;IACjD,SAAS,CAAC,cAAc,EAAE,MAAM,CAAC;IACjC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEb,EACV,QAAQ,EACR,eAAe,EACf,cAAc,EACd,MAAM,GACP,EAAE,kBAAkB;IAOrB,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAE9D,SAAS,CAAC,iBAAiB,CAAC,EAAE,EAAE,WAAW;IAQ3C,SAAS,CAAC,aAAa;CAKxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/bluefin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAWvC,qBAAa,eAAgB,SAAQ,YAAY;IACzC,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CA2C3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/bluefin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAKvC,qBAAa,eAAgB,SAAQ,YAAY;IACzC,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CA4C3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/bluemove/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAQvC,qBAAa,gBAAiB,SAAQ,YAAY;IAC1C,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CAoB3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/bluemove/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,qBAAa,gBAAiB,SAAQ,YAAY;IAC1C,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CAqB3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/cetus/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAWvC,qBAAa,aAAc,SAAQ,YAAY;IACvC,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CA2C3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/cetus/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAMvC,qBAAa,aAAc,SAAQ,YAAY;IACvC,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CA4C3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/deepbook/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAOvC,qBAAa,gBAAiB,SAAQ,YAAY;IAC1C,IAAI,CAAC,EAAE,EAAE,WAAW;;;;IAwE1B,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,gBAAgB;CAMzB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/deepbook/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAMvC,qBAAa,gBAAiB,SAAQ,YAAY;IAC1C,IAAI,CAAC,EAAE,EAAE,WAAW;;;;IAyE1B,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,gBAAgB;CAMzB"}