@7kprotocol/sdk-ts 2.3.4 → 2.3.5
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/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/prices/index.d.ts.map +1 -1
- 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/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 +6 -0
- 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/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/prices/index.d.ts.map +1 -1
- 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/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 +6 -0
- 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
package/lib/cjs/utils/sui.js
CHANGED
|
@@ -172,7 +172,7 @@ exports.SuiUtils = {
|
|
|
172
172
|
try {
|
|
173
173
|
return !!(0, utils_1.parseStructTag)(value);
|
|
174
174
|
}
|
|
175
|
-
catch (
|
|
175
|
+
catch (_) {
|
|
176
176
|
return false;
|
|
177
177
|
}
|
|
178
178
|
},
|
|
@@ -183,6 +183,13 @@ exports.SuiUtils = {
|
|
|
183
183
|
arguments: [],
|
|
184
184
|
})[0];
|
|
185
185
|
},
|
|
186
|
+
zeroCoin(tx, coinType) {
|
|
187
|
+
return tx.moveCall({
|
|
188
|
+
target: `0x2::coin::zero`,
|
|
189
|
+
typeArguments: [coinType],
|
|
190
|
+
arguments: [],
|
|
191
|
+
})[0];
|
|
192
|
+
},
|
|
186
193
|
coinIntoBalance(tx, coinType, coinObject) {
|
|
187
194
|
return tx.moveCall({
|
|
188
195
|
target: `0x2::coin::into_balance`,
|
|
@@ -7,7 +7,7 @@ export async function getTokenPrice(id, vsCoin = NATIVE_USDC_TOKEN_TYPE) {
|
|
|
7
7
|
const pricesRes = (await response.json());
|
|
8
8
|
return Number(pricesRes?.[id]?.price || 0);
|
|
9
9
|
}
|
|
10
|
-
catch (
|
|
10
|
+
catch (_) {
|
|
11
11
|
return 0;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -50,7 +50,7 @@ export async function getTokenPrices(ids, vsCoin = NATIVE_USDC_TOKEN_TYPE) {
|
|
|
50
50
|
}, {});
|
|
51
51
|
return finalPrices;
|
|
52
52
|
}
|
|
53
|
-
catch (
|
|
53
|
+
catch (_) {
|
|
54
54
|
return ids.slice(0, MAX_TOTAL_IDS).reduce((acc, id) => {
|
|
55
55
|
acc[id] = 0;
|
|
56
56
|
return acc;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
let config = null;
|
|
2
2
|
let configTs = 0;
|
|
3
|
-
const DEFAULT_CONFIG = {
|
|
3
|
+
export const DEFAULT_CONFIG = {
|
|
4
4
|
aftermath: {
|
|
5
5
|
name: "Aftermath",
|
|
6
6
|
package: "0xc4049b2d1cc0f6e017fda8260e4377cecd236bd7f56a54fee120816e72e2e0dd",
|
|
@@ -74,12 +74,22 @@ const DEFAULT_CONFIG = {
|
|
|
74
74
|
},
|
|
75
75
|
turbos: {
|
|
76
76
|
name: "Turbos Finance",
|
|
77
|
-
package: "
|
|
77
|
+
package: "0x9df4666296ee324a6f11e9f664e35e7fd6b6e8c9e9058ce6ee9ad5c5343c2f87",
|
|
78
78
|
version: "0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f",
|
|
79
79
|
},
|
|
80
|
+
steamm: {
|
|
81
|
+
name: "Steamm",
|
|
82
|
+
package: "0x4fb1cf45dffd6230305f1d269dd1816678cc8e3ba0b747a813a556921219f261",
|
|
83
|
+
script: "0x13bfc09cfc1bd922d3aa53fcf7b2cd510727ee65068ce136e2ebd5f3b213fdd2",
|
|
84
|
+
},
|
|
85
|
+
magma: {
|
|
86
|
+
name: "Magma",
|
|
87
|
+
package: "0x951d48bece7f6c2a3f4ba0b5791ba823c491e504feb4136497ee51331208ac33",
|
|
88
|
+
globalConfig: "0x4c4e1402401f72c7d8533d0ed8d5f8949da363c7a3319ccef261ffe153d32f8a",
|
|
89
|
+
},
|
|
80
90
|
};
|
|
81
91
|
export async function getConfig() {
|
|
82
|
-
const ttl =
|
|
92
|
+
const ttl = 60;
|
|
83
93
|
if (config && Date.now() - configTs < ttl * 1000) {
|
|
84
94
|
return config;
|
|
85
95
|
}
|
|
@@ -90,7 +100,7 @@ export async function getConfig() {
|
|
|
90
100
|
configTs = Date.now();
|
|
91
101
|
return quoteResponse;
|
|
92
102
|
}
|
|
93
|
-
catch (
|
|
103
|
+
catch (_) {
|
|
94
104
|
return DEFAULT_CONFIG;
|
|
95
105
|
}
|
|
96
106
|
}
|
|
@@ -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 const ProtocolContract = {
|
|
17
19
|
cetus: CetusContract,
|
|
18
20
|
turbos: TurbosContract,
|
|
@@ -29,4 +31,6 @@ export const ProtocolContract = {
|
|
|
29
31
|
springsui: SpringSuiContract,
|
|
30
32
|
obric: ObricContract,
|
|
31
33
|
stsui: StSuiContract,
|
|
34
|
+
steamm: SteammContract,
|
|
35
|
+
magma: MagmaContract,
|
|
32
36
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { BaseContract } from "../base";
|
|
2
2
|
import { normalizeTokenType } from "../../../utils/token";
|
|
3
|
-
const PACKAGE_ID = "0xa0eba10b173538c8fecca1dff298e488402cc9ff374f8a12ca7758eebe830b66";
|
|
4
|
-
const MODULE_NAME = "spot_dex";
|
|
5
3
|
export class KriyaContract extends BaseContract {
|
|
6
4
|
async swap(tx) {
|
|
7
5
|
const swapXtoY = this.swapInfo.swapXtoY;
|
|
@@ -9,8 +7,9 @@ export class KriyaContract extends BaseContract {
|
|
|
9
7
|
const coinOutType = normalizeTokenType(this.swapInfo.assetOut);
|
|
10
8
|
const poolId = this.swapInfo.poolId;
|
|
11
9
|
const inputCoinObject = this.inputCoinObject;
|
|
10
|
+
const config = this.config.kriya;
|
|
12
11
|
const [tokenOut] = tx.moveCall({
|
|
13
|
-
target: `${
|
|
12
|
+
target: `${config.package}::spot_dex::${swapXtoY ? "swap_token_x" : "swap_token_y"}`,
|
|
14
13
|
typeArguments: [
|
|
15
14
|
swapXtoY ? coinInType : coinOutType,
|
|
16
15
|
swapXtoY ? coinOutType : coinInType,
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { BaseContract } from "../base";
|
|
2
2
|
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
|
|
3
3
|
import { normalizeTokenType } from "../../../utils/token";
|
|
4
|
-
const PACKAGE_ID = "0xbd8d4489782042c6fafad4de4bc6a5e0b84a43c6c00647ffd7062d1e2bb7549e";
|
|
5
|
-
const VERSION_ID = "0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78";
|
|
6
4
|
export class KriyaV3Contract extends BaseContract {
|
|
7
5
|
async swap(tx) {
|
|
8
6
|
const swapXtoY = this.swapInfo.swapXtoY;
|
|
@@ -11,6 +9,7 @@ export class KriyaV3Contract extends BaseContract {
|
|
|
11
9
|
const poolId = this.swapInfo.poolId;
|
|
12
10
|
const LowLimitPrice = 4295048017;
|
|
13
11
|
const limitPrice = BigInt("79226673515401279992447579050");
|
|
12
|
+
const { package: PACKAGE_ID, version: VERSION_ID } = this.config.kriya_v3;
|
|
14
13
|
const [receive_a, receive_b, flash_receipt] = tx.moveCall({
|
|
15
14
|
target: `${PACKAGE_ID}::trade::flash_swap`,
|
|
16
15
|
typeArguments: this.getTypeParams(),
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BaseContract } from "../base";
|
|
2
|
+
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
|
|
3
|
+
import { getDefaultSqrtPriceLimit } from "../utils";
|
|
4
|
+
import { SuiUtils } from "../../../utils/sui";
|
|
5
|
+
export class MagmaContract extends BaseContract {
|
|
6
|
+
async swap(tx) {
|
|
7
|
+
const [coinX, coinY] = this.swapInfo.pool.allTokens;
|
|
8
|
+
const swapXtoY = this.swapInfo.swapXtoY;
|
|
9
|
+
const sqrtPriceLimit = getDefaultSqrtPriceLimit(swapXtoY);
|
|
10
|
+
const typeArguments = [coinX.address, coinY.address];
|
|
11
|
+
const [zeroOut] = tx.moveCall({
|
|
12
|
+
target: "0x2::coin::zero",
|
|
13
|
+
typeArguments: [swapXtoY ? coinY.address : coinX.address],
|
|
14
|
+
});
|
|
15
|
+
const amountIn = SuiUtils.getCoinValue(swapXtoY ? coinX.address : coinY.address, this.inputCoinObject, tx);
|
|
16
|
+
const config = this.config.magma;
|
|
17
|
+
const [receiveA, receiveB] = tx.moveCall({
|
|
18
|
+
target: `${config.package}::router::swap`,
|
|
19
|
+
typeArguments,
|
|
20
|
+
arguments: [
|
|
21
|
+
tx.object(config.globalConfig),
|
|
22
|
+
tx.object(this.swapInfo.poolId),
|
|
23
|
+
swapXtoY ? this.inputCoinObject : zeroOut, // coin A
|
|
24
|
+
swapXtoY ? zeroOut : this.inputCoinObject, // coin B
|
|
25
|
+
tx.pure.bool(swapXtoY), // a to b or b to a
|
|
26
|
+
tx.pure.bool(true), // exact in or out
|
|
27
|
+
amountIn, // swap amount
|
|
28
|
+
tx.pure.u128(sqrtPriceLimit.toString()), // sqrt price limit
|
|
29
|
+
tx.pure.bool(false),
|
|
30
|
+
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
31
|
+
],
|
|
32
|
+
});
|
|
33
|
+
SuiUtils.transferOrDestroyZeroCoin(tx, this.swapInfo.assetIn, swapXtoY ? receiveA : receiveB, this.currentAccount);
|
|
34
|
+
console.log(tx);
|
|
35
|
+
return swapXtoY ? receiveB : receiveA;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
|
|
2
2
|
import { BaseContract } from "../base";
|
|
3
|
-
const PACKAGE_ID = "0xb84e63d22ea4822a0a333c250e790f69bf5c2ef0c63f4e120e05a6415991368f";
|
|
4
|
-
const PYTH_STATE = "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";
|
|
5
3
|
export class ObricContract extends BaseContract {
|
|
6
4
|
async swap(tx) {
|
|
7
5
|
const [coinX, coinY] = this.swapInfo.pool.allTokens;
|
|
@@ -10,6 +8,7 @@ export class ObricContract extends BaseContract {
|
|
|
10
8
|
if (!x_price_id || !y_price_id) {
|
|
11
9
|
throw new Error("x_price_id and y_price_id are required");
|
|
12
10
|
}
|
|
11
|
+
const { package: PACKAGE_ID, pythState: PYTH_STATE } = this.config.obric;
|
|
13
12
|
const [coinOut] = tx.moveCall({
|
|
14
13
|
target: `${PACKAGE_ID}::v2::${xToY ? "swap_x_to_y" : "swap_y_to_x"}`,
|
|
15
14
|
typeArguments: [coinX.address, coinY.address],
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SUI_SYSTEM_STATE_OBJECT_ID } from "@mysten/sui/utils";
|
|
2
2
|
import { BaseContract } from "../base";
|
|
3
|
-
const PACKAGE_ID = "0x82e6f4f75441eae97d2d5850f41a09d28c7b64a05b067d37748d471f43aaf3f7";
|
|
4
3
|
export class SpringSuiContract extends BaseContract {
|
|
5
4
|
async swap(tx) {
|
|
6
5
|
// coinX is always SUI
|
|
7
6
|
const coinY = this.swapInfo.pool.allTokens[1];
|
|
8
7
|
const isStake = this.swapInfo.swapXtoY;
|
|
8
|
+
const { package: PACKAGE_ID } = this.config.springsui;
|
|
9
9
|
const [coinOut] = tx.moveCall({
|
|
10
10
|
target: `${PACKAGE_ID}::liquid_staking::${isStake ? "mint" : "redeem"}`,
|
|
11
11
|
typeArguments: [coinY.address],
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { BaseContract } from "../base";
|
|
2
|
+
import { normalizeStructTag, parseStructTag, SUI_CLOCK_OBJECT_ID, } from "@mysten/sui/utils";
|
|
3
|
+
import { SuiUtils } from "../../../utils/sui";
|
|
4
|
+
export class SteammContract extends BaseContract {
|
|
5
|
+
async swap(tx) {
|
|
6
|
+
return this.cpmmSwap(tx);
|
|
7
|
+
}
|
|
8
|
+
cpmmSwap(tx) {
|
|
9
|
+
const extra = this.swapInfo.extra;
|
|
10
|
+
if (!extra ||
|
|
11
|
+
!extra.bankAStructTag ||
|
|
12
|
+
!extra.bankBStructTag ||
|
|
13
|
+
!extra.poolStructTag ||
|
|
14
|
+
!extra.bankA ||
|
|
15
|
+
!extra.bankB ||
|
|
16
|
+
!extra.lendingMarketA ||
|
|
17
|
+
!extra.lendingMarketB) {
|
|
18
|
+
throw new Error(`Invalid extra info for cpmmSwap`);
|
|
19
|
+
}
|
|
20
|
+
// the pool script v1 only support same lending market
|
|
21
|
+
if (extra.lendingMarketA !== extra.lendingMarketB) {
|
|
22
|
+
throw new Error(`Invalid lending market for cpmmSwap`);
|
|
23
|
+
}
|
|
24
|
+
const [btokenA, bTokenB, _quoter, lp] = parseStructTag(extra.poolStructTag).typeParams;
|
|
25
|
+
const [lendingMarket, coinTypeA, _bTokenA] = parseStructTag(extra.bankAStructTag).typeParams;
|
|
26
|
+
const [_lendingMarket, coinTypeB, _bTokenB] = parseStructTag(extra.bankBStructTag).typeParams;
|
|
27
|
+
const xToY = this.swapInfo.swapXtoY;
|
|
28
|
+
const coinA = xToY
|
|
29
|
+
? this.inputCoinObject
|
|
30
|
+
: SuiUtils.zeroCoin(tx, normalizeStructTag(coinTypeA));
|
|
31
|
+
const coinB = !xToY
|
|
32
|
+
? this.inputCoinObject
|
|
33
|
+
: SuiUtils.zeroCoin(tx, normalizeStructTag(coinTypeB));
|
|
34
|
+
tx.moveCall({
|
|
35
|
+
target: `${this.config.steamm.script}::pool_script::cpmm_swap`,
|
|
36
|
+
typeArguments: [
|
|
37
|
+
lendingMarket,
|
|
38
|
+
coinTypeA,
|
|
39
|
+
coinTypeB,
|
|
40
|
+
btokenA,
|
|
41
|
+
bTokenB,
|
|
42
|
+
lp,
|
|
43
|
+
].map(normalizeStructTag),
|
|
44
|
+
arguments: [
|
|
45
|
+
tx.object(this.swapInfo.poolId),
|
|
46
|
+
tx.object(extra.bankA),
|
|
47
|
+
tx.object(extra.bankB),
|
|
48
|
+
tx.object(extra.lendingMarketA),
|
|
49
|
+
coinA,
|
|
50
|
+
coinB,
|
|
51
|
+
tx.pure.bool(xToY),
|
|
52
|
+
this.getInputCoinValue(tx),
|
|
53
|
+
tx.pure.u64(0),
|
|
54
|
+
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
55
|
+
],
|
|
56
|
+
});
|
|
57
|
+
const coinIn = xToY ? coinA : coinB;
|
|
58
|
+
const coinOut = xToY ? coinB : coinA;
|
|
59
|
+
SuiUtils.transferOrDestroyZeroCoin(tx, this.swapInfo.assetIn, coinIn, this.currentAccount);
|
|
60
|
+
return coinOut;
|
|
61
|
+
}
|
|
62
|
+
cpmmSwapV2(tx) {
|
|
63
|
+
const extra = this.swapInfo.extra;
|
|
64
|
+
if (!extra ||
|
|
65
|
+
!extra.bankAStructTag ||
|
|
66
|
+
!extra.bankBStructTag ||
|
|
67
|
+
!extra.poolStructTag ||
|
|
68
|
+
!extra.bankA ||
|
|
69
|
+
!extra.bankB ||
|
|
70
|
+
!extra.lendingMarketA ||
|
|
71
|
+
!extra.lendingMarketB) {
|
|
72
|
+
throw new Error(`Invalid extra info for cpmmSwap`);
|
|
73
|
+
}
|
|
74
|
+
// the pool script v1 only support same lending market
|
|
75
|
+
if (extra.lendingMarketA !== extra.lendingMarketB) {
|
|
76
|
+
throw new Error(`Invalid lending market for cpmmSwap`);
|
|
77
|
+
}
|
|
78
|
+
const [btokenA, bTokenB, _quoter, lp] = parseStructTag(extra.poolStructTag).typeParams;
|
|
79
|
+
const [lendingMarket, coinTypeA, _bTokenA] = parseStructTag(extra.bankAStructTag).typeParams;
|
|
80
|
+
const [_lendingMarket, coinTypeB, _bTokenB] = parseStructTag(extra.bankBStructTag).typeParams;
|
|
81
|
+
const [coinX, _coinY] = this.swapInfo.pool.allTokens;
|
|
82
|
+
const xToY = coinX.address === this.swapInfo.assetIn;
|
|
83
|
+
const coinA = xToY
|
|
84
|
+
? this.inputCoinObject
|
|
85
|
+
: SuiUtils.zeroCoin(tx, normalizeStructTag(coinTypeA));
|
|
86
|
+
const coinB = !xToY
|
|
87
|
+
? this.inputCoinObject
|
|
88
|
+
: SuiUtils.zeroCoin(tx, normalizeStructTag(coinTypeB));
|
|
89
|
+
const bankATypeArgs = [lendingMarket, coinTypeA, btokenA].map(normalizeStructTag);
|
|
90
|
+
const bankBTypeArgs = [lendingMarket, coinTypeB, bTokenB].map(normalizeStructTag);
|
|
91
|
+
const bankInTypeArgs = xToY ? bankATypeArgs : bankBTypeArgs;
|
|
92
|
+
const bankOutTypeArgs = xToY ? bankBTypeArgs : bankATypeArgs;
|
|
93
|
+
// mint btoken from both coins
|
|
94
|
+
const bTokenIn = tx.moveCall({
|
|
95
|
+
target: `${this.config.steamm.package}::bank::mint_btokens`,
|
|
96
|
+
typeArguments: bankInTypeArgs,
|
|
97
|
+
arguments: [
|
|
98
|
+
tx.object(xToY ? extra.bankA : extra.bankB),
|
|
99
|
+
tx.object(extra.lendingMarketA),
|
|
100
|
+
xToY ? coinA : coinB,
|
|
101
|
+
this.getInputCoinValue(tx),
|
|
102
|
+
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
103
|
+
],
|
|
104
|
+
});
|
|
105
|
+
const bTokenOut = SuiUtils.zeroCoin(tx, normalizeStructTag(xToY ? bTokenB : btokenA));
|
|
106
|
+
// call swap on btoken
|
|
107
|
+
tx.moveCall({
|
|
108
|
+
target: `${this.config.steamm.package}::cpmm::swap`,
|
|
109
|
+
typeArguments: [btokenA, bTokenB, lp].map(normalizeStructTag),
|
|
110
|
+
arguments: [
|
|
111
|
+
tx.object(this.swapInfo.poolId),
|
|
112
|
+
xToY ? bTokenIn : bTokenOut,
|
|
113
|
+
xToY ? bTokenOut : bTokenIn,
|
|
114
|
+
tx.pure.bool(xToY),
|
|
115
|
+
SuiUtils.getCoinValue(normalizeStructTag(xToY ? btokenA : bTokenB), bTokenIn, tx),
|
|
116
|
+
tx.pure.u64(0), // min output
|
|
117
|
+
],
|
|
118
|
+
});
|
|
119
|
+
// burn btoken to get out coin
|
|
120
|
+
const [outCoin] = tx.moveCall({
|
|
121
|
+
target: `${this.config.steamm.package}::bank::burn_btokens`,
|
|
122
|
+
typeArguments: bankOutTypeArgs,
|
|
123
|
+
arguments: [
|
|
124
|
+
tx.object(xToY ? extra.bankB : extra.bankA),
|
|
125
|
+
tx.object(extra.lendingMarketA),
|
|
126
|
+
bTokenOut,
|
|
127
|
+
SuiUtils.getCoinValue(normalizeStructTag(xToY ? bTokenB : btokenA), bTokenOut, tx),
|
|
128
|
+
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
129
|
+
],
|
|
130
|
+
});
|
|
131
|
+
const coinIn = xToY ? coinA : coinB;
|
|
132
|
+
const coinOut = xToY ? coinB : coinA;
|
|
133
|
+
// the coinIn was mutated by mint_btokens above, but not consumed, so we need to transfer or destroy it
|
|
134
|
+
SuiUtils.transferOrDestroyZeroCoin(tx, this.swapInfo.assetIn, coinIn, this.currentAccount);
|
|
135
|
+
// bTokenIn was mutated by cpmm::swap above, but not consumed, so we need to transfer or destroy it
|
|
136
|
+
SuiUtils.transferOrDestroyZeroCoin(tx, normalizeStructTag(xToY ? btokenA : bTokenB), bTokenIn, this.currentAccount);
|
|
137
|
+
// bTokenOut was burned by burn_btokens above, but not consumed, so we need to transfer or destroy it
|
|
138
|
+
SuiUtils.transferOrDestroyZeroCoin(tx, normalizeStructTag(xToY ? bTokenB : btokenA), bTokenOut, this.currentAccount);
|
|
139
|
+
// after all we need to merge the placeholder output coin (zero) with actual output coin from swap burn
|
|
140
|
+
tx.mergeCoins(coinOut, [outCoin]);
|
|
141
|
+
return coinOut;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SUI_SYSTEM_STATE_OBJECT_ID } from "@mysten/sui/utils";
|
|
2
2
|
import { BaseContract } from "../base";
|
|
3
|
-
const PACKAGE_ID = "0x059f94b85c07eb74d2847f8255d8cc0a67c9a8dcc039eabf9f8b9e23a0de2700";
|
|
4
3
|
export class StSuiContract extends BaseContract {
|
|
5
4
|
async swap(tx) {
|
|
6
5
|
// coinX is always SUI
|
|
7
6
|
const coinY = this.swapInfo.pool.allTokens[1];
|
|
8
7
|
const isStake = this.swapInfo.swapXtoY;
|
|
8
|
+
const { package: PACKAGE_ID } = this.config.stsui;
|
|
9
9
|
const [coinOut] = tx.moveCall({
|
|
10
10
|
target: `${PACKAGE_ID}::liquid_staking::${isStake ? "mint" : "redeem"}`,
|
|
11
11
|
typeArguments: [coinY.address],
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
|
|
2
2
|
import { BaseContract } from "../base";
|
|
3
3
|
import { SuiUtils } from "../../../utils/sui";
|
|
4
|
-
const PACKAGE_ID = "0xd075d51486df71e750872b4edf82ea3409fda397ceecc0b6aedf573d923c54a0";
|
|
5
|
-
const MODULE_NAME = "pool";
|
|
6
4
|
export class SuiswapContract extends BaseContract {
|
|
7
5
|
async swap(tx) {
|
|
8
6
|
const poolId = this.swapInfo.poolId;
|
|
@@ -12,9 +10,10 @@ export class SuiswapContract extends BaseContract {
|
|
|
12
10
|
const callFunc = swapXtoY
|
|
13
11
|
? "do_swap_x_to_y_direct"
|
|
14
12
|
: "do_swap_y_to_x_direct";
|
|
13
|
+
const { package: PACKAGE_ID } = this.config.suiswap;
|
|
15
14
|
const inputAmount = this.getInputCoinValue(tx);
|
|
16
15
|
const [tokenIn, tokenOut] = tx.moveCall({
|
|
17
|
-
target: `${PACKAGE_ID}::${
|
|
16
|
+
target: `${PACKAGE_ID}::pool::${callFunc}`,
|
|
18
17
|
typeArguments,
|
|
19
18
|
arguments: [
|
|
20
19
|
tx.object(poolId),
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
|
|
2
2
|
import { BaseContract } from "../base";
|
|
3
3
|
import { getDefaultSqrtPriceLimit } from "../utils";
|
|
4
|
-
import { ONE_MINUTE } from "./constants";
|
|
5
4
|
import { SuiUtils } from "../../../utils/sui";
|
|
6
|
-
const
|
|
7
|
-
const MODULE_NAME = "swap_router";
|
|
8
|
-
const VERSION = "0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f";
|
|
5
|
+
const ONE_MINUTE = 60 * 1000;
|
|
9
6
|
export class TurbosContract extends BaseContract {
|
|
10
7
|
async swap(tx) {
|
|
11
8
|
const a2b = this.swapInfo.swapXtoY;
|
|
@@ -13,11 +10,11 @@ export class TurbosContract extends BaseContract {
|
|
|
13
10
|
poolId: this.swapInfo.poolId,
|
|
14
11
|
address: this.currentAccount,
|
|
15
12
|
};
|
|
16
|
-
const
|
|
13
|
+
const { package: PACKAGE_ID, version: VERSION } = this.config.turbos;
|
|
17
14
|
const inputAmount = this.getInputCoinValue(tx);
|
|
18
15
|
const [tokenOut, tokenIn] = tx.moveCall({
|
|
19
|
-
target: `${PACKAGE_ID}
|
|
20
|
-
typeArguments:
|
|
16
|
+
target: `${PACKAGE_ID}::swap_router::swap_${a2b ? "a_b" : "b_a"}_with_return_`,
|
|
17
|
+
typeArguments: this.getTypeParams(),
|
|
21
18
|
arguments: [
|
|
22
19
|
tx.object(poolId),
|
|
23
20
|
tx.makeMoveVec({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/prices/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,yBAAyB,CAAC;AAOjD,wBAAsB,aAAa,CACjC,EAAE,EAAE,MAAM,EACV,MAAM,SAAyB,GAC9B,OAAO,CAAC,MAAM,CAAC,CAUjB;AAYD,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EAAE,EACb,MAAM,SAAyB,GAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/prices/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,yBAAyB,CAAC;AAOjD,wBAAsB,aAAa,CACjC,EAAE,EAAE,MAAM,EACV,MAAM,SAAyB,GAC9B,OAAO,CAAC,MAAM,CAAC,CAUjB;AAYD,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EAAE,EACb,MAAM,SAAyB,GAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAyCjC;AAED,wBAAsB,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,CAEnD"}
|
|
@@ -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"}
|
|
@@ -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;;;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AAE,MAAM,CAAA;KAAE,CAAC;IAC9C,QAAQ,EAAE,SAAS,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,KAAK,EAAE,SAAS,GAAG;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,EAAE,SAAS,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,KAAK,EAAE,SAAS,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,QAAQ,EAAE,SAAS,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5D,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,SAAS,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,KAAK,EAAE,SAAS,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,SAAS,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;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];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../../../src/utils/sui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EACL,UAAU,EAEV,sBAAsB,EACvB,MAAM,oBAAoB,CAAC;AAK5B,KAAK,QAAQ,CAAC,CAAC,IAAI;IACjB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AAEF,KAAK,cAAc,GAAG,KAAK,GAAG,SAAS,CAAC;AAExC,eAAO,MAAM,QAAQ;uBAET,MAAM,GAAG,mBAAmB,OAC/B,WAAW,GACf,mBAAmB;4BAMP,KAAK,CAAC,MAAM,GAAG,mBAAmB,CAAC,OAC3C,WAAW,GACf,mBAAmB,GAAG,SAAS;2BAsBtB,MAAM,cACJ,MAAM,GAAG,mBAAmB,OACnC,WAAW,GACf,mBAAmB;mCAYV,MAAM,SACT;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,UACtC,MAAM,OACT,WAAW;;;;gCAoBgB,MAAM,iBAAiB,MAAM;qCAoCtD,UAAU,EAAE,YACT,MAAM,OACX,WAAW;uCAsBuB;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;sCA8BhE,MAAM,SACP;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE;iCA6BvC,MA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KAAE,EAAE;iCA6BvC,MAAM,SACN,sBAAsB,mBACb,cAAc,GAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;4BAyBD,MAAM;oBAQd,WAAW,YAAY,MAAM;;;;iBAQhC,WAAW,YAAY,MAAM;;;;wBASpC,WAAW,YACL,MAAM,cACJ,mBAAmB;;;;wBAU3B,WAAW,YACL,MAAM,WACP,mBAAmB;;;;kCAUxB,WAAW,YACL,MAAM,QACV,mBAAmB,OACpB,MAAM;CAUd,CAAC"}
|
package/lib/esm/utils/sui.js
CHANGED
|
@@ -159,7 +159,7 @@ export const SuiUtils = {
|
|
|
159
159
|
try {
|
|
160
160
|
return !!parseStructTag(value);
|
|
161
161
|
}
|
|
162
|
-
catch (
|
|
162
|
+
catch (_) {
|
|
163
163
|
return false;
|
|
164
164
|
}
|
|
165
165
|
},
|
|
@@ -170,6 +170,13 @@ export const SuiUtils = {
|
|
|
170
170
|
arguments: [],
|
|
171
171
|
})[0];
|
|
172
172
|
},
|
|
173
|
+
zeroCoin(tx, coinType) {
|
|
174
|
+
return tx.moveCall({
|
|
175
|
+
target: `0x2::coin::zero`,
|
|
176
|
+
typeArguments: [coinType],
|
|
177
|
+
arguments: [],
|
|
178
|
+
})[0];
|
|
179
|
+
},
|
|
173
180
|
coinIntoBalance(tx, coinType, coinObject) {
|
|
174
181
|
return tx.moveCall({
|
|
175
182
|
target: `0x2::coin::into_balance`,
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
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;
|