@rhea-finance/cross-chain-aggregation-dex 2.0.2 → 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 +47 -13
- 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 +3 -4
- package/dist/executors/zcash.d.ts +3 -4
- package/dist/executors/zcash.js +22 -2
- package/dist/executors/zcash.js.map +1 -1
- package/dist/executors/zcash.mjs +22 -2
- 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 +51 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51 -10
- package/dist/index.mjs.map +1 -1
- package/dist/{registry-DjohbPPm.d.mts → shared-BEZXY_BM.d.mts} +37 -7
- package/dist/{registry-DjohbPPm.d.ts → shared-BEZXY_BM.d.ts} +37 -7
- package/package.json +4 -1
- package/dist/shared-BbfGrWrJ.d.ts +0 -18
- package/dist/shared-BxJ0H20s.d.mts +0 -18
|
@@ -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;
|
|
@@ -453,9 +459,16 @@ interface SwapExecutionResult {
|
|
|
453
459
|
};
|
|
454
460
|
raw: unknown;
|
|
455
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
|
+
}
|
|
456
468
|
interface ExecuteSwapInput {
|
|
457
469
|
build: SwapBuild;
|
|
458
470
|
waitFor?: WaitMode;
|
|
471
|
+
orderPolling?: OrderPollingOptions;
|
|
459
472
|
signal?: AbortSignal;
|
|
460
473
|
onEvent?: (event: SwapLifecycleEvent) => void;
|
|
461
474
|
beforeSign?: (preview: SignRequestPreview) => void | Promise<void>;
|
|
@@ -470,10 +483,8 @@ interface OrderStatusResult {
|
|
|
470
483
|
status: OrderStatus;
|
|
471
484
|
raw: SwapOrderStatusDataRaw;
|
|
472
485
|
}
|
|
473
|
-
interface WaitForOrderInput extends OrderReference {
|
|
486
|
+
interface WaitForOrderInput extends OrderReference, OrderPollingOptions {
|
|
474
487
|
signal?: AbortSignal;
|
|
475
|
-
intervalMs?: number;
|
|
476
|
-
timeoutMs?: number;
|
|
477
488
|
}
|
|
478
489
|
declare function normalizeOrderStatus(raw: SwapOrderStatusDataRaw): OrderStatus;
|
|
479
490
|
|
|
@@ -526,4 +537,23 @@ declare class ExecutorRegistry {
|
|
|
526
537
|
getSigner(chain: string, requireSignMessage?: false): ExecutorIdentityProvider;
|
|
527
538
|
}
|
|
528
539
|
|
|
529
|
-
|
|
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;
|
|
@@ -453,9 +459,16 @@ interface SwapExecutionResult {
|
|
|
453
459
|
};
|
|
454
460
|
raw: unknown;
|
|
455
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
|
+
}
|
|
456
468
|
interface ExecuteSwapInput {
|
|
457
469
|
build: SwapBuild;
|
|
458
470
|
waitFor?: WaitMode;
|
|
471
|
+
orderPolling?: OrderPollingOptions;
|
|
459
472
|
signal?: AbortSignal;
|
|
460
473
|
onEvent?: (event: SwapLifecycleEvent) => void;
|
|
461
474
|
beforeSign?: (preview: SignRequestPreview) => void | Promise<void>;
|
|
@@ -470,10 +483,8 @@ interface OrderStatusResult {
|
|
|
470
483
|
status: OrderStatus;
|
|
471
484
|
raw: SwapOrderStatusDataRaw;
|
|
472
485
|
}
|
|
473
|
-
interface WaitForOrderInput extends OrderReference {
|
|
486
|
+
interface WaitForOrderInput extends OrderReference, OrderPollingOptions {
|
|
474
487
|
signal?: AbortSignal;
|
|
475
|
-
intervalMs?: number;
|
|
476
|
-
timeoutMs?: number;
|
|
477
488
|
}
|
|
478
489
|
declare function normalizeOrderStatus(raw: SwapOrderStatusDataRaw): OrderStatus;
|
|
479
490
|
|
|
@@ -526,4 +537,23 @@ declare class ExecutorRegistry {
|
|
|
526
537
|
getSigner(chain: string, requireSignMessage?: false): ExecutorIdentityProvider;
|
|
527
538
|
}
|
|
528
539
|
|
|
529
|
-
|
|
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,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 };
|