@7kprotocol/sdk-ts 3.5.2-beta.0 → 3.5.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/lib/cjs/config/index.js +0 -9
- package/lib/cjs/constants/apiEndpoints.js +1 -1
- package/lib/cjs/features/metaAg/index.js +93 -88
- package/lib/cjs/features/metaAg/providers/bluefin.js +6 -6
- package/lib/cjs/features/metaAg/providers/cetus.js +4 -4
- package/lib/cjs/features/metaAg/providers/flowx.js +4 -4
- package/lib/cjs/features/swap/buildTx.js +0 -3
- package/lib/cjs/features/swap/buildTxV2.js +6 -10
- package/lib/cjs/features/swap/config.js +1 -2
- package/lib/cjs/features/swap/getQuote.js +2 -3
- package/lib/cjs/libs/protocols/bluefinx/client.js +1 -1
- package/lib/cjs/types/config/index.d.ts +0 -4
- package/lib/cjs/types/config/index.d.ts.map +1 -1
- package/lib/cjs/types/features/metaAg/index.d.ts +2 -11
- package/lib/cjs/types/features/metaAg/index.d.ts.map +1 -1
- package/lib/cjs/types/features/metaAg/providers/bluefin.d.ts +3 -3
- package/lib/cjs/types/features/metaAg/providers/bluefin.d.ts.map +1 -1
- package/lib/cjs/types/features/metaAg/providers/cetus.d.ts +5 -4
- package/lib/cjs/types/features/metaAg/providers/cetus.d.ts.map +1 -1
- package/lib/cjs/types/features/metaAg/providers/flowx.d.ts +3 -3
- package/lib/cjs/types/features/metaAg/providers/flowx.d.ts.map +1 -1
- package/lib/cjs/types/features/swap/buildTx.d.ts.map +1 -1
- package/lib/cjs/types/features/swap/buildTxV2.d.ts +3 -3
- package/lib/cjs/types/features/swap/buildTxV2.d.ts.map +1 -1
- package/lib/cjs/types/features/swap/config.d.ts.map +1 -1
- package/lib/cjs/types/features/swap/getQuote.d.ts +3 -1
- package/lib/cjs/types/features/swap/getQuote.d.ts.map +1 -1
- package/lib/cjs/types/index.d.ts +1 -3
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/lib/cjs/types/metaAg.js +4 -11
- package/lib/cjs/types/types/metaAg.d.ts +8 -60
- package/lib/cjs/types/types/metaAg.d.ts.map +1 -1
- package/lib/cjs/types/utils/condition.d.ts +1 -1
- package/lib/cjs/types/utils/condition.d.ts.map +1 -1
- package/lib/esm/config/index.js +0 -9
- package/lib/esm/constants/apiEndpoints.js +1 -1
- package/lib/esm/features/metaAg/index.js +94 -89
- package/lib/esm/features/metaAg/providers/bluefin.js +6 -6
- package/lib/esm/features/metaAg/providers/cetus.js +4 -4
- package/lib/esm/features/metaAg/providers/flowx.js +4 -4
- package/lib/esm/features/swap/buildTx.js +0 -3
- package/lib/esm/features/swap/buildTxV2.js +2 -6
- package/lib/esm/features/swap/config.js +1 -2
- package/lib/esm/features/swap/getQuote.js +2 -3
- package/lib/esm/libs/protocols/bluefinx/client.js +1 -1
- package/lib/esm/types/config/index.d.ts +0 -4
- package/lib/esm/types/config/index.d.ts.map +1 -1
- package/lib/esm/types/features/metaAg/index.d.ts +2 -11
- package/lib/esm/types/features/metaAg/index.d.ts.map +1 -1
- package/lib/esm/types/features/metaAg/providers/bluefin.d.ts +3 -3
- package/lib/esm/types/features/metaAg/providers/bluefin.d.ts.map +1 -1
- package/lib/esm/types/features/metaAg/providers/cetus.d.ts +5 -4
- package/lib/esm/types/features/metaAg/providers/cetus.d.ts.map +1 -1
- package/lib/esm/types/features/metaAg/providers/flowx.d.ts +3 -3
- package/lib/esm/types/features/metaAg/providers/flowx.d.ts.map +1 -1
- package/lib/esm/types/features/swap/buildTx.d.ts.map +1 -1
- package/lib/esm/types/features/swap/buildTxV2.d.ts +3 -3
- package/lib/esm/types/features/swap/buildTxV2.d.ts.map +1 -1
- package/lib/esm/types/features/swap/config.d.ts.map +1 -1
- package/lib/esm/types/features/swap/getQuote.d.ts +3 -1
- package/lib/esm/types/features/swap/getQuote.d.ts.map +1 -1
- package/lib/esm/types/index.d.ts +1 -3
- package/lib/esm/types/index.d.ts.map +1 -1
- package/lib/esm/types/metaAg.js +2 -8
- package/lib/esm/types/types/metaAg.d.ts +8 -60
- package/lib/esm/types/types/metaAg.d.ts.map +1 -1
- package/lib/esm/types/utils/condition.d.ts +1 -1
- package/lib/esm/types/utils/condition.d.ts.map +1 -1
- package/package.json +2 -3
- package/lib/cjs/features/metaAg/common.js +0 -117
- package/lib/cjs/features/metaAg/providers/astro.js +0 -42
- package/lib/cjs/features/metaAg/providers/bluefinx.js +0 -87
- package/lib/cjs/features/metaAg/providers/okx.js +0 -181
- package/lib/cjs/types/features/metaAg/common.d.ts +0 -33
- package/lib/cjs/types/features/metaAg/common.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/providers/astro.d.ts +0 -9
- package/lib/cjs/types/features/metaAg/providers/astro.d.ts.map +0 -1
- package/lib/cjs/types/features/metaAg/providers/bluefinx.d.ts +0 -10
- package/lib/cjs/types/features/metaAg/providers/bluefinx.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/okx.js +0 -6
- package/lib/cjs/types/types/okx.d.ts +0 -193
- package/lib/cjs/types/types/okx.d.ts.map +0 -1
- package/lib/esm/features/metaAg/common.js +0 -109
- package/lib/esm/features/metaAg/providers/astro.js +0 -39
- package/lib/esm/features/metaAg/providers/bluefinx.js +0 -84
- package/lib/esm/features/metaAg/providers/okx.js +0 -146
- package/lib/esm/types/features/metaAg/common.d.ts +0 -33
- package/lib/esm/types/features/metaAg/common.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/providers/astro.d.ts +0 -9
- package/lib/esm/types/features/metaAg/providers/astro.d.ts.map +0 -1
- package/lib/esm/types/features/metaAg/providers/bluefinx.d.ts +0 -10
- package/lib/esm/types/features/metaAg/providers/bluefinx.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/okx.js +0 -5
- package/lib/esm/types/types/okx.d.ts +0 -193
- package/lib/esm/types/types/okx.d.ts.map +0 -1
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OKX DEX Swap API Types
|
|
3
|
-
* Documentation: https://web3.okx.com/vi/build/docs/waas/dex-swap
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Gas level options for swap transactions
|
|
7
|
-
*/
|
|
8
|
-
export type GasLevel = "average" | "fast" | "slow";
|
|
9
|
-
/**
|
|
10
|
-
* Swap API Request Parameters
|
|
11
|
-
*/
|
|
12
|
-
export interface OkxSwapRequest {
|
|
13
|
-
/** Chain ID (e.g., 1 for Ethereum) */
|
|
14
|
-
chainId: string;
|
|
15
|
-
/** The input amount of a token to be sold (set in minimal divisible units) */
|
|
16
|
-
amount: string;
|
|
17
|
-
/** The contract address of a token you want to send (e.g., 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee for native token) */
|
|
18
|
-
fromTokenAddress: string;
|
|
19
|
-
/** The contract address of a token you want to receive */
|
|
20
|
-
toTokenAddress: string;
|
|
21
|
-
/** Slippage limit (0-1 for EVM, 0-less than 1 for Solana) */
|
|
22
|
-
slippage: string;
|
|
23
|
-
/** User's wallet address */
|
|
24
|
-
userWalletAddress: string;
|
|
25
|
-
/** Recipient address of a purchased token (if not set, userWalletAddress will receive the token) */
|
|
26
|
-
swapReceiverAddress?: string;
|
|
27
|
-
/** The percentage of fromTokenAmount or toTokenAmount sent to referrer (0-3, max 2 decimal points) */
|
|
28
|
-
feePercent?: string;
|
|
29
|
-
/** Wallet address to receive commission fee from fromToken */
|
|
30
|
-
fromTokenReferrerWalletAddress?: string;
|
|
31
|
-
/** Wallet address to receive commission fee from toToken */
|
|
32
|
-
toTokenReferrerWalletAddress?: string;
|
|
33
|
-
/** When true, positive slippage revenue sent to referrer's address (default: false) */
|
|
34
|
-
enablePositiveSlippage?: boolean;
|
|
35
|
-
/** The gas (in wei) for the swap transaction */
|
|
36
|
-
gaslimit?: string;
|
|
37
|
-
/** Target gas price level (defaults to "average") */
|
|
38
|
-
gasLevel?: GasLevel;
|
|
39
|
-
/** DexId of liquidity pool for limited quotes, multiple separated by comma (e.g., "1,50,180") */
|
|
40
|
-
dexIds?: string;
|
|
41
|
-
/** When enabled, restricts routing to single liquidity pool (Solana only, default: false) */
|
|
42
|
-
directRoute?: boolean;
|
|
43
|
-
/** Percentage (0-1.0) of price impact allowed (default: 0.9) */
|
|
44
|
-
priceImpactProtectionPercentage?: string;
|
|
45
|
-
/** Custom parameters encoded as 128-character 64-bytes hexadecimal string (must start with "0x") */
|
|
46
|
-
callDataMemo?: string;
|
|
47
|
-
/** Used for Solana transactions, similar to gasPrice on Ethereum */
|
|
48
|
-
computeUnitPrice?: string;
|
|
49
|
-
/** Used for Solana transactions, similar to gasLimit on Ethereum */
|
|
50
|
-
computeUnitLimit?: string;
|
|
51
|
-
/** When true, API calculates auto slippage recommendations (default: false) */
|
|
52
|
-
autoSlippage?: boolean;
|
|
53
|
-
/** Maximum auto slippage when autoSlippage is true */
|
|
54
|
-
maxAutoSlippage?: string;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Token information
|
|
58
|
-
*/
|
|
59
|
-
export interface OkxTokenInfo {
|
|
60
|
-
/** Token contract address */
|
|
61
|
-
tokenContractAddress: string;
|
|
62
|
-
/** Token symbol (e.g., "USDC") */
|
|
63
|
-
tokenSymbol: string;
|
|
64
|
-
/** Token unit price in USD (may be null for special cases) */
|
|
65
|
-
tokenUnitPrice: string | null;
|
|
66
|
-
/** Decimal number defining smallest unit */
|
|
67
|
-
decimal: string;
|
|
68
|
-
/** Whether the token is a honeypot token */
|
|
69
|
-
isHoneyPot: boolean;
|
|
70
|
-
/** Token tax rate (0-1, where 0.01 = 1%) */
|
|
71
|
-
taxRate: string;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* DEX Protocol information
|
|
75
|
-
*/
|
|
76
|
-
export interface OkxDexProtocol {
|
|
77
|
-
/** Name of the liquidity protocol (e.g., "Uniswap V3") */
|
|
78
|
-
dexName: string;
|
|
79
|
-
/** Percentage of assets handled by the protocol */
|
|
80
|
-
percent: string;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Sub-router information
|
|
84
|
-
*/
|
|
85
|
-
export interface OkxSubRouter {
|
|
86
|
-
/** Liquidity protocols used on the path */
|
|
87
|
-
dexProtocol: OkxDexProtocol[];
|
|
88
|
-
/** Information of token to be sold */
|
|
89
|
-
fromToken: OkxTokenInfo;
|
|
90
|
-
/** Information of token to be bought */
|
|
91
|
-
toToken: OkxTokenInfo;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Main router information
|
|
95
|
-
*/
|
|
96
|
-
export interface OkxRouter {
|
|
97
|
-
/** One of the main paths for the token swap */
|
|
98
|
-
router: string;
|
|
99
|
-
/** Percentage of assets handled by the main path */
|
|
100
|
-
routerPercent: string;
|
|
101
|
-
/** Quote path sub data set */
|
|
102
|
-
subRouterList: OkxSubRouter[];
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Quote comparison information
|
|
106
|
-
*/
|
|
107
|
-
export interface OkxQuoteCompare {
|
|
108
|
-
/** DEX name of the quote route */
|
|
109
|
-
dexName: string;
|
|
110
|
-
/** DEX logo of the quote route */
|
|
111
|
-
dexLogo: string;
|
|
112
|
-
/** Estimated network fee (USD) of the quote route */
|
|
113
|
-
tradeFee: string;
|
|
114
|
-
/** Received amount of the quote route */
|
|
115
|
-
amountOut: string;
|
|
116
|
-
/** Price impact percentage */
|
|
117
|
-
priceImpactPercentage: string;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Transaction data model
|
|
121
|
-
*/
|
|
122
|
-
export interface OkxTransactionData {
|
|
123
|
-
/** Additional signing data (if required) */
|
|
124
|
-
signatureData?: string[];
|
|
125
|
-
/** User's wallet address */
|
|
126
|
-
from: string;
|
|
127
|
-
/** Estimated amount of the gas limit */
|
|
128
|
-
gas: string;
|
|
129
|
-
/** Gas price in wei */
|
|
130
|
-
gasPrice?: string;
|
|
131
|
-
/** EIP-1559: Recommended priority cost of gas per unit */
|
|
132
|
-
maxPriorityFeePerGas?: string;
|
|
133
|
-
/** The contract address of OKX DEX router */
|
|
134
|
-
to: string;
|
|
135
|
-
/** The amount of native tokens (in wei) to be sent to the contract */
|
|
136
|
-
value: string;
|
|
137
|
-
/** Minimum amount of token to buy when price reaches slippage limit */
|
|
138
|
-
minReceiveAmount: string;
|
|
139
|
-
/** Call data */
|
|
140
|
-
data: string;
|
|
141
|
-
/** Current transaction slippage value */
|
|
142
|
-
slippage: string;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Router result data
|
|
146
|
-
*/
|
|
147
|
-
export interface OkxRouterResult {
|
|
148
|
-
/** Chain ID */
|
|
149
|
-
chainId: string;
|
|
150
|
-
/** The input amount of a token to be sold */
|
|
151
|
-
fromTokenAmount: string;
|
|
152
|
-
/** The resulting amount of a token to be bought */
|
|
153
|
-
toTokenAmount: string;
|
|
154
|
-
/** Estimated network fee (USD) of the quote route */
|
|
155
|
-
tradeFee: string;
|
|
156
|
-
/** Estimated gas consumption in smallest units (e.g., wei) */
|
|
157
|
-
estimateGasFee: string;
|
|
158
|
-
/** Quote path data set */
|
|
159
|
-
dexRouterList: OkxRouter[];
|
|
160
|
-
/** Information of token to be sold */
|
|
161
|
-
fromToken: OkxTokenInfo;
|
|
162
|
-
/** Information of token to be bought */
|
|
163
|
-
toToken: OkxTokenInfo;
|
|
164
|
-
/** Price impact percentage */
|
|
165
|
-
priceImpactPercentage?: string;
|
|
166
|
-
/** Comparison of quote routes */
|
|
167
|
-
quoteCompareList?: OkxQuoteCompare[];
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Swap API Response Data
|
|
171
|
-
*/
|
|
172
|
-
export interface OkxSwapResponseData {
|
|
173
|
-
/** Quote path data */
|
|
174
|
-
routerResult: OkxRouterResult;
|
|
175
|
-
/** Contract data model */
|
|
176
|
-
tx: OkxTransactionData;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* OKX API Standard Response Wrapper
|
|
180
|
-
*/
|
|
181
|
-
export interface OkxApiResponse<T> {
|
|
182
|
-
/** Response code ("0" indicates success) */
|
|
183
|
-
code: string;
|
|
184
|
-
/** Response data array */
|
|
185
|
-
data: T[];
|
|
186
|
-
/** Response message */
|
|
187
|
-
msg: string;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Complete Swap API Response
|
|
191
|
-
*/
|
|
192
|
-
export type OkxSwapResponse = OkxApiResponse<OkxSwapResponseData>;
|
|
193
|
-
//# sourceMappingURL=okx.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"okx.d.ts","sourceRoot":"","sources":["../../../../src/types/okx.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { coinWithBalance, Transaction, } from "@mysten/sui/transactions";
|
|
2
|
-
import { _7K_META_CONFIG, _7K_META_PACKAGE_ID, _7K_META_PUBLISHED_AT, _7K_META_VAULT, } from "../../constants/_7k";
|
|
3
|
-
import { getExpectedReturn } from "../swap/buildTx";
|
|
4
|
-
const DEFAULT_GAS_USED = {
|
|
5
|
-
computationCost: "0",
|
|
6
|
-
nonRefundableStorageFee: "0",
|
|
7
|
-
storageCost: "0",
|
|
8
|
-
storageRebate: "0",
|
|
9
|
-
};
|
|
10
|
-
export const simulateBluefinX = (quote) => {
|
|
11
|
-
return {
|
|
12
|
-
id: quote.id,
|
|
13
|
-
simulatedAmountOut: quote.amountOut,
|
|
14
|
-
gasUsed: DEFAULT_GAS_USED,
|
|
15
|
-
provider: quote.provider,
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export const simulateSwapTx = async (tx, inspector, simulation) => {
|
|
19
|
-
const res = await timeout(() => inspector.devInspectTransactionBlock({
|
|
20
|
-
sender: simulation.sender,
|
|
21
|
-
transactionBlock: tx,
|
|
22
|
-
}), simulation.timeout ?? 2000);
|
|
23
|
-
if (res.effects.status.status === "failure") {
|
|
24
|
-
throw new Error(res.error ?? "Simulation failed");
|
|
25
|
-
}
|
|
26
|
-
const amountOut = extractAmountOutWrapper(res.events);
|
|
27
|
-
return {
|
|
28
|
-
simulatedAmountOut: amountOut,
|
|
29
|
-
gasUsed: res.effects.gasUsed,
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
export const simulateAggregator = async (provider, quote, simulation, inspector, options) => {
|
|
33
|
-
const tx = new Transaction();
|
|
34
|
-
const coinOut = await provider.swap({
|
|
35
|
-
quote,
|
|
36
|
-
coinIn: coinWithBalance({
|
|
37
|
-
balance: BigInt(quote.amountIn),
|
|
38
|
-
type: quote.coinTypeIn,
|
|
39
|
-
useGasCoin: false,
|
|
40
|
-
}),
|
|
41
|
-
signer: simulation.sender,
|
|
42
|
-
tx,
|
|
43
|
-
});
|
|
44
|
-
tx.add(metaSettle(quote, coinOut, 10000, options.tipBps, options.partner, options.partnerCommissionBps));
|
|
45
|
-
tx.transferObjects([coinOut], simulation.sender);
|
|
46
|
-
const res = await simulateSwapTx(tx, inspector, simulation);
|
|
47
|
-
return {
|
|
48
|
-
id: quote.id,
|
|
49
|
-
provider: provider.kind,
|
|
50
|
-
...res,
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* this settlement does not charge commission fee for partner, since all integrated aggregators already charge commission fee for partner
|
|
55
|
-
* @param quote Meta Aggregator Quote
|
|
56
|
-
* @param coinOut Coin Out Object
|
|
57
|
-
* @param slippageBps Slippage Bps
|
|
58
|
-
* @param tipBps Tip Bps default = 0
|
|
59
|
-
* @param partner address of partner for analytic default is zero address
|
|
60
|
-
*/
|
|
61
|
-
export const metaSettle = (quote, coinOut, slippageBps = 100, tipBps = 0, partner, commissionBps = 0) => {
|
|
62
|
-
return (tx) => {
|
|
63
|
-
const { minAmount, expectedAmount } = getExpectedReturn(quote.rawAmountOut, slippageBps, commissionBps, tipBps);
|
|
64
|
-
if (tipBps > 0) {
|
|
65
|
-
tx.moveCall({
|
|
66
|
-
target: `${_7K_META_PUBLISHED_AT}::vault::collect_tip`,
|
|
67
|
-
typeArguments: [quote.coinTypeOut],
|
|
68
|
-
arguments: [
|
|
69
|
-
tx.object(_7K_META_VAULT),
|
|
70
|
-
tx.object(_7K_META_CONFIG),
|
|
71
|
-
coinOut,
|
|
72
|
-
tx.pure.u64(tipBps),
|
|
73
|
-
],
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
tx.moveCall({
|
|
77
|
-
target: `${_7K_META_PUBLISHED_AT}::settle::settle`,
|
|
78
|
-
typeArguments: [quote.coinTypeIn, quote.coinTypeOut],
|
|
79
|
-
arguments: [
|
|
80
|
-
tx.object(_7K_META_CONFIG),
|
|
81
|
-
tx.object(_7K_META_VAULT),
|
|
82
|
-
tx.pure.u64(quote.amountIn),
|
|
83
|
-
coinOut,
|
|
84
|
-
tx.pure.u64(minAmount),
|
|
85
|
-
tx.pure.u64(expectedAmount),
|
|
86
|
-
tx.pure.option("address", partner),
|
|
87
|
-
tx.pure.u64(commissionBps),
|
|
88
|
-
tx.pure.u64(0), // ps
|
|
89
|
-
],
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
const extractAmountOutWrapper = (events) => {
|
|
94
|
-
const swapEvent = events
|
|
95
|
-
.filter((event) => event.type === `${_7K_META_PACKAGE_ID}::settle::Swap`)
|
|
96
|
-
?.pop();
|
|
97
|
-
return swapEvent?.parsedJson?.amount_out;
|
|
98
|
-
};
|
|
99
|
-
export const timeout = async (fn, timeout, msg) => {
|
|
100
|
-
if (timeout <= 0)
|
|
101
|
-
return fn();
|
|
102
|
-
return new Promise((resolve, reject) => {
|
|
103
|
-
const timer = setTimeout(() => reject(new Error(`Timeout ${msg ?? "operation"}`)), timeout);
|
|
104
|
-
fn()
|
|
105
|
-
.then(resolve)
|
|
106
|
-
.catch(reject)
|
|
107
|
-
.finally(() => clearTimeout(timer));
|
|
108
|
-
});
|
|
109
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { buildSwapPTBFromQuote, getQuote, } from "@naviprotocol/astros-aggregator-sdk";
|
|
2
|
-
import { v4 } from "uuid";
|
|
3
|
-
import { _7K_PARTNER_ADDRESS } from "../../../constants/_7k";
|
|
4
|
-
import { EProvider, } from "../../../types/metaAg";
|
|
5
|
-
import { assert } from "../../../utils/condition";
|
|
6
|
-
export class AstroProvider {
|
|
7
|
-
options;
|
|
8
|
-
kind = EProvider.ASTRO;
|
|
9
|
-
constructor(options) {
|
|
10
|
-
this.options = options;
|
|
11
|
-
}
|
|
12
|
-
async quote({ amountIn, coinTypeIn, coinTypeOut, }) {
|
|
13
|
-
const quote = await getQuote(coinTypeIn, coinTypeOut, amountIn, this.options.api, {
|
|
14
|
-
baseUrl: this.options.api,
|
|
15
|
-
byAmountIn: true,
|
|
16
|
-
depth: this.options.depth,
|
|
17
|
-
dexList: this.options.dexList,
|
|
18
|
-
serviceFee: {
|
|
19
|
-
fee: 0,
|
|
20
|
-
receiverAddress: _7K_PARTNER_ADDRESS,
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
return {
|
|
24
|
-
id: v4(),
|
|
25
|
-
provider: this.kind,
|
|
26
|
-
quote,
|
|
27
|
-
amountIn,
|
|
28
|
-
rawAmountOut: quote.amount_out.toString(),
|
|
29
|
-
amountOut: quote.amount_out.toString(),
|
|
30
|
-
coinTypeIn,
|
|
31
|
-
coinTypeOut,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
async swap({ signer, quote, coinIn, tx }) {
|
|
35
|
-
assert(quote.provider === EProvider.ASTRO, "Invalid quote");
|
|
36
|
-
const coin = await buildSwapPTBFromQuote(signer, tx, 0, coinIn, quote.quote);
|
|
37
|
-
return coin;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { coinWithBalance, Transaction } from "@mysten/sui/transactions";
|
|
2
|
-
import { isValidSuiAddress } from "@mysten/sui/utils";
|
|
3
|
-
import { v4 } from "uuid";
|
|
4
|
-
import { Config } from "../../../config";
|
|
5
|
-
import { _7K_PARTNER_ADDRESS } from "../../../constants/_7k";
|
|
6
|
-
import { executeBluefinTx } from "../../../libs/protocols/bluefinx/client";
|
|
7
|
-
import { BluefinXTx } from "../../../types/aggregator";
|
|
8
|
-
import { EProvider, } from "../../../types/metaAg";
|
|
9
|
-
import { assert } from "../../../utils/condition";
|
|
10
|
-
import { buildTxV2Int } from "../../swap/buildTxV2";
|
|
11
|
-
import { getQuote } from "../../swap/getQuote";
|
|
12
|
-
import { metaSettle } from "../common";
|
|
13
|
-
const SUPPORT_COINS = [
|
|
14
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
15
|
-
"0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
|
|
16
|
-
];
|
|
17
|
-
export class BluefinXProvider {
|
|
18
|
-
options;
|
|
19
|
-
kind = EProvider.BLUEFINX;
|
|
20
|
-
constructor(options) {
|
|
21
|
-
this.options = options;
|
|
22
|
-
if (options.apiKey)
|
|
23
|
-
Config.setApiKey(options.apiKey);
|
|
24
|
-
if (options.api)
|
|
25
|
-
Config.setApi(options.api);
|
|
26
|
-
}
|
|
27
|
-
async quote(options) {
|
|
28
|
-
if (!this.canQuote(options))
|
|
29
|
-
return null;
|
|
30
|
-
const quote = await getQuote({
|
|
31
|
-
amountIn: options.amountIn,
|
|
32
|
-
tokenIn: options.coinTypeIn,
|
|
33
|
-
tokenOut: options.coinTypeOut,
|
|
34
|
-
sources: ["bluefinx"],
|
|
35
|
-
taker: options.signer,
|
|
36
|
-
});
|
|
37
|
-
return {
|
|
38
|
-
id: v4(),
|
|
39
|
-
provider: this.kind,
|
|
40
|
-
quote,
|
|
41
|
-
amountIn: quote.swapAmountWithDecimal,
|
|
42
|
-
rawAmountOut: quote.returnAmountWithDecimal,
|
|
43
|
-
amountOut: quote.returnAmountWithDecimal,
|
|
44
|
-
coinTypeIn: options.coinTypeIn,
|
|
45
|
-
coinTypeOut: options.coinTypeOut,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
canQuote(options) {
|
|
49
|
-
return (!!options.signer &&
|
|
50
|
-
isValidSuiAddress(options.signer) &&
|
|
51
|
-
SUPPORT_COINS.includes(options.coinTypeIn) &&
|
|
52
|
-
SUPPORT_COINS.includes(options.coinTypeOut));
|
|
53
|
-
}
|
|
54
|
-
async fastSwap(options) {
|
|
55
|
-
assert(options.quote.provider === this.kind, "Invalid BluefinX quote");
|
|
56
|
-
const quote = options.quote.quote;
|
|
57
|
-
const tx = new Transaction();
|
|
58
|
-
const { tx: bluefinTx } = await buildTxV2Int({
|
|
59
|
-
quoteResponse: quote,
|
|
60
|
-
accountAddress: options.signer,
|
|
61
|
-
commission: { commissionBps: 0, partner: _7K_PARTNER_ADDRESS },
|
|
62
|
-
slippage: 0,
|
|
63
|
-
extendTx: {
|
|
64
|
-
tx,
|
|
65
|
-
coinIn: coinWithBalance({
|
|
66
|
-
type: options.quote.coinTypeIn,
|
|
67
|
-
balance: BigInt(options.quote.amountIn),
|
|
68
|
-
useGasCoin: false,
|
|
69
|
-
}),
|
|
70
|
-
},
|
|
71
|
-
}, (tx, coinOut) => {
|
|
72
|
-
if (coinOut) {
|
|
73
|
-
tx.add(metaSettle(options.quote, coinOut, 0, 0));
|
|
74
|
-
tx.transferObjects([coinOut], options.signer);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
assert(bluefinTx instanceof BluefinXTx, "BluefinX transaction not found");
|
|
78
|
-
const { signature } = await options.signTransaction(bluefinTx.txBytes);
|
|
79
|
-
const res = await executeBluefinTx(bluefinTx, signature);
|
|
80
|
-
assert(res.approved, "BluefinX transaction not approved");
|
|
81
|
-
assert(res.txDigest, "BluefinX transaction digest not found");
|
|
82
|
-
return res.txDigest;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { Commands, Transaction, TransactionDataBuilder, } from "@mysten/sui/transactions";
|
|
2
|
-
import { normalizeStructTag, normalizeSuiAddress, toBase64, } from "@mysten/sui/utils";
|
|
3
|
-
import { v4 } from "uuid";
|
|
4
|
-
import { SUI_TYPE } from "../../../constants/tokens";
|
|
5
|
-
import { EProvider, } from "../../../types/metaAg";
|
|
6
|
-
import { assert } from "../../../utils/condition";
|
|
7
|
-
import { metaSettle, simulateSwapTx } from "../common";
|
|
8
|
-
const API = "https://web3.okx.com";
|
|
9
|
-
const SWAP_PATH = "/api/v5/dex/aggregator/swap";
|
|
10
|
-
const CHAIN_ID = "784";
|
|
11
|
-
const NORMALIZED_SUI_TYPE = normalizeStructTag(SUI_TYPE);
|
|
12
|
-
export class OkxProvider {
|
|
13
|
-
options;
|
|
14
|
-
metaOptions;
|
|
15
|
-
client;
|
|
16
|
-
kind = EProvider.OKX;
|
|
17
|
-
constructor(options, metaOptions, client) {
|
|
18
|
-
this.options = options;
|
|
19
|
-
this.metaOptions = metaOptions;
|
|
20
|
-
this.client = client;
|
|
21
|
-
}
|
|
22
|
-
async quote({ amountIn, coinTypeIn, coinTypeOut, signer, }) {
|
|
23
|
-
if (!signer)
|
|
24
|
-
return null;
|
|
25
|
-
const request = {
|
|
26
|
-
chainId: CHAIN_ID,
|
|
27
|
-
amount: amountIn,
|
|
28
|
-
fromTokenAddress: coinTypeIn === NORMALIZED_SUI_TYPE ? SUI_TYPE : coinTypeIn,
|
|
29
|
-
toTokenAddress: coinTypeOut === NORMALIZED_SUI_TYPE ? SUI_TYPE : coinTypeOut,
|
|
30
|
-
slippage: (this.metaOptions.slippageBps / 10000).toString(),
|
|
31
|
-
userWalletAddress: signer,
|
|
32
|
-
};
|
|
33
|
-
const queryString = "?" + new URLSearchParams(request).toString();
|
|
34
|
-
const url = `${this.options.api ?? API}${SWAP_PATH}${queryString}`;
|
|
35
|
-
const response = await fetch(url, {
|
|
36
|
-
headers: await getHeaders(this.options, "GET", SWAP_PATH, queryString),
|
|
37
|
-
});
|
|
38
|
-
const quote = (await response.json());
|
|
39
|
-
assert(quote.code === "0" && quote.data.length > 0, "No quote found");
|
|
40
|
-
return {
|
|
41
|
-
id: v4(),
|
|
42
|
-
provider: this.kind,
|
|
43
|
-
coinTypeIn,
|
|
44
|
-
coinTypeOut,
|
|
45
|
-
amountIn,
|
|
46
|
-
amountOut: quote.data[0].routerResult.toTokenAmount,
|
|
47
|
-
rawAmountOut: quote.data[0].routerResult.toTokenAmount,
|
|
48
|
-
quote: quote.data[0],
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
async fastSwap(options) {
|
|
52
|
-
const { quote, signer, signTransaction } = options;
|
|
53
|
-
assert(quote.provider === EProvider.OKX, "Invalid quote");
|
|
54
|
-
const { tx, coin } = buildTx({ quote, signer });
|
|
55
|
-
tx.add(metaSettle(quote, coin, this.metaOptions.slippageBps, this.metaOptions.tipBps, this.metaOptions.partner, this.metaOptions.partnerCommissionBps));
|
|
56
|
-
tx.transferObjects([coin], signer);
|
|
57
|
-
const txBytes = await tx.build({ client: this.client });
|
|
58
|
-
const { bytes, signature } = await signTransaction(toBase64(txBytes));
|
|
59
|
-
const res = await this.client.executeTransactionBlock({
|
|
60
|
-
signature,
|
|
61
|
-
transactionBlock: bytes,
|
|
62
|
-
});
|
|
63
|
-
return res.digest;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
async function generateHmacSha256(message, secretKey) {
|
|
67
|
-
const encoder = new TextEncoder();
|
|
68
|
-
const encodeBase64 = (bytes) => {
|
|
69
|
-
if (typeof Buffer !== "undefined") {
|
|
70
|
-
return Buffer.from(bytes).toString("base64");
|
|
71
|
-
}
|
|
72
|
-
let binary = "";
|
|
73
|
-
for (let i = 0; i < bytes.byteLength; i++) {
|
|
74
|
-
binary += String.fromCharCode(bytes[i]);
|
|
75
|
-
}
|
|
76
|
-
if (typeof btoa !== "undefined") {
|
|
77
|
-
return btoa(binary);
|
|
78
|
-
}
|
|
79
|
-
throw new Error("Base64 encoder not available in this environment");
|
|
80
|
-
};
|
|
81
|
-
if (typeof globalThis !== "undefined" && globalThis.crypto?.subtle) {
|
|
82
|
-
const key = await globalThis.crypto.subtle.importKey("raw", encoder.encode(secretKey), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
83
|
-
const signature = await globalThis.crypto.subtle.sign("HMAC", key, encoder.encode(message));
|
|
84
|
-
return encodeBase64(new Uint8Array(signature));
|
|
85
|
-
}
|
|
86
|
-
const { createHmac } = await import("node:crypto");
|
|
87
|
-
return createHmac("sha256", secretKey).update(message).digest("base64");
|
|
88
|
-
}
|
|
89
|
-
async function getHeaders(options, method, requestPath, queryString = "") {
|
|
90
|
-
const { apiKey, secretKey, apiPassphrase, projectId } = options;
|
|
91
|
-
if (!apiKey || !secretKey || !apiPassphrase || !projectId) {
|
|
92
|
-
throw new Error("Missing required environment variables");
|
|
93
|
-
}
|
|
94
|
-
const timestamp = new Date().toISOString();
|
|
95
|
-
const stringToSign = timestamp + method + requestPath + queryString;
|
|
96
|
-
return {
|
|
97
|
-
"Content-Type": "application/json",
|
|
98
|
-
"OK-ACCESS-KEY": apiKey,
|
|
99
|
-
"OK-ACCESS-SIGN": await generateHmacSha256(stringToSign, secretKey),
|
|
100
|
-
"OK-ACCESS-TIMESTAMP": timestamp,
|
|
101
|
-
"OK-ACCESS-PASSPHRASE": apiPassphrase,
|
|
102
|
-
"OK-ACCESS-PROJECT": projectId,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
const replaceFinalizeCommand = (tx, packageId) => {
|
|
106
|
-
const builder = TransactionDataBuilder.restore(tx.getData());
|
|
107
|
-
const i = builder.commands.findIndex((cmd) => cmd.$kind === "MoveCall" &&
|
|
108
|
-
normalizeSuiAddress(cmd.MoveCall.package) ===
|
|
109
|
-
normalizeSuiAddress(packageId) &&
|
|
110
|
-
cmd.MoveCall.module === "router" &&
|
|
111
|
-
cmd.MoveCall.function === "finalize");
|
|
112
|
-
const cmd = builder.commands[i];
|
|
113
|
-
assert(cmd.MoveCall, "OKX: Finalize command not found");
|
|
114
|
-
builder.replaceCommand(i, Commands.MoveCall({
|
|
115
|
-
package: packageId,
|
|
116
|
-
module: "router",
|
|
117
|
-
function: "finalize_without_transfer",
|
|
118
|
-
typeArguments: cmd.MoveCall.typeArguments,
|
|
119
|
-
arguments: [
|
|
120
|
-
cmd.MoveCall.arguments[0],
|
|
121
|
-
cmd.MoveCall.arguments[5],
|
|
122
|
-
cmd.MoveCall.arguments[6],
|
|
123
|
-
],
|
|
124
|
-
}));
|
|
125
|
-
const tx2 = Transaction.from(builder.build());
|
|
126
|
-
return { tx: tx2, coin: { NestedResult: [i, 0] } };
|
|
127
|
-
};
|
|
128
|
-
const buildTx = (options) => {
|
|
129
|
-
const { quote, signer } = options;
|
|
130
|
-
assert(quote.provider === EProvider.OKX, "Invalid quote");
|
|
131
|
-
const tx = Transaction.from(quote.quote.tx.data);
|
|
132
|
-
tx.setSenderIfNotSet(signer);
|
|
133
|
-
const { tx: tx2, coin } = replaceFinalizeCommand(tx, quote.quote.tx.to);
|
|
134
|
-
return { tx: tx2, coin };
|
|
135
|
-
};
|
|
136
|
-
export const simulateOKXSwap = async (quote, inspector, simulation, metaOptions) => {
|
|
137
|
-
const { tx, coin } = buildTx({ quote, signer: quote.quote.tx.from });
|
|
138
|
-
tx.add(metaSettle(quote, coin, 10000, metaOptions.tipBps, metaOptions.partner, metaOptions.partnerCommissionBps));
|
|
139
|
-
tx.transferObjects([coin], quote.quote.tx.from);
|
|
140
|
-
const res = await simulateSwapTx(tx, inspector, simulation);
|
|
141
|
-
return {
|
|
142
|
-
id: quote.id,
|
|
143
|
-
provider: quote.provider,
|
|
144
|
-
...res,
|
|
145
|
-
};
|
|
146
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { GasCostSummary } from "@mysten/sui/client";
|
|
2
|
-
import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
3
|
-
import { AggregatorProvider, EProvider, MetaAgOptions, MetaQuote, MetaSimulationOptions } from "../../types/metaAg";
|
|
4
|
-
import { SuiClientUtils } from "../../utils/SuiClientUtils";
|
|
5
|
-
export declare const simulateBluefinX: <T extends MetaQuote & {
|
|
6
|
-
provider: EProvider.BLUEFINX;
|
|
7
|
-
}>(quote: T) => {
|
|
8
|
-
id: string;
|
|
9
|
-
simulatedAmountOut: string;
|
|
10
|
-
gasUsed: GasCostSummary;
|
|
11
|
-
provider: EProvider.BLUEFINX;
|
|
12
|
-
};
|
|
13
|
-
export declare const simulateSwapTx: (tx: Transaction, inspector: SuiClientUtils, simulation: MetaSimulationOptions) => Promise<{
|
|
14
|
-
simulatedAmountOut: string;
|
|
15
|
-
gasUsed: GasCostSummary;
|
|
16
|
-
}>;
|
|
17
|
-
export declare const simulateAggregator: (provider: AggregatorProvider, quote: MetaQuote, simulation: MetaSimulationOptions, inspector: SuiClientUtils, options: Required<MetaAgOptions>) => Promise<{
|
|
18
|
-
simulatedAmountOut: string;
|
|
19
|
-
gasUsed: GasCostSummary;
|
|
20
|
-
id: string;
|
|
21
|
-
provider: EProvider.BLUEFIN7K | EProvider.CETUS | EProvider.FLOWX | EProvider.ASTRO;
|
|
22
|
-
}>;
|
|
23
|
-
/**
|
|
24
|
-
* this settlement does not charge commission fee for partner, since all integrated aggregators already charge commission fee for partner
|
|
25
|
-
* @param quote Meta Aggregator Quote
|
|
26
|
-
* @param coinOut Coin Out Object
|
|
27
|
-
* @param slippageBps Slippage Bps
|
|
28
|
-
* @param tipBps Tip Bps default = 0
|
|
29
|
-
* @param partner address of partner for analytic default is zero address
|
|
30
|
-
*/
|
|
31
|
-
export declare const metaSettle: (quote: MetaQuote, coinOut: TransactionObjectArgument, slippageBps?: number, tipBps?: number, partner?: string, commissionBps?: number) => (tx: Transaction) => void;
|
|
32
|
-
export declare const timeout: <T = any>(fn: () => Promise<T>, timeout: number, msg?: string) => Promise<T>;
|
|
33
|
-
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/features/metaAg/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAY,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAEL,WAAW,EACX,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,aAAa,EACb,SAAS,EACT,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAS5D,eAAO,MAAM,gBAAgB,GAC3B,CAAC,SAAS,SAAS,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAA;CAAE,EAEtD,OAAO,CAAC;;;;;CAQT,CAAC;AACF,eAAO,MAAM,cAAc,GACzB,IAAI,WAAW,EACf,WAAW,cAAc,EACzB,YAAY,qBAAqB;wBAeE,MAAM;;EAG1C,CAAC;AACF,eAAO,MAAM,kBAAkB,GAC7B,UAAU,kBAAkB,EAC5B,OAAO,SAAS,EAChB,YAAY,qBAAqB,EACjC,WAAW,cAAc,EACzB,SAAS,QAAQ,CAAC,aAAa,CAAC;wBATG,MAAM;;;;EAuC1C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,SAAS,EAChB,SAAS,yBAAyB,EAClC,oBAAiB,EACjB,eAAU,EACV,UAAU,MAAM,EAChB,sBAAiB,MAET,IAAI,WAAW,SAqCxB,CAAC;AASF,eAAO,MAAM,OAAO,GAAU,CAAC,GAAG,GAAG,EACnC,IAAI,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,SAAS,MAAM,EACf,MAAM,MAAM,eAab,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { AggregatorProvider, AstroProviderOptions, EProvider, MetaQuote, MetaQuoteOptions, MetaSwapOptions, QuoteProvider } from "../../../types/metaAg";
|
|
2
|
-
export declare class AstroProvider implements QuoteProvider, AggregatorProvider {
|
|
3
|
-
private readonly options;
|
|
4
|
-
readonly kind = EProvider.ASTRO;
|
|
5
|
-
constructor(options: AstroProviderOptions);
|
|
6
|
-
quote({ amountIn, coinTypeIn, coinTypeOut, }: MetaQuoteOptions): Promise<MetaQuote | null>;
|
|
7
|
-
swap({ signer, quote, coinIn, tx }: MetaSwapOptions): Promise<import("@mysten/sui/dist/cjs/transactions").TransactionResult>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=astro.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"astro.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/astro.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,aAAa,EACd,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,aAAc,YAAW,aAAa,EAAE,kBAAkB;IAEzD,OAAO,CAAC,QAAQ,CAAC,OAAO;IADpC,QAAQ,CAAC,IAAI,mBAAmB;gBACH,OAAO,EAAE,oBAAoB;IAEpD,KAAK,CAAC,EACV,QAAQ,EACR,UAAU,EACV,WAAW,GACZ,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IA6BzC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,eAAe;CAW1D"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BluefinXProviderOptions, EProvider, MetaFastSwapOptions, MetaQuote, MetaQuoteOptions, QuoteProvider, SwapAPIProvider } from "../../../types/metaAg";
|
|
2
|
-
export declare class BluefinXProvider implements QuoteProvider, SwapAPIProvider {
|
|
3
|
-
private readonly options;
|
|
4
|
-
readonly kind = EProvider.BLUEFINX;
|
|
5
|
-
constructor(options: BluefinXProviderOptions);
|
|
6
|
-
quote(options: MetaQuoteOptions): Promise<MetaQuote | null>;
|
|
7
|
-
canQuote(options: MetaQuoteOptions): boolean;
|
|
8
|
-
fastSwap(options: MetaFastSwapOptions): Promise<string>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=bluefinx.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bluefinx.d.ts","sourceRoot":"","sources":["../../../../../../src/features/metaAg/providers/bluefinx.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,mBAAmB,EACnB,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAU/B,qBAAa,gBAAiB,YAAW,aAAa,EAAE,eAAe;IAEzD,OAAO,CAAC,QAAQ,CAAC,OAAO;IADpC,QAAQ,CAAC,IAAI,sBAAsB;gBACN,OAAO,EAAE,uBAAuB;IAKvD,KAAK,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAqBjE,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO;IAStC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;CAiC9D"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { SuiClient } from "@mysten/sui/client";
|
|
2
|
-
import { EProvider, MetaAgOptions, MetaFastSwapOptions, MetaQuote, MetaQuoteOptions, MetaSimulationOptions, OkxProviderOptions, QuoteProvider, SwapAPIProvider } from "../../../types/metaAg";
|
|
3
|
-
import { SuiClientUtils } from "../../../utils/SuiClientUtils";
|
|
4
|
-
export declare class OkxProvider implements QuoteProvider, SwapAPIProvider {
|
|
5
|
-
private readonly options;
|
|
6
|
-
private readonly metaOptions;
|
|
7
|
-
private readonly client;
|
|
8
|
-
readonly kind = EProvider.OKX;
|
|
9
|
-
constructor(options: OkxProviderOptions, metaOptions: Required<MetaAgOptions>, client: SuiClient);
|
|
10
|
-
quote({ amountIn, coinTypeIn, coinTypeOut, signer, }: MetaQuoteOptions): Promise<MetaQuote | null>;
|
|
11
|
-
fastSwap(options: MetaFastSwapOptions): Promise<string>;
|
|
12
|
-
}
|
|
13
|
-
export declare const simulateOKXSwap: <T extends MetaQuote & {
|
|
14
|
-
provider: EProvider.OKX;
|
|
15
|
-
}>(quote: T, inspector: SuiClientUtils, simulation: MetaSimulationOptions, metaOptions: Required<MetaAgOptions>) => Promise<{
|
|
16
|
-
simulatedAmountOut: string;
|
|
17
|
-
gasUsed: import("@mysten/sui/client").GasCostSummary;
|
|
18
|
-
id: string;
|
|
19
|
-
provider: EProvider.OKX;
|
|
20
|
-
}>;
|
|
21
|
-
//# sourceMappingURL=okx.d.ts.map
|