@rhea-finance/cross-chain-aggregation-dex 2.0.6 → 2.0.8

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 CHANGED
@@ -314,7 +314,7 @@ const quoteRequest: QuoteRequest = {
314
314
  const quote = await client.quote(quoteRequest);
315
315
  ```
316
316
 
317
- `quote()` calls `POST /api/swap/quote`. The frontend can configure the Near Intents wait plus the same-chain and cross-chain route timeouts on every `QuoteRequest`. The SDK sends the defaults shown above when fields are omitted.
317
+ `quote()` calls `POST /api/v2/swap/quote`. The frontend can configure the Near Intents wait plus the same-chain and cross-chain route timeouts on every `QuoteRequest`. The SDK sends the defaults shown above when fields are omitted.
318
318
 
319
319
  Set `confidentiality: "basic"` to use the confidential 1Click route. The SDK preserves it through quote and build, and includes it in automatic or manual report payloads. Omit the field for public swaps:
320
320
 
@@ -345,7 +345,7 @@ const quote = await client.quote({
345
345
  | `sameChainTimeoutMs` | `500` | Timeout budget supplied to same-chain quote routing. |
346
346
  | `crossChainTimeoutMs` | `3000` | Timeout budget supplied to cross-chain quote routing. |
347
347
 
348
- All three values use milliseconds and must be non-negative integers. They affect only `POST /api/swap/quote`; the SDK removes them from the subsequent build request. They do **not** control the SDK HTTP timeout, wallet signing, source-chain confirmation, bridge settlement, or order polling. Keep the client's `timeoutMs` above the configured quote budget plus network overhead.
348
+ All three values use milliseconds and must be non-negative integers. They affect only `POST /api/v2/swap/quote`; the SDK removes them from the subsequent build request. They do **not** control the SDK HTTP timeout, wallet signing, source-chain confirmation, bridge settlement, or order polling. Keep the client's `timeoutMs` above the configured quote budget plus network overhead.
349
349
 
350
350
  ### 3.4 Execute the swap directly
351
351
 
@@ -382,7 +382,7 @@ if (result.status === "completed") {
382
382
  }
383
383
  ```
384
384
 
385
- `"completed"` polls the order-status API whenever the swap has a queryable order reference. 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 does not provide a usable status key, the SDK throws `INVALID_API_RESPONSE` at the `status` stage instead of treating source-chain confirmation as completion.
385
+ `"completed"` polls the order-status API after reporting when possible. The SDK prefers the `recordId` returned by `POST /api/swap/report` (same as multi-chain Trade), and only falls back to `orderId`/`router`/`chainId` or source `txHash` when no record id is available. 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
 
@@ -390,28 +390,41 @@ Set `orderPolling.timeoutMs` only when the application needs a time limit. An ex
390
390
 
391
391
  ### 3.5 Check final delivery status
392
392
 
393
- If the swap first returns with `"submitted"`, use the returned `orderId` to poll manually:
393
+ If the swap first returns with `"submitted"`, poll manually with the report record id when available:
394
394
 
395
395
  ```ts
396
- if (result.orderId) {
396
+ if (result.report?.recordId) {
397
+ const finalStatus = await client.waitForOrder({
398
+ recordId: result.report.recordId,
399
+ intervalMs: 5000,
400
+ timeoutMs: 600000,
401
+ });
402
+ console.log(finalStatus.status);
403
+ } else if (result.orderId) {
397
404
  const finalStatus = await client.waitForOrder({
398
405
  orderId: result.orderId,
399
406
  router: result.router,
400
407
  intervalMs: 5000,
401
408
  timeoutMs: 600000,
402
409
  });
403
-
404
410
  console.log(finalStatus.status);
405
411
  }
406
412
  ```
407
413
 
414
+ For history rows, refresh delivery status with the same record id:
415
+
416
+ ```ts
417
+ const status = await client.getHistoryOrderStatus(historyItem);
418
+ ```
419
+
408
420
  For a single status request:
409
421
 
410
422
  ```ts
411
- const status = await client.getOrderStatus({
412
- orderId: result.orderId!,
413
- router: result.router,
414
- });
423
+ const status = await client.getOrderStatus(
424
+ result.report?.recordId
425
+ ? { recordId: result.report.recordId }
426
+ : { orderId: result.orderId!, router: result.router }
427
+ );
415
428
  ```
416
429
 
417
430
  Terminal statuses are `completed`, `failed`, `refunded`, and `expired`.
@@ -431,7 +444,6 @@ Terminal statuses are `completed`, `failed`, `refunded`, and `expired`.
431
444
  | `retry` | `Partial<RetryConfig>` | No | Retry policy for retryable quote/read operations. Defaults: 2 retries, 250ms base delay, 2000ms maximum delay, and jitter enabled. |
432
445
  | `logger` | `SdkLogger` | No | Receives structured `api.request`, `api.response`, and `api.retry` entries. |
433
446
  | `executors` | `readonly ChainExecutor[]` | Required for execution | Wallet executors. May be omitted when only calling `quote()` or `buildSwap()`. |
434
- | `maxQuoteAgeMs` | `number \| null` | No | Maximum local quote age in milliseconds. Default: `30000`. Set to `null` to disable the local age check; an API-provided `expiresAt` still applies. |
435
447
  | `tokenListCacheTtlMs` | `number` | No | Successful token-list cache lifetime in milliseconds. Default: `600000` (10 minutes). Set to `0` to disable. |
436
448
  | `reportMode` | `"auto" \| "manual" \| "disabled"` | No | Reporting policy. Default: `"auto"`. A reporting failure does not turn a submitted swap into a failed swap. |
437
449
  | `onEvent` | `(event) => void` | No | Receives all lifecycle events. |
@@ -753,7 +765,7 @@ try {
753
765
  }
754
766
  ```
755
767
 
756
- Common `stage` values are `quote`, `build`, `approve`, `sign`, `broadcast`, `submit`, `report`, `status`, and `history`. Common `code` values include `QUOTE_EXPIRED`, `USER_REJECTED`, `APPROVAL_FAILED`, `SIGNING_FAILED`, `BROADCAST_FAILED`, and `ORDER_TIMEOUT`.
768
+ Common `stage` values are `quote`, `build`, `approve`, `sign`, `broadcast`, `submit`, `report`, `status`, and `history`. Common `code` values include `USER_REJECTED`, `APPROVAL_FAILED`, `SIGNING_FAILED`, `BROADCAST_FAILED`, and `ORDER_TIMEOUT`.
757
769
 
758
770
  Pass an `AbortSignal` to stop an unfinished request or wait:
759
771
 
@@ -1,4 +1,4 @@
1
- import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-COkGiqaz.mjs';
1
+ import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-BWv_QHdw.mjs';
2
2
 
3
3
  interface AptosWalletAdapter extends ExecutorErrorAdapter {
4
4
  getChain(): ChainRef | Promise<ChainRef>;
@@ -1,4 +1,4 @@
1
- import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-COkGiqaz.js';
1
+ import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-BWv_QHdw.js';
2
2
 
3
3
  interface AptosWalletAdapter extends ExecutorErrorAdapter {
4
4
  getChain(): ChainRef | Promise<ChainRef>;
@@ -1,4 +1,4 @@
1
- import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-COkGiqaz.mjs';
1
+ import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-BWv_QHdw.mjs';
2
2
 
3
3
  interface BitcoinWalletAdapter extends ExecutorErrorAdapter {
4
4
  getChain(): ChainRef | Promise<ChainRef>;
@@ -1,4 +1,4 @@
1
- import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-COkGiqaz.js';
1
+ import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-BWv_QHdw.js';
2
2
 
3
3
  interface BitcoinWalletAdapter extends ExecutorErrorAdapter {
4
4
  getChain(): ChainRef | Promise<ChainRef>;
@@ -1,4 +1,4 @@
1
- import { ad as ExecutorErrorAdapter, a3 as EvmTx, ae as TransactionSubmission, a5 as EvmSigningRequest, a4 as EvmApproval, T as TransactionConfirmation, w as ChainExecutor } from '../shared-COkGiqaz.mjs';
1
+ import { ad as ExecutorErrorAdapter, a4 as EvmTx, ae as TransactionSubmission, a6 as EvmSigningRequest, a5 as EvmApproval, T as TransactionConfirmation, w as ChainExecutor } from '../shared-BWv_QHdw.mjs';
2
2
 
3
3
  interface EvmWalletAdapter extends ExecutorErrorAdapter {
4
4
  sendTransaction(tx: EvmTx, options: {
@@ -1,4 +1,4 @@
1
- import { ad as ExecutorErrorAdapter, a3 as EvmTx, ae as TransactionSubmission, a5 as EvmSigningRequest, a4 as EvmApproval, T as TransactionConfirmation, w as ChainExecutor } from '../shared-COkGiqaz.js';
1
+ import { ad as ExecutorErrorAdapter, a4 as EvmTx, ae as TransactionSubmission, a6 as EvmSigningRequest, a5 as EvmApproval, T as TransactionConfirmation, w as ChainExecutor } from '../shared-BWv_QHdw.js';
2
2
 
3
3
  interface EvmWalletAdapter extends ExecutorErrorAdapter {
4
4
  sendTransaction(tx: EvmTx, options: {
@@ -1,4 +1,4 @@
1
- import { ad as ExecutorErrorAdapter, C as ChainRef, N as NearTransaction, T as TransactionConfirmation, w as ChainExecutor } from '../shared-COkGiqaz.mjs';
1
+ import { ad as ExecutorErrorAdapter, C as ChainRef, N as NearTransaction, T as TransactionConfirmation, w as ChainExecutor } from '../shared-BWv_QHdw.mjs';
2
2
 
3
3
  interface NearWalletAdapter extends ExecutorErrorAdapter {
4
4
  getChain(): ChainRef | Promise<ChainRef>;
@@ -1,4 +1,4 @@
1
- import { ad as ExecutorErrorAdapter, C as ChainRef, N as NearTransaction, T as TransactionConfirmation, w as ChainExecutor } from '../shared-COkGiqaz.js';
1
+ import { ad as ExecutorErrorAdapter, C as ChainRef, N as NearTransaction, T as TransactionConfirmation, w as ChainExecutor } from '../shared-BWv_QHdw.js';
2
2
 
3
3
  interface NearWalletAdapter extends ExecutorErrorAdapter {
4
4
  getChain(): ChainRef | Promise<ChainRef>;
@@ -1,4 +1,4 @@
1
- import { ad as ExecutorErrorAdapter, C as ChainRef, a6 as SolanaMetadata, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-COkGiqaz.mjs';
1
+ import { ad as ExecutorErrorAdapter, C as ChainRef, a7 as SolanaMetadata, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-BWv_QHdw.mjs';
2
2
 
3
3
  interface SolanaWalletAdapter extends ExecutorErrorAdapter {
4
4
  getChain(): ChainRef | Promise<ChainRef>;
@@ -1,4 +1,4 @@
1
- import { ad as ExecutorErrorAdapter, C as ChainRef, a6 as SolanaMetadata, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-COkGiqaz.js';
1
+ import { ad as ExecutorErrorAdapter, C as ChainRef, a7 as SolanaMetadata, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-BWv_QHdw.js';
2
2
 
3
3
  interface SolanaWalletAdapter extends ExecutorErrorAdapter {
4
4
  getChain(): ChainRef | Promise<ChainRef>;
@@ -1,4 +1,4 @@
1
- import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-COkGiqaz.mjs';
1
+ import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-BWv_QHdw.mjs';
2
2
 
3
3
  interface SuiWalletAdapter extends ExecutorErrorAdapter {
4
4
  getChain(): ChainRef | Promise<ChainRef>;
@@ -1,4 +1,4 @@
1
- import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-COkGiqaz.js';
1
+ import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-BWv_QHdw.js';
2
2
 
3
3
  interface SuiWalletAdapter extends ExecutorErrorAdapter {
4
4
  getChain(): ChainRef | Promise<ChainRef>;
@@ -1,4 +1,4 @@
1
- import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-COkGiqaz.mjs';
1
+ import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-BWv_QHdw.mjs';
2
2
 
3
3
  interface TronWalletAdapter extends ExecutorErrorAdapter {
4
4
  getChain(): ChainRef | Promise<ChainRef>;
@@ -1,4 +1,4 @@
1
- import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-COkGiqaz.js';
1
+ import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-BWv_QHdw.js';
2
2
 
3
3
  interface TronWalletAdapter extends ExecutorErrorAdapter {
4
4
  getChain(): ChainRef | Promise<ChainRef>;
@@ -1,4 +1,4 @@
1
- import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-COkGiqaz.mjs';
1
+ import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-BWv_QHdw.mjs';
2
2
 
3
3
  interface ZcashWalletAdapter extends ExecutorErrorAdapter {
4
4
  getChain(): ChainRef | Promise<ChainRef>;
@@ -1,4 +1,4 @@
1
- import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-COkGiqaz.js';
1
+ import { ad as ExecutorErrorAdapter, C as ChainRef, ae as TransactionSubmission, T as TransactionConfirmation, w as ChainExecutor } from '../shared-BWv_QHdw.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, l as SwapHistoryAuthChallengeRequestRaw, m as SwapHistoryAuthChallengeRaw, n as SwapHistoryAuthVerifyRequestRaw, o as SwapHistoryAuthTokenRaw, p as SwapFromTokensDataRaw, q as SwapCrossChainToTokensDataRaw, Q as QuoteRequest, r as Quote, s as SwapMcaPayloadRaw, W as WaitMode, O as OrderPollingOptions, t as SwapLifecycleEvent, u as SwapExecutionResult, C as ChainRef, A as AssetRef, B as BaseUnitAmount, v as SwapHistoryRecordRaw, w as ChainExecutor, E as ExecutorRegistry, x as SwapBuild, y as ExecuteSwapInput, z as SwapInput, D as OrderStatusResult, F as WaitForOrderInput, G as SwapHistoryAuthProofRaw, N as NearTransaction, H as SwapMcaRelayerRequestRaw } from './shared-COkGiqaz.mjs';
2
- export { ac as BuildContext, Z as ChainExecutionResult, a8 as DepositInfo, a4 as EvmApproval, a5 as EvmSigningRequest, a3 as EvmTx, _ as ExecutionContext, a0 as ExecutorIdentityProvider, a1 as ExecutorMessageSigner, $ as MessageSignOptions, a7 as OrderReference, X as OrderStatus, ab as RouteSummary, V as SignRequestPreview, a6 as SolanaMetadata, I as SwapApiResponse, J as SwapApiTokenMetaRaw, P as SwapBuildApproveRaw, aa as SwapExecution, R as SwapHistoryWalletChainFamilyRaw, L as SwapMcaSignerPayloadRaw, a9 as SwapReportContext, M as SwapSigningRequestRaw, K as SwapTokenListRowRaw, U as SwapWarning, T as TransactionConfirmation, a2 as assertBaseUnitAmount, Y as normalizeOrderStatus } from './shared-COkGiqaz.mjs';
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, l as SwapHistoryAuthChallengeRequestRaw, m as SwapHistoryAuthChallengeRaw, n as SwapHistoryAuthVerifyRequestRaw, o as SwapHistoryAuthTokenRaw, p as SwapFromTokensDataRaw, q as SwapCrossChainToTokensDataRaw, Q as QuoteRequest, r as Quote, s as SwapMcaPayloadRaw, W as WaitMode, O as OrderPollingOptions, t as SwapLifecycleEvent, u as SwapExecutionResult, C as ChainRef, A as AssetRef, B as BaseUnitAmount, v as SwapHistoryRecordRaw, w as ChainExecutor, E as ExecutorRegistry, x as SwapBuild, y as ExecuteSwapInput, z as SwapInput, D as OrderReference, F as OrderStatusResult, G as WaitForOrderInput, H as SwapHistoryAuthProofRaw, N as NearTransaction, I as SwapMcaRelayerRequestRaw } from './shared-BWv_QHdw.mjs';
2
+ export { ac as BuildContext, _ as ChainExecutionResult, a8 as DepositInfo, a5 as EvmApproval, a6 as EvmSigningRequest, a4 as EvmTx, $ as ExecutionContext, a1 as ExecutorIdentityProvider, a2 as ExecutorMessageSigner, a0 as MessageSignOptions, Y as OrderStatus, ab as RouteSummary, X as SignRequestPreview, a7 as SolanaMetadata, J as SwapApiResponse, K as SwapApiTokenMetaRaw, R as SwapBuildApproveRaw, aa as SwapExecution, U as SwapHistoryWalletChainFamilyRaw, M as SwapMcaSignerPayloadRaw, a9 as SwapReportContext, P as SwapSigningRequestRaw, L as SwapTokenListRowRaw, V as SwapWarning, T as TransactionConfirmation, a3 as assertBaseUnitAmount, Z as normalizeOrderStatus } from './shared-BWv_QHdw.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" | "tokens" | "history";
@@ -231,7 +231,6 @@ interface SwapTokenListItem extends AssetRef {
231
231
  }
232
232
 
233
233
  interface SwapClientConfig extends ApiClientConfig {
234
- maxQuoteAgeMs?: number | null;
235
234
  reportMode?: "auto" | "manual" | "disabled";
236
235
  executors?: readonly ChainExecutor[];
237
236
  onEvent?: (event: SwapLifecycleEvent) => void;
@@ -269,10 +268,10 @@ declare class SwapClient {
269
268
  executeSwap(input: ExecuteSwapInput): Promise<SwapExecutionResult>;
270
269
  swap(input: McaSwapInput): Promise<McaSwapResult>;
271
270
  swap(input: SwapInput): Promise<SwapExecutionResult>;
272
- getOrderStatus(input: {
273
- orderId: string;
274
- router: string;
275
- chainId?: string;
271
+ getOrderStatus(input: OrderReference & {
272
+ signal?: AbortSignal;
273
+ }): Promise<OrderStatusResult>;
274
+ getHistoryOrderStatus(item: Pick<SwapHistoryItem, "id" | "orderId" | "router" | "sourceTxHash">, options?: {
276
275
  signal?: AbortSignal;
277
276
  }): Promise<OrderStatusResult>;
278
277
  waitForOrder(input: WaitForOrderInput): Promise<OrderStatusResult>;
@@ -287,7 +286,6 @@ declare class SwapClient {
287
286
  authorizeConfidentialHistory(request: SwapHistoryAuthChallengeRequestRaw, signChallenge: (challenge: SwapHistoryAuthChallengeRaw) => SwapHistoryAuthProofRaw | Promise<SwapHistoryAuthProofRaw>, options?: ApiRequestOptions): Promise<SwapHistoryAuthTokenRaw>;
288
287
  getHistory(request: HistoryRequest, options?: ApiRequestOptions): Promise<SwapHistoryPage>;
289
288
  protected emit(event: SwapLifecycleEvent): void;
290
- private assertQuoteFresh;
291
289
  private createReportRequest;
292
290
  }
293
291
 
@@ -377,7 +375,25 @@ interface BuildMcaWithdrawRelayerRequestInput {
377
375
  }
378
376
  declare function buildMcaWithdrawRelayerRequest(input: BuildMcaWithdrawRelayerRequestInput): SwapBuildRequestRaw;
379
377
 
378
+ declare function resolveSwapReportRecordId(reportData: unknown): string;
379
+ type OrderStatusLookup = OrderReference;
380
+ /** Matches multi-chain-lending `resolveSwapOrderStatusQuery` query shape. */
381
+ declare function buildOrderStatusQuery(params: SwapOrderStatusParamsRaw): Record<string, string | number>;
382
+ declare function resolveOrderStatusLookup(input: {
383
+ recordId?: string | number;
384
+ orderId?: string;
385
+ txHash?: string;
386
+ router?: string;
387
+ chainId?: string | number;
388
+ }): OrderReference | undefined;
389
+ declare function assertOrderStatusParams(params: SwapOrderStatusParamsRaw | OrderReference): OrderReference;
390
+ declare function orderStatusParamsFromHistoryItem(item: Pick<SwapHistoryItem, "id" | "orderId" | "router" | "sourceTxHash">): OrderReference;
391
+ declare function resolveSourceTxHash(input: {
392
+ txHash?: string;
393
+ txHashes?: string[];
394
+ }): string | undefined;
395
+
380
396
  declare function parseUnits(value: string, decimals: number): BaseUnitAmount;
381
397
  declare function formatUnits(value: BaseUnitAmount, decimals: number): string;
382
398
 
383
- 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, 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, buildMcaWithdrawRelayerRequest, buildNearMcaWithdrawTransactions, createExecutionId, extractMcaWithdrawBusiness, extractMcaWithdrawDepositAddress, extractMcaWithdrawSignerWallet, formatMcaWallet, formatUnits, fromApiChain, isSameMcaSignerIdentity, normalizeBuild, normalizeCrossChainToTokenList, normalizeFromTokenList, normalizeHistory, normalizeHistoryStatus, normalizeMcaQuote, normalizeQuote, parseUnits, resolveMcaDecreaseCollateral, resolveMcaRequiredCollateralDecrease, resolveMcaWithdrawPolicy, selectMcaSigner, serializeMcaQuoteRequest, serializeQuoteRequest, toApiAssetAddress, toApiChain };
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 };
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, l as SwapHistoryAuthChallengeRequestRaw, m as SwapHistoryAuthChallengeRaw, n as SwapHistoryAuthVerifyRequestRaw, o as SwapHistoryAuthTokenRaw, p as SwapFromTokensDataRaw, q as SwapCrossChainToTokensDataRaw, Q as QuoteRequest, r as Quote, s as SwapMcaPayloadRaw, W as WaitMode, O as OrderPollingOptions, t as SwapLifecycleEvent, u as SwapExecutionResult, C as ChainRef, A as AssetRef, B as BaseUnitAmount, v as SwapHistoryRecordRaw, w as ChainExecutor, E as ExecutorRegistry, x as SwapBuild, y as ExecuteSwapInput, z as SwapInput, D as OrderStatusResult, F as WaitForOrderInput, G as SwapHistoryAuthProofRaw, N as NearTransaction, H as SwapMcaRelayerRequestRaw } from './shared-COkGiqaz.js';
2
- export { ac as BuildContext, Z as ChainExecutionResult, a8 as DepositInfo, a4 as EvmApproval, a5 as EvmSigningRequest, a3 as EvmTx, _ as ExecutionContext, a0 as ExecutorIdentityProvider, a1 as ExecutorMessageSigner, $ as MessageSignOptions, a7 as OrderReference, X as OrderStatus, ab as RouteSummary, V as SignRequestPreview, a6 as SolanaMetadata, I as SwapApiResponse, J as SwapApiTokenMetaRaw, P as SwapBuildApproveRaw, aa as SwapExecution, R as SwapHistoryWalletChainFamilyRaw, L as SwapMcaSignerPayloadRaw, a9 as SwapReportContext, M as SwapSigningRequestRaw, K as SwapTokenListRowRaw, U as SwapWarning, T as TransactionConfirmation, a2 as assertBaseUnitAmount, Y as normalizeOrderStatus } from './shared-COkGiqaz.js';
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, l as SwapHistoryAuthChallengeRequestRaw, m as SwapHistoryAuthChallengeRaw, n as SwapHistoryAuthVerifyRequestRaw, o as SwapHistoryAuthTokenRaw, p as SwapFromTokensDataRaw, q as SwapCrossChainToTokensDataRaw, Q as QuoteRequest, r as Quote, s as SwapMcaPayloadRaw, W as WaitMode, O as OrderPollingOptions, t as SwapLifecycleEvent, u as SwapExecutionResult, C as ChainRef, A as AssetRef, B as BaseUnitAmount, v as SwapHistoryRecordRaw, w as ChainExecutor, E as ExecutorRegistry, x as SwapBuild, y as ExecuteSwapInput, z as SwapInput, D as OrderReference, F as OrderStatusResult, G as WaitForOrderInput, H as SwapHistoryAuthProofRaw, N as NearTransaction, I as SwapMcaRelayerRequestRaw } from './shared-BWv_QHdw.js';
2
+ export { ac as BuildContext, _ as ChainExecutionResult, a8 as DepositInfo, a5 as EvmApproval, a6 as EvmSigningRequest, a4 as EvmTx, $ as ExecutionContext, a1 as ExecutorIdentityProvider, a2 as ExecutorMessageSigner, a0 as MessageSignOptions, Y as OrderStatus, ab as RouteSummary, X as SignRequestPreview, a7 as SolanaMetadata, J as SwapApiResponse, K as SwapApiTokenMetaRaw, R as SwapBuildApproveRaw, aa as SwapExecution, U as SwapHistoryWalletChainFamilyRaw, M as SwapMcaSignerPayloadRaw, a9 as SwapReportContext, P as SwapSigningRequestRaw, L as SwapTokenListRowRaw, V as SwapWarning, T as TransactionConfirmation, a3 as assertBaseUnitAmount, Z as normalizeOrderStatus } from './shared-BWv_QHdw.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" | "tokens" | "history";
@@ -231,7 +231,6 @@ interface SwapTokenListItem extends AssetRef {
231
231
  }
232
232
 
233
233
  interface SwapClientConfig extends ApiClientConfig {
234
- maxQuoteAgeMs?: number | null;
235
234
  reportMode?: "auto" | "manual" | "disabled";
236
235
  executors?: readonly ChainExecutor[];
237
236
  onEvent?: (event: SwapLifecycleEvent) => void;
@@ -269,10 +268,10 @@ declare class SwapClient {
269
268
  executeSwap(input: ExecuteSwapInput): Promise<SwapExecutionResult>;
270
269
  swap(input: McaSwapInput): Promise<McaSwapResult>;
271
270
  swap(input: SwapInput): Promise<SwapExecutionResult>;
272
- getOrderStatus(input: {
273
- orderId: string;
274
- router: string;
275
- chainId?: string;
271
+ getOrderStatus(input: OrderReference & {
272
+ signal?: AbortSignal;
273
+ }): Promise<OrderStatusResult>;
274
+ getHistoryOrderStatus(item: Pick<SwapHistoryItem, "id" | "orderId" | "router" | "sourceTxHash">, options?: {
276
275
  signal?: AbortSignal;
277
276
  }): Promise<OrderStatusResult>;
278
277
  waitForOrder(input: WaitForOrderInput): Promise<OrderStatusResult>;
@@ -287,7 +286,6 @@ declare class SwapClient {
287
286
  authorizeConfidentialHistory(request: SwapHistoryAuthChallengeRequestRaw, signChallenge: (challenge: SwapHistoryAuthChallengeRaw) => SwapHistoryAuthProofRaw | Promise<SwapHistoryAuthProofRaw>, options?: ApiRequestOptions): Promise<SwapHistoryAuthTokenRaw>;
288
287
  getHistory(request: HistoryRequest, options?: ApiRequestOptions): Promise<SwapHistoryPage>;
289
288
  protected emit(event: SwapLifecycleEvent): void;
290
- private assertQuoteFresh;
291
289
  private createReportRequest;
292
290
  }
293
291
 
@@ -377,7 +375,25 @@ interface BuildMcaWithdrawRelayerRequestInput {
377
375
  }
378
376
  declare function buildMcaWithdrawRelayerRequest(input: BuildMcaWithdrawRelayerRequestInput): SwapBuildRequestRaw;
379
377
 
378
+ declare function resolveSwapReportRecordId(reportData: unknown): string;
379
+ type OrderStatusLookup = OrderReference;
380
+ /** Matches multi-chain-lending `resolveSwapOrderStatusQuery` query shape. */
381
+ declare function buildOrderStatusQuery(params: SwapOrderStatusParamsRaw): Record<string, string | number>;
382
+ declare function resolveOrderStatusLookup(input: {
383
+ recordId?: string | number;
384
+ orderId?: string;
385
+ txHash?: string;
386
+ router?: string;
387
+ chainId?: string | number;
388
+ }): OrderReference | undefined;
389
+ declare function assertOrderStatusParams(params: SwapOrderStatusParamsRaw | OrderReference): OrderReference;
390
+ declare function orderStatusParamsFromHistoryItem(item: Pick<SwapHistoryItem, "id" | "orderId" | "router" | "sourceTxHash">): OrderReference;
391
+ declare function resolveSourceTxHash(input: {
392
+ txHash?: string;
393
+ txHashes?: string[];
394
+ }): string | undefined;
395
+
380
396
  declare function parseUnits(value: string, decimals: number): BaseUnitAmount;
381
397
  declare function formatUnits(value: BaseUnitAmount, decimals: number): string;
382
398
 
383
- 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, 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, buildMcaWithdrawRelayerRequest, buildNearMcaWithdrawTransactions, createExecutionId, extractMcaWithdrawBusiness, extractMcaWithdrawDepositAddress, extractMcaWithdrawSignerWallet, formatMcaWallet, formatUnits, fromApiChain, isSameMcaSignerIdentity, normalizeBuild, normalizeCrossChainToTokenList, normalizeFromTokenList, normalizeHistory, normalizeHistoryStatus, normalizeMcaQuote, normalizeQuote, parseUnits, resolveMcaDecreaseCollateral, resolveMcaRequiredCollateralDecrease, resolveMcaWithdrawPolicy, selectMcaSigner, serializeMcaQuoteRequest, serializeQuoteRequest, toApiAssetAddress, toApiChain };
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 };