@7kprotocol/sdk-ts 3.6.1-beta.0 → 3.6.1-beta.2
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/README.md +13 -10
- package/dist/bluefin7k-I6ZCDWDN.js +2 -0
- package/dist/bluefin7k-I6ZCDWDN.js.map +1 -0
- package/dist/bluefin7k-TERLUCNL.mjs +2 -0
- package/dist/bluefin7k-TERLUCNL.mjs.map +1 -0
- package/dist/cetus-AU3OMWOY.mjs +2 -0
- package/dist/cetus-AU3OMWOY.mjs.map +1 -0
- package/dist/cetus-SIPX6FYL.js +2 -0
- package/dist/cetus-SIPX6FYL.js.map +1 -0
- package/dist/chunk-ETQEI4QC.mjs +2 -0
- package/dist/chunk-ETQEI4QC.mjs.map +1 -0
- package/dist/chunk-KVGSSW22.js +2 -0
- package/dist/chunk-KVGSSW22.js.map +1 -0
- package/dist/flowx-6M54WFWO.js +2 -0
- package/dist/flowx-6M54WFWO.js.map +1 -0
- package/dist/flowx-OXZZX5FD.mjs +2 -0
- package/dist/flowx-OXZZX5FD.mjs.map +1 -0
- package/dist/index.d.mts +536 -0
- package/dist/index.d.ts +536 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +12 -20
- package/lib/cjs/config/fetchClient.js +0 -12
- package/lib/cjs/constants/_7k.js +0 -20
- package/lib/cjs/constants/apiEndpoints.js +0 -9
- package/lib/cjs/constants/sui.js +0 -4
- package/lib/cjs/constants/tokens.js +0 -7
- package/lib/cjs/features/limitDca/cancelDcaOrder.js +0 -14
- package/lib/cjs/features/limitDca/cancelLimitOrder.js +0 -14
- package/lib/cjs/features/limitDca/claimExpiredLimitOrder.js +0 -14
- package/lib/cjs/features/limitDca/constants.js +0 -13
- package/lib/cjs/features/limitDca/getClosedDcaOrders.js +0 -23
- package/lib/cjs/features/limitDca/getClosedLimitOrders.js +0 -22
- package/lib/cjs/features/limitDca/getDcaOrderExecutions.js +0 -23
- package/lib/cjs/features/limitDca/getOpenDcaOrders.js +0 -22
- package/lib/cjs/features/limitDca/getOpenLimitOrders.js +0 -22
- package/lib/cjs/features/limitDca/index.js +0 -26
- package/lib/cjs/features/limitDca/placeDcaOrder.js +0 -33
- package/lib/cjs/features/limitDca/placeLimitOrder.js +0 -27
- package/lib/cjs/features/limitDca/types.js +0 -16
- package/lib/cjs/features/metaAg/common.js +0 -103
- package/lib/cjs/features/metaAg/error.js +0 -31
- package/lib/cjs/features/metaAg/index.js +0 -268
- package/lib/cjs/features/metaAg/providers/bluefin7k.js +0 -57
- package/lib/cjs/features/metaAg/providers/cetus.js +0 -59
- package/lib/cjs/features/metaAg/providers/flowx.js +0 -52
- package/lib/cjs/features/metaAg/providers/okx.js +0 -182
- package/lib/cjs/features/prices/index.js +0 -99
- package/lib/cjs/index.js +0 -55
- package/lib/cjs/libs/url.js +0 -17
- package/lib/cjs/types/config/fetchClient.d.ts +0 -2
- package/lib/cjs/types/config/fetchClient.d.ts.map +0 -1
- package/lib/cjs/types/constants/_7k.d.ts +0 -6
- package/lib/cjs/types/constants/_7k.d.ts.map +0 -1
- package/lib/cjs/types/constants/apiEndpoints.d.ts +0 -7
- package/lib/cjs/types/constants/apiEndpoints.d.ts.map +0 -1
- package/lib/cjs/types/constants/sui.d.ts +0 -2
- package/lib/cjs/types/constants/sui.d.ts.map +0 -1
- package/lib/cjs/types/constants/tokens.d.ts +0 -5
- package/lib/cjs/types/constants/tokens.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/cancelDcaOrder.d.ts +0 -9
- package/lib/cjs/types/features/limitDca/cancelDcaOrder.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/cancelLimitOrder.d.ts +0 -9
- package/lib/cjs/types/features/limitDca/cancelLimitOrder.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/claimExpiredLimitOrder.d.ts +0 -9
- package/lib/cjs/types/features/limitDca/claimExpiredLimitOrder.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/constants.d.ts +0 -10
- package/lib/cjs/types/features/limitDca/constants.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/getClosedDcaOrders.d.ts +0 -10
- package/lib/cjs/types/features/limitDca/getClosedDcaOrders.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/getClosedLimitOrders.d.ts +0 -10
- package/lib/cjs/types/features/limitDca/getClosedLimitOrders.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/getDcaOrderExecutions.d.ts +0 -10
- package/lib/cjs/types/features/limitDca/getDcaOrderExecutions.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/getOpenDcaOrders.d.ts +0 -10
- package/lib/cjs/types/features/limitDca/getOpenDcaOrders.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/getOpenLimitOrders.d.ts +0 -10
- package/lib/cjs/types/features/limitDca/getOpenLimitOrders.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/index.d.ts +0 -11
- package/lib/cjs/types/features/limitDca/index.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/placeDcaOrder.d.ts +0 -14
- package/lib/cjs/types/features/limitDca/placeDcaOrder.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/placeLimitOrder.d.ts +0 -13
- package/lib/cjs/types/features/limitDca/placeLimitOrder.d.ts.map +0 -1
- package/lib/cjs/types/features/limitDca/types.d.ts +0 -98
- package/lib/cjs/types/features/limitDca/types.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/common.d.ts +0 -24
- package/lib/cjs/types/features/metaAg/common.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/error.d.ts +0 -54
- package/lib/cjs/types/features/metaAg/error.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/index.d.ts +0 -42
- package/lib/cjs/types/features/metaAg/index.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/providers/bluefin7k.d.ts +0 -11
- package/lib/cjs/types/features/metaAg/providers/bluefin7k.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/providers/cetus.d.ts +0 -11
- package/lib/cjs/types/features/metaAg/providers/cetus.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/providers/flowx.d.ts +0 -13
- package/lib/cjs/types/features/metaAg/providers/flowx.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/providers/okx.d.ts +0 -21
- package/lib/cjs/types/features/metaAg/providers/okx.d.ts.map +0 -1
- package/lib/cjs/types/features/prices/index.d.ts +0 -18
- package/lib/cjs/types/features/prices/index.d.ts.map +0 -1
- package/lib/cjs/types/index.d.ts +0 -23
- package/lib/cjs/types/index.d.ts.map +0 -1
- package/lib/cjs/types/libs/url.d.ts +0 -2
- package/lib/cjs/types/libs/url.d.ts.map +0 -1
- package/lib/cjs/types/metaAg.js +0 -16
- package/lib/cjs/types/okx.js +0 -6
- package/lib/cjs/types/types/metaAg.d.ts +0 -165
- package/lib/cjs/types/types/metaAg.d.ts.map +0 -1
- package/lib/cjs/types/types/okx.d.ts +0 -206
- package/lib/cjs/types/types/okx.d.ts.map +0 -1
- package/lib/cjs/types/utils/ObjectCache.d.ts +0 -87
- package/lib/cjs/types/utils/ObjectCache.d.ts.map +0 -1
- package/lib/cjs/types/utils/SuiClientUtils.d.ts +0 -15
- package/lib/cjs/types/utils/SuiClientUtils.d.ts.map +0 -1
- package/lib/cjs/types/utils/sui.d.ts +0 -27
- package/lib/cjs/types/utils/sui.d.ts.map +0 -1
- package/lib/cjs/types/utils/swap.d.ts +0 -15
- package/lib/cjs/types/utils/swap.d.ts.map +0 -1
- package/lib/cjs/types/utils/token.d.ts +0 -4
- package/lib/cjs/types/utils/token.d.ts.map +0 -1
- package/lib/cjs/utils/ObjectCache.js +0 -273
- package/lib/cjs/utils/SuiClientUtils.js +0 -50
- package/lib/cjs/utils/sui.js +0 -92
- package/lib/cjs/utils/swap.js +0 -37
- package/lib/cjs/utils/token.js +0 -15
- package/lib/esm/config/fetchClient.js +0 -9
- package/lib/esm/constants/_7k.js +0 -17
- package/lib/esm/constants/apiEndpoints.js +0 -6
- package/lib/esm/constants/sui.js +0 -1
- package/lib/esm/constants/tokens.js +0 -4
- package/lib/esm/features/limitDca/cancelDcaOrder.js +0 -11
- package/lib/esm/features/limitDca/cancelLimitOrder.js +0 -11
- package/lib/esm/features/limitDca/claimExpiredLimitOrder.js +0 -11
- package/lib/esm/features/limitDca/constants.js +0 -10
- package/lib/esm/features/limitDca/getClosedDcaOrders.js +0 -20
- package/lib/esm/features/limitDca/getClosedLimitOrders.js +0 -19
- package/lib/esm/features/limitDca/getDcaOrderExecutions.js +0 -20
- package/lib/esm/features/limitDca/getOpenDcaOrders.js +0 -19
- package/lib/esm/features/limitDca/getOpenLimitOrders.js +0 -19
- package/lib/esm/features/limitDca/index.js +0 -10
- package/lib/esm/features/limitDca/placeDcaOrder.js +0 -30
- package/lib/esm/features/limitDca/placeLimitOrder.js +0 -24
- package/lib/esm/features/limitDca/types.js +0 -13
- package/lib/esm/features/metaAg/common.js +0 -96
- package/lib/esm/features/metaAg/error.js +0 -29
- package/lib/esm/features/metaAg/index.js +0 -234
- package/lib/esm/features/metaAg/providers/bluefin7k.js +0 -55
- package/lib/esm/features/metaAg/providers/cetus.js +0 -57
- package/lib/esm/features/metaAg/providers/flowx.js +0 -51
- package/lib/esm/features/metaAg/providers/okx.js +0 -147
- package/lib/esm/features/prices/index.js +0 -94
- package/lib/esm/index.mjs +0 -31
- package/lib/esm/libs/url.js +0 -14
- package/lib/esm/types/config/fetchClient.d.ts +0 -2
- package/lib/esm/types/config/fetchClient.d.ts.map +0 -1
- package/lib/esm/types/constants/_7k.d.ts +0 -6
- package/lib/esm/types/constants/_7k.d.ts.map +0 -1
- package/lib/esm/types/constants/apiEndpoints.d.ts +0 -7
- package/lib/esm/types/constants/apiEndpoints.d.ts.map +0 -1
- package/lib/esm/types/constants/sui.d.ts +0 -2
- package/lib/esm/types/constants/sui.d.ts.map +0 -1
- package/lib/esm/types/constants/tokens.d.ts +0 -5
- package/lib/esm/types/constants/tokens.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/cancelDcaOrder.d.ts +0 -9
- package/lib/esm/types/features/limitDca/cancelDcaOrder.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/cancelLimitOrder.d.ts +0 -9
- package/lib/esm/types/features/limitDca/cancelLimitOrder.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/claimExpiredLimitOrder.d.ts +0 -9
- package/lib/esm/types/features/limitDca/claimExpiredLimitOrder.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/constants.d.ts +0 -10
- package/lib/esm/types/features/limitDca/constants.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/getClosedDcaOrders.d.ts +0 -10
- package/lib/esm/types/features/limitDca/getClosedDcaOrders.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/getClosedLimitOrders.d.ts +0 -10
- package/lib/esm/types/features/limitDca/getClosedLimitOrders.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/getDcaOrderExecutions.d.ts +0 -10
- package/lib/esm/types/features/limitDca/getDcaOrderExecutions.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/getOpenDcaOrders.d.ts +0 -10
- package/lib/esm/types/features/limitDca/getOpenDcaOrders.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/getOpenLimitOrders.d.ts +0 -10
- package/lib/esm/types/features/limitDca/getOpenLimitOrders.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/index.d.ts +0 -11
- package/lib/esm/types/features/limitDca/index.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/placeDcaOrder.d.ts +0 -14
- package/lib/esm/types/features/limitDca/placeDcaOrder.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/placeLimitOrder.d.ts +0 -13
- package/lib/esm/types/features/limitDca/placeLimitOrder.d.ts.map +0 -1
- package/lib/esm/types/features/limitDca/types.d.ts +0 -98
- package/lib/esm/types/features/limitDca/types.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/common.d.ts +0 -24
- package/lib/esm/types/features/metaAg/common.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/error.d.ts +0 -54
- package/lib/esm/types/features/metaAg/error.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/index.d.ts +0 -42
- package/lib/esm/types/features/metaAg/index.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/providers/bluefin7k.d.ts +0 -11
- package/lib/esm/types/features/metaAg/providers/bluefin7k.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/providers/cetus.d.ts +0 -11
- package/lib/esm/types/features/metaAg/providers/cetus.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/providers/flowx.d.ts +0 -13
- package/lib/esm/types/features/metaAg/providers/flowx.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/providers/okx.d.ts +0 -21
- package/lib/esm/types/features/metaAg/providers/okx.d.ts.map +0 -1
- package/lib/esm/types/features/prices/index.d.ts +0 -18
- package/lib/esm/types/features/prices/index.d.ts.map +0 -1
- package/lib/esm/types/index.d.ts +0 -23
- package/lib/esm/types/index.d.ts.map +0 -1
- package/lib/esm/types/libs/url.d.ts +0 -2
- package/lib/esm/types/libs/url.d.ts.map +0 -1
- package/lib/esm/types/metaAg.js +0 -11
- package/lib/esm/types/okx.js +0 -5
- package/lib/esm/types/types/metaAg.d.ts +0 -165
- package/lib/esm/types/types/metaAg.d.ts.map +0 -1
- package/lib/esm/types/types/okx.d.ts +0 -206
- package/lib/esm/types/types/okx.d.ts.map +0 -1
- package/lib/esm/types/utils/ObjectCache.d.ts +0 -87
- package/lib/esm/types/utils/ObjectCache.d.ts.map +0 -1
- package/lib/esm/types/utils/SuiClientUtils.d.ts +0 -15
- package/lib/esm/types/utils/SuiClientUtils.d.ts.map +0 -1
- package/lib/esm/types/utils/sui.d.ts +0 -27
- package/lib/esm/types/utils/sui.d.ts.map +0 -1
- package/lib/esm/types/utils/swap.d.ts +0 -15
- package/lib/esm/types/utils/swap.d.ts.map +0 -1
- package/lib/esm/types/utils/token.d.ts +0 -4
- package/lib/esm/types/utils/token.d.ts.map +0 -1
- package/lib/esm/utils/ObjectCache.js +0 -250
- package/lib/esm/utils/SuiClientUtils.js +0 -34
- package/lib/esm/utils/sui.js +0 -88
- package/lib/esm/utils/swap.js +0 -33
- package/lib/esm/utils/token.js +0 -10
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
import { SourceDex, QuoteResponse } from '@bluefin-exchange/bluefin7k-aggregator-sdk';
|
|
2
|
+
import { PreSwapLpChangeParams, RouterDataV3 } from '@cetusprotocol/aggregator-sdk';
|
|
3
|
+
import { Protocol, AggregatorQuoter } from '@flowx-finance/sdk';
|
|
4
|
+
import { GasCostSummary, SuiClient, GetTransactionBlockParams, SuiTransactionBlockResponse } from '@mysten/sui/client';
|
|
5
|
+
import { SignatureWithBytes } from '@mysten/sui/cryptography';
|
|
6
|
+
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Swap mode options
|
|
10
|
+
*/
|
|
11
|
+
type SwapMode = "exactIn" | "exactOut";
|
|
12
|
+
/**
|
|
13
|
+
* Token information
|
|
14
|
+
*/
|
|
15
|
+
interface OkxTokenInfo {
|
|
16
|
+
/** Token contract address */
|
|
17
|
+
tokenContractAddress: string;
|
|
18
|
+
/** Token symbol (e.g., "USDC") */
|
|
19
|
+
tokenSymbol: string;
|
|
20
|
+
/** Token unit price in USD (may be null for special cases) */
|
|
21
|
+
tokenUnitPrice: string | null;
|
|
22
|
+
/** Decimal number defining smallest unit */
|
|
23
|
+
decimal: string;
|
|
24
|
+
/** Whether the token is a honeypot token */
|
|
25
|
+
isHoneyPot: boolean;
|
|
26
|
+
/** Token tax rate (0-1, where 0.01 = 1%) */
|
|
27
|
+
taxRate: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* DEX Protocol information
|
|
31
|
+
*/
|
|
32
|
+
interface OkxDexProtocol {
|
|
33
|
+
/** Name of the liquidity protocol (e.g., "Uniswap V3") */
|
|
34
|
+
dexName: string;
|
|
35
|
+
/** Percentage of assets handled by the protocol */
|
|
36
|
+
percent: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Sub-router information
|
|
40
|
+
*/
|
|
41
|
+
interface OkxSubRouter {
|
|
42
|
+
/** Liquidity protocol used on the path */
|
|
43
|
+
dexProtocol: OkxDexProtocol;
|
|
44
|
+
/** Index of the from token */
|
|
45
|
+
fromTokenIndex: string;
|
|
46
|
+
/** Index of the to token */
|
|
47
|
+
toTokenIndex: string;
|
|
48
|
+
/** Information of token to be sold */
|
|
49
|
+
fromToken: OkxTokenInfo;
|
|
50
|
+
/** Information of token to be bought */
|
|
51
|
+
toToken: OkxTokenInfo;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Quote comparison information
|
|
55
|
+
*/
|
|
56
|
+
interface OkxQuoteCompare {
|
|
57
|
+
/** DEX name of the quote route */
|
|
58
|
+
dexName: string;
|
|
59
|
+
/** DEX logo of the quote route */
|
|
60
|
+
dexLogo: string;
|
|
61
|
+
/** Estimated network fee (USD) of the quote route */
|
|
62
|
+
tradeFee: string;
|
|
63
|
+
/** Received amount of the quote route */
|
|
64
|
+
amountOut: string;
|
|
65
|
+
/** Price impact percentage */
|
|
66
|
+
priceImpactPercentage: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Transaction data model
|
|
70
|
+
*/
|
|
71
|
+
interface OkxTransactionData {
|
|
72
|
+
/** Additional signing data (if required). When tips is specified, represents calldata of jito tips transfer */
|
|
73
|
+
signatureData?: string[];
|
|
74
|
+
/** User's wallet address */
|
|
75
|
+
from: string;
|
|
76
|
+
/** Estimated amount of the gas limit (increase by 50% for accurate data) */
|
|
77
|
+
gas: string;
|
|
78
|
+
/** Gas price in wei */
|
|
79
|
+
gasPrice?: string;
|
|
80
|
+
/** EIP-1559: Recommended priority cost of gas per unit */
|
|
81
|
+
maxPriorityFeePerGas?: string;
|
|
82
|
+
/** The contract address of OKX DEX router */
|
|
83
|
+
to: string;
|
|
84
|
+
/** The amount of native tokens (in wei) to be sent to the contract */
|
|
85
|
+
value: string;
|
|
86
|
+
/** The maximum amount of a token to spend when price reaches upper limit of slippage (applies to exactOut mode) */
|
|
87
|
+
maxSpendAmount?: string;
|
|
88
|
+
/** The minimum amount of a token to buy when price reaches upper limit of slippage */
|
|
89
|
+
minReceiveAmount: string;
|
|
90
|
+
/** Call data */
|
|
91
|
+
data: string;
|
|
92
|
+
/** Current transaction slippage value */
|
|
93
|
+
slippagePercent: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Router result data
|
|
97
|
+
*/
|
|
98
|
+
interface OkxRouterResult {
|
|
99
|
+
/** Unique identifier for the chain */
|
|
100
|
+
chainIndex: string;
|
|
101
|
+
/** Context slot (for Solana) */
|
|
102
|
+
contextSlot?: number;
|
|
103
|
+
/** Quote path data set - array of sub-routers */
|
|
104
|
+
dexRouterList: OkxSubRouter[];
|
|
105
|
+
/** Estimated gas consumption in smallest units (e.g., wei) */
|
|
106
|
+
estimateGasFee: string;
|
|
107
|
+
/** Information of token to be sold */
|
|
108
|
+
fromToken: OkxTokenInfo;
|
|
109
|
+
/** The input amount of a token to be sold */
|
|
110
|
+
fromTokenAmount: string;
|
|
111
|
+
/** Price impact percentage = (Received value – Paid value) / Paid value. Can be positive if received value exceeds paid value */
|
|
112
|
+
priceImpactPercent: string;
|
|
113
|
+
/** Router identifier */
|
|
114
|
+
router: string;
|
|
115
|
+
/** Swap mode: "exactIn" or "exactOut" */
|
|
116
|
+
swapMode: SwapMode;
|
|
117
|
+
/** Information of token to be bought */
|
|
118
|
+
toToken: OkxTokenInfo;
|
|
119
|
+
/** The resulting amount of a token to be bought */
|
|
120
|
+
toTokenAmount: string;
|
|
121
|
+
/** Estimated network fee (USD) of the quote route */
|
|
122
|
+
tradeFee: string;
|
|
123
|
+
/** Comparison of quote routes */
|
|
124
|
+
quoteCompareList?: OkxQuoteCompare[];
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Swap API Response Data
|
|
128
|
+
*/
|
|
129
|
+
interface OkxSwapResponseData {
|
|
130
|
+
/** Quote path data */
|
|
131
|
+
routerResult: OkxRouterResult;
|
|
132
|
+
/** Contract data model */
|
|
133
|
+
tx: OkxTransactionData;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
declare enum EProvider {
|
|
137
|
+
BLUEFIN7K = "bluefin7k",
|
|
138
|
+
CETUS = "cetus",
|
|
139
|
+
FLOWX = "flowx",
|
|
140
|
+
OKX = "okx"
|
|
141
|
+
}
|
|
142
|
+
type ProviderBaseOptions = {
|
|
143
|
+
api?: string;
|
|
144
|
+
apiKey?: string;
|
|
145
|
+
disabled?: boolean;
|
|
146
|
+
};
|
|
147
|
+
type Bluefin7kProviderOptions = ProviderBaseOptions & {
|
|
148
|
+
sources?: SourceDex[];
|
|
149
|
+
excludedPools?: string[];
|
|
150
|
+
targetPools?: string[];
|
|
151
|
+
};
|
|
152
|
+
type FlowxProviderOptions = ProviderBaseOptions & {
|
|
153
|
+
sources?: Protocol[];
|
|
154
|
+
excludePools?: string[];
|
|
155
|
+
excludeSources?: Protocol[];
|
|
156
|
+
maxHops?: number;
|
|
157
|
+
splitDistributionPercent?: number;
|
|
158
|
+
};
|
|
159
|
+
type CetusProviderOptions = ProviderBaseOptions & {
|
|
160
|
+
sources?: string[];
|
|
161
|
+
splitCount?: number;
|
|
162
|
+
splitAlgorithm?: string;
|
|
163
|
+
splitFactor?: number;
|
|
164
|
+
depth?: number;
|
|
165
|
+
liquidityChanges?: PreSwapLpChangeParams[];
|
|
166
|
+
};
|
|
167
|
+
type OkxProviderOptions = Required<Omit<ProviderBaseOptions, "api">> & {
|
|
168
|
+
api?: string;
|
|
169
|
+
secretKey: string;
|
|
170
|
+
apiPassphrase: string;
|
|
171
|
+
projectId: string;
|
|
172
|
+
};
|
|
173
|
+
interface MetaAgOptions {
|
|
174
|
+
/**If not specified, all providers will be used */
|
|
175
|
+
providers?: {
|
|
176
|
+
[EProvider.BLUEFIN7K]?: Bluefin7kProviderOptions;
|
|
177
|
+
[EProvider.FLOWX]?: FlowxProviderOptions;
|
|
178
|
+
[EProvider.CETUS]?: CetusProviderOptions;
|
|
179
|
+
[EProvider.OKX]?: OkxProviderOptions;
|
|
180
|
+
};
|
|
181
|
+
/**Mainnet Json Rpc url, if not specified, the default mainnet url will be used */
|
|
182
|
+
fullnodeUrl?: string;
|
|
183
|
+
/**Hermes Api url, if not specified, the default hermes api url will be used */
|
|
184
|
+
hermesApi?: string;
|
|
185
|
+
/**Address to receive commission, if not specified, the commission will not be used */
|
|
186
|
+
partner?: string;
|
|
187
|
+
/**@default 0 */
|
|
188
|
+
partnerCommissionBps?: number;
|
|
189
|
+
/**@default 100 */
|
|
190
|
+
slippageBps?: number;
|
|
191
|
+
/**
|
|
192
|
+
* Tip to support 7k
|
|
193
|
+
* @default 0 */
|
|
194
|
+
tipBps?: number;
|
|
195
|
+
}
|
|
196
|
+
interface MetaQuoteOptions {
|
|
197
|
+
coinTypeIn: string;
|
|
198
|
+
coinTypeOut: string;
|
|
199
|
+
amountIn: string;
|
|
200
|
+
/** Required for api-tx providers (ie: Okx) */
|
|
201
|
+
signer?: string;
|
|
202
|
+
/**
|
|
203
|
+
* Timeout for quote operation in milliseconds
|
|
204
|
+
* @default 2000ms
|
|
205
|
+
*/
|
|
206
|
+
timeout?: number;
|
|
207
|
+
}
|
|
208
|
+
interface MetaSimulationOptions {
|
|
209
|
+
sender: string;
|
|
210
|
+
/**
|
|
211
|
+
* Timeout for simulation operation in milliseconds
|
|
212
|
+
* @default 2000ms
|
|
213
|
+
*/
|
|
214
|
+
timeout?: number;
|
|
215
|
+
/** If specify, defer the simulation that could reduce the time to display quote result, you must update the quote via the id on callback
|
|
216
|
+
* else await all quote and simulation before return
|
|
217
|
+
*/
|
|
218
|
+
onSimulated?: (payload: MetaQuote) => void;
|
|
219
|
+
}
|
|
220
|
+
interface MetaFastSwapOptions {
|
|
221
|
+
/** Quote object from the quote operation */
|
|
222
|
+
quote: MetaQuote;
|
|
223
|
+
/** Signer address (owner of `coinIn`) */
|
|
224
|
+
signer: string;
|
|
225
|
+
/** If true, use the gas coin for the swap
|
|
226
|
+
* @default true */
|
|
227
|
+
useGasCoin?: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Sign the transaction bytes
|
|
230
|
+
* @param txBytes - base64 transaction bytes
|
|
231
|
+
* @returns - signature with bytes
|
|
232
|
+
*/
|
|
233
|
+
signTransaction: (txBytes: string) => Promise<SignatureWithBytes>;
|
|
234
|
+
}
|
|
235
|
+
interface MetaSwapOptions {
|
|
236
|
+
/** Quote object from the quote operation */
|
|
237
|
+
quote: MetaQuote;
|
|
238
|
+
/** Signer address (owner of `coinIn`) */
|
|
239
|
+
signer: string;
|
|
240
|
+
/** Transaction object to add the swap operation */
|
|
241
|
+
tx: Transaction;
|
|
242
|
+
/**
|
|
243
|
+
* Coin object used for the swap, must be consumed completely, no `coinIn` left, user must pass the coinIn object with the balance required for the swap - ie in quote `amountIn`
|
|
244
|
+
* @warning `coinIn` value must match the quote `amountIn` */
|
|
245
|
+
coinIn: TransactionObjectArgument;
|
|
246
|
+
}
|
|
247
|
+
type FlowxQuoteResponse = Awaited<ReturnType<AggregatorQuoter["getRoutes"]>>;
|
|
248
|
+
type MetaQuote = ({
|
|
249
|
+
provider: EProvider.BLUEFIN7K;
|
|
250
|
+
quote: QuoteResponse;
|
|
251
|
+
} | {
|
|
252
|
+
provider: EProvider.CETUS;
|
|
253
|
+
quote: RouterDataV3;
|
|
254
|
+
} | {
|
|
255
|
+
provider: EProvider.FLOWX;
|
|
256
|
+
quote: FlowxQuoteResponse;
|
|
257
|
+
} | {
|
|
258
|
+
provider: EProvider.OKX;
|
|
259
|
+
quote: OkxSwapResponseData;
|
|
260
|
+
}) & {
|
|
261
|
+
/** uuid to keep track the quote result, used to apply simulation result on quote on callback `onSimulated`*/
|
|
262
|
+
id: string;
|
|
263
|
+
/** coin type: ie 0x2::sui::SUI */
|
|
264
|
+
coinTypeIn: string;
|
|
265
|
+
/** coin type: ie 0x2::sui::SUI */
|
|
266
|
+
coinTypeOut: string;
|
|
267
|
+
/** Amount in as u64 */
|
|
268
|
+
amountIn: string;
|
|
269
|
+
/** Amount out as u64 if there're no commission be applied to the amount out */
|
|
270
|
+
rawAmountOut: string;
|
|
271
|
+
/** Amount as u64 after minus any commission kind */
|
|
272
|
+
amountOut: string;
|
|
273
|
+
/** Simulated amount out if the transaction is executed */
|
|
274
|
+
simulatedAmountOut?: string;
|
|
275
|
+
/** Estimate gas consumption if the transaction is executed */
|
|
276
|
+
gasUsed?: GasCostSummary;
|
|
277
|
+
};
|
|
278
|
+
interface QuoteProvider {
|
|
279
|
+
readonly kind: EProvider;
|
|
280
|
+
quote(_quoteOptions: MetaQuoteOptions): Promise<MetaQuote | null>;
|
|
281
|
+
}
|
|
282
|
+
interface SwapAPIProvider extends QuoteProvider {
|
|
283
|
+
readonly kind: EProvider.OKX;
|
|
284
|
+
fastSwap(options: MetaFastSwapOptions): Promise<string>;
|
|
285
|
+
}
|
|
286
|
+
interface AggregatorProvider extends QuoteProvider {
|
|
287
|
+
readonly kind: EProvider.BLUEFIN7K | EProvider.CETUS | EProvider.FLOWX;
|
|
288
|
+
swap(options: MetaSwapOptions): Promise<TransactionObjectArgument>;
|
|
289
|
+
}
|
|
290
|
+
declare const isAggregatorProvider: (provider: QuoteProvider) => provider is AggregatorProvider;
|
|
291
|
+
declare const isSwapAPIProvider: (provider: QuoteProvider) => provider is SwapAPIProvider;
|
|
292
|
+
|
|
293
|
+
declare class MetaAg {
|
|
294
|
+
client: SuiClient;
|
|
295
|
+
private providers;
|
|
296
|
+
private inspector;
|
|
297
|
+
private options;
|
|
298
|
+
constructor(options?: MetaAgOptions);
|
|
299
|
+
private _getProvider;
|
|
300
|
+
private _simulate;
|
|
301
|
+
private _quote;
|
|
302
|
+
private _fastSwap;
|
|
303
|
+
/**
|
|
304
|
+
* Get quotes from all providers
|
|
305
|
+
* @param options - quote options
|
|
306
|
+
* @param simulation - if present, the quote will be simulated
|
|
307
|
+
* @returns quotes from all providers
|
|
308
|
+
*/
|
|
309
|
+
quote(options: MetaQuoteOptions, simulation?: MetaSimulationOptions): Promise<MetaQuote[]>;
|
|
310
|
+
/**
|
|
311
|
+
* Build transaction from quote
|
|
312
|
+
* @info Use this function to build composable transaction (ie: add more commands after the swap, consume the coin out object)
|
|
313
|
+
* @warning Providers that build transaction on the fly (typically RFQ, Swap-API providers ie: Okx, ...) are not supported, please use `fastSwap` instead
|
|
314
|
+
* @param options - build tx options
|
|
315
|
+
* @param slippageBps - slippage bps if not specified, fallback to global slippage bps, if none of them specified, default to 100
|
|
316
|
+
* @returns coin out object, you must consume it by transferObjects, or other sub sequence commands
|
|
317
|
+
*/
|
|
318
|
+
swap(options: MetaSwapOptions, slippageBps?: number): Promise<TransactionObjectArgument>;
|
|
319
|
+
/**
|
|
320
|
+
* Build, Sign, and Execute transaction in one step
|
|
321
|
+
* @param options - fast swap options
|
|
322
|
+
* @returns - txDigest of the transaction
|
|
323
|
+
*/
|
|
324
|
+
fastSwap(options: MetaFastSwapOptions, getTransactionBlockParams?: Omit<GetTransactionBlockParams, "digest">): Promise<SuiTransactionBlockResponse>;
|
|
325
|
+
/**
|
|
326
|
+
* Update meta aggregator options
|
|
327
|
+
* @param options - update options payload
|
|
328
|
+
*/
|
|
329
|
+
updateMetaAgOptions(options: MetaAgOptions): void;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Get price for a single token
|
|
334
|
+
* @param id - Token ID (coin type)
|
|
335
|
+
* @returns Token price, or 0 if not found or on error
|
|
336
|
+
*/
|
|
337
|
+
declare function getTokenPrice(id: string): Promise<number>;
|
|
338
|
+
/**
|
|
339
|
+
* Get prices for multiple tokens
|
|
340
|
+
* @param ids - Array of token IDs (coin types)
|
|
341
|
+
* @returns Record mapping token IDs to their prices
|
|
342
|
+
*/
|
|
343
|
+
declare function getTokenPrices(ids: string[]): Promise<Record<string, number>>;
|
|
344
|
+
/**
|
|
345
|
+
* Get the current SUI token price
|
|
346
|
+
* @returns SUI price, or 0 if not found or on error
|
|
347
|
+
*/
|
|
348
|
+
declare function getSuiPrice(): Promise<number>;
|
|
349
|
+
|
|
350
|
+
interface PlaceLimitOrderParams {
|
|
351
|
+
accountAddress: string;
|
|
352
|
+
payCoinType: string;
|
|
353
|
+
targetCoinType: string;
|
|
354
|
+
payCoinAmount: bigint;
|
|
355
|
+
rate: bigint;
|
|
356
|
+
slippage: bigint;
|
|
357
|
+
expireTs: bigint;
|
|
358
|
+
devInspect?: boolean;
|
|
359
|
+
}
|
|
360
|
+
declare function placeLimitOrder({ accountAddress, payCoinType, targetCoinType, payCoinAmount, rate, slippage, expireTs, devInspect, }: PlaceLimitOrderParams): Promise<Transaction>;
|
|
361
|
+
|
|
362
|
+
interface CancelLimitOrderParams {
|
|
363
|
+
orderId: string;
|
|
364
|
+
payCoinType: string;
|
|
365
|
+
targetCoinType: string;
|
|
366
|
+
}
|
|
367
|
+
declare function cancelLimitOrder({ orderId, payCoinType, targetCoinType, }: CancelLimitOrderParams): Promise<Transaction>;
|
|
368
|
+
|
|
369
|
+
interface ClaimExpiredLimitOrderParams {
|
|
370
|
+
orderId: string;
|
|
371
|
+
payCoinType: string;
|
|
372
|
+
targetCoinType: string;
|
|
373
|
+
}
|
|
374
|
+
declare function claimExpiredLimitOrder({ orderId, payCoinType, targetCoinType, }: ClaimExpiredLimitOrderParams): Promise<Transaction>;
|
|
375
|
+
|
|
376
|
+
declare enum LoDcaOrderStatus {
|
|
377
|
+
PENDING = "PENDING",
|
|
378
|
+
ACTIVE = "ACTIVE",
|
|
379
|
+
EXPIRED = "EXPIRED",
|
|
380
|
+
CANCELED = "CANCELED"
|
|
381
|
+
}
|
|
382
|
+
interface LimitOrder {
|
|
383
|
+
id: number;
|
|
384
|
+
createdAt: string;
|
|
385
|
+
updatedAt: string;
|
|
386
|
+
softDeleteAt: string;
|
|
387
|
+
orderId: string;
|
|
388
|
+
owner: string;
|
|
389
|
+
payCoinName: string;
|
|
390
|
+
targetCoinName: string;
|
|
391
|
+
totalPayAmount: string;
|
|
392
|
+
paidAmount: string;
|
|
393
|
+
obtainedAmount: string;
|
|
394
|
+
claimedAmount: string;
|
|
395
|
+
targetBalance: string;
|
|
396
|
+
createdTs: number;
|
|
397
|
+
expireTs: number;
|
|
398
|
+
canceledTs: number;
|
|
399
|
+
lastExecutedTs: number;
|
|
400
|
+
status: LoDcaOrderStatus;
|
|
401
|
+
payBalance: string;
|
|
402
|
+
rate: string;
|
|
403
|
+
slippageBps: string;
|
|
404
|
+
filled: number;
|
|
405
|
+
volume: number;
|
|
406
|
+
digest: string | null;
|
|
407
|
+
}
|
|
408
|
+
interface DcaOrder {
|
|
409
|
+
id: number;
|
|
410
|
+
createdAt: string;
|
|
411
|
+
updatedAt: string;
|
|
412
|
+
softDeletedAt: string;
|
|
413
|
+
orderId: string;
|
|
414
|
+
owner: string;
|
|
415
|
+
payCoinName: string;
|
|
416
|
+
targetCoinName: string;
|
|
417
|
+
totalPayAmount: string;
|
|
418
|
+
paidAmount: string;
|
|
419
|
+
obtainedAmount: string;
|
|
420
|
+
claimedAmount: string;
|
|
421
|
+
targetBalance: string;
|
|
422
|
+
createdTs: number;
|
|
423
|
+
expireTs: number;
|
|
424
|
+
canceledTs: number;
|
|
425
|
+
status: LoDcaOrderStatus;
|
|
426
|
+
slippage: number;
|
|
427
|
+
minRate: string;
|
|
428
|
+
maxRate: string;
|
|
429
|
+
amountPerOrder: string;
|
|
430
|
+
interval: number;
|
|
431
|
+
filled: number;
|
|
432
|
+
volume: number;
|
|
433
|
+
digest: string | null;
|
|
434
|
+
numOrders: number;
|
|
435
|
+
}
|
|
436
|
+
declare enum LoDcaOrderExecutionStatus {
|
|
437
|
+
PENDING = "PENDING",
|
|
438
|
+
SUCCESS = "SUCCESS",
|
|
439
|
+
FAILED = "FAILED"
|
|
440
|
+
}
|
|
441
|
+
interface LoDcaOrderExecution {
|
|
442
|
+
id: number;
|
|
443
|
+
createdAt: string;
|
|
444
|
+
updatedAt: string;
|
|
445
|
+
softDeletedAt: null;
|
|
446
|
+
orderId: string;
|
|
447
|
+
digest: string;
|
|
448
|
+
payCoinName: string;
|
|
449
|
+
targetCoinName: string;
|
|
450
|
+
payAmount: string;
|
|
451
|
+
repayAmount: string;
|
|
452
|
+
obtainedAmount: string;
|
|
453
|
+
executedTs: number;
|
|
454
|
+
slippage: number;
|
|
455
|
+
status: LoDcaOrderExecutionStatus;
|
|
456
|
+
orderType: string;
|
|
457
|
+
volume: number | null;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
interface Params$4 {
|
|
461
|
+
owner: string;
|
|
462
|
+
offset: number;
|
|
463
|
+
limit: number;
|
|
464
|
+
tokenPair?: string;
|
|
465
|
+
}
|
|
466
|
+
declare function getOpenLimitOrders({ owner, offset, limit, tokenPair, }: Params$4): Promise<LimitOrder[]>;
|
|
467
|
+
|
|
468
|
+
interface Params$3 {
|
|
469
|
+
owner: string;
|
|
470
|
+
offset: number;
|
|
471
|
+
limit: number;
|
|
472
|
+
tokenPair?: string;
|
|
473
|
+
}
|
|
474
|
+
declare function getClosedLimitOrders({ owner, offset, limit, tokenPair, }: Params$3): Promise<LimitOrder[]>;
|
|
475
|
+
|
|
476
|
+
interface PlaceDcaOrderParams {
|
|
477
|
+
payCoinType: string;
|
|
478
|
+
targetCoinType: string;
|
|
479
|
+
payCoinAmountEach: bigint;
|
|
480
|
+
numOrders: number;
|
|
481
|
+
interval: number;
|
|
482
|
+
slippage: bigint;
|
|
483
|
+
minRate: bigint;
|
|
484
|
+
maxRate: bigint;
|
|
485
|
+
}
|
|
486
|
+
declare function placeDcaOrder({ payCoinType, targetCoinType, payCoinAmountEach, numOrders, interval, slippage, minRate, maxRate, }: PlaceDcaOrderParams): Promise<Transaction>;
|
|
487
|
+
|
|
488
|
+
interface CancelDcaOrderParams {
|
|
489
|
+
orderId: string;
|
|
490
|
+
payCoinType: string;
|
|
491
|
+
targetCoinType: string;
|
|
492
|
+
}
|
|
493
|
+
declare function cancelDcaOrder({ orderId, payCoinType, targetCoinType, }: CancelDcaOrderParams): Promise<Transaction>;
|
|
494
|
+
|
|
495
|
+
interface Params$2 {
|
|
496
|
+
owner: string;
|
|
497
|
+
offset: number;
|
|
498
|
+
limit: number;
|
|
499
|
+
tokenPair?: string;
|
|
500
|
+
}
|
|
501
|
+
declare function getOpenDcaOrders({ owner, offset, limit, tokenPair, }: Params$2): Promise<DcaOrder[]>;
|
|
502
|
+
|
|
503
|
+
interface Params$1 {
|
|
504
|
+
owner: string;
|
|
505
|
+
offset: number;
|
|
506
|
+
limit: number;
|
|
507
|
+
tokenPair?: string;
|
|
508
|
+
}
|
|
509
|
+
declare function getClosedDcaOrders({ owner, offset, limit, tokenPair, }: Params$1): Promise<LoDcaOrderExecution[]>;
|
|
510
|
+
|
|
511
|
+
interface Params {
|
|
512
|
+
owner: string;
|
|
513
|
+
orderId: string;
|
|
514
|
+
offset: number;
|
|
515
|
+
limit: number;
|
|
516
|
+
}
|
|
517
|
+
declare function getDcaOrderExecutions({ owner, orderId, offset, limit, }: Params): Promise<LoDcaOrderExecution[]>;
|
|
518
|
+
|
|
519
|
+
declare const _default: {
|
|
520
|
+
getTokenPrice: typeof getTokenPrice;
|
|
521
|
+
getTokenPrices: typeof getTokenPrices;
|
|
522
|
+
getSuiPrice: typeof getSuiPrice;
|
|
523
|
+
placeLimitOrder: typeof placeLimitOrder;
|
|
524
|
+
getOpenLimitOrders: typeof getOpenLimitOrders;
|
|
525
|
+
cancelLimitOrder: typeof cancelLimitOrder;
|
|
526
|
+
claimExpiredLimitOrder: typeof claimExpiredLimitOrder;
|
|
527
|
+
getClosedLimitOrders: typeof getClosedLimitOrders;
|
|
528
|
+
placeDcaOrder: typeof placeDcaOrder;
|
|
529
|
+
getOpenDcaOrders: typeof getOpenDcaOrders;
|
|
530
|
+
cancelDcaOrder: typeof cancelDcaOrder;
|
|
531
|
+
getClosedDcaOrders: typeof getClosedDcaOrders;
|
|
532
|
+
getDcaOrderExecutions: typeof getDcaOrderExecutions;
|
|
533
|
+
MetaAg: typeof MetaAg;
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
export { type AggregatorProvider, type Bluefin7kProviderOptions, type CetusProviderOptions, EProvider, type FlowxProviderOptions, type FlowxQuoteResponse, MetaAg, type MetaAgOptions, type MetaFastSwapOptions, type MetaQuote, type MetaQuoteOptions, type MetaSimulationOptions, type MetaSwapOptions, type OkxProviderOptions, type QuoteProvider, type SwapAPIProvider, cancelDcaOrder, cancelLimitOrder, claimExpiredLimitOrder, _default as default, getClosedDcaOrders, getClosedLimitOrders, getDcaOrderExecutions, getOpenDcaOrders, getOpenLimitOrders, getSuiPrice, getTokenPrice, getTokenPrices, isAggregatorProvider, isSwapAPIProvider, placeDcaOrder, placeLimitOrder };
|