@7kprotocol/sdk-ts 1.0.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/LICENSE +21 -0
- package/README.md +122 -0
- package/lib/cjs/buildTx.js +93 -0
- package/lib/cjs/constants/explorer.js +6 -0
- package/lib/cjs/constants/tokens.js +5 -0
- package/lib/cjs/estimateGasFee.js +52 -0
- package/lib/cjs/getQuote.js +22 -0
- package/lib/cjs/getSuiPrice.js +31 -0
- package/lib/cjs/index.js +37 -0
- package/lib/cjs/libs/getCoinOjectIdsByAmount.js +74 -0
- package/lib/cjs/libs/getSplitCoinForTx.js +55 -0
- package/lib/cjs/libs/groupSwapRoutes.js +62 -0
- package/lib/cjs/libs/protocols/aftermath/index.js +52 -0
- package/lib/cjs/libs/protocols/base.js +20 -0
- package/lib/cjs/libs/protocols/bluemove/index.js +36 -0
- package/lib/cjs/libs/protocols/cetus/index.js +56 -0
- package/lib/cjs/libs/protocols/constants.js +5 -0
- package/lib/cjs/libs/protocols/deepbook/index.js +96 -0
- package/lib/cjs/libs/protocols/flowx/index.js +31 -0
- package/lib/cjs/libs/protocols/index.js +21 -0
- package/lib/cjs/libs/protocols/kriya/index.js +42 -0
- package/lib/cjs/libs/protocols/suiswap/index.js +45 -0
- package/lib/cjs/libs/protocols/turbos/constants.js +7 -0
- package/lib/cjs/libs/protocols/turbos/index.js +53 -0
- package/lib/cjs/libs/protocols/utils.js +11 -0
- package/lib/cjs/libs/swapWithRoute.js +31 -0
- package/lib/cjs/suiClient.js +14 -0
- package/lib/cjs/types/aggregator.js +2 -0
- package/lib/cjs/types/buildTx.d.ts +4 -0
- package/lib/cjs/types/buildTx.d.ts.map +1 -0
- package/lib/cjs/types/constants/explorer.d.ts +4 -0
- package/lib/cjs/types/constants/explorer.d.ts.map +1 -0
- package/lib/cjs/types/constants/tokens.d.ts +3 -0
- package/lib/cjs/types/constants/tokens.d.ts.map +1 -0
- package/lib/cjs/types/estimateGasFee.d.ts +3 -0
- package/lib/cjs/types/estimateGasFee.d.ts.map +1 -0
- package/lib/cjs/types/getQuote.d.ts +9 -0
- package/lib/cjs/types/getQuote.d.ts.map +1 -0
- package/lib/cjs/types/getSuiPrice.d.ts +2 -0
- package/lib/cjs/types/getSuiPrice.d.ts.map +1 -0
- package/lib/cjs/types/index.d.ts +17 -0
- package/lib/cjs/types/index.d.ts.map +1 -0
- package/lib/cjs/types/libs/getCoinOjectIdsByAmount.d.ts +7 -0
- package/lib/cjs/types/libs/getCoinOjectIdsByAmount.d.ts.map +1 -0
- package/lib/cjs/types/libs/getSplitCoinForTx.d.ts +6 -0
- package/lib/cjs/types/libs/getSplitCoinForTx.d.ts.map +1 -0
- package/lib/cjs/types/libs/groupSwapRoutes.d.ts +3 -0
- package/lib/cjs/types/libs/groupSwapRoutes.d.ts.map +1 -0
- package/lib/cjs/types/libs/protocols/aftermath/index.d.ts +10 -0
- package/lib/cjs/types/libs/protocols/aftermath/index.d.ts.map +1 -0
- package/lib/cjs/types/libs/protocols/base.d.ts +37 -0
- package/lib/cjs/types/libs/protocols/base.d.ts.map +1 -0
- package/lib/cjs/types/libs/protocols/bluemove/index.d.ts +10 -0
- package/lib/cjs/types/libs/protocols/bluemove/index.d.ts.map +1 -0
- package/lib/cjs/types/libs/protocols/cetus/index.d.ts +10 -0
- package/lib/cjs/types/libs/protocols/cetus/index.d.ts.map +1 -0
- package/lib/cjs/types/libs/protocols/constants.d.ts +3 -0
- package/lib/cjs/types/libs/protocols/constants.d.ts.map +1 -0
- package/lib/cjs/types/libs/protocols/deepbook/index.d.ts +12 -0
- package/lib/cjs/types/libs/protocols/deepbook/index.d.ts.map +1 -0
- package/lib/cjs/types/libs/protocols/flowx/index.d.ts +10 -0
- package/lib/cjs/types/libs/protocols/flowx/index.d.ts.map +1 -0
- package/lib/cjs/types/libs/protocols/index.d.ts +19 -0
- package/lib/cjs/types/libs/protocols/index.d.ts.map +1 -0
- package/lib/cjs/types/libs/protocols/kriya/index.d.ts +10 -0
- package/lib/cjs/types/libs/protocols/kriya/index.d.ts.map +1 -0
- package/lib/cjs/types/libs/protocols/suiswap/index.d.ts +10 -0
- package/lib/cjs/types/libs/protocols/suiswap/index.d.ts.map +1 -0
- package/lib/cjs/types/libs/protocols/turbos/constants.d.ts +5 -0
- package/lib/cjs/types/libs/protocols/turbos/constants.d.ts.map +1 -0
- package/lib/cjs/types/libs/protocols/turbos/index.d.ts +10 -0
- package/lib/cjs/types/libs/protocols/turbos/index.d.ts.map +1 -0
- package/lib/cjs/types/libs/protocols/utils.d.ts +3 -0
- package/lib/cjs/types/libs/protocols/utils.d.ts.map +1 -0
- package/lib/cjs/types/libs/swapWithRoute.d.ts +10 -0
- package/lib/cjs/types/libs/swapWithRoute.d.ts.map +1 -0
- package/lib/cjs/types/sui.js +2 -0
- package/lib/cjs/types/suiClient.d.ts +4 -0
- package/lib/cjs/types/suiClient.d.ts.map +1 -0
- package/lib/cjs/types/token.js +2 -0
- package/lib/cjs/types/tx.js +2 -0
- package/lib/cjs/types/types/aggregator.d.ts +69 -0
- package/lib/cjs/types/types/aggregator.d.ts.map +1 -0
- package/lib/cjs/types/types/sui.d.ts +4 -0
- package/lib/cjs/types/types/sui.d.ts.map +1 -0
- package/lib/cjs/types/types/token.d.ts +30 -0
- package/lib/cjs/types/types/token.d.ts.map +1 -0
- package/lib/cjs/types/types/tx.d.ts +14 -0
- package/lib/cjs/types/types/tx.d.ts.map +1 -0
- package/lib/cjs/types/types/utilities.d.ts +5 -0
- package/lib/cjs/types/types/utilities.d.ts.map +1 -0
- package/lib/cjs/types/utilities.js +2 -0
- package/lib/cjs/types/utils/number.d.ts +4 -0
- package/lib/cjs/types/utils/number.d.ts.map +1 -0
- package/lib/cjs/types/utils/sui.d.ts +39 -0
- package/lib/cjs/types/utils/sui.d.ts.map +1 -0
- package/lib/cjs/types/utils/token.d.ts +6 -0
- package/lib/cjs/types/utils/token.d.ts.map +1 -0
- package/lib/cjs/utils/number.js +15 -0
- package/lib/cjs/utils/sui.js +180 -0
- package/lib/cjs/utils/token.js +36 -0
- package/lib/esm/buildTx.js +77 -0
- package/lib/esm/constants/explorer.js +3 -0
- package/lib/esm/constants/tokens.js +2 -0
- package/lib/esm/estimateGasFee.js +35 -0
- package/lib/esm/getQuote.js +8 -0
- package/lib/esm/getSuiPrice.js +13 -0
- package/lib/esm/index.mjs +15 -0
- package/lib/esm/libs/getCoinOjectIdsByAmount.js +61 -0
- package/lib/esm/libs/getSplitCoinForTx.js +39 -0
- package/lib/esm/libs/groupSwapRoutes.js +58 -0
- package/lib/esm/libs/protocols/aftermath/index.js +37 -0
- package/lib/esm/libs/protocols/base.js +18 -0
- package/lib/esm/libs/protocols/bluemove/index.js +21 -0
- package/lib/esm/libs/protocols/cetus/index.js +41 -0
- package/lib/esm/libs/protocols/constants.js +2 -0
- package/lib/esm/libs/protocols/deepbook/index.js +80 -0
- package/lib/esm/libs/protocols/flowx/index.js +16 -0
- package/lib/esm/libs/protocols/index.js +18 -0
- package/lib/esm/libs/protocols/kriya/index.js +27 -0
- package/lib/esm/libs/protocols/suiswap/index.js +30 -0
- package/lib/esm/libs/protocols/turbos/constants.js +4 -0
- package/lib/esm/libs/protocols/turbos/index.js +38 -0
- package/lib/esm/libs/protocols/utils.js +5 -0
- package/lib/esm/libs/swapWithRoute.js +17 -0
- package/lib/esm/suiClient.js +10 -0
- package/lib/esm/types/aggregator.js +1 -0
- package/lib/esm/types/buildTx.d.ts +4 -0
- package/lib/esm/types/buildTx.d.ts.map +1 -0
- package/lib/esm/types/constants/explorer.d.ts +4 -0
- package/lib/esm/types/constants/explorer.d.ts.map +1 -0
- package/lib/esm/types/constants/tokens.d.ts +3 -0
- package/lib/esm/types/constants/tokens.d.ts.map +1 -0
- package/lib/esm/types/estimateGasFee.d.ts +3 -0
- package/lib/esm/types/estimateGasFee.d.ts.map +1 -0
- package/lib/esm/types/getQuote.d.ts +9 -0
- package/lib/esm/types/getQuote.d.ts.map +1 -0
- package/lib/esm/types/getSuiPrice.d.ts +2 -0
- package/lib/esm/types/getSuiPrice.d.ts.map +1 -0
- package/lib/esm/types/index.d.ts +17 -0
- package/lib/esm/types/index.d.ts.map +1 -0
- package/lib/esm/types/libs/getCoinOjectIdsByAmount.d.ts +7 -0
- package/lib/esm/types/libs/getCoinOjectIdsByAmount.d.ts.map +1 -0
- package/lib/esm/types/libs/getSplitCoinForTx.d.ts +6 -0
- package/lib/esm/types/libs/getSplitCoinForTx.d.ts.map +1 -0
- package/lib/esm/types/libs/groupSwapRoutes.d.ts +3 -0
- package/lib/esm/types/libs/groupSwapRoutes.d.ts.map +1 -0
- package/lib/esm/types/libs/protocols/aftermath/index.d.ts +10 -0
- package/lib/esm/types/libs/protocols/aftermath/index.d.ts.map +1 -0
- package/lib/esm/types/libs/protocols/base.d.ts +37 -0
- package/lib/esm/types/libs/protocols/base.d.ts.map +1 -0
- package/lib/esm/types/libs/protocols/bluemove/index.d.ts +10 -0
- package/lib/esm/types/libs/protocols/bluemove/index.d.ts.map +1 -0
- package/lib/esm/types/libs/protocols/cetus/index.d.ts +10 -0
- package/lib/esm/types/libs/protocols/cetus/index.d.ts.map +1 -0
- package/lib/esm/types/libs/protocols/constants.d.ts +3 -0
- package/lib/esm/types/libs/protocols/constants.d.ts.map +1 -0
- package/lib/esm/types/libs/protocols/deepbook/index.d.ts +12 -0
- package/lib/esm/types/libs/protocols/deepbook/index.d.ts.map +1 -0
- package/lib/esm/types/libs/protocols/flowx/index.d.ts +10 -0
- package/lib/esm/types/libs/protocols/flowx/index.d.ts.map +1 -0
- package/lib/esm/types/libs/protocols/index.d.ts +19 -0
- package/lib/esm/types/libs/protocols/index.d.ts.map +1 -0
- package/lib/esm/types/libs/protocols/kriya/index.d.ts +10 -0
- package/lib/esm/types/libs/protocols/kriya/index.d.ts.map +1 -0
- package/lib/esm/types/libs/protocols/suiswap/index.d.ts +10 -0
- package/lib/esm/types/libs/protocols/suiswap/index.d.ts.map +1 -0
- package/lib/esm/types/libs/protocols/turbos/constants.d.ts +5 -0
- package/lib/esm/types/libs/protocols/turbos/constants.d.ts.map +1 -0
- package/lib/esm/types/libs/protocols/turbos/index.d.ts +10 -0
- package/lib/esm/types/libs/protocols/turbos/index.d.ts.map +1 -0
- package/lib/esm/types/libs/protocols/utils.d.ts +3 -0
- package/lib/esm/types/libs/protocols/utils.d.ts.map +1 -0
- package/lib/esm/types/libs/swapWithRoute.d.ts +10 -0
- package/lib/esm/types/libs/swapWithRoute.d.ts.map +1 -0
- package/lib/esm/types/sui.js +1 -0
- package/lib/esm/types/suiClient.d.ts +4 -0
- package/lib/esm/types/suiClient.d.ts.map +1 -0
- package/lib/esm/types/token.js +1 -0
- package/lib/esm/types/tx.js +1 -0
- package/lib/esm/types/types/aggregator.d.ts +69 -0
- package/lib/esm/types/types/aggregator.d.ts.map +1 -0
- package/lib/esm/types/types/sui.d.ts +4 -0
- package/lib/esm/types/types/sui.d.ts.map +1 -0
- package/lib/esm/types/types/token.d.ts +30 -0
- package/lib/esm/types/types/token.d.ts.map +1 -0
- package/lib/esm/types/types/tx.d.ts +14 -0
- package/lib/esm/types/types/tx.d.ts.map +1 -0
- package/lib/esm/types/types/utilities.d.ts +5 -0
- package/lib/esm/types/types/utilities.d.ts.map +1 -0
- package/lib/esm/types/utilities.js +1 -0
- package/lib/esm/types/utils/number.d.ts +4 -0
- package/lib/esm/types/utils/number.d.ts.map +1 -0
- package/lib/esm/types/utils/sui.d.ts +39 -0
- package/lib/esm/types/utils/sui.d.ts.map +1 -0
- package/lib/esm/types/utils/token.d.ts +6 -0
- package/lib/esm/types/utils/token.d.ts.map +1 -0
- package/lib/esm/utils/number.js +8 -0
- package/lib/esm/utils/sui.js +167 -0
- package/lib/esm/utils/token.js +19 -0
- package/package.json +70 -0
|
@@ -0,0 +1,36 @@
|
|
|
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.BluemoveContract = void 0;
|
|
13
|
+
const base_1 = require("../base");
|
|
14
|
+
const sui_1 = require("../../../utils/sui");
|
|
15
|
+
const PACKAGE_ID = "0xb24b6789e088b876afabca733bed2299fbc9e2d6369be4d1acfa17d8145454d9";
|
|
16
|
+
const DEX_INFO_ID = "0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92";
|
|
17
|
+
class BluemoveContract extends base_1.BaseContract {
|
|
18
|
+
swap(tx) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const [coinOut] = tx.moveCall({
|
|
21
|
+
target: `${PACKAGE_ID}::router::swap_exact_input_`,
|
|
22
|
+
typeArguments: [this.swapInfo.coinX.type, this.swapInfo.coinY.type],
|
|
23
|
+
arguments: [
|
|
24
|
+
sui_1.SuiUtils.getCoinValue(this.swapInfo.swapXtoY
|
|
25
|
+
? this.swapInfo.coinX.type
|
|
26
|
+
: this.swapInfo.coinY.type, this.inputCoinObject, tx), // input amount
|
|
27
|
+
this.inputCoinObject, // input coin
|
|
28
|
+
tx.pure.u64(0), // min output amount
|
|
29
|
+
tx.object(DEX_INFO_ID),
|
|
30
|
+
],
|
|
31
|
+
});
|
|
32
|
+
return coinOut;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.BluemoveContract = BluemoveContract;
|
|
@@ -0,0 +1,56 @@
|
|
|
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.CetusContract = void 0;
|
|
13
|
+
const base_1 = require("../base");
|
|
14
|
+
const utils_1 = require("@mysten/sui.js/utils");
|
|
15
|
+
const utils_2 = require("../utils");
|
|
16
|
+
const sui_1 = require("../../../utils/sui");
|
|
17
|
+
const GLOBAL_CONFIG_ID = "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f";
|
|
18
|
+
const INTEGRATE_PACKAGE_ID = "0x6f5e582ede61fe5395b50c4a449ec11479a54d7ff8e0158247adfda60d98970b";
|
|
19
|
+
class CetusContract extends base_1.BaseContract {
|
|
20
|
+
swap(tx) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const sqrtPriceLimit = (0, utils_2.getDefaultSqrtPriceLimit)(this.swapInfo.swapXtoY);
|
|
23
|
+
const typeArguments = [this.swapInfo.coinX.type, this.swapInfo.coinY.type];
|
|
24
|
+
const [zeroOut] = tx.moveCall({
|
|
25
|
+
target: "0x2::coin::zero",
|
|
26
|
+
typeArguments: [
|
|
27
|
+
this.swapInfo.swapXtoY
|
|
28
|
+
? this.swapInfo.coinY.type
|
|
29
|
+
: this.swapInfo.coinX.type,
|
|
30
|
+
],
|
|
31
|
+
});
|
|
32
|
+
const amountIn = sui_1.SuiUtils.getCoinValue(this.swapInfo.swapXtoY
|
|
33
|
+
? this.swapInfo.coinX.type
|
|
34
|
+
: this.swapInfo.coinY.type, this.inputCoinObject, tx);
|
|
35
|
+
const [receiveA, receiveB] = tx.moveCall({
|
|
36
|
+
target: `${INTEGRATE_PACKAGE_ID}::router::swap`,
|
|
37
|
+
typeArguments,
|
|
38
|
+
arguments: [
|
|
39
|
+
tx.object(GLOBAL_CONFIG_ID),
|
|
40
|
+
tx.object(this.swapInfo.poolId),
|
|
41
|
+
this.swapInfo.swapXtoY ? this.inputCoinObject : zeroOut, // coin A
|
|
42
|
+
this.swapInfo.swapXtoY ? zeroOut : this.inputCoinObject, // coin B
|
|
43
|
+
tx.pure(this.swapInfo.swapXtoY), // a to b or b to a
|
|
44
|
+
tx.pure(true), // exact in or out
|
|
45
|
+
amountIn, // swap amount
|
|
46
|
+
tx.pure.u128(sqrtPriceLimit.toString()), // sqrt price limit
|
|
47
|
+
tx.pure(false),
|
|
48
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
49
|
+
],
|
|
50
|
+
});
|
|
51
|
+
tx.transferObjects([this.swapInfo.swapXtoY ? receiveA : receiveB], tx.pure.address(this.currentAccount));
|
|
52
|
+
return this.swapInfo.swapXtoY ? receiveB : receiveA;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.CetusContract = CetusContract;
|
|
@@ -0,0 +1,96 @@
|
|
|
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.DeepBookContract = void 0;
|
|
13
|
+
const utils_1 = require("@mysten/sui.js/utils");
|
|
14
|
+
const base_1 = require("../base");
|
|
15
|
+
const PACKAGE_ID = "0xdee9";
|
|
16
|
+
const MODULE_NAME = "clob_v2";
|
|
17
|
+
const _7K_PACKAGE_ID = "0xd48e7cdc9e92bec69ce3baa75578010458a0c5b2733d661a84971e8cef6806bc";
|
|
18
|
+
class DeepBookContract extends base_1.BaseContract {
|
|
19
|
+
swap(tx) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
var _a;
|
|
22
|
+
const swapXtoY = this.swapInfo.swapXtoY;
|
|
23
|
+
const poolId = this.swapInfo.poolId;
|
|
24
|
+
const clientOrderId = Date.now();
|
|
25
|
+
const currentAddress = this.currentAccount;
|
|
26
|
+
const typeArgs = this.getTypeParams();
|
|
27
|
+
const lotSize = (_a = this.swapInfo.extra) === null || _a === void 0 ? void 0 : _a.lotSize;
|
|
28
|
+
const [baseAsset, quoteAsset] = typeArgs;
|
|
29
|
+
const accountCap = this.createAccountCap(tx);
|
|
30
|
+
const amountIn = this.getInputCoinValue(tx);
|
|
31
|
+
let result;
|
|
32
|
+
if (swapXtoY) {
|
|
33
|
+
const amountInRound = tx.moveCall({
|
|
34
|
+
target: `${_7K_PACKAGE_ID}::math::m_round_down`,
|
|
35
|
+
arguments: [
|
|
36
|
+
amountIn, // input coin value
|
|
37
|
+
tx.pure.u64(lotSize), // lot size
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
const [base_coin_ret, quote_coin_ret] = tx.moveCall({
|
|
41
|
+
target: `${PACKAGE_ID}::${MODULE_NAME}::swap_exact_base_for_quote`,
|
|
42
|
+
typeArguments: [baseAsset, quoteAsset],
|
|
43
|
+
arguments: [
|
|
44
|
+
tx.object(poolId),
|
|
45
|
+
tx.pure.u64(clientOrderId),
|
|
46
|
+
accountCap,
|
|
47
|
+
amountInRound,
|
|
48
|
+
this.inputCoinObject, // coin 0 ~ base
|
|
49
|
+
tx.moveCall({
|
|
50
|
+
typeArguments: [quoteAsset],
|
|
51
|
+
target: `0x2::coin::zero`,
|
|
52
|
+
arguments: [],
|
|
53
|
+
}), // coin 1 ~ quote
|
|
54
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
55
|
+
],
|
|
56
|
+
});
|
|
57
|
+
this.deleteAccountCap(tx, accountCap);
|
|
58
|
+
tx.transferObjects([base_coin_ret], currentAddress);
|
|
59
|
+
result = quote_coin_ret;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const [base_coin_ret, quote_coin_ret] = tx.moveCall({
|
|
63
|
+
target: `${PACKAGE_ID}::${MODULE_NAME}::swap_exact_quote_for_base`,
|
|
64
|
+
typeArguments: [baseAsset, quoteAsset],
|
|
65
|
+
arguments: [
|
|
66
|
+
tx.object(poolId),
|
|
67
|
+
tx.pure.u64(clientOrderId),
|
|
68
|
+
accountCap,
|
|
69
|
+
amountIn,
|
|
70
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
71
|
+
this.inputCoinObject, // coin 1 ~ quote
|
|
72
|
+
],
|
|
73
|
+
});
|
|
74
|
+
this.deleteAccountCap(tx, accountCap);
|
|
75
|
+
tx.transferObjects([quote_coin_ret], currentAddress);
|
|
76
|
+
result = base_coin_ret;
|
|
77
|
+
}
|
|
78
|
+
return result;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
createAccountCap(tx) {
|
|
82
|
+
const [cap] = tx.moveCall({
|
|
83
|
+
typeArguments: [],
|
|
84
|
+
target: `${PACKAGE_ID}::${MODULE_NAME}::create_account`,
|
|
85
|
+
arguments: [],
|
|
86
|
+
});
|
|
87
|
+
return cap;
|
|
88
|
+
}
|
|
89
|
+
deleteAccountCap(tx, accountCap) {
|
|
90
|
+
tx.moveCall({
|
|
91
|
+
target: `${PACKAGE_ID}::custodian_v2::delete_account_cap`,
|
|
92
|
+
arguments: [accountCap],
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.DeepBookContract = DeepBookContract;
|
|
@@ -0,0 +1,31 @@
|
|
|
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.FlowXContract = void 0;
|
|
13
|
+
const base_1 = require("../base");
|
|
14
|
+
const PACKAGE_ID = "0xba153169476e8c3114962261d1edc70de5ad9781b83cc617ecc8c1923191cae0";
|
|
15
|
+
const MODULE_NAME = "router";
|
|
16
|
+
const CONTAINER_OBJECT_ID = "0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511";
|
|
17
|
+
class FlowXContract extends base_1.BaseContract {
|
|
18
|
+
swap(tx) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const coinInType = this.swapInfo.assetIn;
|
|
21
|
+
const coinOutType = this.swapInfo.assetOut;
|
|
22
|
+
const [tokenOut] = tx.moveCall({
|
|
23
|
+
target: `${PACKAGE_ID}::${MODULE_NAME}::swap_exact_input_direct`,
|
|
24
|
+
typeArguments: [coinInType, coinOutType],
|
|
25
|
+
arguments: [tx.object(CONTAINER_OBJECT_ID), this.inputCoinObject],
|
|
26
|
+
});
|
|
27
|
+
return tokenOut;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.FlowXContract = FlowXContract;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProtocolContract = void 0;
|
|
4
|
+
const flowx_1 = require("./flowx");
|
|
5
|
+
const aftermath_1 = require("./aftermath");
|
|
6
|
+
const cetus_1 = require("./cetus");
|
|
7
|
+
const deepbook_1 = require("./deepbook");
|
|
8
|
+
const kriya_1 = require("./kriya");
|
|
9
|
+
const turbos_1 = require("./turbos");
|
|
10
|
+
const suiswap_1 = require("./suiswap");
|
|
11
|
+
const bluemove_1 = require("./bluemove");
|
|
12
|
+
exports.ProtocolContract = {
|
|
13
|
+
cetus: cetus_1.CetusContract,
|
|
14
|
+
turbos: turbos_1.TurbosContract,
|
|
15
|
+
bluemove: bluemove_1.BluemoveContract,
|
|
16
|
+
kriya: kriya_1.KriyaContract,
|
|
17
|
+
suiswap: suiswap_1.SuiswapContract,
|
|
18
|
+
aftermath: aftermath_1.AfterMathContract,
|
|
19
|
+
deepbook: deepbook_1.DeepBookContract,
|
|
20
|
+
flowx: flowx_1.FlowXContract,
|
|
21
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
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.KriyaContract = void 0;
|
|
13
|
+
const base_1 = require("../base");
|
|
14
|
+
const token_1 = require("../../../utils/token");
|
|
15
|
+
const PACKAGE_ID = "0xa0eba10b173538c8fecca1dff298e488402cc9ff374f8a12ca7758eebe830b66";
|
|
16
|
+
const MODULE_NAME = "spot_dex";
|
|
17
|
+
class KriyaContract extends base_1.BaseContract {
|
|
18
|
+
swap(tx) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const swapXtoY = this.swapInfo.swapXtoY;
|
|
21
|
+
const coinInType = (0, token_1.normalizeTokenType)(this.swapInfo.assetIn);
|
|
22
|
+
const coinOutType = (0, token_1.normalizeTokenType)(this.swapInfo.assetOut);
|
|
23
|
+
const poolId = this.swapInfo.poolId;
|
|
24
|
+
const inputCoinObject = this.inputCoinObject;
|
|
25
|
+
const [tokenOut] = tx.moveCall({
|
|
26
|
+
target: `${PACKAGE_ID}::${MODULE_NAME}::${swapXtoY ? "swap_token_x" : "swap_token_y"}`,
|
|
27
|
+
typeArguments: [
|
|
28
|
+
swapXtoY ? coinInType : coinOutType,
|
|
29
|
+
swapXtoY ? coinOutType : coinInType,
|
|
30
|
+
],
|
|
31
|
+
arguments: [
|
|
32
|
+
tx.object(poolId),
|
|
33
|
+
inputCoinObject,
|
|
34
|
+
this.getInputCoinValue(tx),
|
|
35
|
+
tx.pure.u64(0),
|
|
36
|
+
],
|
|
37
|
+
});
|
|
38
|
+
return tokenOut;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.KriyaContract = KriyaContract;
|
|
@@ -0,0 +1,45 @@
|
|
|
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.SuiswapContract = void 0;
|
|
13
|
+
const utils_1 = require("@mysten/sui.js/utils");
|
|
14
|
+
const base_1 = require("../base");
|
|
15
|
+
const PACKAGE_ID = "0xd075d51486df71e750872b4edf82ea3409fda397ceecc0b6aedf573d923c54a0";
|
|
16
|
+
const MODULE_NAME = "pool";
|
|
17
|
+
class SuiswapContract extends base_1.BaseContract {
|
|
18
|
+
swap(tx) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const poolId = this.swapInfo.poolId;
|
|
21
|
+
const swapXtoY = this.swapInfo.swapXtoY;
|
|
22
|
+
const inputCoin = this.inputCoinObject;
|
|
23
|
+
const typeArguments = [this.swapInfo.coinX.type, this.swapInfo.coinY.type];
|
|
24
|
+
const callFunc = swapXtoY
|
|
25
|
+
? "do_swap_x_to_y_direct"
|
|
26
|
+
: "do_swap_y_to_x_direct";
|
|
27
|
+
const inputAmount = this.getInputCoinValue(tx);
|
|
28
|
+
const [tokenIn, tokenOut] = tx.moveCall({
|
|
29
|
+
target: `${PACKAGE_ID}::${MODULE_NAME}::${callFunc}`,
|
|
30
|
+
typeArguments,
|
|
31
|
+
arguments: [
|
|
32
|
+
tx.object(poolId),
|
|
33
|
+
tx.makeMoveVec({
|
|
34
|
+
objects: [inputCoin],
|
|
35
|
+
}),
|
|
36
|
+
inputAmount,
|
|
37
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
tx.transferObjects([tokenIn], this.currentAccount);
|
|
41
|
+
return tokenOut;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.SuiswapContract = SuiswapContract;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ONE_MINUTE = exports.MIN_TICK_INDEX = exports.MAX_TICK_INDEX = exports.MAX_TICK_STEP = void 0;
|
|
4
|
+
exports.MAX_TICK_STEP = 100;
|
|
5
|
+
exports.MAX_TICK_INDEX = 443636;
|
|
6
|
+
exports.MIN_TICK_INDEX = -443636;
|
|
7
|
+
exports.ONE_MINUTE = 60 * 1000;
|
|
@@ -0,0 +1,53 @@
|
|
|
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.TurbosContract = void 0;
|
|
13
|
+
const utils_1 = require("@mysten/sui.js/utils");
|
|
14
|
+
const base_1 = require("../base");
|
|
15
|
+
const utils_2 = require("../utils");
|
|
16
|
+
const constants_1 = require("./constants");
|
|
17
|
+
const PACKAGE_ID = "0x1a3c42ded7b75cdf4ebc7c7b7da9d1e1db49f16fcdca934fac003f35f39ecad9";
|
|
18
|
+
const MODULE_NAME = "swap_router";
|
|
19
|
+
const VERSION = "0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f";
|
|
20
|
+
class TurbosContract extends base_1.BaseContract {
|
|
21
|
+
swap(tx) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const a2b = this.swapInfo.swapXtoY;
|
|
24
|
+
const { poolId, address } = {
|
|
25
|
+
poolId: this.swapInfo.poolId,
|
|
26
|
+
address: this.currentAccount,
|
|
27
|
+
};
|
|
28
|
+
const typeArguments = this.getTypeParams();
|
|
29
|
+
const inputAmount = this.getInputCoinValue(tx);
|
|
30
|
+
const [tokenOut, tokenIn] = tx.moveCall({
|
|
31
|
+
target: `${PACKAGE_ID}::${MODULE_NAME}::swap_${a2b ? "a_b" : "b_a"}_with_return_`,
|
|
32
|
+
typeArguments: typeArguments,
|
|
33
|
+
arguments: [
|
|
34
|
+
tx.object(poolId),
|
|
35
|
+
tx.makeMoveVec({
|
|
36
|
+
objects: [this.inputCoinObject],
|
|
37
|
+
}),
|
|
38
|
+
inputAmount,
|
|
39
|
+
tx.pure.u64(0),
|
|
40
|
+
tx.pure.u128((0, utils_2.getDefaultSqrtPriceLimit)(this.swapInfo.swapXtoY).toString()),
|
|
41
|
+
tx.pure.bool(true),
|
|
42
|
+
tx.pure.address(this.currentAccount),
|
|
43
|
+
tx.pure.u64(Date.now() + constants_1.ONE_MINUTE * 3),
|
|
44
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
45
|
+
tx.object(VERSION),
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
tx.transferObjects([tokenIn], address);
|
|
49
|
+
return tokenOut;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.TurbosContract = TurbosContract;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getDefaultSqrtPriceLimit = getDefaultSqrtPriceLimit;
|
|
7
|
+
const bn_js_1 = __importDefault(require("bn.js"));
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
function getDefaultSqrtPriceLimit(a2b) {
|
|
10
|
+
return new bn_js_1.default(a2b ? constants_1.MIN_SQRT_PRICE : constants_1.MAX_SQRT_PRICE);
|
|
11
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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.swapWithRoute = swapWithRoute;
|
|
13
|
+
const protocols_1 = require("./protocols");
|
|
14
|
+
function swapWithRoute(_a) {
|
|
15
|
+
return __awaiter(this, arguments, void 0, function* ({ route, inputCoinObject, currentAccount, tx, }) {
|
|
16
|
+
let inputTokenObject = inputCoinObject;
|
|
17
|
+
let txbResultToReturn;
|
|
18
|
+
for (const swap of route) {
|
|
19
|
+
const ContractClass = protocols_1.ProtocolContract[swap.pool.type];
|
|
20
|
+
const contractInstance = new ContractClass({
|
|
21
|
+
swapInfo: swap,
|
|
22
|
+
inputCoinObject: inputTokenObject,
|
|
23
|
+
currentAccount,
|
|
24
|
+
});
|
|
25
|
+
const tokenOut = yield contractInstance.swap(tx);
|
|
26
|
+
inputTokenObject = tokenOut;
|
|
27
|
+
txbResultToReturn = tokenOut;
|
|
28
|
+
}
|
|
29
|
+
return txbResultToReturn;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSuiClient = getSuiClient;
|
|
4
|
+
exports.setSuiClient = setSuiClient;
|
|
5
|
+
const client_1 = require("@mysten/sui.js/client");
|
|
6
|
+
let suiClient = new client_1.SuiClient({
|
|
7
|
+
url: (0, client_1.getFullnodeUrl)("mainnet"),
|
|
8
|
+
});
|
|
9
|
+
function getSuiClient() {
|
|
10
|
+
return suiClient;
|
|
11
|
+
}
|
|
12
|
+
function setSuiClient(client) {
|
|
13
|
+
suiClient = client;
|
|
14
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { BuildTxParams } from "./types/tx";
|
|
3
|
+
export declare const buildTx: ({ quoteResponse, accountAddress, slippage, tx: _tx, commission: _commission, }: BuildTxParams) => Promise<TransactionBlock | undefined>;
|
|
4
|
+
//# sourceMappingURL=buildTx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildTx.d.ts","sourceRoot":"","sources":["../../../src/buildTx.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEjB,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAO3C,eAAO,MAAM,OAAO,mFAMjB,aAAa,0CA2Df,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explorer.d.ts","sourceRoot":"","sources":["../../../../src/constants/explorer.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ;;CAEpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../../src/constants/tokens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,kBAAkB,CAAC;AAExC,eAAO,MAAM,aAAa,iFACsD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimateGasFee.d.ts","sourceRoot":"","sources":["../../../src/estimateGasFee.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAIlD,wBAAsB,cAAc,CAAC,EACnC,aAAa,EACb,cAAc,EACd,QAAQ,EACR,QAAQ,EAAE,SAAS,EACnB,EAAE,EAAE,GAAG,EACP,UAAU,GACX,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoCxC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { QuoteResponse } from "./types/aggregator";
|
|
2
|
+
interface Params {
|
|
3
|
+
tokenIn: string;
|
|
4
|
+
tokenOut: string;
|
|
5
|
+
amountIn: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function getQuote({ tokenIn, tokenOut, amountIn, }: Params): Promise<QuoteResponse>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=getQuote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getQuote.d.ts","sourceRoot":"","sources":["../../../src/getQuote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,UAAU,MAAM;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAsB,QAAQ,CAAC,EAC7B,OAAO,EACP,QAAQ,EACR,QAAQ,GACT,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAQjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSuiPrice.d.ts","sourceRoot":"","sources":["../../../src/getSuiPrice.ts"],"names":[],"mappings":"AAIA,wBAAsB,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,CAQnD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from "./types/aggregator";
|
|
2
|
+
import { getSuiClient, setSuiClient } from "./suiClient";
|
|
3
|
+
import { getQuote } from "./getQuote";
|
|
4
|
+
import { getSuiPrice } from "./getSuiPrice";
|
|
5
|
+
import { estimateGasFee } from "./estimateGasFee";
|
|
6
|
+
import { buildTx } from "./buildTx";
|
|
7
|
+
export { getSuiClient, setSuiClient, getQuote, getSuiPrice, estimateGasFee, buildTx, };
|
|
8
|
+
declare const _default: {
|
|
9
|
+
getSuiClient: typeof getSuiClient;
|
|
10
|
+
setSuiClient: typeof setSuiClient;
|
|
11
|
+
getQuote: typeof getQuote;
|
|
12
|
+
getSuiPrice: typeof getSuiPrice;
|
|
13
|
+
estimateGasFee: typeof estimateGasFee;
|
|
14
|
+
buildTx: ({ quoteResponse, accountAddress, slippage, tx: _tx, commission: _commission, }: import("./types/tx").BuildTxParams) => Promise<import("@mysten/sui.js/dist/cjs/transactions").TransactionBlock | undefined>;
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,cAAc,EACd,OAAO,GACR,CAAC;;;;;;;;;AAEF,wBAOE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CoinStruct } from "@mysten/sui.js/client";
|
|
2
|
+
export declare const getCoinOjectIdsByAmount: (address: string, amount: string, coinType: string) => Promise<{
|
|
3
|
+
objectIds: string[];
|
|
4
|
+
objectCoins: CoinStruct[];
|
|
5
|
+
balance: string;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=getCoinOjectIdsByAmount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCoinOjectIdsByAmount.d.ts","sourceRoot":"","sources":["../../../../src/libs/getCoinOjectIdsByAmount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAkB,MAAM,uBAAuB,CAAC;AA2BnE,eAAO,MAAM,uBAAuB,YACzB,MAAM,UACP,MAAM,YACJ,MAAM,KACf,OAAO,CAAC;IACT,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB,CA0CA,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TransactionBlock, TransactionResult } from "@mysten/sui.js/transactions";
|
|
2
|
+
export declare const getSplitCoinForTx: (account: string, amount: string, splits: string[], coinType: string, inheritTx?: TransactionBlock, inspecTransaction?: boolean) => Promise<{
|
|
3
|
+
tx: TransactionBlock;
|
|
4
|
+
coinData: TransactionResult;
|
|
5
|
+
}>;
|
|
6
|
+
//# sourceMappingURL=getSplitCoinForTx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSplitCoinForTx.d.ts","sourceRoot":"","sources":["../../../../src/libs/getSplitCoinForTx.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAKrC,eAAO,MAAM,iBAAiB,YACnB,MAAM,UACP,MAAM,UACN,MAAM,EAAE,YACN,MAAM,cACJ,gBAAgB,sBACR,OAAO,KAC1B,OAAO,CAAC;IACT,EAAE,EAAE,gBAAgB,CAAC;IACrB,QAAQ,EAAE,iBAAiB,CAAC;CAC7B,CAgDA,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groupSwapRoutes.d.ts","sourceRoot":"","sources":["../../../../src/libs/groupSwapRoutes.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,aAAa,EACb,SAAS,EACV,MAAM,qBAAqB,CAAC;AAG7B,wBAAgB,eAAe,CAAC,aAAa,EAAE,aAAa,GAAG,SAAS,EAAE,EAAE,CA2B3E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { BaseContract } from "../base";
|
|
3
|
+
export declare class AfterMathContract extends BaseContract {
|
|
4
|
+
swap(tx: TransactionBlock): Promise<{
|
|
5
|
+
index: number;
|
|
6
|
+
resultIndex: number;
|
|
7
|
+
kind: "NestedResult";
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/aftermath/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAkBvC,qBAAa,iBAAkB,SAAQ,YAAY;IAC3C,IAAI,CAAC,EAAE,EAAE,gBAAgB;;;;;CA2BhC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { TxSorSwap } from "../../types/aggregator";
|
|
3
|
+
import { TransactionResultItem } from "../../types/sui";
|
|
4
|
+
export interface BaseContractParams {
|
|
5
|
+
swapInfo: TxSorSwap;
|
|
6
|
+
inputCoinObject: TransactionResultItem;
|
|
7
|
+
currentAccount: string;
|
|
8
|
+
}
|
|
9
|
+
export declare abstract class BaseContract {
|
|
10
|
+
protected swapInfo: TxSorSwap;
|
|
11
|
+
protected inputCoinObject: TransactionResultItem;
|
|
12
|
+
protected currentAccount: string;
|
|
13
|
+
constructor({ swapInfo, inputCoinObject, currentAccount, }: BaseContractParams);
|
|
14
|
+
abstract swap(tx: TransactionBlock): Promise<TransactionResultItem>;
|
|
15
|
+
protected getInputCoinValue(tx: TransactionBlock): {
|
|
16
|
+
index: number;
|
|
17
|
+
kind: "Input";
|
|
18
|
+
value?: any;
|
|
19
|
+
type?: "object" | undefined;
|
|
20
|
+
} | {
|
|
21
|
+
index: number;
|
|
22
|
+
kind: "Input";
|
|
23
|
+
type: "pure";
|
|
24
|
+
value?: any;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "GasCoin";
|
|
27
|
+
} | {
|
|
28
|
+
index: number;
|
|
29
|
+
kind: "Result";
|
|
30
|
+
} | {
|
|
31
|
+
index: number;
|
|
32
|
+
resultIndex: number;
|
|
33
|
+
kind: "NestedResult";
|
|
34
|
+
};
|
|
35
|
+
protected getTypeParams(): string[];
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=base.d.ts.map
|