@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.
- package/README.md +567 -206
- package/dist/executors/aptos.d.mts +3 -4
- package/dist/executors/aptos.d.ts +3 -4
- package/dist/executors/aptos.js +22 -2
- package/dist/executors/aptos.js.map +1 -1
- package/dist/executors/aptos.mjs +22 -2
- package/dist/executors/aptos.mjs.map +1 -1
- package/dist/executors/bitcoin.d.mts +3 -4
- package/dist/executors/bitcoin.d.ts +3 -4
- package/dist/executors/bitcoin.js +22 -2
- package/dist/executors/bitcoin.js.map +1 -1
- package/dist/executors/bitcoin.mjs +22 -2
- package/dist/executors/bitcoin.mjs.map +1 -1
- package/dist/executors/evm.d.mts +3 -4
- package/dist/executors/evm.d.ts +3 -4
- package/dist/executors/evm.js +29 -13
- package/dist/executors/evm.js.map +1 -1
- package/dist/executors/evm.mjs +29 -13
- package/dist/executors/evm.mjs.map +1 -1
- package/dist/executors/near.d.mts +3 -4
- package/dist/executors/near.d.ts +3 -4
- package/dist/executors/near.js +22 -2
- package/dist/executors/near.js.map +1 -1
- package/dist/executors/near.mjs +22 -2
- package/dist/executors/near.mjs.map +1 -1
- package/dist/executors/solana.d.mts +3 -4
- package/dist/executors/solana.d.ts +3 -4
- package/dist/executors/solana.js +22 -2
- package/dist/executors/solana.js.map +1 -1
- package/dist/executors/solana.mjs +22 -2
- package/dist/executors/solana.mjs.map +1 -1
- package/dist/executors/sui.d.mts +3 -4
- package/dist/executors/sui.d.ts +3 -4
- package/dist/executors/sui.js +22 -2
- package/dist/executors/sui.js.map +1 -1
- package/dist/executors/sui.mjs +22 -2
- package/dist/executors/sui.mjs.map +1 -1
- package/dist/executors/tron.d.mts +3 -4
- package/dist/executors/tron.d.ts +3 -4
- package/dist/executors/tron.js +22 -2
- package/dist/executors/tron.js.map +1 -1
- package/dist/executors/tron.mjs +22 -2
- package/dist/executors/tron.mjs.map +1 -1
- package/dist/executors/zcash.d.mts +4 -5
- package/dist/executors/zcash.d.ts +4 -5
- package/dist/executors/zcash.js +24 -10
- package/dist/executors/zcash.js.map +1 -1
- package/dist/executors/zcash.mjs +24 -10
- package/dist/executors/zcash.mjs.map +1 -1
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +59 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -25
- package/dist/index.mjs.map +1 -1
- package/dist/{registry-DRYUqs7T.d.mts → shared-BEZXY_BM.d.mts} +39 -12
- package/dist/{registry-DRYUqs7T.d.ts → shared-BEZXY_BM.d.ts} +39 -12
- package/package.json +4 -1
- package/dist/shared-BdH3hWuP.d.ts +0 -23
- 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
|
|
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
|
-
|
|
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"
|
|
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"
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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"
|
|
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"
|
|
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
|
-
|
|
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.
|
|
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 };
|