@7kprotocol/sdk-ts 2.3.4 → 2.3.6
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/prices/index.js +2 -2
- package/lib/cjs/features/swap/config.js +16 -5
- package/lib/cjs/features/swap/getQuote.js +2 -0
- package/lib/cjs/libs/protocols/index.js +4 -0
- package/lib/cjs/libs/protocols/kriya/index.js +2 -3
- package/lib/cjs/libs/protocols/kriyaV3/index.js +1 -2
- package/lib/cjs/libs/protocols/magma/index.js +52 -0
- package/lib/cjs/libs/protocols/obric/index.js +1 -2
- package/lib/cjs/libs/protocols/springsui/index.js +1 -1
- package/lib/cjs/libs/protocols/steamm/index.js +158 -0
- package/lib/cjs/libs/protocols/stsui/index.js +1 -1
- package/lib/cjs/libs/protocols/suiswap/index.js +2 -3
- package/lib/cjs/libs/protocols/turbos/index.js +5 -8
- package/lib/cjs/types/features/swap/config.d.ts +1 -0
- 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/index.d.ts +4 -0
- package/lib/cjs/types/libs/protocols/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/kriya/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/kriyaV3/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/magma/index.d.ts +9 -0
- package/lib/cjs/types/libs/protocols/magma/index.d.ts.map +1 -0
- package/lib/cjs/types/libs/protocols/obric/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/springsui/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/steamm/index.d.ts +26 -0
- package/lib/cjs/types/libs/protocols/steamm/index.d.ts.map +1 -0
- package/lib/cjs/types/libs/protocols/stsui/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/suiswap/index.d.ts.map +1 -1
- package/lib/cjs/types/libs/protocols/turbos/index.d.ts.map +1 -1
- package/lib/cjs/types/types/aggregator.d.ts +7 -1
- package/lib/cjs/types/types/aggregator.d.ts.map +1 -1
- package/lib/cjs/types/utils/sui.d.ts +4 -0
- package/lib/cjs/types/utils/sui.d.ts.map +1 -1
- package/lib/cjs/utils/sui.js +8 -1
- package/lib/esm/features/prices/index.js +2 -2
- package/lib/esm/features/swap/config.js +14 -4
- package/lib/esm/features/swap/getQuote.js +2 -0
- package/lib/esm/libs/protocols/index.js +4 -0
- package/lib/esm/libs/protocols/kriya/index.js +2 -3
- package/lib/esm/libs/protocols/kriyaV3/index.js +1 -2
- package/lib/esm/libs/protocols/magma/index.js +37 -0
- package/lib/esm/libs/protocols/obric/index.js +1 -2
- package/lib/esm/libs/protocols/springsui/index.js +1 -1
- package/lib/esm/libs/protocols/steamm/index.js +143 -0
- package/lib/esm/libs/protocols/stsui/index.js +1 -1
- package/lib/esm/libs/protocols/suiswap/index.js +2 -3
- package/lib/esm/libs/protocols/turbos/index.js +4 -7
- package/lib/esm/types/features/swap/config.d.ts +1 -0
- 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/index.d.ts +4 -0
- package/lib/esm/types/libs/protocols/index.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/kriya/index.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/kriyaV3/index.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/magma/index.d.ts +9 -0
- package/lib/esm/types/libs/protocols/magma/index.d.ts.map +1 -0
- package/lib/esm/types/libs/protocols/obric/index.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/springsui/index.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/steamm/index.d.ts +26 -0
- package/lib/esm/types/libs/protocols/steamm/index.d.ts.map +1 -0
- package/lib/esm/types/libs/protocols/stsui/index.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/suiswap/index.d.ts.map +1 -1
- package/lib/esm/types/libs/protocols/turbos/index.d.ts.map +1 -1
- package/lib/esm/types/types/aggregator.d.ts +7 -1
- package/lib/esm/types/types/aggregator.d.ts.map +1 -1
- package/lib/esm/types/utils/sui.d.ts +4 -0
- package/lib/esm/types/utils/sui.d.ts.map +1 -1
- package/lib/esm/utils/sui.js +8 -1
- package/package.json +1 -1
- package/lib/cjs/libs/protocols/turbos/constants.js +0 -7
- package/lib/cjs/types/libs/protocols/turbos/constants.d.ts +0 -5
- package/lib/cjs/types/libs/protocols/turbos/constants.d.ts.map +0 -1
- package/lib/esm/libs/protocols/turbos/constants.js +0 -4
- package/lib/esm/types/libs/protocols/turbos/constants.d.ts +0 -5
- package/lib/esm/types/libs/protocols/turbos/constants.d.ts.map +0 -1
|
@@ -24,7 +24,7 @@ function getTokenPrice(id_1) {
|
|
|
24
24
|
const pricesRes = (yield response.json());
|
|
25
25
|
return Number(((_a = pricesRes === null || pricesRes === void 0 ? void 0 : pricesRes[id]) === null || _a === void 0 ? void 0 : _a.price) || 0);
|
|
26
26
|
}
|
|
27
|
-
catch (
|
|
27
|
+
catch (_) {
|
|
28
28
|
return 0;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
@@ -70,7 +70,7 @@ function getTokenPrices(ids_1) {
|
|
|
70
70
|
}, {});
|
|
71
71
|
return finalPrices;
|
|
72
72
|
}
|
|
73
|
-
catch (
|
|
73
|
+
catch (_) {
|
|
74
74
|
return ids.slice(0, MAX_TOTAL_IDS).reduce((acc, id) => {
|
|
75
75
|
acc[id] = 0;
|
|
76
76
|
return acc;
|
|
@@ -9,10 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DEFAULT_CONFIG = void 0;
|
|
12
13
|
exports.getConfig = getConfig;
|
|
13
14
|
let config = null;
|
|
14
15
|
let configTs = 0;
|
|
15
|
-
|
|
16
|
+
exports.DEFAULT_CONFIG = {
|
|
16
17
|
aftermath: {
|
|
17
18
|
name: "Aftermath",
|
|
18
19
|
package: "0xc4049b2d1cc0f6e017fda8260e4377cecd236bd7f56a54fee120816e72e2e0dd",
|
|
@@ -86,13 +87,23 @@ const DEFAULT_CONFIG = {
|
|
|
86
87
|
},
|
|
87
88
|
turbos: {
|
|
88
89
|
name: "Turbos Finance",
|
|
89
|
-
package: "
|
|
90
|
+
package: "0x9df4666296ee324a6f11e9f664e35e7fd6b6e8c9e9058ce6ee9ad5c5343c2f87",
|
|
90
91
|
version: "0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f",
|
|
91
92
|
},
|
|
93
|
+
steamm: {
|
|
94
|
+
name: "Steamm",
|
|
95
|
+
package: "0x4fb1cf45dffd6230305f1d269dd1816678cc8e3ba0b747a813a556921219f261",
|
|
96
|
+
script: "0x13bfc09cfc1bd922d3aa53fcf7b2cd510727ee65068ce136e2ebd5f3b213fdd2",
|
|
97
|
+
},
|
|
98
|
+
magma: {
|
|
99
|
+
name: "Magma",
|
|
100
|
+
package: "0x951d48bece7f6c2a3f4ba0b5791ba823c491e504feb4136497ee51331208ac33",
|
|
101
|
+
globalConfig: "0x4c4e1402401f72c7d8533d0ed8d5f8949da363c7a3319ccef261ffe153d32f8a",
|
|
102
|
+
},
|
|
92
103
|
};
|
|
93
104
|
function getConfig() {
|
|
94
105
|
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
const ttl =
|
|
106
|
+
const ttl = 60;
|
|
96
107
|
if (config && Date.now() - configTs < ttl * 1000) {
|
|
97
108
|
return config;
|
|
98
109
|
}
|
|
@@ -103,8 +114,8 @@ function getConfig() {
|
|
|
103
114
|
configTs = Date.now();
|
|
104
115
|
return quoteResponse;
|
|
105
116
|
}
|
|
106
|
-
catch (
|
|
107
|
-
return DEFAULT_CONFIG;
|
|
117
|
+
catch (_) {
|
|
118
|
+
return exports.DEFAULT_CONFIG;
|
|
108
119
|
}
|
|
109
120
|
});
|
|
110
121
|
}
|
|
@@ -28,6 +28,8 @@ exports.DEFAULT_SOURCES = [
|
|
|
28
28
|
"springsui",
|
|
29
29
|
"obric",
|
|
30
30
|
"stsui",
|
|
31
|
+
"steamm",
|
|
32
|
+
"magma",
|
|
31
33
|
];
|
|
32
34
|
function getQuote(_a) {
|
|
33
35
|
return __awaiter(this, arguments, void 0, function* ({ tokenIn, tokenOut, amountIn, sources = exports.DEFAULT_SOURCES, targetPools, excludedPools, }) {
|
|
@@ -16,6 +16,8 @@ const springsui_1 = require("./springsui");
|
|
|
16
16
|
const obric_1 = require("./obric");
|
|
17
17
|
const stsui_1 = require("./stsui");
|
|
18
18
|
const flowxV3_1 = require("./flowxV3");
|
|
19
|
+
const steamm_1 = require("./steamm");
|
|
20
|
+
const magma_1 = require("./magma");
|
|
19
21
|
exports.ProtocolContract = {
|
|
20
22
|
cetus: cetus_1.CetusContract,
|
|
21
23
|
turbos: turbos_1.TurbosContract,
|
|
@@ -32,4 +34,6 @@ exports.ProtocolContract = {
|
|
|
32
34
|
springsui: springsui_1.SpringSuiContract,
|
|
33
35
|
obric: obric_1.ObricContract,
|
|
34
36
|
stsui: stsui_1.StSuiContract,
|
|
37
|
+
steamm: steamm_1.SteammContract,
|
|
38
|
+
magma: magma_1.MagmaContract,
|
|
35
39
|
};
|
|
@@ -12,8 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.KriyaContract = void 0;
|
|
13
13
|
const base_1 = require("../base");
|
|
14
14
|
const token_1 = require("../../../utils/token");
|
|
15
|
-
const PACKAGE_ID = "0xa0eba10b173538c8fecca1dff298e488402cc9ff374f8a12ca7758eebe830b66";
|
|
16
|
-
const MODULE_NAME = "spot_dex";
|
|
17
15
|
class KriyaContract extends base_1.BaseContract {
|
|
18
16
|
swap(tx) {
|
|
19
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -22,8 +20,9 @@ class KriyaContract extends base_1.BaseContract {
|
|
|
22
20
|
const coinOutType = (0, token_1.normalizeTokenType)(this.swapInfo.assetOut);
|
|
23
21
|
const poolId = this.swapInfo.poolId;
|
|
24
22
|
const inputCoinObject = this.inputCoinObject;
|
|
23
|
+
const config = this.config.kriya;
|
|
25
24
|
const [tokenOut] = tx.moveCall({
|
|
26
|
-
target: `${
|
|
25
|
+
target: `${config.package}::spot_dex::${swapXtoY ? "swap_token_x" : "swap_token_y"}`,
|
|
27
26
|
typeArguments: [
|
|
28
27
|
swapXtoY ? coinInType : coinOutType,
|
|
29
28
|
swapXtoY ? coinOutType : coinInType,
|
|
@@ -13,8 +13,6 @@ exports.KriyaV3Contract = void 0;
|
|
|
13
13
|
const base_1 = require("../base");
|
|
14
14
|
const utils_1 = require("@mysten/sui/utils");
|
|
15
15
|
const token_1 = require("../../../utils/token");
|
|
16
|
-
const PACKAGE_ID = "0xbd8d4489782042c6fafad4de4bc6a5e0b84a43c6c00647ffd7062d1e2bb7549e";
|
|
17
|
-
const VERSION_ID = "0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78";
|
|
18
16
|
class KriyaV3Contract extends base_1.BaseContract {
|
|
19
17
|
swap(tx) {
|
|
20
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -24,6 +22,7 @@ class KriyaV3Contract extends base_1.BaseContract {
|
|
|
24
22
|
const poolId = this.swapInfo.poolId;
|
|
25
23
|
const LowLimitPrice = 4295048017;
|
|
26
24
|
const limitPrice = BigInt("79226673515401279992447579050");
|
|
25
|
+
const { package: PACKAGE_ID, version: VERSION_ID } = this.config.kriya_v3;
|
|
27
26
|
const [receive_a, receive_b, flash_receipt] = tx.moveCall({
|
|
28
27
|
target: `${PACKAGE_ID}::trade::flash_swap`,
|
|
29
28
|
typeArguments: this.getTypeParams(),
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.MagmaContract = void 0;
|
|
13
|
+
const base_1 = require("../base");
|
|
14
|
+
const utils_1 = require("@mysten/sui/utils");
|
|
15
|
+
const utils_2 = require("../utils");
|
|
16
|
+
const sui_1 = require("../../../utils/sui");
|
|
17
|
+
class MagmaContract extends base_1.BaseContract {
|
|
18
|
+
swap(tx) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const [coinX, coinY] = this.swapInfo.pool.allTokens;
|
|
21
|
+
const swapXtoY = this.swapInfo.swapXtoY;
|
|
22
|
+
const sqrtPriceLimit = (0, utils_2.getDefaultSqrtPriceLimit)(swapXtoY);
|
|
23
|
+
const typeArguments = [coinX.address, coinY.address];
|
|
24
|
+
const [zeroOut] = tx.moveCall({
|
|
25
|
+
target: "0x2::coin::zero",
|
|
26
|
+
typeArguments: [swapXtoY ? coinY.address : coinX.address],
|
|
27
|
+
});
|
|
28
|
+
const amountIn = sui_1.SuiUtils.getCoinValue(swapXtoY ? coinX.address : coinY.address, this.inputCoinObject, tx);
|
|
29
|
+
const config = this.config.magma;
|
|
30
|
+
const [receiveA, receiveB] = tx.moveCall({
|
|
31
|
+
target: `${config.package}::router::swap`,
|
|
32
|
+
typeArguments,
|
|
33
|
+
arguments: [
|
|
34
|
+
tx.object(config.globalConfig),
|
|
35
|
+
tx.object(this.swapInfo.poolId),
|
|
36
|
+
swapXtoY ? this.inputCoinObject : zeroOut, // coin A
|
|
37
|
+
swapXtoY ? zeroOut : this.inputCoinObject, // coin B
|
|
38
|
+
tx.pure.bool(swapXtoY), // a to b or b to a
|
|
39
|
+
tx.pure.bool(true), // exact in or out
|
|
40
|
+
amountIn, // swap amount
|
|
41
|
+
tx.pure.u128(sqrtPriceLimit.toString()), // sqrt price limit
|
|
42
|
+
tx.pure.bool(false),
|
|
43
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
44
|
+
],
|
|
45
|
+
});
|
|
46
|
+
sui_1.SuiUtils.transferOrDestroyZeroCoin(tx, this.swapInfo.assetIn, swapXtoY ? receiveA : receiveB, this.currentAccount);
|
|
47
|
+
console.log(tx);
|
|
48
|
+
return swapXtoY ? receiveB : receiveA;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.MagmaContract = MagmaContract;
|
|
@@ -12,8 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.ObricContract = void 0;
|
|
13
13
|
const utils_1 = require("@mysten/sui/utils");
|
|
14
14
|
const base_1 = require("../base");
|
|
15
|
-
const PACKAGE_ID = "0xb84e63d22ea4822a0a333c250e790f69bf5c2ef0c63f4e120e05a6415991368f";
|
|
16
|
-
const PYTH_STATE = "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";
|
|
17
15
|
class ObricContract extends base_1.BaseContract {
|
|
18
16
|
swap(tx) {
|
|
19
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -23,6 +21,7 @@ class ObricContract extends base_1.BaseContract {
|
|
|
23
21
|
if (!x_price_id || !y_price_id) {
|
|
24
22
|
throw new Error("x_price_id and y_price_id are required");
|
|
25
23
|
}
|
|
24
|
+
const { package: PACKAGE_ID, pythState: PYTH_STATE } = this.config.obric;
|
|
26
25
|
const [coinOut] = tx.moveCall({
|
|
27
26
|
target: `${PACKAGE_ID}::v2::${xToY ? "swap_x_to_y" : "swap_y_to_x"}`,
|
|
28
27
|
typeArguments: [coinX.address, coinY.address],
|
|
@@ -12,13 +12,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.SpringSuiContract = void 0;
|
|
13
13
|
const utils_1 = require("@mysten/sui/utils");
|
|
14
14
|
const base_1 = require("../base");
|
|
15
|
-
const PACKAGE_ID = "0x82e6f4f75441eae97d2d5850f41a09d28c7b64a05b067d37748d471f43aaf3f7";
|
|
16
15
|
class SpringSuiContract extends base_1.BaseContract {
|
|
17
16
|
swap(tx) {
|
|
18
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
18
|
// coinX is always SUI
|
|
20
19
|
const coinY = this.swapInfo.pool.allTokens[1];
|
|
21
20
|
const isStake = this.swapInfo.swapXtoY;
|
|
21
|
+
const { package: PACKAGE_ID } = this.config.springsui;
|
|
22
22
|
const [coinOut] = tx.moveCall({
|
|
23
23
|
target: `${PACKAGE_ID}::liquid_staking::${isStake ? "mint" : "redeem"}`,
|
|
24
24
|
typeArguments: [coinY.address],
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SteammContract = void 0;
|
|
13
|
+
const base_1 = require("../base");
|
|
14
|
+
const utils_1 = require("@mysten/sui/utils");
|
|
15
|
+
const sui_1 = require("../../../utils/sui");
|
|
16
|
+
class SteammContract extends base_1.BaseContract {
|
|
17
|
+
swap(tx) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
return this.cpmmSwap(tx);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
cpmmSwap(tx) {
|
|
23
|
+
const extra = this.swapInfo.extra;
|
|
24
|
+
if (!extra ||
|
|
25
|
+
!extra.bankAStructTag ||
|
|
26
|
+
!extra.bankBStructTag ||
|
|
27
|
+
!extra.poolStructTag ||
|
|
28
|
+
!extra.bankA ||
|
|
29
|
+
!extra.bankB ||
|
|
30
|
+
!extra.lendingMarketA ||
|
|
31
|
+
!extra.lendingMarketB) {
|
|
32
|
+
throw new Error(`Invalid extra info for cpmmSwap`);
|
|
33
|
+
}
|
|
34
|
+
// the pool script v1 only support same lending market
|
|
35
|
+
if (extra.lendingMarketA !== extra.lendingMarketB) {
|
|
36
|
+
throw new Error(`Invalid lending market for cpmmSwap`);
|
|
37
|
+
}
|
|
38
|
+
const [btokenA, bTokenB, _quoter, lp] = (0, utils_1.parseStructTag)(extra.poolStructTag).typeParams;
|
|
39
|
+
const [lendingMarket, coinTypeA, _bTokenA] = (0, utils_1.parseStructTag)(extra.bankAStructTag).typeParams;
|
|
40
|
+
const [_lendingMarket, coinTypeB, _bTokenB] = (0, utils_1.parseStructTag)(extra.bankBStructTag).typeParams;
|
|
41
|
+
const xToY = this.swapInfo.swapXtoY;
|
|
42
|
+
const coinA = xToY
|
|
43
|
+
? this.inputCoinObject
|
|
44
|
+
: sui_1.SuiUtils.zeroCoin(tx, (0, utils_1.normalizeStructTag)(coinTypeA));
|
|
45
|
+
const coinB = !xToY
|
|
46
|
+
? this.inputCoinObject
|
|
47
|
+
: sui_1.SuiUtils.zeroCoin(tx, (0, utils_1.normalizeStructTag)(coinTypeB));
|
|
48
|
+
tx.moveCall({
|
|
49
|
+
target: `${this.config.steamm.script}::pool_script::cpmm_swap`,
|
|
50
|
+
typeArguments: [
|
|
51
|
+
lendingMarket,
|
|
52
|
+
coinTypeA,
|
|
53
|
+
coinTypeB,
|
|
54
|
+
btokenA,
|
|
55
|
+
bTokenB,
|
|
56
|
+
lp,
|
|
57
|
+
].map(utils_1.normalizeStructTag),
|
|
58
|
+
arguments: [
|
|
59
|
+
tx.object(this.swapInfo.poolId),
|
|
60
|
+
tx.object(extra.bankA),
|
|
61
|
+
tx.object(extra.bankB),
|
|
62
|
+
tx.object(extra.lendingMarketA),
|
|
63
|
+
coinA,
|
|
64
|
+
coinB,
|
|
65
|
+
tx.pure.bool(xToY),
|
|
66
|
+
this.getInputCoinValue(tx),
|
|
67
|
+
tx.pure.u64(0),
|
|
68
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
69
|
+
],
|
|
70
|
+
});
|
|
71
|
+
const coinIn = xToY ? coinA : coinB;
|
|
72
|
+
const coinOut = xToY ? coinB : coinA;
|
|
73
|
+
sui_1.SuiUtils.transferOrDestroyZeroCoin(tx, this.swapInfo.assetIn, coinIn, this.currentAccount);
|
|
74
|
+
return coinOut;
|
|
75
|
+
}
|
|
76
|
+
cpmmSwapV2(tx) {
|
|
77
|
+
const extra = this.swapInfo.extra;
|
|
78
|
+
if (!extra ||
|
|
79
|
+
!extra.bankAStructTag ||
|
|
80
|
+
!extra.bankBStructTag ||
|
|
81
|
+
!extra.poolStructTag ||
|
|
82
|
+
!extra.bankA ||
|
|
83
|
+
!extra.bankB ||
|
|
84
|
+
!extra.lendingMarketA ||
|
|
85
|
+
!extra.lendingMarketB) {
|
|
86
|
+
throw new Error(`Invalid extra info for cpmmSwap`);
|
|
87
|
+
}
|
|
88
|
+
// the pool script v1 only support same lending market
|
|
89
|
+
if (extra.lendingMarketA !== extra.lendingMarketB) {
|
|
90
|
+
throw new Error(`Invalid lending market for cpmmSwap`);
|
|
91
|
+
}
|
|
92
|
+
const [btokenA, bTokenB, _quoter, lp] = (0, utils_1.parseStructTag)(extra.poolStructTag).typeParams;
|
|
93
|
+
const [lendingMarket, coinTypeA, _bTokenA] = (0, utils_1.parseStructTag)(extra.bankAStructTag).typeParams;
|
|
94
|
+
const [_lendingMarket, coinTypeB, _bTokenB] = (0, utils_1.parseStructTag)(extra.bankBStructTag).typeParams;
|
|
95
|
+
const [coinX, _coinY] = this.swapInfo.pool.allTokens;
|
|
96
|
+
const xToY = coinX.address === this.swapInfo.assetIn;
|
|
97
|
+
const coinA = xToY
|
|
98
|
+
? this.inputCoinObject
|
|
99
|
+
: sui_1.SuiUtils.zeroCoin(tx, (0, utils_1.normalizeStructTag)(coinTypeA));
|
|
100
|
+
const coinB = !xToY
|
|
101
|
+
? this.inputCoinObject
|
|
102
|
+
: sui_1.SuiUtils.zeroCoin(tx, (0, utils_1.normalizeStructTag)(coinTypeB));
|
|
103
|
+
const bankATypeArgs = [lendingMarket, coinTypeA, btokenA].map(utils_1.normalizeStructTag);
|
|
104
|
+
const bankBTypeArgs = [lendingMarket, coinTypeB, bTokenB].map(utils_1.normalizeStructTag);
|
|
105
|
+
const bankInTypeArgs = xToY ? bankATypeArgs : bankBTypeArgs;
|
|
106
|
+
const bankOutTypeArgs = xToY ? bankBTypeArgs : bankATypeArgs;
|
|
107
|
+
// mint btoken from both coins
|
|
108
|
+
const bTokenIn = tx.moveCall({
|
|
109
|
+
target: `${this.config.steamm.package}::bank::mint_btokens`,
|
|
110
|
+
typeArguments: bankInTypeArgs,
|
|
111
|
+
arguments: [
|
|
112
|
+
tx.object(xToY ? extra.bankA : extra.bankB),
|
|
113
|
+
tx.object(extra.lendingMarketA),
|
|
114
|
+
xToY ? coinA : coinB,
|
|
115
|
+
this.getInputCoinValue(tx),
|
|
116
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
117
|
+
],
|
|
118
|
+
});
|
|
119
|
+
const bTokenOut = sui_1.SuiUtils.zeroCoin(tx, (0, utils_1.normalizeStructTag)(xToY ? bTokenB : btokenA));
|
|
120
|
+
// call swap on btoken
|
|
121
|
+
tx.moveCall({
|
|
122
|
+
target: `${this.config.steamm.package}::cpmm::swap`,
|
|
123
|
+
typeArguments: [btokenA, bTokenB, lp].map(utils_1.normalizeStructTag),
|
|
124
|
+
arguments: [
|
|
125
|
+
tx.object(this.swapInfo.poolId),
|
|
126
|
+
xToY ? bTokenIn : bTokenOut,
|
|
127
|
+
xToY ? bTokenOut : bTokenIn,
|
|
128
|
+
tx.pure.bool(xToY),
|
|
129
|
+
sui_1.SuiUtils.getCoinValue((0, utils_1.normalizeStructTag)(xToY ? btokenA : bTokenB), bTokenIn, tx),
|
|
130
|
+
tx.pure.u64(0), // min output
|
|
131
|
+
],
|
|
132
|
+
});
|
|
133
|
+
// burn btoken to get out coin
|
|
134
|
+
const [outCoin] = tx.moveCall({
|
|
135
|
+
target: `${this.config.steamm.package}::bank::burn_btokens`,
|
|
136
|
+
typeArguments: bankOutTypeArgs,
|
|
137
|
+
arguments: [
|
|
138
|
+
tx.object(xToY ? extra.bankB : extra.bankA),
|
|
139
|
+
tx.object(extra.lendingMarketA),
|
|
140
|
+
bTokenOut,
|
|
141
|
+
sui_1.SuiUtils.getCoinValue((0, utils_1.normalizeStructTag)(xToY ? bTokenB : btokenA), bTokenOut, tx),
|
|
142
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
143
|
+
],
|
|
144
|
+
});
|
|
145
|
+
const coinIn = xToY ? coinA : coinB;
|
|
146
|
+
const coinOut = xToY ? coinB : coinA;
|
|
147
|
+
// the coinIn was mutated by mint_btokens above, but not consumed, so we need to transfer or destroy it
|
|
148
|
+
sui_1.SuiUtils.transferOrDestroyZeroCoin(tx, this.swapInfo.assetIn, coinIn, this.currentAccount);
|
|
149
|
+
// bTokenIn was mutated by cpmm::swap above, but not consumed, so we need to transfer or destroy it
|
|
150
|
+
sui_1.SuiUtils.transferOrDestroyZeroCoin(tx, (0, utils_1.normalizeStructTag)(xToY ? btokenA : bTokenB), bTokenIn, this.currentAccount);
|
|
151
|
+
// bTokenOut was burned by burn_btokens above, but not consumed, so we need to transfer or destroy it
|
|
152
|
+
sui_1.SuiUtils.transferOrDestroyZeroCoin(tx, (0, utils_1.normalizeStructTag)(xToY ? bTokenB : btokenA), bTokenOut, this.currentAccount);
|
|
153
|
+
// after all we need to merge the placeholder output coin (zero) with actual output coin from swap burn
|
|
154
|
+
tx.mergeCoins(coinOut, [outCoin]);
|
|
155
|
+
return coinOut;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
exports.SteammContract = SteammContract;
|
|
@@ -12,13 +12,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.StSuiContract = void 0;
|
|
13
13
|
const utils_1 = require("@mysten/sui/utils");
|
|
14
14
|
const base_1 = require("../base");
|
|
15
|
-
const PACKAGE_ID = "0x059f94b85c07eb74d2847f8255d8cc0a67c9a8dcc039eabf9f8b9e23a0de2700";
|
|
16
15
|
class StSuiContract extends base_1.BaseContract {
|
|
17
16
|
swap(tx) {
|
|
18
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
18
|
// coinX is always SUI
|
|
20
19
|
const coinY = this.swapInfo.pool.allTokens[1];
|
|
21
20
|
const isStake = this.swapInfo.swapXtoY;
|
|
21
|
+
const { package: PACKAGE_ID } = this.config.stsui;
|
|
22
22
|
const [coinOut] = tx.moveCall({
|
|
23
23
|
target: `${PACKAGE_ID}::liquid_staking::${isStake ? "mint" : "redeem"}`,
|
|
24
24
|
typeArguments: [coinY.address],
|
|
@@ -13,8 +13,6 @@ exports.SuiswapContract = void 0;
|
|
|
13
13
|
const utils_1 = require("@mysten/sui/utils");
|
|
14
14
|
const base_1 = require("../base");
|
|
15
15
|
const sui_1 = require("../../../utils/sui");
|
|
16
|
-
const PACKAGE_ID = "0xd075d51486df71e750872b4edf82ea3409fda397ceecc0b6aedf573d923c54a0";
|
|
17
|
-
const MODULE_NAME = "pool";
|
|
18
16
|
class SuiswapContract extends base_1.BaseContract {
|
|
19
17
|
swap(tx) {
|
|
20
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -25,9 +23,10 @@ class SuiswapContract extends base_1.BaseContract {
|
|
|
25
23
|
const callFunc = swapXtoY
|
|
26
24
|
? "do_swap_x_to_y_direct"
|
|
27
25
|
: "do_swap_y_to_x_direct";
|
|
26
|
+
const { package: PACKAGE_ID } = this.config.suiswap;
|
|
28
27
|
const inputAmount = this.getInputCoinValue(tx);
|
|
29
28
|
const [tokenIn, tokenOut] = tx.moveCall({
|
|
30
|
-
target: `${PACKAGE_ID}::${
|
|
29
|
+
target: `${PACKAGE_ID}::pool::${callFunc}`,
|
|
31
30
|
typeArguments,
|
|
32
31
|
arguments: [
|
|
33
32
|
tx.object(poolId),
|
|
@@ -13,11 +13,8 @@ exports.TurbosContract = void 0;
|
|
|
13
13
|
const utils_1 = require("@mysten/sui/utils");
|
|
14
14
|
const base_1 = require("../base");
|
|
15
15
|
const utils_2 = require("../utils");
|
|
16
|
-
const constants_1 = require("./constants");
|
|
17
16
|
const sui_1 = require("../../../utils/sui");
|
|
18
|
-
const
|
|
19
|
-
const MODULE_NAME = "swap_router";
|
|
20
|
-
const VERSION = "0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f";
|
|
17
|
+
const ONE_MINUTE = 60 * 1000;
|
|
21
18
|
class TurbosContract extends base_1.BaseContract {
|
|
22
19
|
swap(tx) {
|
|
23
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -26,11 +23,11 @@ class TurbosContract extends base_1.BaseContract {
|
|
|
26
23
|
poolId: this.swapInfo.poolId,
|
|
27
24
|
address: this.currentAccount,
|
|
28
25
|
};
|
|
29
|
-
const
|
|
26
|
+
const { package: PACKAGE_ID, version: VERSION } = this.config.turbos;
|
|
30
27
|
const inputAmount = this.getInputCoinValue(tx);
|
|
31
28
|
const [tokenOut, tokenIn] = tx.moveCall({
|
|
32
|
-
target: `${PACKAGE_ID}
|
|
33
|
-
typeArguments:
|
|
29
|
+
target: `${PACKAGE_ID}::swap_router::swap_${a2b ? "a_b" : "b_a"}_with_return_`,
|
|
30
|
+
typeArguments: this.getTypeParams(),
|
|
34
31
|
arguments: [
|
|
35
32
|
tx.object(poolId),
|
|
36
33
|
tx.makeMoveVec({
|
|
@@ -41,7 +38,7 @@ class TurbosContract extends base_1.BaseContract {
|
|
|
41
38
|
tx.pure.u128((0, utils_2.getDefaultSqrtPriceLimit)(this.swapInfo.swapXtoY).toString()),
|
|
42
39
|
tx.pure.bool(true),
|
|
43
40
|
tx.pure.address(this.currentAccount),
|
|
44
|
-
tx.pure.u64(Date.now() +
|
|
41
|
+
tx.pure.u64(Date.now() + ONE_MINUTE * 3),
|
|
45
42
|
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
46
43
|
tx.object(VERSION),
|
|
47
44
|
],
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,eAAO,MAAM,cAAc,EAAE,MAwH5B,CAAC;AAEF,wBAAsB,SAAS,oBAe9B"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,EAkBtC,CAAC;AAEF,wBAAsB,QAAQ,CAAC,EAC7B,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,OAAyB,EACzB,WAAW,EACX,aAAa,GACd,EAAE,MAAM,0BA2BR"}
|
|
@@ -13,6 +13,8 @@ import { SpringSuiContract } from "./springsui";
|
|
|
13
13
|
import { ObricContract } from "./obric";
|
|
14
14
|
import { StSuiContract } from "./stsui";
|
|
15
15
|
import { FlowxV3Contract } from "./flowxV3";
|
|
16
|
+
import { SteammContract } from "./steamm";
|
|
17
|
+
import { MagmaContract } from "./magma";
|
|
16
18
|
export declare const ProtocolContract: {
|
|
17
19
|
cetus: typeof CetusContract;
|
|
18
20
|
turbos: typeof TurbosContract;
|
|
@@ -29,5 +31,7 @@ export declare const ProtocolContract: {
|
|
|
29
31
|
springsui: typeof SpringSuiContract;
|
|
30
32
|
obric: typeof ObricContract;
|
|
31
33
|
stsui: typeof StSuiContract;
|
|
34
|
+
steamm: typeof SteammContract;
|
|
35
|
+
magma: typeof MagmaContract;
|
|
32
36
|
};
|
|
33
37
|
//# 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,SAAS,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,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,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/libs/protocols/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,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,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;CAkB5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/kriya/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/kriya/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,qBAAa,aAAc,SAAQ,YAAY;IACvC,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CA0B3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/kriyaV3/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/kriyaV3/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIvC,qBAAa,eAAgB,SAAQ,YAAY;IACzC,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CAgE3B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
|
+
import { BaseContract } from "../base";
|
|
3
|
+
export declare class MagmaContract extends BaseContract {
|
|
4
|
+
swap(tx: Transaction): Promise<{
|
|
5
|
+
$kind: "NestedResult";
|
|
6
|
+
NestedResult: [number, number];
|
|
7
|
+
}>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/magma/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAMvC,qBAAa,aAAc,SAAQ,YAAY;IACvC,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CAyC3B"}
|
|
@@ -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,YAAY,EAAE,MAAM,SAAS,CAAC;AAMvC,qBAAa,aAAc,SAAQ,YAAY;IACvC,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CAwB3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/springsui/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/springsui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,qBAAa,iBAAkB,SAAQ,YAAY;IAC3C,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CAiB3B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
|
+
import { BaseContract } from "../base";
|
|
3
|
+
export type SteamExtra = {
|
|
4
|
+
bankAStructTag: string;
|
|
5
|
+
bankBStructTag: string;
|
|
6
|
+
poolStructTag: string;
|
|
7
|
+
bankA: string;
|
|
8
|
+
bankB: string;
|
|
9
|
+
lendingMarketA: string;
|
|
10
|
+
lendingMarketB: string;
|
|
11
|
+
};
|
|
12
|
+
export declare class SteammContract extends BaseContract {
|
|
13
|
+
swap(tx: Transaction): Promise<{
|
|
14
|
+
$kind: "NestedResult";
|
|
15
|
+
NestedResult: [number, number];
|
|
16
|
+
}>;
|
|
17
|
+
cpmmSwap(tx: Transaction): {
|
|
18
|
+
$kind: "NestedResult";
|
|
19
|
+
NestedResult: [number, number];
|
|
20
|
+
};
|
|
21
|
+
cpmmSwapV2(tx: Transaction): {
|
|
22
|
+
$kind: "NestedResult";
|
|
23
|
+
NestedResult: [number, number];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAQvC,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;CACxB,CAAC;AACF,qBAAa,cAAe,SAAQ,YAAY;IACxC,IAAI,CAAC,EAAE,EAAE,WAAW;;;;IAI1B,QAAQ,CAAC,EAAE,EAAE,WAAW;;;;IAuExB,UAAU,CAAC,EAAE,EAAE,WAAW;;;;CAiI3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/stsui/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/stsui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,qBAAa,aAAc,SAAQ,YAAY;IACvC,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CAiB3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/suiswap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/suiswap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,qBAAa,eAAgB,SAAQ,YAAY;IACzC,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CAgC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/turbos/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/turbos/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAMvC,qBAAa,cAAe,SAAQ,YAAY;IACxC,IAAI,CAAC,EAAE,EAAE,WAAW;;;;CAwC3B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type SourceDex = "suiswap" | "turbos" | "cetus" | "bluemove" | "kriya" | "kriya_v3" | "aftermath" | "deepbook" | "deepbook_v3" | "flowx" | "flowx_v3" | "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" | "steamm" | "magma";
|
|
2
2
|
export type SorSwap = {
|
|
3
3
|
poolId: string;
|
|
4
4
|
assetInIndex: number;
|
|
@@ -114,5 +114,11 @@ export interface Config {
|
|
|
114
114
|
turbos: DexConfig & {
|
|
115
115
|
version: string;
|
|
116
116
|
};
|
|
117
|
+
steamm: DexConfig & {
|
|
118
|
+
script: string;
|
|
119
|
+
};
|
|
120
|
+
magma: DexConfig & {
|
|
121
|
+
globalConfig: string;
|
|
122
|
+
};
|
|
117
123
|
}
|
|
118
124
|
//# 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,UAAU,GACV,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,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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AAE,SAAS,CAAC;IACrB,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,SAAS,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,MAAM,EAAE,SAAS,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,KAAK,EAAE,SAAS,GAAG;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7C"}
|
|
@@ -37,6 +37,10 @@ export declare const SuiUtils: {
|
|
|
37
37
|
$kind: "NestedResult";
|
|
38
38
|
NestedResult: [number, number];
|
|
39
39
|
};
|
|
40
|
+
zeroCoin(tx: Transaction, coinType: string): {
|
|
41
|
+
$kind: "NestedResult";
|
|
42
|
+
NestedResult: [number, number];
|
|
43
|
+
};
|
|
40
44
|
coinIntoBalance(tx: Transaction, coinType: string, coinObject: TransactionArgument): {
|
|
41
45
|
$kind: "NestedResult";
|
|
42
46
|
NestedResult: [number, number];
|