@rhea-finance/cross-chain-aggregation-dex 0.1.1
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 +653 -0
- package/dist/index.d.mts +465 -0
- package/dist/index.d.ts +465 -0
- package/dist/index.js +1295 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1275 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +67 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-chain DEX aggregation SDK core type definitions
|
|
3
|
+
*/
|
|
4
|
+
interface TokenInfo {
|
|
5
|
+
address: string;
|
|
6
|
+
symbol: string;
|
|
7
|
+
decimals: number;
|
|
8
|
+
chain: string;
|
|
9
|
+
}
|
|
10
|
+
interface Route {
|
|
11
|
+
pools: PoolInfo[];
|
|
12
|
+
amountIn: string;
|
|
13
|
+
amountOut: string;
|
|
14
|
+
}
|
|
15
|
+
interface PoolInfo {
|
|
16
|
+
pool_id: number;
|
|
17
|
+
token_in: string;
|
|
18
|
+
token_out: string;
|
|
19
|
+
amount_in?: string;
|
|
20
|
+
amount_out?: string;
|
|
21
|
+
fee?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Base quote parameters (common to all routers)
|
|
25
|
+
*/
|
|
26
|
+
interface BaseQuoteParams {
|
|
27
|
+
tokenIn: TokenInfo;
|
|
28
|
+
tokenOut: TokenInfo;
|
|
29
|
+
amountIn: string;
|
|
30
|
+
/** Slippage tolerance in bps (e.g. 50 = 0.5%). */
|
|
31
|
+
slippage: number;
|
|
32
|
+
swapType?: "EXACT_INPUT" | "EXACT_OUTPUT";
|
|
33
|
+
recipient?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Simple quote parameters (V1 NEAR, etc., no recipient required)
|
|
37
|
+
*/
|
|
38
|
+
interface SimpleQuoteParams extends BaseQuoteParams {
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Recipient quote parameters (V2 NEAR, EVM, etc., recipient required)
|
|
42
|
+
*/
|
|
43
|
+
interface RecipientQuoteParams extends BaseQuoteParams {
|
|
44
|
+
/** Sender address (current user) */
|
|
45
|
+
sender: string;
|
|
46
|
+
/** Recipient address (equals sender during quote, equals depositAddress during execution) */
|
|
47
|
+
recipient: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Unified quote parameters (union type)
|
|
51
|
+
* Supports both simple and recipient modes
|
|
52
|
+
*/
|
|
53
|
+
type QuoteParams = SimpleQuoteParams | RecipientQuoteParams;
|
|
54
|
+
/**
|
|
55
|
+
* Type guard: check if recipient parameters are required
|
|
56
|
+
*/
|
|
57
|
+
declare function requiresRecipient(params: QuoteParams): params is RecipientQuoteParams;
|
|
58
|
+
interface QuoteResult {
|
|
59
|
+
success: boolean;
|
|
60
|
+
tokenIn: TokenInfo;
|
|
61
|
+
tokenOut: TokenInfo;
|
|
62
|
+
amountIn: string;
|
|
63
|
+
amountOut: string;
|
|
64
|
+
minAmountOut: string;
|
|
65
|
+
routes: Route[];
|
|
66
|
+
/**
|
|
67
|
+
* Optional: Raw route data returned by chain router/aggregator
|
|
68
|
+
* - Used for scenarios where aggregator-specific fields need to be passed through in executeSwap
|
|
69
|
+
* - Kept optional to avoid tightly coupling implementation details into core logic
|
|
70
|
+
*/
|
|
71
|
+
rawRoutes?: any[];
|
|
72
|
+
priceImpact?: number;
|
|
73
|
+
avgFee?: number;
|
|
74
|
+
estimatedGas?: string;
|
|
75
|
+
error?: string;
|
|
76
|
+
routerMsg?: string;
|
|
77
|
+
signature?: string;
|
|
78
|
+
tokens?: string[];
|
|
79
|
+
dexs?: string[];
|
|
80
|
+
recipient?: string;
|
|
81
|
+
slippage?: number;
|
|
82
|
+
transactionData?: string;
|
|
83
|
+
gasEstimate?: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Base execute parameters (common to all routers)
|
|
87
|
+
*/
|
|
88
|
+
interface BaseExecuteParams {
|
|
89
|
+
quote: QuoteResult;
|
|
90
|
+
recipient: string;
|
|
91
|
+
depositAddress?: string;
|
|
92
|
+
deadline?: number;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Recipient execute parameters (V2 NEAR, EVM, etc.)
|
|
96
|
+
*/
|
|
97
|
+
interface RecipientExecuteParams extends BaseExecuteParams {
|
|
98
|
+
/** Sender address (current user) */
|
|
99
|
+
sender: string;
|
|
100
|
+
/** Recipient address (usually depositAddress) */
|
|
101
|
+
receiveUser: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Unified execute parameters (union type)
|
|
105
|
+
* Supports both simple and recipient modes
|
|
106
|
+
*/
|
|
107
|
+
type ExecuteParams = BaseExecuteParams | RecipientExecuteParams;
|
|
108
|
+
/**
|
|
109
|
+
* Type guard: check if execute parameters require recipient
|
|
110
|
+
*/
|
|
111
|
+
declare function requiresRecipientInExecute(params: ExecuteParams): params is RecipientExecuteParams;
|
|
112
|
+
interface ExecuteResult {
|
|
113
|
+
success: boolean;
|
|
114
|
+
txHash?: string;
|
|
115
|
+
txHashArray?: string[];
|
|
116
|
+
error?: string;
|
|
117
|
+
}
|
|
118
|
+
type SupportedChain = "near" | "evm" | "solana";
|
|
119
|
+
/**
|
|
120
|
+
* Router capabilities
|
|
121
|
+
* Used to declare router features and requirements
|
|
122
|
+
*/
|
|
123
|
+
interface RouterCapabilities {
|
|
124
|
+
/** Whether recipient parameters (sender/recipient) are required */
|
|
125
|
+
requiresRecipient: boolean;
|
|
126
|
+
/** Whether two API calls are needed (quote + finalize) */
|
|
127
|
+
requiresFinalizeQuote: boolean;
|
|
128
|
+
/** Whether complex token registration is required */
|
|
129
|
+
requiresComplexRegistration: boolean;
|
|
130
|
+
/** Supported chain */
|
|
131
|
+
supportedChain: SupportedChain | string;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* DEX aggregator router abstract interface
|
|
135
|
+
* Each chain/aggregator implements its own quote/executeSwap
|
|
136
|
+
*
|
|
137
|
+
* Extended to support common architecture:
|
|
138
|
+
* - Capabilities (RouterCapabilities)
|
|
139
|
+
* - Optional finalize quote method (finalizeQuote)
|
|
140
|
+
* - Unified parameter interface (supports both simple and recipient modes)
|
|
141
|
+
*/
|
|
142
|
+
interface DexRouter {
|
|
143
|
+
getCapabilities(): RouterCapabilities;
|
|
144
|
+
getSupportedChain(): SupportedChain | string;
|
|
145
|
+
/**
|
|
146
|
+
* Quote method
|
|
147
|
+
* - Simple router: only needs BaseQuoteParams
|
|
148
|
+
* - Recipient router: needs RecipientQuoteParams
|
|
149
|
+
*/
|
|
150
|
+
quote(params: QuoteParams): Promise<QuoteResult>;
|
|
151
|
+
/**
|
|
152
|
+
* Execute swap
|
|
153
|
+
* - Simple router: only needs BaseExecuteParams
|
|
154
|
+
* - Recipient router: needs RecipientExecuteParams
|
|
155
|
+
*/
|
|
156
|
+
executeSwap(params: ExecuteParams): Promise<ExecuteResult>;
|
|
157
|
+
/**
|
|
158
|
+
* Finalize quote (if two API calls are needed)
|
|
159
|
+
* - Only implemented when requiresFinalizeQuote = true
|
|
160
|
+
* - Used to call API again after getting depositAddress
|
|
161
|
+
*/
|
|
162
|
+
finalizeQuote?(params: QuoteParams, depositAddress: string): Promise<QuoteResult>;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Bluechip token configuration
|
|
166
|
+
*/
|
|
167
|
+
interface BluechipTokenConfig {
|
|
168
|
+
address: string;
|
|
169
|
+
symbol: string;
|
|
170
|
+
decimals: number;
|
|
171
|
+
assetId?: string;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Bluechip tokens list configuration
|
|
175
|
+
*/
|
|
176
|
+
interface BluechipTokensConfig {
|
|
177
|
+
USDT?: BluechipTokenConfig;
|
|
178
|
+
USDC?: BluechipTokenConfig;
|
|
179
|
+
NEAR?: BluechipTokenConfig;
|
|
180
|
+
[key: string]: BluechipTokenConfig | undefined;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** FindPath API response. */
|
|
184
|
+
interface FindPathResponse {
|
|
185
|
+
result_code: number;
|
|
186
|
+
result_msg?: string;
|
|
187
|
+
result_message?: string;
|
|
188
|
+
result_data: {
|
|
189
|
+
routes: any[];
|
|
190
|
+
amount_out: string;
|
|
191
|
+
} | null;
|
|
192
|
+
}
|
|
193
|
+
/** Adapter for querying DEX routes (FindPath). */
|
|
194
|
+
interface FindPathAdapter {
|
|
195
|
+
findPath(params: {
|
|
196
|
+
tokenIn: string;
|
|
197
|
+
tokenOut: string;
|
|
198
|
+
amountIn: string;
|
|
199
|
+
slippage: number;
|
|
200
|
+
supportLedger?: boolean;
|
|
201
|
+
}): Promise<FindPathResponse>;
|
|
202
|
+
}
|
|
203
|
+
/** NearIntents quote result. */
|
|
204
|
+
interface IntentsQuoteResult {
|
|
205
|
+
quoteStatus: "success" | "error";
|
|
206
|
+
message?: string;
|
|
207
|
+
quoteSuccessResult?: {
|
|
208
|
+
quote: {
|
|
209
|
+
amountOut: string;
|
|
210
|
+
depositAddress: string;
|
|
211
|
+
[key: string]: any;
|
|
212
|
+
};
|
|
213
|
+
[key: string]: any;
|
|
214
|
+
};
|
|
215
|
+
[key: string]: any;
|
|
216
|
+
}
|
|
217
|
+
/** Adapter for fetching NearIntents quotes. */
|
|
218
|
+
interface IntentsQuotationAdapter {
|
|
219
|
+
quote(params: {
|
|
220
|
+
originAsset: string;
|
|
221
|
+
destinationAsset: string;
|
|
222
|
+
amount: string;
|
|
223
|
+
refundTo: string;
|
|
224
|
+
recipient: string;
|
|
225
|
+
slippageTolerance: number;
|
|
226
|
+
swapType?: "EXACT_INPUT" | "EXACT_OUTPUT" | "FLEX_INPUT";
|
|
227
|
+
[key: string]: any;
|
|
228
|
+
}): Promise<IntentsQuoteResult>;
|
|
229
|
+
}
|
|
230
|
+
/** Adapter for interacting with NEAR (call/view). */
|
|
231
|
+
interface NearChainAdapter {
|
|
232
|
+
call(params: {
|
|
233
|
+
transactions: Array<{
|
|
234
|
+
contractId: string;
|
|
235
|
+
methodName: string;
|
|
236
|
+
args: any;
|
|
237
|
+
gas?: string;
|
|
238
|
+
expandDeposit?: string;
|
|
239
|
+
}>;
|
|
240
|
+
}): Promise<{
|
|
241
|
+
status: "success" | "error";
|
|
242
|
+
txHash?: string;
|
|
243
|
+
txHashArr?: string[];
|
|
244
|
+
message?: string;
|
|
245
|
+
}>;
|
|
246
|
+
view(params: {
|
|
247
|
+
contractId: string;
|
|
248
|
+
methodName: string;
|
|
249
|
+
args?: any;
|
|
250
|
+
}): Promise<any>;
|
|
251
|
+
}
|
|
252
|
+
/** V2 Router API response. */
|
|
253
|
+
interface SwapMultiDexPathResponse {
|
|
254
|
+
result_code: number;
|
|
255
|
+
result_message?: string;
|
|
256
|
+
result_data: {
|
|
257
|
+
amount_in: string;
|
|
258
|
+
amount_out: string;
|
|
259
|
+
min_amount_out: string;
|
|
260
|
+
msg: string;
|
|
261
|
+
signature: string;
|
|
262
|
+
tokens: string[];
|
|
263
|
+
dexs: string[];
|
|
264
|
+
} | null;
|
|
265
|
+
}
|
|
266
|
+
/** Adapter for V2 Router API (swapMultiDexPath). */
|
|
267
|
+
interface SwapMultiDexPathAdapter {
|
|
268
|
+
swapMultiDexPath(params: {
|
|
269
|
+
amountIn: string;
|
|
270
|
+
tokenIn: string;
|
|
271
|
+
tokenOut: string;
|
|
272
|
+
slippage: number;
|
|
273
|
+
pathDeep?: number;
|
|
274
|
+
chainId?: number;
|
|
275
|
+
routerCount?: number;
|
|
276
|
+
user: string;
|
|
277
|
+
receiveUser: string;
|
|
278
|
+
skipUnwrapNativeToken?: boolean;
|
|
279
|
+
}): Promise<SwapMultiDexPathResponse>;
|
|
280
|
+
}
|
|
281
|
+
/** Chain-specific configuration provider. */
|
|
282
|
+
interface ConfigAdapter {
|
|
283
|
+
getRefExchangeId(): string;
|
|
284
|
+
getWrapNearContractId(): string;
|
|
285
|
+
getFindPathUrl(): string;
|
|
286
|
+
/** Storage deposit amount (yoctoNEAR) for `storage_deposit` when needed. */
|
|
287
|
+
getTokenStorageDepositRead?(): string;
|
|
288
|
+
getAggregateDexContractId?(): string;
|
|
289
|
+
getSmartxUrl?(): string;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
declare const logger: {
|
|
293
|
+
debug: (...args: any[]) => void;
|
|
294
|
+
info: (...args: any[]) => void;
|
|
295
|
+
warn: (...args: any[]) => void;
|
|
296
|
+
error: (...args: any[]) => void;
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
/** Set the SDK-wide bluechip token config used for NearIntents compatibility and intermediate routing. */
|
|
300
|
+
declare function setBluechipTokensConfig(config: BluechipTokensConfig): void;
|
|
301
|
+
/** Get the bluechip token config; returns an empty object (and warns) if unset. */
|
|
302
|
+
declare function getBluechipTokensConfig(): BluechipTokensConfig;
|
|
303
|
+
/**
|
|
304
|
+
* Normalize a NEAR asset id:
|
|
305
|
+
* - strip `nep141:` prefix (if present)
|
|
306
|
+
* - map `near` -> `wrap.near` (overridable via `wrapNearContractId`)
|
|
307
|
+
*/
|
|
308
|
+
declare function normalizeTokenId(tokenId: string | undefined | null, wrapNearContractId?: string): string;
|
|
309
|
+
/** True if the token matches a NearIntents-supported bluechip token (by symbol + address/assetId). */
|
|
310
|
+
declare function isNearIntentsSupportedToken(token: TokenInfo, bluechipTokens?: BluechipTokensConfig): boolean;
|
|
311
|
+
/** Pick an intermediate bluechip token (priority: USDT > USDC > wNEAR; fallback to `wrapNearContractId`). */
|
|
312
|
+
declare function findBestBluechipToken(bluechipTokens: BluechipTokensConfig, wrapNearContractId?: string): TokenInfo;
|
|
313
|
+
/**
|
|
314
|
+
* Convert slippage input into bps (1 bps = 0.01%).
|
|
315
|
+
* - `>= 1`: bps (e.g. 50 = 0.5%)
|
|
316
|
+
* - `[0.01, 1)`: percent (e.g. 0.5 = 0.5%)
|
|
317
|
+
* - `(0, 0.01)`: decimal (e.g. 0.005 = 0.5%)
|
|
318
|
+
*/
|
|
319
|
+
declare function convertSlippageToBasisPoints(slippage: number): number;
|
|
320
|
+
/** Normalize NearIntents `destinationAsset` (prefix + `near` -> `wrap.near`). */
|
|
321
|
+
declare function normalizeDestinationAsset(assetId: string, wrapNearContractId?: string): string;
|
|
322
|
+
/**
|
|
323
|
+
* Format gas value from yoctoNEAR to Tgas string, avoiding scientific notation.
|
|
324
|
+
* @param gasInYoctoNEAR Gas value in yoctoNEAR (string or number)
|
|
325
|
+
* @returns Formatted gas string in Tgas units (e.g., "795" for 795 Tgas)
|
|
326
|
+
*/
|
|
327
|
+
declare function formatGasToTgas(gasInYoctoNEAR: string | number): string;
|
|
328
|
+
/**
|
|
329
|
+
* Ensure gas value is a string without scientific notation.
|
|
330
|
+
* This is used to format gas values before passing to wallet selector.
|
|
331
|
+
* @param gas Gas value (string, number, or BigInt)
|
|
332
|
+
* @returns Formatted gas string in yoctoNEAR
|
|
333
|
+
*/
|
|
334
|
+
declare function formatGasString(gas: string | number | bigint): string;
|
|
335
|
+
|
|
336
|
+
/** NEAR DEX router implementation (FindPath for routing + REF for execution). */
|
|
337
|
+
|
|
338
|
+
interface NearSmartRouterConfig {
|
|
339
|
+
findPathAdapter: FindPathAdapter;
|
|
340
|
+
nearChainAdapter: NearChainAdapter;
|
|
341
|
+
configAdapter: ConfigAdapter;
|
|
342
|
+
}
|
|
343
|
+
declare class NearSmartRouter implements DexRouter {
|
|
344
|
+
private findPathAdapter;
|
|
345
|
+
private nearChainAdapter;
|
|
346
|
+
private configAdapter;
|
|
347
|
+
private wrapNearContractId;
|
|
348
|
+
private refExchangeId;
|
|
349
|
+
private tokenStorageDepositRead;
|
|
350
|
+
constructor(config: NearSmartRouterConfig);
|
|
351
|
+
/**
|
|
352
|
+
* Get a swap quote (normalizes token ids and queries FindPath for routes).
|
|
353
|
+
*/
|
|
354
|
+
quote(params: QuoteParams): Promise<QuoteResult>;
|
|
355
|
+
/**
|
|
356
|
+
* Execute a swap: optionally adds `storage_deposit` for the recipient, then calls REF via `ft_transfer_call`.
|
|
357
|
+
*/
|
|
358
|
+
executeSwap(params: ExecuteParams): Promise<ExecuteResult>;
|
|
359
|
+
/**
|
|
360
|
+
* Get Router capabilities
|
|
361
|
+
*/
|
|
362
|
+
getCapabilities(): RouterCapabilities;
|
|
363
|
+
/**
|
|
364
|
+
* Get supported chain
|
|
365
|
+
*/
|
|
366
|
+
getSupportedChain(): "near";
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/** V2 Router implementation (Aggregate DEX Router). */
|
|
370
|
+
|
|
371
|
+
interface AggregateDexRouterConfig {
|
|
372
|
+
swapMultiDexPathAdapter: SwapMultiDexPathAdapter;
|
|
373
|
+
nearChainAdapter: NearChainAdapter;
|
|
374
|
+
configAdapter: ConfigAdapter;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* V2 Router implementation for NEAR
|
|
378
|
+
* Uses Aggregate DEX contract for routing
|
|
379
|
+
*/
|
|
380
|
+
declare class AggregateDexRouter implements DexRouter {
|
|
381
|
+
private swapMultiDexPathAdapter;
|
|
382
|
+
private nearChainAdapter;
|
|
383
|
+
private configAdapter;
|
|
384
|
+
private aggregateDexContractId;
|
|
385
|
+
private wrapNearContractId;
|
|
386
|
+
private readonly NEW_ACCOUNT_STORAGE_COST;
|
|
387
|
+
private readonly ONE_YOCTO_NEAR;
|
|
388
|
+
constructor(config: AggregateDexRouterConfig);
|
|
389
|
+
/**
|
|
390
|
+
* Get Router capabilities
|
|
391
|
+
*/
|
|
392
|
+
getCapabilities(): RouterCapabilities;
|
|
393
|
+
getSupportedChain(): "near";
|
|
394
|
+
/**
|
|
395
|
+
* Get a swap quote from V2 Router API
|
|
396
|
+
*/
|
|
397
|
+
quote(params: QuoteParams): Promise<QuoteResult>;
|
|
398
|
+
/**
|
|
399
|
+
* Finalize quote with depositAddress (deprecated)
|
|
400
|
+
*
|
|
401
|
+
* @deprecated No longer needed. executeSwap automatically fetches final quote using receiveUser (depositAddress).
|
|
402
|
+
* Kept for interface compatibility only.
|
|
403
|
+
*/
|
|
404
|
+
finalizeQuote(params: QuoteParams, depositAddress: string): Promise<QuoteResult>;
|
|
405
|
+
/**
|
|
406
|
+
* Execute swap with V2 Router
|
|
407
|
+
* Automatically fetches final quote using receiveUser (depositAddress) to ensure correct routerMsg and signature.
|
|
408
|
+
*/
|
|
409
|
+
executeSwap(params: ExecuteParams): Promise<ExecuteResult>;
|
|
410
|
+
/**
|
|
411
|
+
* Query user token registration status in AGGREGATE_DEX contract
|
|
412
|
+
*/
|
|
413
|
+
private queryUserTokensRegistered;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/** Composite quote: optional NEAR DEX pre-swap + NearIntents quote. */
|
|
417
|
+
|
|
418
|
+
interface CompleteQuoteParams {
|
|
419
|
+
sourceToken: TokenInfo;
|
|
420
|
+
targetToken: TokenInfo;
|
|
421
|
+
sourceChain: string;
|
|
422
|
+
targetChain: string;
|
|
423
|
+
amountIn: string;
|
|
424
|
+
slippage: number;
|
|
425
|
+
recipient: string;
|
|
426
|
+
refundTo?: string;
|
|
427
|
+
}
|
|
428
|
+
interface CompleteQuoteResult {
|
|
429
|
+
intents: {
|
|
430
|
+
/** Raw NearIntents response (passed through). */
|
|
431
|
+
quote: any;
|
|
432
|
+
depositAddress: string;
|
|
433
|
+
};
|
|
434
|
+
preSwap?: {
|
|
435
|
+
quote: QuoteResult;
|
|
436
|
+
tokenIn: TokenInfo;
|
|
437
|
+
tokenOut: TokenInfo;
|
|
438
|
+
executor: DexRouter;
|
|
439
|
+
};
|
|
440
|
+
finalAmountOut: string;
|
|
441
|
+
totalPriceImpact?: number;
|
|
442
|
+
totalFee?: number;
|
|
443
|
+
}
|
|
444
|
+
interface CompleteQuoteConfig {
|
|
445
|
+
intentsQuotationAdapter: IntentsQuotationAdapter;
|
|
446
|
+
dexRouters?: DexRouter[];
|
|
447
|
+
dexRouter?: DexRouter;
|
|
448
|
+
bluechipTokens: BluechipTokensConfig;
|
|
449
|
+
configAdapter: {
|
|
450
|
+
getWrapNearContractId(): string;
|
|
451
|
+
};
|
|
452
|
+
currentUserAddress?: string;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Build a "complete quote":
|
|
456
|
+
* - If `sourceToken` is not NearIntents-supported, pre-swap to a bluechip token on NEAR DEX.
|
|
457
|
+
* - Quote NearIntents using (pre-swap output) or `amountIn`.
|
|
458
|
+
*
|
|
459
|
+
* Notes:
|
|
460
|
+
* - Prefer `slippage` in bps (e.g. 50 = 0.5%); we also accept percent/decimal inputs.
|
|
461
|
+
* - `targetChain` is currently reserved for future use.
|
|
462
|
+
*/
|
|
463
|
+
declare function completeQuote(params: CompleteQuoteParams, config: CompleteQuoteConfig): Promise<CompleteQuoteResult>;
|
|
464
|
+
|
|
465
|
+
export { AggregateDexRouter, type AggregateDexRouterConfig, type BaseExecuteParams, type BaseQuoteParams, type BluechipTokenConfig, type BluechipTokensConfig, type CompleteQuoteConfig, type CompleteQuoteParams, type CompleteQuoteResult, type ConfigAdapter, type DexRouter, type ExecuteParams, type ExecuteResult, type FindPathAdapter, type FindPathResponse, type IntentsQuotationAdapter, type IntentsQuoteResult, type NearChainAdapter, NearSmartRouter, type NearSmartRouterConfig, type PoolInfo, type QuoteParams, type QuoteResult, type RecipientExecuteParams, type RecipientQuoteParams, type Route, type RouterCapabilities, type SimpleQuoteParams, type SupportedChain, type SwapMultiDexPathAdapter, type SwapMultiDexPathResponse, type TokenInfo, completeQuote, convertSlippageToBasisPoints, findBestBluechipToken, formatGasString, formatGasToTgas, getBluechipTokensConfig, isNearIntentsSupportedToken, logger, normalizeDestinationAsset, normalizeTokenId, requiresRecipient, requiresRecipientInExecute, setBluechipTokensConfig };
|