@rhea-finance/cross-chain-aggregation-dex 2.1.0 → 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 +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -6
- 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
|
|
package/dist/index.d.mts
CHANGED
|
@@ -375,11 +375,13 @@ interface BuildMcaWithdrawRelayerRequestInput {
|
|
|
375
375
|
}
|
|
376
376
|
declare function buildMcaWithdrawRelayerRequest(input: BuildMcaWithdrawRelayerRequestInput): SwapBuildRequestRaw;
|
|
377
377
|
|
|
378
|
-
/**
|
|
378
|
+
/** Poll order-status after a report id, or for tracked swaps that wait past broadcast. */
|
|
379
379
|
declare function shouldPollSwapOrderStatus(input: {
|
|
380
380
|
waitFor?: WaitMode;
|
|
381
381
|
isCrossChain: boolean;
|
|
382
382
|
confidentiality?: string;
|
|
383
|
+
/** Present when POST /api/swap/report returned a history row id. */
|
|
384
|
+
reportRecordId?: string;
|
|
383
385
|
}): boolean;
|
|
384
386
|
declare function resolveSwapReportRecordId(reportData: unknown): string;
|
|
385
387
|
type OrderStatusLookup = OrderReference;
|
package/dist/index.d.ts
CHANGED
|
@@ -375,11 +375,13 @@ interface BuildMcaWithdrawRelayerRequestInput {
|
|
|
375
375
|
}
|
|
376
376
|
declare function buildMcaWithdrawRelayerRequest(input: BuildMcaWithdrawRelayerRequestInput): SwapBuildRequestRaw;
|
|
377
377
|
|
|
378
|
-
/**
|
|
378
|
+
/** Poll order-status after a report id, or for tracked swaps that wait past broadcast. */
|
|
379
379
|
declare function shouldPollSwapOrderStatus(input: {
|
|
380
380
|
waitFor?: WaitMode;
|
|
381
381
|
isCrossChain: boolean;
|
|
382
382
|
confidentiality?: string;
|
|
383
|
+
/** Present when POST /api/swap/report returned a history row id. */
|
|
384
|
+
reportRecordId?: string;
|
|
383
385
|
}): boolean;
|
|
384
386
|
declare function resolveSwapReportRecordId(reportData: unknown): string;
|
|
385
387
|
type OrderStatusLookup = OrderReference;
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ function asSwapSdkError(error, stage) {
|
|
|
30
30
|
|
|
31
31
|
// src/utils/orderStatus.ts
|
|
32
32
|
function shouldPollSwapOrderStatus(input) {
|
|
33
|
+
if (String(input.reportRecordId ?? "").trim()) return true;
|
|
33
34
|
const waitMode = input.waitFor ?? "submitted";
|
|
34
35
|
const requiresOrderStatus = input.isCrossChain || input.confidentiality === "basic";
|
|
35
36
|
return requiresOrderStatus && waitMode !== "submitted";
|
|
@@ -2586,16 +2587,12 @@ var SwapClient = class {
|
|
|
2586
2587
|
});
|
|
2587
2588
|
}
|
|
2588
2589
|
const waitMode = input.waitFor ?? "submitted";
|
|
2589
|
-
const
|
|
2590
|
-
waitFor: waitMode,
|
|
2591
|
-
isCrossChain: build.isCrossChain,
|
|
2592
|
-
confidentiality: build.request?.confidentiality
|
|
2593
|
-
});
|
|
2590
|
+
const requiresTrackedStatus = build.isCrossChain || build.request?.confidentiality === "basic";
|
|
2594
2591
|
const reportRequest = this.createReportRequest(build, result);
|
|
2595
2592
|
if (reportRequest) {
|
|
2596
2593
|
this.reportRequests.set(build.executionId, reportRequest);
|
|
2597
2594
|
}
|
|
2598
|
-
const mustReportForStatus =
|
|
2595
|
+
const mustReportForStatus = requiresTrackedStatus && waitMode !== "submitted" && Boolean(reportRequest);
|
|
2599
2596
|
const shouldReportNow = Boolean(reportRequest) && this.reportMode !== "disabled" && (this.reportMode === "auto" || mustReportForStatus);
|
|
2600
2597
|
let reportRecordId;
|
|
2601
2598
|
if (shouldReportNow && reportRequest) {
|
|
@@ -2618,6 +2615,12 @@ var SwapClient = class {
|
|
|
2618
2615
|
emit({ type: "warning", executionId: build.executionId, warning });
|
|
2619
2616
|
}
|
|
2620
2617
|
}
|
|
2618
|
+
const shouldPollOrderStatus = shouldPollSwapOrderStatus({
|
|
2619
|
+
waitFor: waitMode,
|
|
2620
|
+
isCrossChain: build.isCrossChain,
|
|
2621
|
+
confidentiality: build.request?.confidentiality,
|
|
2622
|
+
reportRecordId
|
|
2623
|
+
});
|
|
2621
2624
|
const statusLookup = resolveOrderStatusLookup({
|
|
2622
2625
|
recordId: reportRecordId ?? result.report?.recordId,
|
|
2623
2626
|
orderId,
|