@7kprotocol/sdk-ts 3.0.2 → 3.2.0
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/lib/cjs/features/swap/buildTx.js +3 -2
- package/lib/cjs/features/swap/config.js +17 -12
- package/lib/cjs/features/swap/getQuote.js +2 -0
- package/lib/cjs/libs/protocols/base.js +13 -0
- package/lib/cjs/libs/protocols/haedal_pmm/index.js +5 -7
- package/lib/cjs/libs/protocols/index.js +16 -13
- package/lib/cjs/libs/protocols/obric/index.js +4 -6
- package/lib/cjs/libs/protocols/sevenk/index.js +55 -0
- package/lib/cjs/libs/protocols/steamm/index.js +12 -9
- package/lib/cjs/types/features/swap/buildTx.d.ts.map +1 -1
- package/lib/cjs/types/features/swap/config.d.ts.map +1 -1
- package/lib/cjs/types/features/swap/getQuote.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/base.d.ts +2 -1
- package/lib/cjs/types/libs/protocols/base.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/haedal_pmm/index.d.ts +6 -1
- package/lib/cjs/types/libs/protocols/haedal_pmm/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/index.d.ts +16 -13
- package/lib/cjs/types/libs/protocols/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/obric/index.d.ts +6 -1
- package/lib/cjs/types/libs/protocols/obric/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/sevenk/index.d.ts +18 -0
- package/lib/cjs/types/libs/protocols/sevenk/index.d.ts.map +1 -0
- package/lib/cjs/types/libs/protocols/steamm/index.d.ts +3 -3
- package/lib/cjs/types/libs/protocols/steamm/index.d.ts.map +1 -1
- package/lib/cjs/types/types/aggregator.d.ts +5 -7
- package/lib/cjs/types/types/aggregator.d.ts.map +1 -1
- package/lib/esm/features/swap/buildTx.js +3 -2
- package/lib/esm/features/swap/config.js +17 -12
- package/lib/esm/features/swap/getQuote.js +2 -0
- package/lib/esm/libs/protocols/base.js +14 -1
- package/lib/esm/libs/protocols/haedal_pmm/index.js +5 -7
- package/lib/esm/libs/protocols/index.js +16 -13
- package/lib/esm/libs/protocols/obric/index.js +4 -6
- package/lib/esm/libs/protocols/sevenk/index.js +51 -0
- package/lib/esm/libs/protocols/steamm/index.js +13 -10
- package/lib/esm/types/features/swap/buildTx.d.ts.map +1 -1
- package/lib/esm/types/features/swap/config.d.ts.map +1 -1
- package/lib/esm/types/features/swap/getQuote.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/base.d.ts +2 -1
- package/lib/esm/types/libs/protocols/base.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/haedal_pmm/index.d.ts +6 -1
- package/lib/esm/types/libs/protocols/haedal_pmm/index.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/index.d.ts +16 -13
- package/lib/esm/types/libs/protocols/index.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/obric/index.d.ts +6 -1
- package/lib/esm/types/libs/protocols/obric/index.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/sevenk/index.d.ts +18 -0
- package/lib/esm/types/libs/protocols/sevenk/index.d.ts.map +1 -0
- package/lib/esm/types/libs/protocols/steamm/index.d.ts +3 -3
- package/lib/esm/types/libs/protocols/steamm/index.d.ts.map +1 -1
- package/lib/esm/types/types/aggregator.d.ts +5 -7
- package/lib/esm/types/types/aggregator.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -124,8 +124,9 @@ exports.buildTx = buildTx;
|
|
|
124
124
|
const getPythPriceFeeds = (res) => {
|
|
125
125
|
const ids = new Set();
|
|
126
126
|
for (const s of res.swaps) {
|
|
127
|
-
for (const o of s.extra?.oracles || []) {
|
|
128
|
-
|
|
127
|
+
for (const o of (s.extra?.oracles || [])) {
|
|
128
|
+
// FIXME: deprecation price_identifier in the next version
|
|
129
|
+
const bytes = o.Pyth?.bytes || o.Pyth?.price_identifier?.bytes;
|
|
129
130
|
if (bytes) {
|
|
130
131
|
ids.add("0x" + (0, utils_1.toHex)(Uint8Array.from(bytes)));
|
|
131
132
|
}
|
|
@@ -16,14 +16,9 @@ exports.DEFAULT_CONFIG = {
|
|
|
16
16
|
},
|
|
17
17
|
bluefin: {
|
|
18
18
|
name: "Bluefin",
|
|
19
|
-
package: "
|
|
19
|
+
package: "0x67b34b728c4e28e704dcfecf7c5cf55c7fc593b6c65c20d1836d97c209c1928a",
|
|
20
20
|
globalConfig: "0x03db251ba509a8d5d8777b6338836082335d93eecbdd09a11e190a1cff51c352",
|
|
21
21
|
},
|
|
22
|
-
bluefinx: {
|
|
23
|
-
name: "BluefinX",
|
|
24
|
-
package: "0xf8870f988ab09be7c5820a856bd5e9da84fc7192e095a7a8829919293b00a36c",
|
|
25
|
-
globalConfig: "0xc6b29a60c3924776bedc78df72c127ea52b86aeb655432979a38f13d742dedaa",
|
|
26
|
-
},
|
|
27
22
|
bluemove: {
|
|
28
23
|
name: "Bluemove",
|
|
29
24
|
package: "0x08cd33481587d4c4612865b164796d937df13747d8c763b8a178c87e3244498f",
|
|
@@ -31,7 +26,7 @@ exports.DEFAULT_CONFIG = {
|
|
|
31
26
|
},
|
|
32
27
|
cetus: {
|
|
33
28
|
name: "Cetus",
|
|
34
|
-
package: "
|
|
29
|
+
package: "0xb2db7142fa83210a7d78d9c12ac49c043b3cbbd482224fea6e3da00aa5a5ae2d",
|
|
35
30
|
globalConfig: "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f",
|
|
36
31
|
},
|
|
37
32
|
deepbook_v3: {
|
|
@@ -47,7 +42,7 @@ exports.DEFAULT_CONFIG = {
|
|
|
47
42
|
},
|
|
48
43
|
flowx_v3: {
|
|
49
44
|
name: "Flowx Finance V3",
|
|
50
|
-
package: "
|
|
45
|
+
package: "0xe882cd54551e73e64ff5b257146a0c5264546974cf00d78ecc871017cb22df67",
|
|
51
46
|
registry: "0x27565d24a4cd51127ac90e4074a841bbe356cca7bf5759ddc14a975be1632abc",
|
|
52
47
|
version: "0x67624a1533b5aff5d0dfcf5e598684350efd38134d2d245f475524c03a64e656",
|
|
53
48
|
},
|
|
@@ -57,7 +52,7 @@ exports.DEFAULT_CONFIG = {
|
|
|
57
52
|
},
|
|
58
53
|
kriya_v3: {
|
|
59
54
|
name: "Kriya V3",
|
|
60
|
-
package: "
|
|
55
|
+
package: "0x0d7305a7475ed54adc905365bd081939a81926636b4c438cf2f75f4924b8d960",
|
|
61
56
|
version: "0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78",
|
|
62
57
|
},
|
|
63
58
|
obric: {
|
|
@@ -79,7 +74,7 @@ exports.DEFAULT_CONFIG = {
|
|
|
79
74
|
},
|
|
80
75
|
turbos: {
|
|
81
76
|
name: "Turbos Finance",
|
|
82
|
-
package: "
|
|
77
|
+
package: "0xd02012c71c1a6a221e540c36c37c81e0224907fe1ee05bfe250025654ff17103",
|
|
83
78
|
version: "0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f",
|
|
84
79
|
},
|
|
85
80
|
steamm: {
|
|
@@ -90,7 +85,7 @@ exports.DEFAULT_CONFIG = {
|
|
|
90
85
|
},
|
|
91
86
|
magma: {
|
|
92
87
|
name: "Magma",
|
|
93
|
-
package: "
|
|
88
|
+
package: "0x49e9f06c58a36830fe0d83291f002012e72b00a4ec9b3a6304c40fc5712bb6e3",
|
|
94
89
|
globalConfig: "0x4c4e1402401f72c7d8533d0ed8d5f8949da363c7a3319ccef261ffe153d32f8a",
|
|
95
90
|
},
|
|
96
91
|
haedal_pmm: {
|
|
@@ -99,9 +94,19 @@ exports.DEFAULT_CONFIG = {
|
|
|
99
94
|
},
|
|
100
95
|
momentum: {
|
|
101
96
|
name: "Momentum",
|
|
102
|
-
package: "
|
|
97
|
+
package: "0xc84b1ef2ac2ba5c3018e2b8c956ba5d0391e0e46d1daa1926d5a99a6a42526b4",
|
|
103
98
|
version: "0x2375a0b1ec12010aaea3b2545acfa2ad34cfbba03ce4b59f4c39e1e25eed1b2a",
|
|
104
99
|
},
|
|
100
|
+
bluefinx: {
|
|
101
|
+
name: "BluefinX",
|
|
102
|
+
package: "0xf8870f988ab09be7c5820a856bd5e9da84fc7192e095a7a8829919293b00a36c",
|
|
103
|
+
globalConfig: "0xc6b29a60c3924776bedc78df72c127ea52b86aeb655432979a38f13d742dedaa",
|
|
104
|
+
},
|
|
105
|
+
sevenk_v1: {
|
|
106
|
+
name: "7K DEX",
|
|
107
|
+
package: "0x4142285db093ba0cf0623b3cbc07372fb4f5ed00af1fb62be6d55f49a42c0b0e",
|
|
108
|
+
oracle: "0x8c36ea167c5e6da8c3d60b4fc897416105dcb986471bd81cfbfd38720a4487c0",
|
|
109
|
+
},
|
|
105
110
|
};
|
|
106
111
|
let config = exports.DEFAULT_CONFIG;
|
|
107
112
|
let configTs = 0;
|
|
@@ -23,9 +23,11 @@ exports.DEFAULT_SOURCES = [
|
|
|
23
23
|
"stsui",
|
|
24
24
|
"steamm",
|
|
25
25
|
"steamm_oracle_quoter",
|
|
26
|
+
"steamm_oracle_quoter_v2",
|
|
26
27
|
"magma",
|
|
27
28
|
"haedal_pmm",
|
|
28
29
|
"momentum",
|
|
30
|
+
"sevenk_v1",
|
|
29
31
|
];
|
|
30
32
|
async function getQuote({ tokenIn, tokenOut, amountIn, sources = exports.DEFAULT_SOURCES, commissionBps, targetPools, excludedPools, taker, }) {
|
|
31
33
|
const params = new URLSearchParams({
|
|
@@ -24,5 +24,18 @@ class BaseContract {
|
|
|
24
24
|
}
|
|
25
25
|
return extra;
|
|
26
26
|
}
|
|
27
|
+
getPythPriceInfoId(oracle) {
|
|
28
|
+
// FIXME: deprecation price_identifier in the next version
|
|
29
|
+
const bytes = oracle?.Pyth?.bytes || oracle?.Pyth?.price_identifier?.bytes;
|
|
30
|
+
if (!bytes) {
|
|
31
|
+
throw new Error(`Invalid oracle info for getPythPriceInfoId`);
|
|
32
|
+
}
|
|
33
|
+
const feedId = "0x" + (0, utils_1.toHex)(Uint8Array.from(bytes));
|
|
34
|
+
const id = this.pythMap[feedId];
|
|
35
|
+
if (!id) {
|
|
36
|
+
throw new Error(`Missing price info for oracle ${feedId}`);
|
|
37
|
+
}
|
|
38
|
+
return id;
|
|
39
|
+
}
|
|
27
40
|
}
|
|
28
41
|
exports.BaseContract = BaseContract;
|
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HaedalPMMContract = void 0;
|
|
4
4
|
const utils_1 = require("@mysten/sui/utils");
|
|
5
|
-
const base_1 = require("../base");
|
|
6
5
|
const sui_1 = require("../../../utils/sui");
|
|
6
|
+
const base_1 = require("../base");
|
|
7
7
|
class HaedalPMMContract extends base_1.BaseContract {
|
|
8
8
|
async swap(tx) {
|
|
9
9
|
const [coinX, coinY] = this.swapInfo.pool.allTokens;
|
|
10
10
|
const xToY = this.swapInfo.swapXtoY;
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
throw new Error("x_price_id and y_price_id are required");
|
|
14
|
-
}
|
|
11
|
+
const oracleX = this.getPythPriceInfoId(this.extra.oracles?.[0]);
|
|
12
|
+
const oracleY = this.getPythPriceInfoId(this.extra.oracles?.[1]);
|
|
15
13
|
const config = this.config.haedal_pmm;
|
|
16
14
|
const [coinOut] = tx.moveCall({
|
|
17
15
|
target: `${config.package}::trader::${xToY ? "sell_base_coin" : "sell_quote_coin"}`,
|
|
@@ -19,8 +17,8 @@ class HaedalPMMContract extends base_1.BaseContract {
|
|
|
19
17
|
arguments: [
|
|
20
18
|
tx.object(this.swapInfo.poolId),
|
|
21
19
|
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
22
|
-
tx.object(
|
|
23
|
-
tx.object(
|
|
20
|
+
tx.object(oracleX), // pyth pricefeed for x
|
|
21
|
+
tx.object(oracleY), // pyth pricefeed for y
|
|
24
22
|
this.inputCoinObject, // mutable coin
|
|
25
23
|
this.getInputCoinValue(tx), // swap amount
|
|
26
24
|
tx.pure.u64(0), // min output amount
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProtocolContract = void 0;
|
|
4
|
-
const flowx_1 = require("./flowx");
|
|
5
4
|
const aftermath_1 = require("./aftermath");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const turbos_1 = require("./turbos");
|
|
9
|
-
const suiswap_1 = require("./suiswap");
|
|
5
|
+
const bluefin_1 = require("./bluefin");
|
|
6
|
+
const bluefinx_1 = require("./bluefinx");
|
|
10
7
|
const bluemove_1 = require("./bluemove");
|
|
11
|
-
const
|
|
8
|
+
const cetus_1 = require("./cetus");
|
|
12
9
|
const sponsored_1 = require("./deepbookV3/sponsored");
|
|
13
|
-
const
|
|
14
|
-
const springsui_1 = require("./springsui");
|
|
15
|
-
const obric_1 = require("./obric");
|
|
16
|
-
const stsui_1 = require("./stsui");
|
|
10
|
+
const flowx_1 = require("./flowx");
|
|
17
11
|
const flowxV3_1 = require("./flowxV3");
|
|
18
|
-
const steamm_1 = require("./steamm");
|
|
19
|
-
const magma_1 = require("./magma");
|
|
20
12
|
const haedal_pmm_1 = require("./haedal_pmm");
|
|
13
|
+
const kriya_1 = require("./kriya");
|
|
14
|
+
const kriyaV3_1 = require("./kriyaV3");
|
|
15
|
+
const magma_1 = require("./magma");
|
|
21
16
|
const momentum_1 = require("./momentum");
|
|
22
|
-
const
|
|
17
|
+
const obric_1 = require("./obric");
|
|
18
|
+
const sevenk_1 = require("./sevenk");
|
|
19
|
+
const springsui_1 = require("./springsui");
|
|
20
|
+
const steamm_1 = require("./steamm");
|
|
21
|
+
const stsui_1 = require("./stsui");
|
|
22
|
+
const suiswap_1 = require("./suiswap");
|
|
23
|
+
const turbos_1 = require("./turbos");
|
|
23
24
|
exports.ProtocolContract = {
|
|
24
25
|
cetus: cetus_1.CetusContract,
|
|
25
26
|
turbos: turbos_1.TurbosContract,
|
|
@@ -37,8 +38,10 @@ exports.ProtocolContract = {
|
|
|
37
38
|
stsui: stsui_1.StSuiContract,
|
|
38
39
|
steamm: steamm_1.SteammContract,
|
|
39
40
|
steamm_oracle_quoter: steamm_1.SteammContract,
|
|
41
|
+
steamm_oracle_quoter_v2: steamm_1.SteammContract,
|
|
40
42
|
magma: magma_1.MagmaContract,
|
|
41
43
|
haedal_pmm: haedal_pmm_1.HaedalPMMContract,
|
|
42
44
|
momentum: momentum_1.MomentumContract,
|
|
43
45
|
bluefinx: bluefinx_1.BluefinXContract,
|
|
46
|
+
sevenk_v1: sevenk_1.SevenKV1,
|
|
44
47
|
};
|
|
@@ -7,10 +7,8 @@ class ObricContract extends base_1.BaseContract {
|
|
|
7
7
|
async swap(tx) {
|
|
8
8
|
const [coinX, coinY] = this.swapInfo.pool.allTokens;
|
|
9
9
|
const xToY = this.swapInfo.swapXtoY;
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
throw new Error("x_price_id and y_price_id are required");
|
|
13
|
-
}
|
|
10
|
+
const oracleX = this.getPythPriceInfoId(this.extra.oracles?.[0]);
|
|
11
|
+
const oracleY = this.getPythPriceInfoId(this.extra.oracles?.[1]);
|
|
14
12
|
const { package: PACKAGE_ID, pythState: PYTH_STATE } = this.config.obric;
|
|
15
13
|
const [coinOut] = tx.moveCall({
|
|
16
14
|
target: `${PACKAGE_ID}::v2::${xToY ? "swap_x_to_y" : "swap_y_to_x"}`,
|
|
@@ -19,8 +17,8 @@ class ObricContract extends base_1.BaseContract {
|
|
|
19
17
|
tx.object(this.swapInfo.poolId),
|
|
20
18
|
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
21
19
|
tx.object(PYTH_STATE),
|
|
22
|
-
tx.object(
|
|
23
|
-
tx.object(
|
|
20
|
+
tx.object(oracleX), // pyth pricefeed for x
|
|
21
|
+
tx.object(oracleY), // pyth pricefeed for y
|
|
24
22
|
this.inputCoinObject,
|
|
25
23
|
],
|
|
26
24
|
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SevenKV1 = void 0;
|
|
4
|
+
const utils_1 = require("@mysten/sui/utils");
|
|
5
|
+
const base_1 = require("../base");
|
|
6
|
+
class SevenKV1 extends base_1.BaseContract {
|
|
7
|
+
async swap(tx) {
|
|
8
|
+
const x2y = this.swapInfo.swapXtoY;
|
|
9
|
+
const config = this.config.sevenk_v1;
|
|
10
|
+
const [coinOut] = tx.moveCall({
|
|
11
|
+
target: `${config.package}::pool_v1::${x2y ? "swap_x_to_y" : "swap_y_to_x"}`,
|
|
12
|
+
typeArguments: (0, utils_1.parseStructTag)(this.extra.poolStructTag).typeParams.map(utils_1.normalizeStructTag),
|
|
13
|
+
arguments: [
|
|
14
|
+
tx.object(this.swapInfo.poolId),
|
|
15
|
+
this.getOraclePriceUpdate(tx),
|
|
16
|
+
this.inputCoinObject,
|
|
17
|
+
tx.pure.u64(0),
|
|
18
|
+
],
|
|
19
|
+
});
|
|
20
|
+
return coinOut;
|
|
21
|
+
}
|
|
22
|
+
getOraclePriceUpdate(tx) {
|
|
23
|
+
const oracleX = this.extra.oracles?.[0]?.Pyth?.bytes;
|
|
24
|
+
const oracleY = this.extra.oracles?.[1]?.Pyth?.bytes;
|
|
25
|
+
if (!oracleX ||
|
|
26
|
+
!oracleY ||
|
|
27
|
+
!this.extra.oracleConfigX ||
|
|
28
|
+
!this.extra.oracleConfigY) {
|
|
29
|
+
throw new Error(`Invalid oracle info for getOraclePriceUpdate`);
|
|
30
|
+
}
|
|
31
|
+
const [holder] = tx.moveCall({
|
|
32
|
+
target: `${this.config.sevenk_v1.oracle}::oracle::new_holder`,
|
|
33
|
+
});
|
|
34
|
+
tx.moveCall({
|
|
35
|
+
target: `${this.config.sevenk_v1.oracle}::pyth::get_price`,
|
|
36
|
+
arguments: [
|
|
37
|
+
tx.object(this.extra.oracleConfigX),
|
|
38
|
+
holder,
|
|
39
|
+
tx.object(this.pythMap["0x" + (0, utils_1.toHex)(Uint8Array.from(oracleX))]),
|
|
40
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
41
|
+
],
|
|
42
|
+
});
|
|
43
|
+
tx.moveCall({
|
|
44
|
+
target: `${this.config.sevenk_v1.oracle}::pyth::get_price`,
|
|
45
|
+
arguments: [
|
|
46
|
+
tx.object(this.extra.oracleConfigY),
|
|
47
|
+
holder,
|
|
48
|
+
tx.object(this.pythMap["0x" + (0, utils_1.toHex)(Uint8Array.from(oracleY))]),
|
|
49
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
50
|
+
],
|
|
51
|
+
});
|
|
52
|
+
return holder;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.SevenKV1 = SevenKV1;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SteammContract = void 0;
|
|
4
|
-
const base_1 = require("../base");
|
|
5
4
|
const utils_1 = require("@mysten/sui/utils");
|
|
6
5
|
const sui_1 = require("../../../utils/sui");
|
|
6
|
+
const base_1 = require("../base");
|
|
7
7
|
class SteammContract extends base_1.BaseContract {
|
|
8
8
|
async swap(tx) {
|
|
9
9
|
if (this.extra.poolStructTag.includes("omm::OracleQuoter")) {
|
|
10
|
-
return this.ommSwap(tx);
|
|
10
|
+
return this.ommSwap(tx, "v1");
|
|
11
|
+
}
|
|
12
|
+
else if (this.extra.poolStructTag.includes("omm_v2::OracleQuoterV2")) {
|
|
13
|
+
return this.ommSwap(tx, "v2");
|
|
11
14
|
}
|
|
12
15
|
else if (this.extra.poolStructTag.includes("cpmm::CpQuoter")) {
|
|
13
16
|
return this.cpmmSwap(tx);
|
|
@@ -68,7 +71,7 @@ class SteammContract extends base_1.BaseContract {
|
|
|
68
71
|
sui_1.SuiUtils.collectDust(tx, this.swapInfo.assetIn, coinIn);
|
|
69
72
|
return coinOut;
|
|
70
73
|
}
|
|
71
|
-
ommSwap(tx) {
|
|
74
|
+
ommSwap(tx, version) {
|
|
72
75
|
const extra = this.swapInfo.extra;
|
|
73
76
|
if (!extra ||
|
|
74
77
|
!extra.bankAStructTag ||
|
|
@@ -96,7 +99,7 @@ class SteammContract extends base_1.BaseContract {
|
|
|
96
99
|
: sui_1.SuiUtils.zeroCoin(tx, (0, utils_1.normalizeStructTag)(coinTypeB));
|
|
97
100
|
const [priceA, priceB] = this.getOraclePriceUpdate(tx);
|
|
98
101
|
tx.moveCall({
|
|
99
|
-
target: `${this.config.steamm.script}::pool_script_v2
|
|
102
|
+
target: `${this.config.steamm.script}::pool_script_v2::${version === "v1" ? "omm_swap" : "omm_v2_swap"}`,
|
|
100
103
|
typeArguments: [
|
|
101
104
|
lendingMarket,
|
|
102
105
|
coinTypeA,
|
|
@@ -126,18 +129,18 @@ class SteammContract extends base_1.BaseContract {
|
|
|
126
129
|
return coinOut;
|
|
127
130
|
}
|
|
128
131
|
getOraclePriceUpdate(tx) {
|
|
129
|
-
const oracleA = this.extra.oracles?.[0]
|
|
130
|
-
const oracleB = this.extra.oracles?.[1]
|
|
132
|
+
const oracleA = this.getPythPriceInfoId(this.extra.oracles?.[0]);
|
|
133
|
+
const oracleB = this.getPythPriceInfoId(this.extra.oracles?.[1]);
|
|
131
134
|
const registry = this.extra.oracleRegistry;
|
|
132
135
|
const indexes = this.extra.oracleIndexes;
|
|
133
|
-
if (!
|
|
136
|
+
if (!registry || indexes?.length !== 2) {
|
|
134
137
|
throw new Error(`Invalid oracle info for getOraclePriceUpdate`);
|
|
135
138
|
}
|
|
136
139
|
const [a] = tx.moveCall({
|
|
137
140
|
target: `${this.config.steamm.oracle}::oracles::get_pyth_price`,
|
|
138
141
|
arguments: [
|
|
139
142
|
tx.object(registry),
|
|
140
|
-
tx.object(
|
|
143
|
+
tx.object(oracleA),
|
|
141
144
|
tx.pure.u64(indexes[0]),
|
|
142
145
|
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
143
146
|
],
|
|
@@ -146,7 +149,7 @@ class SteammContract extends base_1.BaseContract {
|
|
|
146
149
|
target: `${this.config.steamm.oracle}::oracles::get_pyth_price`,
|
|
147
150
|
arguments: [
|
|
148
151
|
tx.object(registry),
|
|
149
|
-
tx.object(
|
|
152
|
+
tx.object(oracleB),
|
|
150
153
|
tx.pure.u64(indexes[1]),
|
|
151
154
|
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
152
155
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildTx.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/buildTx.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,aAAa,
|
|
1
|
+
{"version":3,"file":"buildTx.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/buildTx.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,aAAa,EAId,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAK/C,eAAO,MAAM,OAAO,GAAU,2GAQ3B,aAAa,KAAG,OAAO,CAAC,aAAa,CA4IvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,eAAO,MAAM,cAAc,EAAE,MAgJ5B,CAAC;AAIF,wBAAsB,SAAS,oBAe9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getQuote.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/getQuote.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,aAAa,EACb,SAAS,EACV,MAAM,wBAAwB,CAAC;AAEhC,UAAU,MAAM;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB;;;kEAG8D;IAC9D,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,eAAe,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"getQuote.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/getQuote.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,aAAa,EACb,SAAS,EACV,MAAM,wBAAwB,CAAC;AAEhC,UAAU,MAAM;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB;;;kEAG8D;IAC9D,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,eAAe,EAAE,SAAS,EAsBtC,CAAC;AAEF,wBAAsB,QAAQ,CAAC,EAC7B,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,OAAyB,EACzB,aAAa,EACb,WAAW,EACX,aAAa,EACb,KAAK,GACN,EAAE,MAAM,0BA+BR"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Transaction } from "@mysten/sui/transactions";
|
|
2
|
-
import { Config, TxSorSwap } from "../../types/aggregator";
|
|
2
|
+
import { Config, ExtraOracle, TxSorSwap } from "../../types/aggregator";
|
|
3
3
|
import { TransactionResultItem } from "../../types/sui";
|
|
4
4
|
export interface BaseContractParams {
|
|
5
5
|
swapInfo: TxSorSwap;
|
|
@@ -20,5 +20,6 @@ export declare abstract class BaseContract<T = any> {
|
|
|
20
20
|
protected getInputCoinValue(tx: Transaction): import("@mysten/sui/transactions").TransactionArgument;
|
|
21
21
|
protected getTypeParams(): string[];
|
|
22
22
|
protected get extra(): NonNullable<T>;
|
|
23
|
+
protected getPythPriceInfoId(oracle?: ExtraOracle): string;
|
|
23
24
|
}
|
|
24
25
|
//# sourceMappingURL=base.d.ts.map
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../../src/libs/protocols/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAGxD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,eAAe,EAAE,qBAAqB,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,8BAAsB,YAAY,CAAC,CAAC,GAAG,GAAG;IACxC,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;IACzB,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAE9B,EACV,QAAQ,EACR,eAAe,EACf,cAAc,EACd,MAAM,EACN,OAAO,GACR,EAAE,kBAAkB;IAQrB,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAE9D,SAAS,CAAC,iBAAiB,CAAC,EAAE,EAAE,WAAW;IAQ3C,SAAS,CAAC,aAAa;IAMvB,SAAS,KAAK,KAAK,mBAMlB;IAED,SAAS,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,WAAW;CAclD"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { Transaction } from "@mysten/sui/transactions";
|
|
2
|
+
import { ExtraOracle } from "../../../types/aggregator";
|
|
2
3
|
import { BaseContract } from "../base";
|
|
3
|
-
|
|
4
|
+
type HaedalPMMExtra = {
|
|
5
|
+
oracles: ExtraOracle[];
|
|
6
|
+
};
|
|
7
|
+
export declare class HaedalPMMContract extends BaseContract<HaedalPMMExtra> {
|
|
4
8
|
swap(tx: Transaction): Promise<{
|
|
5
9
|
$kind: "NestedResult";
|
|
6
10
|
NestedResult: [number, number];
|
|
7
11
|
}>;
|
|
8
12
|
}
|
|
13
|
+
export {};
|
|
9
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/haedal_pmm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/haedal_pmm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,KAAK,cAAc,GAAG;IACpB,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC;AACF,qBAAa,iBAAkB,SAAQ,YAAY,CAAC,cAAc,CAAC;IAC3D,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CAyB3B"}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { FlowXContract } from "./flowx";
|
|
2
1
|
import { AfterMathContract } from "./aftermath";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { TurbosContract } from "./turbos";
|
|
6
|
-
import { SuiswapContract } from "./suiswap";
|
|
2
|
+
import { BluefinContract } from "./bluefin";
|
|
3
|
+
import { BluefinXContract } from "./bluefinx";
|
|
7
4
|
import { BluemoveContract } from "./bluemove";
|
|
8
|
-
import {
|
|
5
|
+
import { CetusContract } from "./cetus";
|
|
9
6
|
import { SponsoredDeepBookV3Contract } from "./deepbookV3/sponsored";
|
|
10
|
-
import {
|
|
11
|
-
import { SpringSuiContract } from "./springsui";
|
|
12
|
-
import { ObricContract } from "./obric";
|
|
13
|
-
import { StSuiContract } from "./stsui";
|
|
7
|
+
import { FlowXContract } from "./flowx";
|
|
14
8
|
import { FlowxV3Contract } from "./flowxV3";
|
|
15
|
-
import { SteammContract } from "./steamm";
|
|
16
|
-
import { MagmaContract } from "./magma";
|
|
17
9
|
import { HaedalPMMContract } from "./haedal_pmm";
|
|
10
|
+
import { KriyaContract } from "./kriya";
|
|
11
|
+
import { KriyaV3Contract } from "./kriyaV3";
|
|
12
|
+
import { MagmaContract } from "./magma";
|
|
18
13
|
import { MomentumContract } from "./momentum";
|
|
19
|
-
import {
|
|
14
|
+
import { ObricContract } from "./obric";
|
|
15
|
+
import { SevenKV1 } from "./sevenk";
|
|
16
|
+
import { SpringSuiContract } from "./springsui";
|
|
17
|
+
import { SteammContract } from "./steamm";
|
|
18
|
+
import { StSuiContract } from "./stsui";
|
|
19
|
+
import { SuiswapContract } from "./suiswap";
|
|
20
|
+
import { TurbosContract } from "./turbos";
|
|
20
21
|
export declare const ProtocolContract: {
|
|
21
22
|
cetus: typeof CetusContract;
|
|
22
23
|
turbos: typeof TurbosContract;
|
|
@@ -34,9 +35,11 @@ export declare const ProtocolContract: {
|
|
|
34
35
|
stsui: typeof StSuiContract;
|
|
35
36
|
steamm: typeof SteammContract;
|
|
36
37
|
steamm_oracle_quoter: typeof SteammContract;
|
|
38
|
+
steamm_oracle_quoter_v2: typeof SteammContract;
|
|
37
39
|
magma: typeof MagmaContract;
|
|
38
40
|
haedal_pmm: typeof HaedalPMMContract;
|
|
39
41
|
momentum: typeof MomentumContract;
|
|
40
42
|
bluefinx: typeof BluefinXContract;
|
|
43
|
+
sevenk_v1: typeof SevenKV1;
|
|
41
44
|
};
|
|
42
45
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/libs/protocols/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/libs/protocols/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;CAuB5B,CAAC"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { Transaction } from "@mysten/sui/transactions";
|
|
2
|
+
import { ExtraOracle } from "../../../types/aggregator";
|
|
2
3
|
import { BaseContract } from "../base";
|
|
3
|
-
|
|
4
|
+
type ObricExtra = {
|
|
5
|
+
oracles: ExtraOracle[];
|
|
6
|
+
};
|
|
7
|
+
export declare class ObricContract extends BaseContract<ObricExtra> {
|
|
4
8
|
swap(tx: Transaction): Promise<{
|
|
5
9
|
$kind: "NestedResult";
|
|
6
10
|
NestedResult: [number, number];
|
|
7
11
|
}>;
|
|
8
12
|
}
|
|
13
|
+
export {};
|
|
9
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/obric/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/obric/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,KAAK,UAAU,GAAG;IAChB,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC;AACF,qBAAa,aAAc,SAAQ,YAAY,CAAC,UAAU,CAAC;IACnD,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CAuB3B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
|
+
import { ExtraOracle } from "../../../types/aggregator";
|
|
3
|
+
import { TransactionResultItem } from "../../../types/sui";
|
|
4
|
+
import { BaseContract } from "../base";
|
|
5
|
+
export type SevenKExtra = {
|
|
6
|
+
poolStructTag: string;
|
|
7
|
+
oracleConfigX: string;
|
|
8
|
+
oracleConfigY: string;
|
|
9
|
+
oracles: ExtraOracle[];
|
|
10
|
+
};
|
|
11
|
+
export declare class SevenKV1 extends BaseContract<SevenKExtra> {
|
|
12
|
+
swap(tx: Transaction): Promise<TransactionResultItem>;
|
|
13
|
+
getOraclePriceUpdate(tx: Transaction): {
|
|
14
|
+
$kind: "NestedResult";
|
|
15
|
+
NestedResult: [number, number];
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/sevenk/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAOvD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,MAAM,WAAW,GAAG;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC;AAEF,qBAAa,QAAS,SAAQ,YAAY,CAAC,WAAW,CAAC;IAC/C,IAAI,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAqB3D,oBAAoB,CAAC,EAAE,EAAE,WAAW;;;;CAkCrC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transaction } from "@mysten/sui/transactions";
|
|
2
|
-
import { BaseContract } from "../base";
|
|
3
2
|
import { ExtraOracle } from "../../../types/aggregator";
|
|
3
|
+
import { BaseContract } from "../base";
|
|
4
4
|
export type SteamExtra = {
|
|
5
5
|
bankAStructTag: string;
|
|
6
6
|
bankBStructTag: string;
|
|
@@ -10,7 +10,7 @@ export type SteamExtra = {
|
|
|
10
10
|
lendingMarketA: string;
|
|
11
11
|
lendingMarketB: string;
|
|
12
12
|
oracleRegistry?: string;
|
|
13
|
-
oracles
|
|
13
|
+
oracles: ExtraOracle[];
|
|
14
14
|
oracleIndexes?: number[];
|
|
15
15
|
};
|
|
16
16
|
export declare class SteammContract extends BaseContract<SteamExtra> {
|
|
@@ -22,7 +22,7 @@ export declare class SteammContract extends BaseContract<SteamExtra> {
|
|
|
22
22
|
$kind: "NestedResult";
|
|
23
23
|
NestedResult: [number, number];
|
|
24
24
|
};
|
|
25
|
-
ommSwap(tx: Transaction): {
|
|
25
|
+
ommSwap(tx: Transaction, version: "v1" | "v2"): {
|
|
26
26
|
$kind: "NestedResult";
|
|
27
27
|
NestedResult: [number, number];
|
|
28
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/steamm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/steamm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAMvD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,MAAM,UAAU,GAAG;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AACF,qBAAa,cAAe,SAAQ,YAAY,CAAC,UAAU,CAAC;IACpD,IAAI,CAAC,EAAE,EAAE,WAAW;;;;IAW1B,QAAQ,CAAC,EAAE,EAAE,WAAW;;;;IAmExB,OAAO,CAAC,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,GAAG,IAAI;;;;IAuE7C,oBAAoB,CAAC,EAAE,EAAE,WAAW;;;;;;;CA8BrC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
2
2
|
import { BluefinXTx } from "../libs/protocols/bluefinx/types";
|
|
3
3
|
export { BluefinXTx };
|
|
4
|
-
export type SourceDex = "suiswap" | "turbos" | "cetus" | "bluemove" | "kriya" | "kriya_v3" | "aftermath" | "deepbook_v3" | "flowx" | "flowx_v3" | "bluefin" | "bluefinx" | "springsui" | "obric" | "stsui" | "steamm" | "steamm_oracle_quoter" | "magma" | "haedal_pmm" | "momentum";
|
|
4
|
+
export type SourceDex = "suiswap" | "turbos" | "cetus" | "bluemove" | "kriya" | "kriya_v3" | "aftermath" | "deepbook_v3" | "flowx" | "flowx_v3" | "bluefin" | "bluefinx" | "springsui" | "obric" | "stsui" | "steamm" | "steamm_oracle_quoter" | "steamm_oracle_quoter_v2" | "magma" | "haedal_pmm" | "momentum" | "sevenk_v1";
|
|
5
5
|
export type SorSwap = {
|
|
6
6
|
poolId: string;
|
|
7
7
|
assetInIndex: number;
|
|
@@ -132,15 +132,13 @@ export interface Config {
|
|
|
132
132
|
momentum: DexConfig & {
|
|
133
133
|
version: string;
|
|
134
134
|
};
|
|
135
|
+
sevenk_v1: DexConfig & {
|
|
136
|
+
oracle: string;
|
|
137
|
+
};
|
|
135
138
|
}
|
|
136
139
|
export type ExtraOracle = {
|
|
137
140
|
Pyth?: {
|
|
138
|
-
|
|
139
|
-
bytes: number[];
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
Switchboard?: {
|
|
143
|
-
object_id: string;
|
|
141
|
+
bytes: number[];
|
|
144
142
|
};
|
|
145
143
|
};
|
|
146
144
|
export type AggregatorTx = Transaction | BluefinXTx;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregator.d.ts","sourceRoot":"","sources":["../../../../src/types/aggregator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,QAAQ,GACR,OAAO,GACP,UAAU,GACV,OAAO,GACP,UAAU,GACV,WAAW,GACX,aAAa,GACb,OAAO,GACP,UAAU,GACV,SAAS,GACT,UAAU,GACV,WAAW,GACX,OAAO,GACP,OAAO,GACP,QAAQ,GACR,sBAAsB,GACtB,OAAO,GACP,YAAY,GACZ,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"aggregator.d.ts","sourceRoot":"","sources":["../../../../src/types/aggregator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,QAAQ,GACR,OAAO,GACP,UAAU,GACV,OAAO,GACP,UAAU,GACV,WAAW,GACX,aAAa,GACb,OAAO,GACP,UAAU,GACV,SAAS,GACT,UAAU,GACV,WAAW,GACX,OAAO,GACP,OAAO,GACP,QAAQ,GACR,sBAAsB,GACtB,yBAAyB,GACzB,OAAO,GACP,YAAY,GACZ,UAAU,GACV,WAAW,CAAC;AAEhB,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,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,SAAS,EAAE,KAAK,CAAC;QAAE,OAAO,E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export const buildTx = async ({ quoteResponse, accountAddress, slippage, commiss
|
|
|
120
120
|
const getPythPriceFeeds = (res) => {
|
|
121
121
|
const ids = new Set();
|
|
122
122
|
for (const s of res.swaps) {
|
|
123
|
-
for (const o of s.extra?.oracles || []) {
|
|
124
|
-
|
|
123
|
+
for (const o of (s.extra?.oracles || [])) {
|
|
124
|
+
// FIXME: deprecation price_identifier in the next version
|
|
125
|
+
const bytes = o.Pyth?.bytes || o.Pyth?.price_identifier?.bytes;
|
|
125
126
|
if (bytes) {
|
|
126
127
|
ids.add("0x" + toHex(Uint8Array.from(bytes)));
|
|
127
128
|
}
|