@rhea-finance/cross-chain-aggregation-dex 2.0.9 → 2.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 +4 -4
- package/dist/index.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +19 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -35
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -382,7 +382,7 @@ if (result.status === "completed") {
|
|
|
382
382
|
}
|
|
383
383
|
```
|
|
384
384
|
|
|
385
|
-
`
|
|
385
|
+
After `POST /api/swap/report` returns an `id`, the SDK always polls `GET /api/swap/order-status?recordId=...`, including when `waitFor` is `"submitted"`. `"completed"` and `"source-confirmed"` also poll for cross-chain and confidential swaps when no report id is available, falling back to `orderId`/`router`/`chainId` or source `txHash`. Confidential swaps also require order-status polling when they are same-chain. For confidential Near Intents builds, the SDK uses `deposit.orderId` when present and otherwise uses `deposit.depositAddress` as the status key. If a cross-chain or confidential swap provides none of these identifiers, the SDK throws `INVALID_API_RESPONSE` at the `status` stage instead of treating source-chain confirmation as completion.
|
|
386
386
|
|
|
387
387
|
The default polling interval is 5 seconds. There is no default polling timeout, so polling continues until the order reaches a terminal state or the supplied `AbortSignal` is aborted.
|
|
388
388
|
|
|
@@ -497,7 +497,7 @@ Important normalized quote fields:
|
|
|
497
497
|
| --- | --- | --- | --- |
|
|
498
498
|
| `quote` | `Quote` | Yes | The value returned by `client.quote()`. Pass it directly without modification. |
|
|
499
499
|
| `waitFor` | `"submitted" \| "source-confirmed" \| "completed"` | No | Default: `"submitted"`. |
|
|
500
|
-
| `orderPolling` | `OrderPollingOptions` | No | Used
|
|
500
|
+
| `orderPolling` | `OrderPollingOptions` | No | Used when cross-chain or confidential swaps poll order status (`waitFor: "source-confirmed"` or `"completed"`). `intervalMs` defaults to `5000`; omit `timeoutMs` to poll indefinitely. |
|
|
501
501
|
| `signal` | `AbortSignal` | No | Cancels unfinished SDK requests or waits. It cannot withdraw an already broadcast transaction. |
|
|
502
502
|
| `onEvent` | `(event) => void` | No | Receives lifecycle events for this swap only. |
|
|
503
503
|
| `beforeSign` | `(preview) => void \| Promise<void>` | No | Called before each wallet signature or transaction request. It can be used for application confirmation UI. |
|
|
@@ -508,8 +508,8 @@ Wait modes:
|
|
|
508
508
|
| Mode | Return condition |
|
|
509
509
|
| --- | --- |
|
|
510
510
|
| `submitted` | Returns after the wallet signs or broadcasts the source action. |
|
|
511
|
-
| `source-confirmed` |
|
|
512
|
-
| `completed` |
|
|
511
|
+
| `source-confirmed` | Waits for source-chain confirmation, then reports and polls `/api/swap/order-status` (preferring the report `recordId`) for cross-chain and confidential swaps. A `failed` or malformed source confirmation throws `BROADCAST_FAILED`. |
|
|
512
|
+
| `completed` | Same delivery polling as `source-confirmed`, but also waits through any required source confirmation first. Same-chain confidential swaps are included. A cross-chain or confidential swap without a usable status key fails at the `status` stage instead of being reported as completed. |
|
|
513
513
|
|
|
514
514
|
`waitForOrder()` accepts the same polling values directly:
|
|
515
515
|
|
package/dist/index.d.mts
CHANGED
|
@@ -375,6 +375,14 @@ interface BuildMcaWithdrawRelayerRequestInput {
|
|
|
375
375
|
}
|
|
376
376
|
declare function buildMcaWithdrawRelayerRequest(input: BuildMcaWithdrawRelayerRequestInput): SwapBuildRequestRaw;
|
|
377
377
|
|
|
378
|
+
/** Poll order-status after a report id, or for tracked swaps that wait past broadcast. */
|
|
379
|
+
declare function shouldPollSwapOrderStatus(input: {
|
|
380
|
+
waitFor?: WaitMode;
|
|
381
|
+
isCrossChain: boolean;
|
|
382
|
+
confidentiality?: string;
|
|
383
|
+
/** Present when POST /api/swap/report returned a history row id. */
|
|
384
|
+
reportRecordId?: string;
|
|
385
|
+
}): boolean;
|
|
378
386
|
declare function resolveSwapReportRecordId(reportData: unknown): string;
|
|
379
387
|
type OrderStatusLookup = OrderReference;
|
|
380
388
|
/** Matches multi-chain-lending `resolveSwapOrderStatusQuery` query shape. */
|
|
@@ -396,4 +404,4 @@ declare function resolveSourceTxHash(input: {
|
|
|
396
404
|
declare function parseUnits(value: string, decimals: number): BaseUnitAmount;
|
|
397
405
|
declare function formatUnits(value: BaseUnitAmount, decimals: number): string;
|
|
398
406
|
|
|
399
|
-
export { ApiClient, type ApiClientConfig, type ApiRequestOptions, AssetRef, BaseUnitAmount, type BuildMcaWithdrawRelayerRequestInput, type BuildNearMcaWithdrawTransactionsInput, type BuildSwapInput, ChainExecutor, ChainRef, DEFAULT_MCA_SIGNER_PRIORITY, ExecuteSwapInput, ExecutorRegistry, type ExtractMcaWithdrawDepositAddressInput, type HistoryRequest, type HistoryStatus, type McaDepositCollateral, type McaDepositQuote, type McaDepositQuoteRequest, type McaFlow, type McaQuote, type McaQuoteRequest, type McaSignerChain, type McaSignerIdentity, type McaSwapInput, type McaSwapResult, type McaWalletDescriptor, type McaWalletKey, type McaWithdrawCollateral, type McaWithdrawNearQuote, type McaWithdrawQuoteRequest, type McaWithdrawRelayerQuote, NearTransaction, OrderPollingOptions, OrderReference, type OrderStatusLookup, OrderStatusResult, Quote, QuoteRequest, type ResolveMcaRequiredCollateralDecreaseInput, type ResolveMcaWithdrawPolicyInput, type RetryConfig, type SdkLogEntry, type SdkLogLevel, type SdkLogger, SwapBuild, SwapBuildDataRaw, SwapBuildRequestRaw, SwapClient, type SwapClientConfig, SwapCrossChainToTokensDataRaw, type SwapErrorCode, type SwapErrorStage, SwapExecutionResult, SwapFromTokensDataRaw, SwapHistoryAuthChallengeRaw, SwapHistoryAuthChallengeRequestRaw, SwapHistoryAuthProofRaw, SwapHistoryAuthTokenRaw, SwapHistoryAuthVerifyRequestRaw, SwapHistoryDataRaw, type SwapHistoryItem, type SwapHistoryPage, SwapHistoryParamsRaw, SwapHistoryRecordRaw, SwapInput, SwapLifecycleEvent, SwapMcaPayloadRaw, SwapMcaRelayerRequestRaw, SwapOrderStatusDataRaw, SwapOrderStatusParamsRaw, SwapOrderSubmitDataRaw, SwapOrderSubmitRequestRaw, SwapQuoteDataRaw, SwapQuoteRequestRaw, SwapReportDataRaw, SwapReportRequestRaw, SwapSdkError, type SwapSdkErrorOptions, type SwapTokenListItem, type TokenListRequest, WaitForOrderInput, WaitMode, asSwapSdkError, assertOrderStatusParams, buildMcaWithdrawRelayerRequest, buildNearMcaWithdrawTransactions, buildOrderStatusQuery, createExecutionId, extractMcaWithdrawBusiness, extractMcaWithdrawDepositAddress, extractMcaWithdrawSignerWallet, formatMcaWallet, formatUnits, fromApiChain, isSameMcaSignerIdentity, normalizeBuild, normalizeCrossChainToTokenList, normalizeFromTokenList, normalizeHistory, normalizeHistoryStatus, normalizeMcaQuote, normalizeQuote, orderStatusParamsFromHistoryItem, parseUnits, resolveMcaDecreaseCollateral, resolveMcaRequiredCollateralDecrease, resolveMcaWithdrawPolicy, resolveOrderStatusLookup, resolveSourceTxHash, resolveSwapReportRecordId, selectMcaSigner, serializeMcaQuoteRequest, serializeQuoteRequest, toApiAssetAddress, toApiChain };
|
|
407
|
+
export { ApiClient, type ApiClientConfig, type ApiRequestOptions, AssetRef, BaseUnitAmount, type BuildMcaWithdrawRelayerRequestInput, type BuildNearMcaWithdrawTransactionsInput, type BuildSwapInput, ChainExecutor, ChainRef, DEFAULT_MCA_SIGNER_PRIORITY, ExecuteSwapInput, ExecutorRegistry, type ExtractMcaWithdrawDepositAddressInput, type HistoryRequest, type HistoryStatus, type McaDepositCollateral, type McaDepositQuote, type McaDepositQuoteRequest, type McaFlow, type McaQuote, type McaQuoteRequest, type McaSignerChain, type McaSignerIdentity, type McaSwapInput, type McaSwapResult, type McaWalletDescriptor, type McaWalletKey, type McaWithdrawCollateral, type McaWithdrawNearQuote, type McaWithdrawQuoteRequest, type McaWithdrawRelayerQuote, NearTransaction, OrderPollingOptions, OrderReference, type OrderStatusLookup, OrderStatusResult, Quote, QuoteRequest, type ResolveMcaRequiredCollateralDecreaseInput, type ResolveMcaWithdrawPolicyInput, type RetryConfig, type SdkLogEntry, type SdkLogLevel, type SdkLogger, SwapBuild, SwapBuildDataRaw, SwapBuildRequestRaw, SwapClient, type SwapClientConfig, SwapCrossChainToTokensDataRaw, type SwapErrorCode, type SwapErrorStage, SwapExecutionResult, SwapFromTokensDataRaw, SwapHistoryAuthChallengeRaw, SwapHistoryAuthChallengeRequestRaw, SwapHistoryAuthProofRaw, SwapHistoryAuthTokenRaw, SwapHistoryAuthVerifyRequestRaw, SwapHistoryDataRaw, type SwapHistoryItem, type SwapHistoryPage, SwapHistoryParamsRaw, SwapHistoryRecordRaw, SwapInput, SwapLifecycleEvent, SwapMcaPayloadRaw, SwapMcaRelayerRequestRaw, SwapOrderStatusDataRaw, SwapOrderStatusParamsRaw, SwapOrderSubmitDataRaw, SwapOrderSubmitRequestRaw, SwapQuoteDataRaw, SwapQuoteRequestRaw, SwapReportDataRaw, SwapReportRequestRaw, SwapSdkError, type SwapSdkErrorOptions, type SwapTokenListItem, type TokenListRequest, WaitForOrderInput, WaitMode, asSwapSdkError, assertOrderStatusParams, buildMcaWithdrawRelayerRequest, buildNearMcaWithdrawTransactions, buildOrderStatusQuery, createExecutionId, extractMcaWithdrawBusiness, extractMcaWithdrawDepositAddress, extractMcaWithdrawSignerWallet, formatMcaWallet, formatUnits, fromApiChain, isSameMcaSignerIdentity, normalizeBuild, normalizeCrossChainToTokenList, normalizeFromTokenList, normalizeHistory, normalizeHistoryStatus, normalizeMcaQuote, normalizeQuote, orderStatusParamsFromHistoryItem, parseUnits, resolveMcaDecreaseCollateral, resolveMcaRequiredCollateralDecrease, resolveMcaWithdrawPolicy, resolveOrderStatusLookup, resolveSourceTxHash, resolveSwapReportRecordId, selectMcaSigner, serializeMcaQuoteRequest, serializeQuoteRequest, shouldPollSwapOrderStatus, toApiAssetAddress, toApiChain };
|
package/dist/index.d.ts
CHANGED
|
@@ -375,6 +375,14 @@ interface BuildMcaWithdrawRelayerRequestInput {
|
|
|
375
375
|
}
|
|
376
376
|
declare function buildMcaWithdrawRelayerRequest(input: BuildMcaWithdrawRelayerRequestInput): SwapBuildRequestRaw;
|
|
377
377
|
|
|
378
|
+
/** Poll order-status after a report id, or for tracked swaps that wait past broadcast. */
|
|
379
|
+
declare function shouldPollSwapOrderStatus(input: {
|
|
380
|
+
waitFor?: WaitMode;
|
|
381
|
+
isCrossChain: boolean;
|
|
382
|
+
confidentiality?: string;
|
|
383
|
+
/** Present when POST /api/swap/report returned a history row id. */
|
|
384
|
+
reportRecordId?: string;
|
|
385
|
+
}): boolean;
|
|
378
386
|
declare function resolveSwapReportRecordId(reportData: unknown): string;
|
|
379
387
|
type OrderStatusLookup = OrderReference;
|
|
380
388
|
/** Matches multi-chain-lending `resolveSwapOrderStatusQuery` query shape. */
|
|
@@ -396,4 +404,4 @@ declare function resolveSourceTxHash(input: {
|
|
|
396
404
|
declare function parseUnits(value: string, decimals: number): BaseUnitAmount;
|
|
397
405
|
declare function formatUnits(value: BaseUnitAmount, decimals: number): string;
|
|
398
406
|
|
|
399
|
-
export { ApiClient, type ApiClientConfig, type ApiRequestOptions, AssetRef, BaseUnitAmount, type BuildMcaWithdrawRelayerRequestInput, type BuildNearMcaWithdrawTransactionsInput, type BuildSwapInput, ChainExecutor, ChainRef, DEFAULT_MCA_SIGNER_PRIORITY, ExecuteSwapInput, ExecutorRegistry, type ExtractMcaWithdrawDepositAddressInput, type HistoryRequest, type HistoryStatus, type McaDepositCollateral, type McaDepositQuote, type McaDepositQuoteRequest, type McaFlow, type McaQuote, type McaQuoteRequest, type McaSignerChain, type McaSignerIdentity, type McaSwapInput, type McaSwapResult, type McaWalletDescriptor, type McaWalletKey, type McaWithdrawCollateral, type McaWithdrawNearQuote, type McaWithdrawQuoteRequest, type McaWithdrawRelayerQuote, NearTransaction, OrderPollingOptions, OrderReference, type OrderStatusLookup, OrderStatusResult, Quote, QuoteRequest, type ResolveMcaRequiredCollateralDecreaseInput, type ResolveMcaWithdrawPolicyInput, type RetryConfig, type SdkLogEntry, type SdkLogLevel, type SdkLogger, SwapBuild, SwapBuildDataRaw, SwapBuildRequestRaw, SwapClient, type SwapClientConfig, SwapCrossChainToTokensDataRaw, type SwapErrorCode, type SwapErrorStage, SwapExecutionResult, SwapFromTokensDataRaw, SwapHistoryAuthChallengeRaw, SwapHistoryAuthChallengeRequestRaw, SwapHistoryAuthProofRaw, SwapHistoryAuthTokenRaw, SwapHistoryAuthVerifyRequestRaw, SwapHistoryDataRaw, type SwapHistoryItem, type SwapHistoryPage, SwapHistoryParamsRaw, SwapHistoryRecordRaw, SwapInput, SwapLifecycleEvent, SwapMcaPayloadRaw, SwapMcaRelayerRequestRaw, SwapOrderStatusDataRaw, SwapOrderStatusParamsRaw, SwapOrderSubmitDataRaw, SwapOrderSubmitRequestRaw, SwapQuoteDataRaw, SwapQuoteRequestRaw, SwapReportDataRaw, SwapReportRequestRaw, SwapSdkError, type SwapSdkErrorOptions, type SwapTokenListItem, type TokenListRequest, WaitForOrderInput, WaitMode, asSwapSdkError, assertOrderStatusParams, buildMcaWithdrawRelayerRequest, buildNearMcaWithdrawTransactions, buildOrderStatusQuery, createExecutionId, extractMcaWithdrawBusiness, extractMcaWithdrawDepositAddress, extractMcaWithdrawSignerWallet, formatMcaWallet, formatUnits, fromApiChain, isSameMcaSignerIdentity, normalizeBuild, normalizeCrossChainToTokenList, normalizeFromTokenList, normalizeHistory, normalizeHistoryStatus, normalizeMcaQuote, normalizeQuote, orderStatusParamsFromHistoryItem, parseUnits, resolveMcaDecreaseCollateral, resolveMcaRequiredCollateralDecrease, resolveMcaWithdrawPolicy, resolveOrderStatusLookup, resolveSourceTxHash, resolveSwapReportRecordId, selectMcaSigner, serializeMcaQuoteRequest, serializeQuoteRequest, toApiAssetAddress, toApiChain };
|
|
407
|
+
export { ApiClient, type ApiClientConfig, type ApiRequestOptions, AssetRef, BaseUnitAmount, type BuildMcaWithdrawRelayerRequestInput, type BuildNearMcaWithdrawTransactionsInput, type BuildSwapInput, ChainExecutor, ChainRef, DEFAULT_MCA_SIGNER_PRIORITY, ExecuteSwapInput, ExecutorRegistry, type ExtractMcaWithdrawDepositAddressInput, type HistoryRequest, type HistoryStatus, type McaDepositCollateral, type McaDepositQuote, type McaDepositQuoteRequest, type McaFlow, type McaQuote, type McaQuoteRequest, type McaSignerChain, type McaSignerIdentity, type McaSwapInput, type McaSwapResult, type McaWalletDescriptor, type McaWalletKey, type McaWithdrawCollateral, type McaWithdrawNearQuote, type McaWithdrawQuoteRequest, type McaWithdrawRelayerQuote, NearTransaction, OrderPollingOptions, OrderReference, type OrderStatusLookup, OrderStatusResult, Quote, QuoteRequest, type ResolveMcaRequiredCollateralDecreaseInput, type ResolveMcaWithdrawPolicyInput, type RetryConfig, type SdkLogEntry, type SdkLogLevel, type SdkLogger, SwapBuild, SwapBuildDataRaw, SwapBuildRequestRaw, SwapClient, type SwapClientConfig, SwapCrossChainToTokensDataRaw, type SwapErrorCode, type SwapErrorStage, SwapExecutionResult, SwapFromTokensDataRaw, SwapHistoryAuthChallengeRaw, SwapHistoryAuthChallengeRequestRaw, SwapHistoryAuthProofRaw, SwapHistoryAuthTokenRaw, SwapHistoryAuthVerifyRequestRaw, SwapHistoryDataRaw, type SwapHistoryItem, type SwapHistoryPage, SwapHistoryParamsRaw, SwapHistoryRecordRaw, SwapInput, SwapLifecycleEvent, SwapMcaPayloadRaw, SwapMcaRelayerRequestRaw, SwapOrderStatusDataRaw, SwapOrderStatusParamsRaw, SwapOrderSubmitDataRaw, SwapOrderSubmitRequestRaw, SwapQuoteDataRaw, SwapQuoteRequestRaw, SwapReportDataRaw, SwapReportRequestRaw, SwapSdkError, type SwapSdkErrorOptions, type SwapTokenListItem, type TokenListRequest, WaitForOrderInput, WaitMode, asSwapSdkError, assertOrderStatusParams, buildMcaWithdrawRelayerRequest, buildNearMcaWithdrawTransactions, buildOrderStatusQuery, createExecutionId, extractMcaWithdrawBusiness, extractMcaWithdrawDepositAddress, extractMcaWithdrawSignerWallet, formatMcaWallet, formatUnits, fromApiChain, isSameMcaSignerIdentity, normalizeBuild, normalizeCrossChainToTokenList, normalizeFromTokenList, normalizeHistory, normalizeHistoryStatus, normalizeMcaQuote, normalizeQuote, orderStatusParamsFromHistoryItem, parseUnits, resolveMcaDecreaseCollateral, resolveMcaRequiredCollateralDecrease, resolveMcaWithdrawPolicy, resolveOrderStatusLookup, resolveSourceTxHash, resolveSwapReportRecordId, selectMcaSigner, serializeMcaQuoteRequest, serializeQuoteRequest, shouldPollSwapOrderStatus, toApiAssetAddress, toApiChain };
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,12 @@ function asSwapSdkError(error, stage) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// src/utils/orderStatus.ts
|
|
32
|
+
function shouldPollSwapOrderStatus(input) {
|
|
33
|
+
if (String(input.reportRecordId ?? "").trim()) return true;
|
|
34
|
+
const waitMode = input.waitFor ?? "submitted";
|
|
35
|
+
const requiresOrderStatus = input.isCrossChain || input.confidentiality === "basic";
|
|
36
|
+
return requiresOrderStatus && waitMode !== "submitted";
|
|
37
|
+
}
|
|
32
38
|
function resolveSwapReportRecordId(reportData) {
|
|
33
39
|
if (!reportData || typeof reportData !== "object") return "";
|
|
34
40
|
const record = reportData;
|
|
@@ -2064,41 +2070,13 @@ var McaSwapService = class {
|
|
|
2064
2070
|
"MCA NEAR withdraw is missing a status deposit address"
|
|
2065
2071
|
);
|
|
2066
2072
|
}
|
|
2067
|
-
|
|
2073
|
+
return this.client.executeSwap({
|
|
2068
2074
|
build,
|
|
2069
2075
|
waitFor: input.quote.executionMode === "withdraw-near" && input.waitFor === "completed" ? "source-confirmed" : input.waitFor,
|
|
2070
2076
|
orderPolling: input.orderPolling,
|
|
2071
2077
|
signal: input.signal,
|
|
2072
2078
|
onEvent: input.onEvent
|
|
2073
2079
|
});
|
|
2074
|
-
if (input.quote.executionMode === "withdraw-near" && input.waitFor === "completed") {
|
|
2075
|
-
const statusLookup = resolveOrderStatusLookup({
|
|
2076
|
-
recordId: result.report?.recordId,
|
|
2077
|
-
orderId: nearStatusKey,
|
|
2078
|
-
router: input.quote.route.router
|
|
2079
|
-
}) ?? { orderId: nearStatusKey, router: input.quote.route.router };
|
|
2080
|
-
const status = await this.client.waitForOrder({
|
|
2081
|
-
...statusLookup,
|
|
2082
|
-
...input.orderPolling,
|
|
2083
|
-
signal: input.signal
|
|
2084
|
-
});
|
|
2085
|
-
this.emitEvent(
|
|
2086
|
-
{
|
|
2087
|
-
type: "order-status",
|
|
2088
|
-
executionId: result.executionId,
|
|
2089
|
-
status: status.status
|
|
2090
|
-
},
|
|
2091
|
-
input.onEvent
|
|
2092
|
-
);
|
|
2093
|
-
result.status = status.status === "unknown" || status.status === "pending" ? "processing" : status.status;
|
|
2094
|
-
if (status.status === "completed") {
|
|
2095
|
-
this.emitEvent(
|
|
2096
|
-
{ type: "completed", executionId: result.executionId },
|
|
2097
|
-
input.onEvent
|
|
2098
|
-
);
|
|
2099
|
-
}
|
|
2100
|
-
}
|
|
2101
|
-
return result;
|
|
2102
2080
|
}
|
|
2103
2081
|
reportIfManaged(result) {
|
|
2104
2082
|
const request = this.relayerReports.get(result.executionId);
|
|
@@ -2608,13 +2586,13 @@ var SwapClient = class {
|
|
|
2608
2586
|
executionId: build.executionId
|
|
2609
2587
|
});
|
|
2610
2588
|
}
|
|
2611
|
-
const
|
|
2612
|
-
const
|
|
2589
|
+
const waitMode = input.waitFor ?? "submitted";
|
|
2590
|
+
const requiresTrackedStatus = build.isCrossChain || build.request?.confidentiality === "basic";
|
|
2613
2591
|
const reportRequest = this.createReportRequest(build, result);
|
|
2614
2592
|
if (reportRequest) {
|
|
2615
2593
|
this.reportRequests.set(build.executionId, reportRequest);
|
|
2616
2594
|
}
|
|
2617
|
-
const mustReportForStatus =
|
|
2595
|
+
const mustReportForStatus = requiresTrackedStatus && waitMode !== "submitted" && Boolean(reportRequest);
|
|
2618
2596
|
const shouldReportNow = Boolean(reportRequest) && this.reportMode !== "disabled" && (this.reportMode === "auto" || mustReportForStatus);
|
|
2619
2597
|
let reportRecordId;
|
|
2620
2598
|
if (shouldReportNow && reportRequest) {
|
|
@@ -2637,6 +2615,12 @@ var SwapClient = class {
|
|
|
2637
2615
|
emit({ type: "warning", executionId: build.executionId, warning });
|
|
2638
2616
|
}
|
|
2639
2617
|
}
|
|
2618
|
+
const shouldPollOrderStatus = shouldPollSwapOrderStatus({
|
|
2619
|
+
waitFor: waitMode,
|
|
2620
|
+
isCrossChain: build.isCrossChain,
|
|
2621
|
+
confidentiality: build.request?.confidentiality,
|
|
2622
|
+
reportRecordId
|
|
2623
|
+
});
|
|
2640
2624
|
const statusLookup = resolveOrderStatusLookup({
|
|
2641
2625
|
recordId: reportRecordId ?? result.report?.recordId,
|
|
2642
2626
|
orderId,
|
|
@@ -2644,7 +2628,7 @@ var SwapClient = class {
|
|
|
2644
2628
|
router: orderRouter ?? build.router,
|
|
2645
2629
|
chainId: orderChainId
|
|
2646
2630
|
});
|
|
2647
|
-
if (
|
|
2631
|
+
if (shouldPollOrderStatus && !statusLookup) {
|
|
2648
2632
|
throw new SwapSdkError(
|
|
2649
2633
|
"INVALID_API_RESPONSE",
|
|
2650
2634
|
"status",
|
|
@@ -2657,7 +2641,7 @@ var SwapClient = class {
|
|
|
2657
2641
|
}
|
|
2658
2642
|
);
|
|
2659
2643
|
}
|
|
2660
|
-
if (
|
|
2644
|
+
if (shouldPollOrderStatus && statusLookup) {
|
|
2661
2645
|
const status = await this.waitForOrder({
|
|
2662
2646
|
...statusLookup,
|
|
2663
2647
|
...input.orderPolling,
|
|
@@ -2959,6 +2943,7 @@ exports.resolveSwapReportRecordId = resolveSwapReportRecordId;
|
|
|
2959
2943
|
exports.selectMcaSigner = selectMcaSigner;
|
|
2960
2944
|
exports.serializeMcaQuoteRequest = serializeMcaQuoteRequest;
|
|
2961
2945
|
exports.serializeQuoteRequest = serializeQuoteRequest;
|
|
2946
|
+
exports.shouldPollSwapOrderStatus = shouldPollSwapOrderStatus;
|
|
2962
2947
|
exports.toApiAssetAddress = toApiAssetAddress;
|
|
2963
2948
|
exports.toApiChain = toApiChain;
|
|
2964
2949
|
//# sourceMappingURL=index.js.map
|