@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,38 @@
|
|
|
1
|
+
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui.js/utils";
|
|
2
|
+
import { BaseContract } from "../base";
|
|
3
|
+
import { getDefaultSqrtPriceLimit } from "../utils";
|
|
4
|
+
import { ONE_MINUTE } from "./constants";
|
|
5
|
+
const PACKAGE_ID = "0x1a3c42ded7b75cdf4ebc7c7b7da9d1e1db49f16fcdca934fac003f35f39ecad9";
|
|
6
|
+
const MODULE_NAME = "swap_router";
|
|
7
|
+
const VERSION = "0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f";
|
|
8
|
+
export class TurbosContract extends BaseContract {
|
|
9
|
+
async swap(tx) {
|
|
10
|
+
const a2b = this.swapInfo.swapXtoY;
|
|
11
|
+
const { poolId, address } = {
|
|
12
|
+
poolId: this.swapInfo.poolId,
|
|
13
|
+
address: this.currentAccount,
|
|
14
|
+
};
|
|
15
|
+
const typeArguments = this.getTypeParams();
|
|
16
|
+
const inputAmount = this.getInputCoinValue(tx);
|
|
17
|
+
const [tokenOut, tokenIn] = tx.moveCall({
|
|
18
|
+
target: `${PACKAGE_ID}::${MODULE_NAME}::swap_${a2b ? "a_b" : "b_a"}_with_return_`,
|
|
19
|
+
typeArguments: typeArguments,
|
|
20
|
+
arguments: [
|
|
21
|
+
tx.object(poolId),
|
|
22
|
+
tx.makeMoveVec({
|
|
23
|
+
objects: [this.inputCoinObject],
|
|
24
|
+
}),
|
|
25
|
+
inputAmount,
|
|
26
|
+
tx.pure.u64(0),
|
|
27
|
+
tx.pure.u128(getDefaultSqrtPriceLimit(this.swapInfo.swapXtoY).toString()),
|
|
28
|
+
tx.pure.bool(true),
|
|
29
|
+
tx.pure.address(this.currentAccount),
|
|
30
|
+
tx.pure.u64(Date.now() + ONE_MINUTE * 3),
|
|
31
|
+
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
32
|
+
tx.object(VERSION),
|
|
33
|
+
],
|
|
34
|
+
});
|
|
35
|
+
tx.transferObjects([tokenIn], address);
|
|
36
|
+
return tokenOut;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ProtocolContract } from "./protocols";
|
|
2
|
+
export async function swapWithRoute({ route, inputCoinObject, currentAccount, tx, }) {
|
|
3
|
+
let inputTokenObject = inputCoinObject;
|
|
4
|
+
let txbResultToReturn;
|
|
5
|
+
for (const swap of route) {
|
|
6
|
+
const ContractClass = ProtocolContract[swap.pool.type];
|
|
7
|
+
const contractInstance = new ContractClass({
|
|
8
|
+
swapInfo: swap,
|
|
9
|
+
inputCoinObject: inputTokenObject,
|
|
10
|
+
currentAccount,
|
|
11
|
+
});
|
|
12
|
+
const tokenOut = await contractInstance.swap(tx);
|
|
13
|
+
inputTokenObject = tokenOut;
|
|
14
|
+
txbResultToReturn = tokenOut;
|
|
15
|
+
}
|
|
16
|
+
return txbResultToReturn;
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SuiClient, getFullnodeUrl } from "@mysten/sui.js/client";
|
|
2
|
+
let suiClient = new SuiClient({
|
|
3
|
+
url: getFullnodeUrl("mainnet"),
|
|
4
|
+
});
|
|
5
|
+
export function getSuiClient() {
|
|
6
|
+
return suiClient;
|
|
7
|
+
}
|
|
8
|
+
export function setSuiClient(client) {
|
|
9
|
+
suiClient = client;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../../src/libs/protocols/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,eAAe,EAAE,qBAAqB,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,8BAAsB,YAAY;IAChC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC9B,SAAS,CAAC,eAAe,EAAE,qBAAqB,CAAC;IACjD,SAAS,CAAC,cAAc,EAAE,MAAM,CAAC;gBAErB,EACV,QAAQ,EACR,eAAe,EACf,cAAc,GACf,EAAE,kBAAkB;IAMrB,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,gBAAgB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAEnE,SAAS,CAAC,iBAAiB,CAAC,EAAE,EAAE,gBAAgB;;;;;;;;;;;;;;;;;;;;IAQhD,SAAS,CAAC,aAAa;CAKxB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { BaseContract } from "../base";
|
|
3
|
+
export declare class BluemoveContract 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/bluemove/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAQvC,qBAAa,gBAAiB,SAAQ,YAAY;IAC1C,IAAI,CAAC,EAAE,EAAE,gBAAgB;;;;;CAoBhC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { BaseContract } from "../base";
|
|
3
|
+
export declare class CetusContract 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/cetus/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAWvC,qBAAa,aAAc,SAAQ,YAAY;IACvC,IAAI,CAAC,EAAE,EAAE,gBAAgB;;;;;CAyChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/libs/protocols/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,eAAe,CAAC;AAC3C,eAAO,MAAM,cAAc,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { BaseContract } from "../base";
|
|
3
|
+
export declare class DeepBookContract extends BaseContract {
|
|
4
|
+
swap(tx: TransactionBlock): Promise<{
|
|
5
|
+
index: number;
|
|
6
|
+
resultIndex: number;
|
|
7
|
+
kind: "NestedResult";
|
|
8
|
+
}>;
|
|
9
|
+
private createAccountCap;
|
|
10
|
+
private deleteAccountCap;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/deepbook/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAOvC,qBAAa,gBAAiB,SAAQ,YAAY;IAC1C,IAAI,CAAC,EAAE,EAAE,gBAAgB;;;;;IA+D/B,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,gBAAgB;CAMzB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { BaseContract } from "../base";
|
|
3
|
+
export declare class FlowXContract 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/flowx/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAQvC,qBAAa,aAAc,SAAQ,YAAY;IACvC,IAAI,CAAC,EAAE,EAAE,gBAAgB;;;;;CAYhC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FlowXContract } from "./flowx";
|
|
2
|
+
import { AfterMathContract } from "./aftermath";
|
|
3
|
+
import { CetusContract } from "./cetus";
|
|
4
|
+
import { DeepBookContract } from "./deepbook";
|
|
5
|
+
import { KriyaContract } from "./kriya";
|
|
6
|
+
import { TurbosContract } from "./turbos";
|
|
7
|
+
import { SuiswapContract } from "./suiswap";
|
|
8
|
+
import { BluemoveContract } from "./bluemove";
|
|
9
|
+
export declare const ProtocolContract: {
|
|
10
|
+
cetus: typeof CetusContract;
|
|
11
|
+
turbos: typeof TurbosContract;
|
|
12
|
+
bluemove: typeof BluemoveContract;
|
|
13
|
+
kriya: typeof KriyaContract;
|
|
14
|
+
suiswap: typeof SuiswapContract;
|
|
15
|
+
aftermath: typeof AfterMathContract;
|
|
16
|
+
deepbook: typeof DeepBookContract;
|
|
17
|
+
flowx: typeof FlowXContract;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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;AAE9C,eAAO,MAAM,gBAAgB;;;;;;;;;CAS5B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { BaseContract } from "../base";
|
|
3
|
+
export declare class KriyaContract 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/kriya/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAOvC,qBAAa,aAAc,SAAQ,YAAY;IACvC,IAAI,CAAC,EAAE,EAAE,gBAAgB;;;;;CAyBhC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { BaseContract } from "../base";
|
|
3
|
+
export declare class SuiswapContract 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/suiswap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAMvC,qBAAa,eAAgB,SAAQ,YAAY;IACzC,IAAI,CAAC,EAAE,EAAE,gBAAgB;;;;;CA2BhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/protocols/turbos/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,eAAO,MAAM,UAAU,QAAY,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { BaseContract } from "../base";
|
|
3
|
+
export declare class TurbosContract 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/turbos/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAUvC,qBAAa,cAAe,SAAQ,YAAY;IACxC,IAAI,CAAC,EAAE,EAAE,gBAAgB;;;;;CAqChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/libs/protocols/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,OAAO,CAAC;AAGvB,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,EAAE,CAEzD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { TxSorSwap } from "../types/aggregator";
|
|
3
|
+
import { TransactionResultItem } from "../types/sui";
|
|
4
|
+
export declare function swapWithRoute({ route, inputCoinObject, currentAccount, tx, }: {
|
|
5
|
+
route: TxSorSwap[];
|
|
6
|
+
inputCoinObject: TransactionResultItem;
|
|
7
|
+
currentAccount: string;
|
|
8
|
+
tx: TransactionBlock;
|
|
9
|
+
}): Promise<TransactionResultItem | undefined>;
|
|
10
|
+
//# sourceMappingURL=swapWithRoute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swapWithRoute.d.ts","sourceRoot":"","sources":["../../../../src/libs/swapWithRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,wBAAsB,aAAa,CAAC,EAClC,KAAK,EACL,eAAe,EACf,cAAc,EACd,EAAE,GACH,EAAE;IACD,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,eAAe,EAAE,qBAAqB,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,EAAE,EAAE,gBAAgB,CAAC;CACtB,GAAG,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAiB7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suiClient.d.ts","sourceRoot":"","sources":["../../../src/suiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,uBAAuB,CAAC;AAMlE,wBAAgB,YAAY,cAE3B;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,QAE7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export type SourceDex = "suiswap" | "turbos" | "cetus" | "bluemove" | "kriya" | "aftermath" | "deepbook" | "flowx";
|
|
2
|
+
export type SorSwap = {
|
|
3
|
+
poolId: string;
|
|
4
|
+
assetInIndex: number;
|
|
5
|
+
assetOutIndex: number;
|
|
6
|
+
amount: string;
|
|
7
|
+
returnAmount: string;
|
|
8
|
+
assetIn: string;
|
|
9
|
+
assetOut: string;
|
|
10
|
+
functionName: string;
|
|
11
|
+
arguments: string[];
|
|
12
|
+
extra?: any;
|
|
13
|
+
};
|
|
14
|
+
export type SorPool = {
|
|
15
|
+
allTokens: Array<{
|
|
16
|
+
address: string;
|
|
17
|
+
decimal: number;
|
|
18
|
+
}>;
|
|
19
|
+
type: SourceDex;
|
|
20
|
+
};
|
|
21
|
+
export type SorHop = {
|
|
22
|
+
poolId: string;
|
|
23
|
+
tokenInAmount: string;
|
|
24
|
+
tokenOutAmount: string;
|
|
25
|
+
tokenIn: string;
|
|
26
|
+
tokenOut: string;
|
|
27
|
+
pool: SorPool;
|
|
28
|
+
};
|
|
29
|
+
export type SorRoute = {
|
|
30
|
+
hops: SorHop[];
|
|
31
|
+
share?: number;
|
|
32
|
+
tokenIn: string;
|
|
33
|
+
tokenInAmount: string;
|
|
34
|
+
tokenOut: string;
|
|
35
|
+
tokenOutAmount: string;
|
|
36
|
+
};
|
|
37
|
+
export type QuoteResponse = {
|
|
38
|
+
effectivePrice: number | null;
|
|
39
|
+
effectivePriceReserved: number | null;
|
|
40
|
+
priceImpact: number | null;
|
|
41
|
+
swapAmount: string;
|
|
42
|
+
returnAmount: string;
|
|
43
|
+
returnAmountWithDecimal: string;
|
|
44
|
+
returnAmountConsiderGasFees?: string;
|
|
45
|
+
returnAmountWithoutSwapFees?: string;
|
|
46
|
+
swapAmountWithDecimal: string;
|
|
47
|
+
tokenAddresses: string[];
|
|
48
|
+
tokenIn: string;
|
|
49
|
+
tokenOut: string;
|
|
50
|
+
marketSp: string;
|
|
51
|
+
routes?: SorRoute[];
|
|
52
|
+
swaps: SorSwap[];
|
|
53
|
+
warning: string;
|
|
54
|
+
};
|
|
55
|
+
export interface Coin {
|
|
56
|
+
type: string;
|
|
57
|
+
decimals: number;
|
|
58
|
+
}
|
|
59
|
+
export interface TxSorSwap extends SorSwap {
|
|
60
|
+
pool: SorPool;
|
|
61
|
+
coinX: Coin;
|
|
62
|
+
coinY: Coin;
|
|
63
|
+
swapXtoY: boolean;
|
|
64
|
+
}
|
|
65
|
+
export interface Commission {
|
|
66
|
+
partner: string;
|
|
67
|
+
commissionBps: number;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=aggregator.d.ts.map
|
|
@@ -0,0 +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,WAAW,GACX,UAAU,GACV,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,SAAS,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvD,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,uBAAuB,EAAE,MAAM,CAAC;IAChC,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;IACpB,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,SAAU,SAAQ,OAAO;IACxC,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,IAAI,CAAC;IACZ,KAAK,EAAE,IAAI,CAAC;IACZ,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../../../src/types/sui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface SuiscanToken {
|
|
2
|
+
type: string;
|
|
3
|
+
objectId: string;
|
|
4
|
+
name: string;
|
|
5
|
+
supply: number | null;
|
|
6
|
+
supplyInUsd: number | null;
|
|
7
|
+
tokenPrice: number | null;
|
|
8
|
+
dominance: number | null;
|
|
9
|
+
circulatingSupply: number | null;
|
|
10
|
+
marketCap: number | null;
|
|
11
|
+
totalVolume: number | null;
|
|
12
|
+
maxSupply: number | null;
|
|
13
|
+
fdv: number | null;
|
|
14
|
+
holders: number | null;
|
|
15
|
+
denom: string;
|
|
16
|
+
packageId: string;
|
|
17
|
+
createTimestamp: number;
|
|
18
|
+
creator: string;
|
|
19
|
+
creatorName: string | null;
|
|
20
|
+
creatorImg: string | null;
|
|
21
|
+
creatorScamMessage: string | null;
|
|
22
|
+
scamMessage: string | null;
|
|
23
|
+
decimals: number;
|
|
24
|
+
symbol: string;
|
|
25
|
+
iconUrl: string | null;
|
|
26
|
+
description: string;
|
|
27
|
+
bridge: boolean;
|
|
28
|
+
verified: boolean;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../../src/types/token.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { Commission, QuoteResponse } from "./aggregator";
|
|
3
|
+
import BigNumber from "bignumber.js";
|
|
4
|
+
export interface BuildTxParams {
|
|
5
|
+
tx?: TransactionBlock;
|
|
6
|
+
quoteResponse: QuoteResponse;
|
|
7
|
+
accountAddress: string;
|
|
8
|
+
slippage: BigNumber.Value;
|
|
9
|
+
commission?: Commission;
|
|
10
|
+
}
|
|
11
|
+
export interface EstimateGasFeeParams extends BuildTxParams {
|
|
12
|
+
suiPrice?: number;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=tx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tx.d.ts","sourceRoot":"","sources":["../../../../src/types/tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,MAAM,WAAW,aAAa;IAC5B,EAAE,CAAC,EAAE,gBAAgB,CAAC;IACtB,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,SAAS,CAAC,KAAK,CAAC;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED,MAAM,WAAW,oBAAqB,SAAQ,aAAa;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../../../src/types/utilities.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACpC,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAClC,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC1D,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|