@rhea-finance/cross-chain-aggregation-dex 2.0.1 → 2.0.3

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 +567 -206
  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 +4 -5
  45. package/dist/executors/zcash.d.ts +4 -5
  46. package/dist/executors/zcash.js +24 -10
  47. package/dist/executors/zcash.js.map +1 -1
  48. package/dist/executors/zcash.mjs +24 -10
  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 -25
  53. package/dist/index.js.map +1 -1
  54. package/dist/index.mjs +59 -25
  55. package/dist/index.mjs.map +1 -1
  56. package/dist/{registry-DRYUqs7T.d.mts → shared-BEZXY_BM.d.mts} +39 -12
  57. package/dist/{registry-DRYUqs7T.d.ts → shared-BEZXY_BM.d.ts} +39 -12
  58. package/package.json +4 -1
  59. package/dist/shared-BdH3hWuP.d.ts +0 -23
  60. package/dist/shared-BqpFeosz.d.mts +0 -23
@@ -86,7 +86,7 @@ interface SwapSigningRequestRaw {
86
86
  type: string;
87
87
  router: string;
88
88
  quoteId: string;
89
- chainId: number;
89
+ chainId: number | string;
90
90
  signingScheme?: string;
91
91
  typedData: {
92
92
  domain: Record<string, unknown>;
@@ -226,14 +226,20 @@ interface EvmTx {
226
226
  to: string;
227
227
  data: string;
228
228
  value: BaseUnitAmount;
229
- gasLimit: BaseUnitAmount;
229
+ gasLimit?: BaseUnitAmount;
230
+ gasPrice?: BaseUnitAmount;
231
+ maxFeePerGas?: BaseUnitAmount;
232
+ maxPriorityFeePerGas?: BaseUnitAmount;
233
+ from?: string;
230
234
  chainId: number;
231
235
  }
232
236
  interface EvmApproval {
233
237
  tx: EvmTx;
234
238
  spender: string;
235
239
  }
236
- type EvmSigningRequest = SwapSigningRequestRaw;
240
+ interface EvmSigningRequest extends Omit<SwapSigningRequestRaw, "chainId"> {
241
+ chainId: number;
242
+ }
237
243
  interface SolanaMetadata {
238
244
  addressLookupTableAddresses?: string[];
239
245
  recentBlockhash?: string;
@@ -430,9 +436,6 @@ type SwapLifecycleEvent = {
430
436
  } | {
431
437
  type: "completed";
432
438
  executionId: string;
433
- } | {
434
- type: "requires-user-action";
435
- executionId: string;
436
439
  } | {
437
440
  type: "warning";
438
441
  executionId: string;
@@ -444,7 +447,7 @@ type SwapLifecycleEvent = {
444
447
  };
445
448
  interface SwapExecutionResult {
446
449
  executionId: string;
447
- status: "submitted" | "source-confirmed" | "processing" | "completed" | "failed" | "refunded" | "expired" | "requires-user-action";
450
+ status: "submitted" | "source-confirmed" | "processing" | "completed" | "failed" | "refunded" | "expired";
448
451
  router: string;
449
452
  txHash?: string;
450
453
  txHashes?: string[];
@@ -456,9 +459,16 @@ interface SwapExecutionResult {
456
459
  };
457
460
  raw: unknown;
458
461
  }
462
+ interface OrderPollingOptions {
463
+ /** Delay between order-status requests in milliseconds. Defaults to 5000. */
464
+ intervalMs?: number;
465
+ /** Maximum polling duration in milliseconds. Omit to poll indefinitely. */
466
+ timeoutMs?: number;
467
+ }
459
468
  interface ExecuteSwapInput {
460
469
  build: SwapBuild;
461
470
  waitFor?: WaitMode;
471
+ orderPolling?: OrderPollingOptions;
462
472
  signal?: AbortSignal;
463
473
  onEvent?: (event: SwapLifecycleEvent) => void;
464
474
  beforeSign?: (preview: SignRequestPreview) => void | Promise<void>;
@@ -473,15 +483,13 @@ interface OrderStatusResult {
473
483
  status: OrderStatus;
474
484
  raw: SwapOrderStatusDataRaw;
475
485
  }
476
- interface WaitForOrderInput extends OrderReference {
486
+ interface WaitForOrderInput extends OrderReference, OrderPollingOptions {
477
487
  signal?: AbortSignal;
478
- intervalMs?: number;
479
- timeoutMs?: number;
480
488
  }
481
489
  declare function normalizeOrderStatus(raw: SwapOrderStatusDataRaw): OrderStatus;
482
490
 
483
491
  interface ChainExecutionResult {
484
- status: "submitted" | "source-confirmed" | "requires-user-action";
492
+ status: "submitted" | "source-confirmed";
485
493
  txHash?: string;
486
494
  txHashes?: string[];
487
495
  orderId?: string;
@@ -529,4 +537,23 @@ declare class ExecutorRegistry {
529
537
  getSigner(chain: string, requireSignMessage?: false): ExecutorIdentityProvider;
530
538
  }
531
539
 
532
- 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 };
540
+ interface TransactionSubmission {
541
+ txHash: string;
542
+ raw?: unknown;
543
+ }
544
+ interface TransactionConfirmation {
545
+ status: "confirmed" | "failed";
546
+ raw?: unknown;
547
+ }
548
+ interface ExecutorErrorAdapter {
549
+ isUserRejection?(error: unknown): boolean;
550
+ /** Identity serialized as `mca.signer.identityKey` for MCA quotes. */
551
+ getIdentityKey?(): string | Promise<string>;
552
+ /**
553
+ * Optional offline message signing for flows such as MCA relayer withdraw.
554
+ * Chain transfer executors do not call this during normal swap execution.
555
+ */
556
+ signMessage?(message: string, options?: MessageSignOptions): Promise<string>;
557
+ }
558
+
559
+ 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 };
@@ -86,7 +86,7 @@ interface SwapSigningRequestRaw {
86
86
  type: string;
87
87
  router: string;
88
88
  quoteId: string;
89
- chainId: number;
89
+ chainId: number | string;
90
90
  signingScheme?: string;
91
91
  typedData: {
92
92
  domain: Record<string, unknown>;
@@ -226,14 +226,20 @@ interface EvmTx {
226
226
  to: string;
227
227
  data: string;
228
228
  value: BaseUnitAmount;
229
- gasLimit: BaseUnitAmount;
229
+ gasLimit?: BaseUnitAmount;
230
+ gasPrice?: BaseUnitAmount;
231
+ maxFeePerGas?: BaseUnitAmount;
232
+ maxPriorityFeePerGas?: BaseUnitAmount;
233
+ from?: string;
230
234
  chainId: number;
231
235
  }
232
236
  interface EvmApproval {
233
237
  tx: EvmTx;
234
238
  spender: string;
235
239
  }
236
- type EvmSigningRequest = SwapSigningRequestRaw;
240
+ interface EvmSigningRequest extends Omit<SwapSigningRequestRaw, "chainId"> {
241
+ chainId: number;
242
+ }
237
243
  interface SolanaMetadata {
238
244
  addressLookupTableAddresses?: string[];
239
245
  recentBlockhash?: string;
@@ -430,9 +436,6 @@ type SwapLifecycleEvent = {
430
436
  } | {
431
437
  type: "completed";
432
438
  executionId: string;
433
- } | {
434
- type: "requires-user-action";
435
- executionId: string;
436
439
  } | {
437
440
  type: "warning";
438
441
  executionId: string;
@@ -444,7 +447,7 @@ type SwapLifecycleEvent = {
444
447
  };
445
448
  interface SwapExecutionResult {
446
449
  executionId: string;
447
- status: "submitted" | "source-confirmed" | "processing" | "completed" | "failed" | "refunded" | "expired" | "requires-user-action";
450
+ status: "submitted" | "source-confirmed" | "processing" | "completed" | "failed" | "refunded" | "expired";
448
451
  router: string;
449
452
  txHash?: string;
450
453
  txHashes?: string[];
@@ -456,9 +459,16 @@ interface SwapExecutionResult {
456
459
  };
457
460
  raw: unknown;
458
461
  }
462
+ interface OrderPollingOptions {
463
+ /** Delay between order-status requests in milliseconds. Defaults to 5000. */
464
+ intervalMs?: number;
465
+ /** Maximum polling duration in milliseconds. Omit to poll indefinitely. */
466
+ timeoutMs?: number;
467
+ }
459
468
  interface ExecuteSwapInput {
460
469
  build: SwapBuild;
461
470
  waitFor?: WaitMode;
471
+ orderPolling?: OrderPollingOptions;
462
472
  signal?: AbortSignal;
463
473
  onEvent?: (event: SwapLifecycleEvent) => void;
464
474
  beforeSign?: (preview: SignRequestPreview) => void | Promise<void>;
@@ -473,15 +483,13 @@ interface OrderStatusResult {
473
483
  status: OrderStatus;
474
484
  raw: SwapOrderStatusDataRaw;
475
485
  }
476
- interface WaitForOrderInput extends OrderReference {
486
+ interface WaitForOrderInput extends OrderReference, OrderPollingOptions {
477
487
  signal?: AbortSignal;
478
- intervalMs?: number;
479
- timeoutMs?: number;
480
488
  }
481
489
  declare function normalizeOrderStatus(raw: SwapOrderStatusDataRaw): OrderStatus;
482
490
 
483
491
  interface ChainExecutionResult {
484
- status: "submitted" | "source-confirmed" | "requires-user-action";
492
+ status: "submitted" | "source-confirmed";
485
493
  txHash?: string;
486
494
  txHashes?: string[];
487
495
  orderId?: string;
@@ -529,4 +537,23 @@ declare class ExecutorRegistry {
529
537
  getSigner(chain: string, requireSignMessage?: false): ExecutorIdentityProvider;
530
538
  }
531
539
 
532
- 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 };
540
+ interface TransactionSubmission {
541
+ txHash: string;
542
+ raw?: unknown;
543
+ }
544
+ interface TransactionConfirmation {
545
+ status: "confirmed" | "failed";
546
+ raw?: unknown;
547
+ }
548
+ interface ExecutorErrorAdapter {
549
+ isUserRejection?(error: unknown): boolean;
550
+ /** Identity serialized as `mca.signer.identityKey` for MCA quotes. */
551
+ getIdentityKey?(): string | Promise<string>;
552
+ /**
553
+ * Optional offline message signing for flows such as MCA relayer withdraw.
554
+ * Chain transfer executors do not call this during normal swap execution.
555
+ */
556
+ signMessage?(message: string, options?: MessageSignOptions): Promise<string>;
557
+ }
558
+
559
+ 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.1",
3
+ "version": "2.0.3",
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,23 +0,0 @@
1
- import { M as MessageSignOptions } from './registry-DRYUqs7T.js';
2
-
3
- interface TransactionSubmission {
4
- txHash: string;
5
- raw?: unknown;
6
- }
7
- interface TransferSubmission {
8
- txHash?: string;
9
- requiresUserAction?: boolean;
10
- raw?: unknown;
11
- }
12
- interface ExecutorErrorAdapter {
13
- isUserRejection?(error: unknown): boolean;
14
- /** Identity serialized as `mca.signer.identityKey` for MCA quotes. */
15
- getIdentityKey?(): string | Promise<string>;
16
- /**
17
- * Optional offline message signing for flows such as MCA relayer withdraw.
18
- * Chain transfer executors do not call this during normal swap execution.
19
- */
20
- signMessage?(message: string, options?: MessageSignOptions): Promise<string>;
21
- }
22
-
23
- export type { ExecutorErrorAdapter as E, TransactionSubmission as T, TransferSubmission as a };
@@ -1,23 +0,0 @@
1
- import { M as MessageSignOptions } from './registry-DRYUqs7T.mjs';
2
-
3
- interface TransactionSubmission {
4
- txHash: string;
5
- raw?: unknown;
6
- }
7
- interface TransferSubmission {
8
- txHash?: string;
9
- requiresUserAction?: boolean;
10
- raw?: unknown;
11
- }
12
- interface ExecutorErrorAdapter {
13
- isUserRejection?(error: unknown): boolean;
14
- /** Identity serialized as `mca.signer.identityKey` for MCA quotes. */
15
- getIdentityKey?(): string | Promise<string>;
16
- /**
17
- * Optional offline message signing for flows such as MCA relayer withdraw.
18
- * Chain transfer executors do not call this during normal swap execution.
19
- */
20
- signMessage?(message: string, options?: MessageSignOptions): Promise<string>;
21
- }
22
-
23
- export type { ExecutorErrorAdapter as E, TransactionSubmission as T, TransferSubmission as a };