@rhea-finance/cross-chain-aggregation-dex 2.0.2 → 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.
Files changed (60) hide show
  1. package/README.md +71 -15
  2. package/dist/executors/aptos.d.mts +3 -4
  3. package/dist/executors/aptos.d.ts +3 -4
  4. package/dist/executors/aptos.js +22 -2
  5. package/dist/executors/aptos.js.map +1 -1
  6. package/dist/executors/aptos.mjs +22 -2
  7. package/dist/executors/aptos.mjs.map +1 -1
  8. package/dist/executors/bitcoin.d.mts +3 -4
  9. package/dist/executors/bitcoin.d.ts +3 -4
  10. package/dist/executors/bitcoin.js +22 -2
  11. package/dist/executors/bitcoin.js.map +1 -1
  12. package/dist/executors/bitcoin.mjs +22 -2
  13. package/dist/executors/bitcoin.mjs.map +1 -1
  14. package/dist/executors/evm.d.mts +3 -4
  15. package/dist/executors/evm.d.ts +3 -4
  16. package/dist/executors/evm.js +29 -13
  17. package/dist/executors/evm.js.map +1 -1
  18. package/dist/executors/evm.mjs +29 -13
  19. package/dist/executors/evm.mjs.map +1 -1
  20. package/dist/executors/near.d.mts +3 -4
  21. package/dist/executors/near.d.ts +3 -4
  22. package/dist/executors/near.js +22 -2
  23. package/dist/executors/near.js.map +1 -1
  24. package/dist/executors/near.mjs +22 -2
  25. package/dist/executors/near.mjs.map +1 -1
  26. package/dist/executors/solana.d.mts +3 -4
  27. package/dist/executors/solana.d.ts +3 -4
  28. package/dist/executors/solana.js +22 -2
  29. package/dist/executors/solana.js.map +1 -1
  30. package/dist/executors/solana.mjs +22 -2
  31. package/dist/executors/solana.mjs.map +1 -1
  32. package/dist/executors/sui.d.mts +3 -4
  33. package/dist/executors/sui.d.ts +3 -4
  34. package/dist/executors/sui.js +22 -2
  35. package/dist/executors/sui.js.map +1 -1
  36. package/dist/executors/sui.mjs +22 -2
  37. package/dist/executors/sui.mjs.map +1 -1
  38. package/dist/executors/tron.d.mts +3 -4
  39. package/dist/executors/tron.d.ts +3 -4
  40. package/dist/executors/tron.js +22 -2
  41. package/dist/executors/tron.js.map +1 -1
  42. package/dist/executors/tron.mjs +22 -2
  43. package/dist/executors/tron.mjs.map +1 -1
  44. package/dist/executors/zcash.d.mts +3 -4
  45. package/dist/executors/zcash.d.ts +3 -4
  46. package/dist/executors/zcash.js +22 -2
  47. package/dist/executors/zcash.js.map +1 -1
  48. package/dist/executors/zcash.mjs +22 -2
  49. package/dist/executors/zcash.mjs.map +1 -1
  50. package/dist/index.d.mts +4 -3
  51. package/dist/index.d.ts +4 -3
  52. package/dist/index.js +59 -11
  53. package/dist/index.js.map +1 -1
  54. package/dist/index.mjs +59 -11
  55. package/dist/index.mjs.map +1 -1
  56. package/dist/{registry-DjohbPPm.d.mts → shared-D0_DbMT2.d.mts} +44 -9
  57. package/dist/{registry-DjohbPPm.d.ts → shared-D0_DbMT2.d.ts} +44 -9
  58. package/package.json +4 -1
  59. package/dist/shared-BbfGrWrJ.d.ts +0 -18
  60. package/dist/shared-BxJ0H20s.d.mts +0 -18
