@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.
- package/README.md +71 -15
- 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 +59 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -11
- package/dist/index.mjs.map +1 -1
- package/dist/{registry-DjohbPPm.d.mts → shared-D0_DbMT2.d.mts} +44 -9
- package/dist/{registry-DjohbPPm.d.ts → shared-D0_DbMT2.d.ts} +44 -9
- package/package.json +4 -1
- package/dist/shared-BbfGrWrJ.d.ts +0 -18
- 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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
/**
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
/**
|
|
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
|
-
|
|
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.
|
|
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 };
|