@rhea-finance/cross-chain-aggregation-dex 2.0.3 → 2.0.4
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 +24 -2
- package/dist/executors/aptos.d.mts +1 -1
- package/dist/executors/aptos.d.ts +1 -1
- package/dist/executors/bitcoin.d.mts +1 -1
- package/dist/executors/bitcoin.d.ts +1 -1
- package/dist/executors/evm.d.mts +1 -1
- package/dist/executors/evm.d.ts +1 -1
- package/dist/executors/near.d.mts +1 -1
- package/dist/executors/near.d.ts +1 -1
- package/dist/executors/solana.d.mts +1 -1
- package/dist/executors/solana.d.ts +1 -1
- package/dist/executors/sui.d.mts +1 -1
- package/dist/executors/sui.d.ts +1 -1
- package/dist/executors/tron.d.mts +1 -1
- package/dist/executors/tron.d.ts +1 -1
- package/dist/executors/zcash.d.mts +1 -1
- package/dist/executors/zcash.d.ts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -1
- package/dist/index.mjs.map +1 -1
- package/dist/{shared-BEZXY_BM.d.mts → shared-D0_DbMT2.d.mts} +7 -2
- package/dist/{shared-BEZXY_BM.d.ts → shared-D0_DbMT2.d.ts} +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -239,7 +239,29 @@ const quoteRequest: QuoteRequest = {
|
|
|
239
239
|
const quote = await client.quote(quoteRequest);
|
|
240
240
|
```
|
|
241
241
|
|
|
242
|
-
`quote()` calls `POST /api/swap/quote`. `quoteWaitingTimeMs`
|
|
242
|
+
`quote()` calls `POST /api/swap/quote`. The frontend can set `quoteWaitingTimeMs` on every `QuoteRequest` to control how long the quote service may wait for Near Intents and similar intent-based routes. The SDK sends `3000` when the field is omitted.
|
|
243
|
+
|
|
244
|
+
#### 3.3.1 Configure the Near Intents quote wait
|
|
245
|
+
|
|
246
|
+
`quoteWaitingTimeMs` is a first-class SDK parameter. Pass it directly to `client.quote()`; do not put it in `extensions` or an executor configuration.
|
|
247
|
+
|
|
248
|
+
```ts
|
|
249
|
+
// Frontend: allow Near Intents up to 5 seconds to return a route quote.
|
|
250
|
+
const quote = await client.quote({
|
|
251
|
+
...quoteRequest,
|
|
252
|
+
quoteWaitingTimeMs: 5000,
|
|
253
|
+
});
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
| Rule | Detail |
|
|
257
|
+
| --- | --- |
|
|
258
|
+
| Who sets it | The frontend or any other SDK caller, on each `client.quote(request)` call. |
|
|
259
|
+
| Unit and range | Milliseconds; must be a non-negative integer. |
|
|
260
|
+
| Default | `3000` (3 seconds) when omitted. Pass it explicitly when the product needs to control the Near Intents latency/route-availability tradeoff. |
|
|
261
|
+
| Typical use | Increase it, for example to `5000`–`10000`, when Near Intents needs more time to return a quote. Decrease it, for example to `0`–`1000`, when a faster response is more important than waiting for that route. |
|
|
262
|
+
| Scope | Quote aggregation for intent-based routes such as `nearintents` and `preswap-nearintents`. It also applies to MCA deposit/withdraw quote requests whose Near Intents previews are produced by the same quote call. |
|
|
263
|
+
|
|
264
|
+
This value limits the server-side route-quote wait only. It does **not** control the SDK HTTP request timeout, wallet signing, source-chain confirmation, bridge settlement, or `waitFor: "completed"` order polling. If the frontend configures a value close to or above the client's `timeoutMs`, increase `timeoutMs` enough to include the quote wait plus network overhead; otherwise the HTTP request may time out first.
|
|
243
265
|
|
|
244
266
|
### 3.4 Execute the swap directly
|
|
245
267
|
|
|
@@ -350,7 +372,7 @@ Terminal statuses are `completed`, `failed`, `refunded`, and `expired`.
|
|
|
350
372
|
| `tokenOut` | `AssetRef` | Yes | Asset being received. |
|
|
351
373
|
| `amountIn` | `string` | Yes | A non-negative base-unit decimal integer string. Do not pass `"1.5"` or scientific notation. |
|
|
352
374
|
| `slippageBps` | `number` | Yes | Slippage in basis points. `50` means 0.5%; `100` means 1%. |
|
|
353
|
-
| `quoteWaitingTimeMs` | `number` | No |
|
|
375
|
+
| `quoteWaitingTimeMs` | `number` | No | **Frontend-configurable Near Intents quote wait.** Milliseconds; must be a non-negative integer. Default: `3000`. See [Configure the Near Intents quote wait](#331-configure-the-near-intents-quote-wait). |
|
|
354
376
|
| `sender` | `string` | Yes | Sender address on the source chain. |
|
|
355
377
|
| `recipient` | `string` | No | Recipient address on the destination chain. Cross-chain requests should normally provide it explicitly. |
|
|
356
378
|
| `extensions` | `Record<string,unknown>` | No | Additional fields forwarded to the API. Regular applications should not use this to replace standard fields. |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-
|
|
1
|
+
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-D0_DbMT2.mjs';
|
|
2
2
|
|
|
3
3
|
interface AptosWalletAdapter extends ExecutorErrorAdapter {
|
|
4
4
|
getChain(): ChainRef | Promise<ChainRef>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-
|
|
1
|
+
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-D0_DbMT2.js';
|
|
2
2
|
|
|
3
3
|
interface AptosWalletAdapter extends ExecutorErrorAdapter {
|
|
4
4
|
getChain(): ChainRef | Promise<ChainRef>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-
|
|
1
|
+
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-D0_DbMT2.mjs';
|
|
2
2
|
|
|
3
3
|
interface BitcoinWalletAdapter extends ExecutorErrorAdapter {
|
|
4
4
|
getChain(): ChainRef | Promise<ChainRef>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-
|
|
1
|
+
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-D0_DbMT2.js';
|
|
2
2
|
|
|
3
3
|
interface BitcoinWalletAdapter extends ExecutorErrorAdapter {
|
|
4
4
|
getChain(): ChainRef | Promise<ChainRef>;
|
package/dist/executors/evm.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a4 as ExecutorErrorAdapter, V as EvmTx, a5 as TransactionSubmission, Y as EvmSigningRequest, X as EvmApproval, T as TransactionConfirmation, q as ChainExecutor } from '../shared-
|
|
1
|
+
import { a4 as ExecutorErrorAdapter, V as EvmTx, a5 as TransactionSubmission, Y as EvmSigningRequest, X as EvmApproval, T as TransactionConfirmation, q as ChainExecutor } from '../shared-D0_DbMT2.mjs';
|
|
2
2
|
|
|
3
3
|
interface EvmWalletAdapter extends ExecutorErrorAdapter {
|
|
4
4
|
sendTransaction(tx: EvmTx, options: {
|
package/dist/executors/evm.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a4 as ExecutorErrorAdapter, V as EvmTx, a5 as TransactionSubmission, Y as EvmSigningRequest, X as EvmApproval, T as TransactionConfirmation, q as ChainExecutor } from '../shared-
|
|
1
|
+
import { a4 as ExecutorErrorAdapter, V as EvmTx, a5 as TransactionSubmission, Y as EvmSigningRequest, X as EvmApproval, T as TransactionConfirmation, q as ChainExecutor } from '../shared-D0_DbMT2.js';
|
|
2
2
|
|
|
3
3
|
interface EvmWalletAdapter extends ExecutorErrorAdapter {
|
|
4
4
|
sendTransaction(tx: EvmTx, options: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a4 as ExecutorErrorAdapter, C as ChainRef, N as NearTransaction, T as TransactionConfirmation, q as ChainExecutor } from '../shared-
|
|
1
|
+
import { a4 as ExecutorErrorAdapter, C as ChainRef, N as NearTransaction, T as TransactionConfirmation, q as ChainExecutor } from '../shared-D0_DbMT2.mjs';
|
|
2
2
|
|
|
3
3
|
interface NearWalletAdapter extends ExecutorErrorAdapter {
|
|
4
4
|
getChain(): ChainRef | Promise<ChainRef>;
|
package/dist/executors/near.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a4 as ExecutorErrorAdapter, C as ChainRef, N as NearTransaction, T as TransactionConfirmation, q as ChainExecutor } from '../shared-
|
|
1
|
+
import { a4 as ExecutorErrorAdapter, C as ChainRef, N as NearTransaction, T as TransactionConfirmation, q as ChainExecutor } from '../shared-D0_DbMT2.js';
|
|
2
2
|
|
|
3
3
|
interface NearWalletAdapter extends ExecutorErrorAdapter {
|
|
4
4
|
getChain(): ChainRef | Promise<ChainRef>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a4 as ExecutorErrorAdapter, C as ChainRef, Z as SolanaMetadata, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-
|
|
1
|
+
import { a4 as ExecutorErrorAdapter, C as ChainRef, Z as SolanaMetadata, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-D0_DbMT2.mjs';
|
|
2
2
|
|
|
3
3
|
interface SolanaWalletAdapter extends ExecutorErrorAdapter {
|
|
4
4
|
getChain(): ChainRef | Promise<ChainRef>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a4 as ExecutorErrorAdapter, C as ChainRef, Z as SolanaMetadata, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-
|
|
1
|
+
import { a4 as ExecutorErrorAdapter, C as ChainRef, Z as SolanaMetadata, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-D0_DbMT2.js';
|
|
2
2
|
|
|
3
3
|
interface SolanaWalletAdapter extends ExecutorErrorAdapter {
|
|
4
4
|
getChain(): ChainRef | Promise<ChainRef>;
|
package/dist/executors/sui.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-
|
|
1
|
+
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-D0_DbMT2.mjs';
|
|
2
2
|
|
|
3
3
|
interface SuiWalletAdapter extends ExecutorErrorAdapter {
|
|
4
4
|
getChain(): ChainRef | Promise<ChainRef>;
|
package/dist/executors/sui.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-
|
|
1
|
+
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-D0_DbMT2.js';
|
|
2
2
|
|
|
3
3
|
interface SuiWalletAdapter extends ExecutorErrorAdapter {
|
|
4
4
|
getChain(): ChainRef | Promise<ChainRef>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-
|
|
1
|
+
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-D0_DbMT2.mjs';
|
|
2
2
|
|
|
3
3
|
interface TronWalletAdapter extends ExecutorErrorAdapter {
|
|
4
4
|
getChain(): ChainRef | Promise<ChainRef>;
|
package/dist/executors/tron.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-
|
|
1
|
+
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-D0_DbMT2.js';
|
|
2
2
|
|
|
3
3
|
interface TronWalletAdapter extends ExecutorErrorAdapter {
|
|
4
4
|
getChain(): ChainRef | Promise<ChainRef>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-
|
|
1
|
+
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-D0_DbMT2.mjs';
|
|
2
2
|
|
|
3
3
|
interface ZcashWalletAdapter extends ExecutorErrorAdapter {
|
|
4
4
|
getChain(): ChainRef | Promise<ChainRef>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-
|
|
1
|
+
import { a4 as ExecutorErrorAdapter, C as ChainRef, a5 as TransactionSubmission, T as TransactionConfirmation, q as ChainExecutor } from '../shared-D0_DbMT2.js';
|
|
2
2
|
|
|
3
3
|
interface ZcashWalletAdapter extends ExecutorErrorAdapter {
|
|
4
4
|
getChain(): ChainRef | Promise<ChainRef>;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SwapQuoteRequestRaw, a as SwapQuoteDataRaw, b as SwapBuildRequestRaw, c as SwapBuildDataRaw, d as SwapOrderSubmitRequestRaw, e as SwapOrderSubmitDataRaw, f as SwapOrderStatusParamsRaw, g as SwapOrderStatusDataRaw, h as SwapReportRequestRaw, i as SwapReportDataRaw, j as SwapHistoryParamsRaw, k as SwapHistoryDataRaw, Q as QuoteRequest, l as Quote, m as SwapMcaPayloadRaw, W as WaitMode, O as OrderPollingOptions, n as SwapLifecycleEvent, o as SwapExecutionResult, C as ChainRef, A as AssetRef, B as BaseUnitAmount, p as SwapHistoryRecordRaw, q as ChainExecutor, E as ExecutorRegistry, r as SwapBuild, s as ExecuteSwapInput, t as SwapInput, u as OrderStatusResult, v as WaitForOrderInput, N as NearTransaction, w as SwapMcaRelayerRequestRaw } from './shared-
|
|
2
|
-
export { a3 as BuildContext, K as ChainExecutionResult, $ as DepositInfo, X as EvmApproval, Y as EvmSigningRequest, V as EvmTx, L as ExecutionContext, P as ExecutorIdentityProvider, R as ExecutorMessageSigner, M as MessageSignOptions, _ as OrderReference, I as OrderStatus, a2 as RouteSummary, H as SignRequestPreview, Z as SolanaMetadata, x as SwapApiResponse, y as SwapApiTokenMetaRaw, F as SwapBuildApproveRaw, a1 as SwapExecution, z as SwapMcaSignerPayloadRaw, a0 as SwapReportContext, D as SwapSigningRequestRaw, G as SwapWarning, T as TransactionConfirmation, U as assertBaseUnitAmount, J as normalizeOrderStatus } from './shared-
|
|
1
|
+
import { S as SwapQuoteRequestRaw, a as SwapQuoteDataRaw, b as SwapBuildRequestRaw, c as SwapBuildDataRaw, d as SwapOrderSubmitRequestRaw, e as SwapOrderSubmitDataRaw, f as SwapOrderStatusParamsRaw, g as SwapOrderStatusDataRaw, h as SwapReportRequestRaw, i as SwapReportDataRaw, j as SwapHistoryParamsRaw, k as SwapHistoryDataRaw, Q as QuoteRequest, l as Quote, m as SwapMcaPayloadRaw, W as WaitMode, O as OrderPollingOptions, n as SwapLifecycleEvent, o as SwapExecutionResult, C as ChainRef, A as AssetRef, B as BaseUnitAmount, p as SwapHistoryRecordRaw, q as ChainExecutor, E as ExecutorRegistry, r as SwapBuild, s as ExecuteSwapInput, t as SwapInput, u as OrderStatusResult, v as WaitForOrderInput, N as NearTransaction, w as SwapMcaRelayerRequestRaw } from './shared-D0_DbMT2.mjs';
|
|
2
|
+
export { a3 as BuildContext, K as ChainExecutionResult, $ as DepositInfo, X as EvmApproval, Y as EvmSigningRequest, V as EvmTx, L as ExecutionContext, P as ExecutorIdentityProvider, R as ExecutorMessageSigner, M as MessageSignOptions, _ as OrderReference, I as OrderStatus, a2 as RouteSummary, H as SignRequestPreview, Z as SolanaMetadata, x as SwapApiResponse, y as SwapApiTokenMetaRaw, F as SwapBuildApproveRaw, a1 as SwapExecution, z as SwapMcaSignerPayloadRaw, a0 as SwapReportContext, D as SwapSigningRequestRaw, G as SwapWarning, T as TransactionConfirmation, U as assertBaseUnitAmount, J as normalizeOrderStatus } from './shared-D0_DbMT2.mjs';
|
|
3
3
|
|
|
4
4
|
type SwapErrorCode = "HTTP_ERROR" | "API_ERROR" | "RATE_LIMITED" | "AUTH_FAILED" | "REQUEST_ABORTED" | "REQUEST_TIMEOUT" | "INVALID_REQUEST" | "INVALID_API_RESPONSE" | "QUOTE_EXPIRED" | "ROUTE_NOT_FOUND" | "EXECUTOR_NOT_FOUND" | "UNSUPPORTED_CHAIN" | "CHAIN_MISMATCH" | "INVALID_TRANSACTION" | "USER_REJECTED" | "INSUFFICIENT_BALANCE" | "APPROVAL_FAILED" | "SIGNING_FAILED" | "BROADCAST_FAILED" | "ORDER_SUBMIT_FAILED" | "ORDER_TIMEOUT" | "REPORT_FAILED";
|
|
5
5
|
type SwapErrorStage = "quote" | "build" | "approve" | "sign" | "broadcast" | "submit" | "report" | "status" | "history";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SwapQuoteRequestRaw, a as SwapQuoteDataRaw, b as SwapBuildRequestRaw, c as SwapBuildDataRaw, d as SwapOrderSubmitRequestRaw, e as SwapOrderSubmitDataRaw, f as SwapOrderStatusParamsRaw, g as SwapOrderStatusDataRaw, h as SwapReportRequestRaw, i as SwapReportDataRaw, j as SwapHistoryParamsRaw, k as SwapHistoryDataRaw, Q as QuoteRequest, l as Quote, m as SwapMcaPayloadRaw, W as WaitMode, O as OrderPollingOptions, n as SwapLifecycleEvent, o as SwapExecutionResult, C as ChainRef, A as AssetRef, B as BaseUnitAmount, p as SwapHistoryRecordRaw, q as ChainExecutor, E as ExecutorRegistry, r as SwapBuild, s as ExecuteSwapInput, t as SwapInput, u as OrderStatusResult, v as WaitForOrderInput, N as NearTransaction, w as SwapMcaRelayerRequestRaw } from './shared-
|
|
2
|
-
export { a3 as BuildContext, K as ChainExecutionResult, $ as DepositInfo, X as EvmApproval, Y as EvmSigningRequest, V as EvmTx, L as ExecutionContext, P as ExecutorIdentityProvider, R as ExecutorMessageSigner, M as MessageSignOptions, _ as OrderReference, I as OrderStatus, a2 as RouteSummary, H as SignRequestPreview, Z as SolanaMetadata, x as SwapApiResponse, y as SwapApiTokenMetaRaw, F as SwapBuildApproveRaw, a1 as SwapExecution, z as SwapMcaSignerPayloadRaw, a0 as SwapReportContext, D as SwapSigningRequestRaw, G as SwapWarning, T as TransactionConfirmation, U as assertBaseUnitAmount, J as normalizeOrderStatus } from './shared-
|
|
1
|
+
import { S as SwapQuoteRequestRaw, a as SwapQuoteDataRaw, b as SwapBuildRequestRaw, c as SwapBuildDataRaw, d as SwapOrderSubmitRequestRaw, e as SwapOrderSubmitDataRaw, f as SwapOrderStatusParamsRaw, g as SwapOrderStatusDataRaw, h as SwapReportRequestRaw, i as SwapReportDataRaw, j as SwapHistoryParamsRaw, k as SwapHistoryDataRaw, Q as QuoteRequest, l as Quote, m as SwapMcaPayloadRaw, W as WaitMode, O as OrderPollingOptions, n as SwapLifecycleEvent, o as SwapExecutionResult, C as ChainRef, A as AssetRef, B as BaseUnitAmount, p as SwapHistoryRecordRaw, q as ChainExecutor, E as ExecutorRegistry, r as SwapBuild, s as ExecuteSwapInput, t as SwapInput, u as OrderStatusResult, v as WaitForOrderInput, N as NearTransaction, w as SwapMcaRelayerRequestRaw } from './shared-D0_DbMT2.js';
|
|
2
|
+
export { a3 as BuildContext, K as ChainExecutionResult, $ as DepositInfo, X as EvmApproval, Y as EvmSigningRequest, V as EvmTx, L as ExecutionContext, P as ExecutorIdentityProvider, R as ExecutorMessageSigner, M as MessageSignOptions, _ as OrderReference, I as OrderStatus, a2 as RouteSummary, H as SignRequestPreview, Z as SolanaMetadata, x as SwapApiResponse, y as SwapApiTokenMetaRaw, F as SwapBuildApproveRaw, a1 as SwapExecution, z as SwapMcaSignerPayloadRaw, a0 as SwapReportContext, D as SwapSigningRequestRaw, G as SwapWarning, T as TransactionConfirmation, U as assertBaseUnitAmount, J as normalizeOrderStatus } from './shared-D0_DbMT2.js';
|
|
3
3
|
|
|
4
4
|
type SwapErrorCode = "HTTP_ERROR" | "API_ERROR" | "RATE_LIMITED" | "AUTH_FAILED" | "REQUEST_ABORTED" | "REQUEST_TIMEOUT" | "INVALID_REQUEST" | "INVALID_API_RESPONSE" | "QUOTE_EXPIRED" | "ROUTE_NOT_FOUND" | "EXECUTOR_NOT_FOUND" | "UNSUPPORTED_CHAIN" | "CHAIN_MISMATCH" | "INVALID_TRANSACTION" | "USER_REJECTED" | "INSUFFICIENT_BALANCE" | "APPROVAL_FAILED" | "SIGNING_FAILED" | "BROADCAST_FAILED" | "ORDER_SUBMIT_FAILED" | "ORDER_TIMEOUT" | "REPORT_FAILED";
|
|
5
5
|
type SwapErrorStage = "quote" | "build" | "approve" | "sign" | "broadcast" | "submit" | "report" | "status" | "history";
|
package/dist/index.js
CHANGED
|
@@ -977,7 +977,7 @@ function normalizeQuote(request, raw, receivedAt = Date.now()) {
|
|
|
977
977
|
estimatedOut: bestRoute.amountOut,
|
|
978
978
|
minAmountOut: bestRoute.minAmountOut,
|
|
979
979
|
route: bestRoute,
|
|
980
|
-
alternatives: raw.allQuotes.flatMap((route) => {
|
|
980
|
+
alternatives: readQuoteAlternatives(raw.allQuotes).flatMap((route) => {
|
|
981
981
|
try {
|
|
982
982
|
const normalized = normalizeRoute(route, false);
|
|
983
983
|
return normalized ? [normalized] : [];
|
|
@@ -991,6 +991,13 @@ function normalizeQuote(request, raw, receivedAt = Date.now()) {
|
|
|
991
991
|
raw
|
|
992
992
|
};
|
|
993
993
|
}
|
|
994
|
+
function readQuoteAlternatives(value) {
|
|
995
|
+
if (!Array.isArray(value)) return [];
|
|
996
|
+
return value.filter(isRecord);
|
|
997
|
+
}
|
|
998
|
+
function isRecord(value) {
|
|
999
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1000
|
+
}
|
|
994
1001
|
function validateQuoteRequest(request) {
|
|
995
1002
|
assertBaseUnitAmount(request.amountIn);
|
|
996
1003
|
if (!Number.isInteger(request.slippageBps) || request.slippageBps < 0) {
|