@@ -55,7 +55,8 @@ interface SwapQuoteDataRaw {
55
55
  isCrossChain: boolean;
56
56
  chainType: string;
57
57
  bestQuote: Record<string, unknown>;
58
- allQuotes: Record<string, unknown>[];
58
+ /** Optional route alternatives. Some quote responses only return bestQuote. */
59
+ allQuotes?: Record<string, unknown>[];
59
60
  errors?: unknown;
60
61
  nearDepositTx?: unknown;
61
62
  nearDepositTxError?: string;
@@ -86,7 +87,7 @@ interface SwapSigningRequestRaw {
86
87
  type: string;
87
88
  router: string;
88
89
  quoteId: string;
89
- chainId: number;
90
+ chainId: number | string;
90
91
  signingScheme?: string;
91
92
  typedData: {
92
93
  domain: Record<string, unknown>;
@@ -226,14 +227,20 @@ interface EvmTx {
226
227
  to: string;
227
228
  data: string;
228
229
  value: BaseUnitAmount;
229
- gasLimit: BaseUnitAmount;
230
+ gasLimit?: BaseUnitAmount;
231
+ gasPrice?: BaseUnitAmount;
232
+ maxFeePerGas?: BaseUnitAmount;
233
+ maxPriorityFeePerGas?: BaseUnitAmount;
234
+ from?: string;
230
235
  chainId: number;
231
236
  }
232
237
  interface EvmApproval {
233
238
  tx: EvmTx;
234
239
  spender: string;
235
240
  }
236
- type EvmSigningRequest = SwapSigningRequestRaw;
241
+ interface EvmSigningRequest extends Omit<SwapSigningRequestRaw, "chainId"> {
242
+ chainId: number;
243
+ }
237
244
  interface SolanaMetadata {
238
245
  addressLookupTableAddresses?: string[];
239
246
  recentBlockhash?: string;
@@ -347,7 +354,11 @@ interface QuoteRequest {
347
354
  tokenOut: AssetRef;
348
355
  amountIn: BaseUnitAmount;
349
356
  slippageBps: number;
350
- /** Near Intents quote waiting time in milliseconds. Defaults to 3000. */
357
+ /**
358
+ * Frontend-configurable Near Intents route-quote wait in milliseconds.
359
+ * Must be a non-negative integer. Defaults to 3000 when omitted.
360
+ * This is not an HTTP, wallet, settlement, or order-polling timeout.
361
+ */
351
362
  quoteWaitingTimeMs?: number;
352
363
  sender: string;
353
364
  recipient?: string;
@@ -453,9 +464,16 @@ interface SwapExecutionResult {
453
464
  };
454
465
  raw: unknown;
455
466
  }
467
+ interface OrderPollingOptions {
468
+ /** Delay between order-status requests in milliseconds. Defaults to 5000. */
469
+ intervalMs?: number;
470
+ /** Maximum polling duration in milliseconds. Omit to poll indefinitely. */
471
+ timeoutMs?: number;
472
+ }
456
473
  interface ExecuteSwapInput {
457
474
  build: SwapBuild;
458
475
  waitFor?: WaitMode;
476
+ orderPolling?: OrderPollingOptions;
459
477
  signal?: AbortSignal;
460
478
  onEvent?: (event: SwapLifecycleEvent) => void;
461
479
  beforeSign?: (preview: SignRequestPreview) => void | Promise<void>;
@@ -470,10 +488,8 @@ interface OrderStatusResult {
470
488
  status: OrderStatus;
471
489
  raw: SwapOrderStatusDataRaw;
472
490
  }
473
- interface WaitForOrderInput extends OrderReference {
491
+ interface WaitForOrderInput extends OrderReference, OrderPollingOptions {
474
492
  signal?: AbortSignal;
475
- intervalMs?: number;
476
- timeoutMs?: number;
477
493
  }
478
494
  declare function normalizeOrderStatus(raw: SwapOrderStatusDataRaw): OrderStatus;
479
495
 
@@ -526,4 +542,23 @@ declare class ExecutorRegistry {
526
542
  getSigner(chain: string, requireSignMessage?: false): ExecutorIdentityProvider;
527
543
  }
528
544
 
529
- export { type SwapExecution as $, type AssetRef as A, type BaseUnitAmount as B, type ChainRef as C, type SwapBuildApproveRaw as D, ExecutorRegistry as E, type SwapWarning as F, type SignRequestPreview as G, type OrderStatus as H, normalizeOrderStatus as I, type ChainExecutionResult as J, type ExecutionContext as K, type ExecutorIdentityProvider as L, type MessageSignOptions as M, type NearTransaction as N, type OrderStatusResult as O, type ExecutorMessageSigner as P, type QuoteRequest as Q, assertBaseUnitAmount as R, type SwapQuoteRequestRaw as S, type EvmTx as T, type EvmApproval as U, type EvmSigningRequest as V, type WaitMode as W, type SolanaMetadata as X, type OrderReference as Y, type DepositInfo as Z, type SwapReportContext as _, type SwapQuoteDataRaw as a, type RouteSummary as a0, type BuildContext as a1, type SwapBuildRequestRaw as b, type SwapBuildDataRaw as c, type SwapOrderSubmitRequestRaw as d, type SwapOrderSubmitDataRaw as e, type SwapOrderStatusParamsRaw as f, type SwapOrderStatusDataRaw as g, type SwapReportRequestRaw as h, type SwapReportDataRaw as i, type SwapHistoryParamsRaw as j, type SwapHistoryDataRaw as k, type Quote as l, type SwapMcaPayloadRaw as m, type SwapLifecycleEvent as n, type SwapExecutionResult as o, type SwapHistoryRecordRaw as p, type ChainExecutor as q, type SwapBuild as r, type ExecuteSwapInput as s, type SwapInput as t, type WaitForOrderInput as u, type SwapMcaRelayerRequestRaw as v, type SwapApiResponse as w, type SwapApiTokenMetaRaw as x, type SwapMcaSignerPayloadRaw as y, type SwapSigningRequestRaw as z };
545
+ interface TransactionSubmission {
546
+ txHash: string;
547
+ raw?: unknown;
548
+ }
549
+ interface TransactionConfirmation {
550
+ status: "confirmed" | "failed";
551
+ raw?: unknown;
552
+ }
553
+ interface ExecutorErrorAdapter {
554
+ isUserRejection?(error: unknown): boolean;
555
+ /** Identity serialized as `mca.signer.identityKey` for MCA quotes. */
556
+ getIdentityKey?(): string | Promise<string>;
557
+ /**
558
+ * Optional offline message signing for flows such as MCA relayer withdraw.
559
+ * Chain transfer executors do not call this during normal swap execution.
560
+ */
561
+ signMessage?(message: string, options?: MessageSignOptions): Promise<string>;
562
+ }
563
+
564
+ export { type DepositInfo as $, type AssetRef as A, type BaseUnitAmount as B, type ChainRef as C, type SwapSigningRequestRaw as D, ExecutorRegistry as E, type SwapBuildApproveRaw as F, type SwapWarning as G, type SignRequestPreview as H, type OrderStatus as I, normalizeOrderStatus as J, type ChainExecutionResult as K, type ExecutionContext as L, type MessageSignOptions as M, type NearTransaction as N, type OrderPollingOptions as O, type ExecutorIdentityProvider as P, type QuoteRequest as Q, type ExecutorMessageSigner as R, type SwapQuoteRequestRaw as S, type TransactionConfirmation as T, assertBaseUnitAmount as U, type EvmTx as V, type WaitMode as W, type EvmApproval as X, type EvmSigningRequest as Y, type SolanaMetadata as Z, type OrderReference as _, type SwapQuoteDataRaw as a, type SwapReportContext as a0, type SwapExecution as a1, type RouteSummary as a2, type BuildContext as a3, type ExecutorErrorAdapter as a4, type TransactionSubmission as a5, type SwapBuildRequestRaw as b, type SwapBuildDataRaw as c, type SwapOrderSubmitRequestRaw as d, type SwapOrderSubmitDataRaw as e, type SwapOrderStatusParamsRaw as f, type SwapOrderStatusDataRaw as g, type SwapReportRequestRaw as h, type SwapReportDataRaw as i, type SwapHistoryParamsRaw as j, type SwapHistoryDataRaw as k, type Quote as l, type SwapMcaPayloadRaw as m, type SwapLifecycleEvent as n, type SwapExecutionResult as o, type SwapHistoryRecordRaw as p, type ChainExecutor as q, type SwapBuild as r, type ExecuteSwapInput as s, type SwapInput as t, type OrderStatusResult as u, type WaitForOrderInput as v, type SwapMcaRelayerRequestRaw as w, type SwapApiResponse as x, type SwapApiTokenMetaRaw as y, type SwapMcaSignerPayloadRaw as z };
@@ -55,7 +55,8 @@ interface SwapQuoteDataRaw {
55
55
  isCrossChain: boolean;
56
56
  chainType: string;
57
57
  bestQuote: Record<string, unknown>;
58
- allQuotes: Record<string, unknown>[];
58
+ /** Optional route alternatives. Some quote responses only return bestQuote. */
59
+ allQuotes?: Record<string, unknown>[];
59
60
  errors?: unknown;
60
61
  nearDepositTx?: unknown;
61
62
  nearDepositTxError?: string;
@@ -86,7 +87,7 @@ interface SwapSigningRequestRaw {
86
87
  type: string;
87
88
  router: string;
88
89
  quoteId: string;
89
- chainId: number;
90
+ chainId: number | string;
90
91
  signingScheme?: string;
91
92
  typedData: {
92
93
  domain: Record<string, unknown>;
@@ -226,14 +227,20 @@ interface EvmTx {
226
227
  to: string;
227
228
  data: string;
228
229
  value: BaseUnitAmount;
229
- gasLimit: BaseUnitAmount;
230
+ gasLimit?: BaseUnitAmount;
231
+ gasPrice?: BaseUnitAmount;
232
+ maxFeePerGas?: BaseUnitAmount;
233
+ maxPriorityFeePerGas?: BaseUnitAmount;
234
+ from?: string;
230
235
  chainId: number;
231
236
  }
232
237
  interface EvmApproval {
233
238
  tx: EvmTx;
234
239
  spender: string;
235
240
  }
236
- type EvmSigningRequest = SwapSigningRequestRaw;
241
+ interface EvmSigningRequest extends Omit<SwapSigningRequestRaw, "chainId"> {
242
+ chainId: number;
243
+ }
237
244
  interface SolanaMetadata {
238
245
  addressLookupTableAddresses?: string[];
239
246
  recentBlockhash?: string;
@@ -347,7 +354,11 @@ interface QuoteRequest {
347
354
  tokenOut: AssetRef;
348
355
  amountIn: BaseUnitAmount;
349
356
  slippageBps: number;
350
- /** Near Intents quote waiting time in milliseconds. Defaults to 3000. */
357
+ /**
358
+ * Frontend-configurable Near Intents route-quote wait in milliseconds.
359
+ * Must be a non-negative integer. Defaults to 3000 when omitted.
360
+ * This is not an HTTP, wallet, settlement, or order-polling timeout.
361
+ */
351
362
  quoteWaitingTimeMs?: number;
352
363
  sender: string;
353
364
  recipient?: string;
@@ -453,9 +464,16 @@ interface SwapExecutionResult {
453
464
  };
454
465
  raw: unknown;
455
466
  }
467
+ interface OrderPollingOptions {
468
+ /** Delay between order-status requests in milliseconds. Defaults to 5000. */
469
+ intervalMs?: number;
470
+ /** Maximum polling duration in milliseconds. Omit to poll indefinitely. */
471
+ timeoutMs?: number;
472
+ }
456
473
  interface ExecuteSwapInput {
457
474
  build: SwapBuild;
458
475
  waitFor?: WaitMode;
476
+ orderPolling?: OrderPollingOptions;
459
477
  signal?: AbortSignal;
460
478
  onEvent?: (event: SwapLifecycleEvent) => void;
461
479
  beforeSign?: (preview: SignRequestPreview) => void | Promise<void>;
@@ -470,10 +488,8 @@ interface OrderStatusResult {
470
488
  status: OrderStatus;
471
489
  raw: SwapOrderStatusDataRaw;
472
490
  }
473
- interface WaitForOrderInput extends OrderReference {
491
+ interface WaitForOrderInput extends OrderReference, OrderPollingOptions {
474
492
  signal?: AbortSignal;
475
- intervalMs?: number;
476
- timeoutMs?: number;
477
493
  }
478
494
  declare function normalizeOrderStatus(raw: SwapOrderStatusDataRaw): OrderStatus;
479
495
 
@@ -526,4 +542,23 @@ declare class ExecutorRegistry {
526
542
  getSigner(chain: string, requireSignMessage?: false): ExecutorIdentityProvider;
527
543
  }
528
544
 
529
- export { type SwapExecution as $, type AssetRef as A, type BaseUnitAmount as B, type ChainRef as C, type SwapBuildApproveRaw as D, ExecutorRegistry as E, type SwapWarning as F, type SignRequestPreview as G, type OrderStatus as H, normalizeOrderStatus as I, type ChainExecutionResult as J, type ExecutionContext as K, type ExecutorIdentityProvider as L, type MessageSignOptions as M, type NearTransaction as N, type OrderStatusResult as O, type ExecutorMessageSigner as P, type QuoteRequest as Q, assertBaseUnitAmount as R, type SwapQuoteRequestRaw as S, type EvmTx as T, type EvmApproval as U, type EvmSigningRequest as V, type WaitMode as W, type SolanaMetadata as X, type OrderReference as Y, type DepositInfo as Z, type SwapReportContext as _, type SwapQuoteDataRaw as a, type RouteSummary as a0, type BuildContext as a1, type SwapBuildRequestRaw as b, type SwapBuildDataRaw as c, type SwapOrderSubmitRequestRaw as d, type SwapOrderSubmitDataRaw as e, type SwapOrderStatusParamsRaw as f, type SwapOrderStatusDataRaw as g, type SwapReportRequestRaw as h, type SwapReportDataRaw as i, type SwapHistoryParamsRaw as j, type SwapHistoryDataRaw as k, type Quote as l, type SwapMcaPayloadRaw as m, type SwapLifecycleEvent as n, type SwapExecutionResult as o, type SwapHistoryRecordRaw as p, type ChainExecutor as q, type SwapBuild as r, type ExecuteSwapInput as s, type SwapInput as t, type WaitForOrderInput as u, type SwapMcaRelayerRequestRaw as v, type SwapApiResponse as w, type SwapApiTokenMetaRaw as x, type SwapMcaSignerPayloadRaw as y, type SwapSigningRequestRaw as z };
545
+ interface TransactionSubmission {
546
+ txHash: string;
547
+ raw?: unknown;
548
+ }
549
+ interface TransactionConfirmation {
550
+ status: "confirmed" | "failed";
551
+ raw?: unknown;
552
+ }
553
+ interface ExecutorErrorAdapter {
554
+ isUserRejection?(error: unknown): boolean;
555
+ /** Identity serialized as `mca.signer.identityKey` for MCA quotes. */
556
+ getIdentityKey?(): string | Promise<string>;
557
+ /**
558
+ * Optional offline message signing for flows such as MCA relayer withdraw.
559
+ * Chain transfer executors do not call this during normal swap execution.
560
+ */
561
+ signMessage?(message: string, options?: MessageSignOptions): Promise<string>;
562
+ }
563
+
564
+ export { type DepositInfo as $, type AssetRef as A, type BaseUnitAmount as B, type ChainRef as C, type SwapSigningRequestRaw as D, ExecutorRegistry as E, type SwapBuildApproveRaw as F, type SwapWarning as G, type SignRequestPreview as H, type OrderStatus as I, normalizeOrderStatus as J, type ChainExecutionResult as K, type ExecutionContext as L, type MessageSignOptions as M, type NearTransaction as N, type OrderPollingOptions as O, type ExecutorIdentityProvider as P, type QuoteRequest as Q, type ExecutorMessageSigner as R, type SwapQuoteRequestRaw as S, type TransactionConfirmation as T, assertBaseUnitAmount as U, type EvmTx as V, type WaitMode as W, type EvmApproval as X, type EvmSigningRequest as Y, type SolanaMetadata as Z, type OrderReference as _, type SwapQuoteDataRaw as a, type SwapReportContext as a0, type SwapExecution as a1, type RouteSummary as a2, type BuildContext as a3, type ExecutorErrorAdapter as a4, type TransactionSubmission as a5, type SwapBuildRequestRaw as b, type SwapBuildDataRaw as c, type SwapOrderSubmitRequestRaw as d, type SwapOrderSubmitDataRaw as e, type SwapOrderStatusParamsRaw as f, type SwapOrderStatusDataRaw as g, type SwapReportRequestRaw as h, type SwapReportDataRaw as i, type SwapHistoryParamsRaw as j, type SwapHistoryDataRaw as k, type Quote as l, type SwapMcaPayloadRaw as m, type SwapLifecycleEvent as n, type SwapExecutionResult as o, type SwapHistoryRecordRaw as p, type ChainExecutor as q, type SwapBuild as r, type ExecuteSwapInput as s, type SwapInput as t, type OrderStatusResult as u, type WaitForOrderInput as v, type SwapMcaRelayerRequestRaw as w, type SwapApiResponse as x, type SwapApiTokenMetaRaw as y, type SwapMcaSignerPayloadRaw as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhea-finance/cross-chain-aggregation-dex",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "TypeScript SDK for a unified multi-chain Swap API with quote, transaction building, execution adapters, status, reporting, and history.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -62,6 +62,7 @@
62
62
  "dev": "tsup --watch",
63
63
  "test": "vitest run",
64
64
  "test:watch": "vitest",
65
+ "test:live-shapes": "tsx scripts/validate-live-shapes.ts",
65
66
  "type-check": "tsc --noEmit",
66
67
  "lint": "eslint src tests --ext .ts",
67
68
  "prepublishOnly": "pnpm test && pnpm type-check && pnpm build"
@@ -92,7 +93,9 @@
92
93
  "@typescript-eslint/parser": "^7.0.0",
93
94
  "eslint": "^8.57.1",
94
95
  "tsup": "^8.0.0",
96
+ "tsx": "4.23.1",
95
97
  "typescript": "^5.0.0",
98
+ "undici": "^6.27.0",
96
99
  "vitest": "^4.1.10"
97
100
  },
98
101
  "engines": {
@@ -1,18 +0,0 @@
1
- import { M as MessageSignOptions } from './registry-DjohbPPm.js';
2
-
3
- interface TransactionSubmission {
4
- txHash: string;
5
- raw?: unknown;
6
- }
7
- interface ExecutorErrorAdapter {
8
- isUserRejection?(error: unknown): boolean;
9
- /** Identity serialized as `mca.signer.identityKey` for MCA quotes. */
10
- getIdentityKey?(): string | Promise<string>;
11
- /**
12
- * Optional offline message signing for flows such as MCA relayer withdraw.
13
- * Chain transfer executors do not call this during normal swap execution.
14
- */
15
- signMessage?(message: string, options?: MessageSignOptions): Promise<string>;
16
- }
17
-
18
- export type { ExecutorErrorAdapter as E, TransactionSubmission as T };
@@ -1,18 +0,0 @@
1
- import { M as MessageSignOptions } from './registry-DjohbPPm.mjs';
2
-
3
- interface TransactionSubmission {
4
- txHash: string;
5
- raw?: unknown;
6
- }
7
- interface ExecutorErrorAdapter {
8
- isUserRejection?(error: unknown): boolean;
9
- /** Identity serialized as `mca.signer.identityKey` for MCA quotes. */
10
- getIdentityKey?(): string | Promise<string>;
11
- /**
12
- * Optional offline message signing for flows such as MCA relayer withdraw.
13
- * Chain transfer executors do not call this during normal swap execution.
14
- */
15
- signMessage?(message: string, options?: MessageSignOptions): Promise<string>;
16
- }
17
-
18
- export type { ExecutorErrorAdapter as E, TransactionSubmission as T };