@pushchain/core 4.0.14-alpha.0 → 5.1.0

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 (87) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/package.json +1 -1
  3. package/src/lib/constants/abi/cea.evm.d.ts +23 -0
  4. package/src/lib/constants/abi/cea.evm.js +34 -0
  5. package/src/lib/constants/abi/cea.evm.js.map +1 -0
  6. package/src/lib/constants/abi/ceaFactory.evm.d.ts +65 -0
  7. package/src/lib/constants/abi/ceaFactory.evm.js +41 -0
  8. package/src/lib/constants/abi/ceaFactory.evm.js.map +1 -0
  9. package/src/lib/constants/abi/erc20.evm.d.ts +14 -0
  10. package/src/lib/constants/abi/erc20.evm.js +7 -0
  11. package/src/lib/constants/abi/erc20.evm.js.map +1 -1
  12. package/src/lib/constants/abi/index.d.ts +6 -0
  13. package/src/lib/constants/abi/index.js +15 -1
  14. package/src/lib/constants/abi/index.js.map +1 -1
  15. package/src/lib/constants/abi/prc20.evm.d.ts +188 -0
  16. package/src/lib/constants/abi/prc20.evm.js +130 -0
  17. package/src/lib/constants/abi/prc20.evm.js.map +1 -0
  18. package/src/lib/constants/abi/uea-factory.d.ts +30 -0
  19. package/src/lib/constants/abi/uea-factory.js +25 -0
  20. package/src/lib/constants/abi/uea-factory.js.map +1 -0
  21. package/src/lib/constants/abi/universalGateway.evm.d.ts +93 -0
  22. package/src/lib/constants/abi/universalGateway.evm.js +70 -0
  23. package/src/lib/constants/abi/universalGateway.evm.js.map +1 -0
  24. package/src/lib/constants/abi/universalGatewayPC.evm.d.ts +140 -0
  25. package/src/lib/constants/abi/universalGatewayPC.evm.js +70 -0
  26. package/src/lib/constants/abi/universalGatewayPC.evm.js.map +1 -0
  27. package/src/lib/constants/abi/universalGatewayV0.evm.js +57 -0
  28. package/src/lib/constants/abi/universalGatewayV0.evm.js.map +1 -1
  29. package/src/lib/constants/abi/universalGatewayV0.json +1162 -1647
  30. package/src/lib/constants/chain.d.ts +52 -0
  31. package/src/lib/constants/chain.js +161 -1
  32. package/src/lib/constants/chain.js.map +1 -1
  33. package/src/lib/constants/index.d.ts +9 -1
  34. package/src/lib/constants/index.js +20 -1
  35. package/src/lib/constants/index.js.map +1 -1
  36. package/src/lib/constants/selectors.d.ts +42 -0
  37. package/src/lib/constants/selectors.js +45 -0
  38. package/src/lib/constants/selectors.js.map +1 -0
  39. package/src/lib/constants/tokens.d.ts +41 -0
  40. package/src/lib/constants/tokens.js +62 -1
  41. package/src/lib/constants/tokens.js.map +1 -1
  42. package/src/lib/generated/uexecutor/v2/index.d.ts +2 -0
  43. package/src/lib/generated/uexecutor/v2/index.js +31 -0
  44. package/src/lib/generated/uexecutor/v2/index.js.map +1 -0
  45. package/src/lib/generated/uexecutor/v2/query.d.ts +23 -0
  46. package/src/lib/generated/uexecutor/v2/query.js +79 -0
  47. package/src/lib/generated/uexecutor/v2/query.js.map +1 -0
  48. package/src/lib/generated/uexecutor/v2/types.d.ts +101 -0
  49. package/src/lib/generated/uexecutor/v2/types.js +660 -0
  50. package/src/lib/generated/uexecutor/v2/types.js.map +1 -0
  51. package/src/lib/generated/v1/tx.d.ts +22 -0
  52. package/src/lib/generated/v1/tx.js +188 -1
  53. package/src/lib/generated/v1/tx.js.map +1 -1
  54. package/src/lib/index.d.ts +5 -0
  55. package/src/lib/index.js +25 -1
  56. package/src/lib/index.js.map +1 -1
  57. package/src/lib/orchestrator/cea-utils.d.ts +85 -0
  58. package/src/lib/orchestrator/cea-utils.js +186 -0
  59. package/src/lib/orchestrator/cea-utils.js.map +1 -0
  60. package/src/lib/orchestrator/orchestrator.d.ts +326 -3
  61. package/src/lib/orchestrator/orchestrator.js +3262 -135
  62. package/src/lib/orchestrator/orchestrator.js.map +1 -1
  63. package/src/lib/orchestrator/orchestrator.types.d.ts +487 -0
  64. package/src/lib/orchestrator/orchestrator.types.js +17 -0
  65. package/src/lib/orchestrator/orchestrator.types.js.map +1 -1
  66. package/src/lib/orchestrator/payload-builders.d.ts +210 -1
  67. package/src/lib/orchestrator/payload-builders.js +481 -0
  68. package/src/lib/orchestrator/payload-builders.js.map +1 -1
  69. package/src/lib/orchestrator/route-detector.d.ts +102 -0
  70. package/src/lib/orchestrator/route-detector.js +355 -0
  71. package/src/lib/orchestrator/route-detector.js.map +1 -0
  72. package/src/lib/price-fetch/price-fetch.js +5 -2
  73. package/src/lib/price-fetch/price-fetch.js.map +1 -1
  74. package/src/lib/progress-hook/progress-hook.js +43 -0
  75. package/src/lib/progress-hook/progress-hook.js.map +1 -1
  76. package/src/lib/progress-hook/progress-hook.types.d.ts +7 -1
  77. package/src/lib/progress-hook/progress-hook.types.js +7 -0
  78. package/src/lib/progress-hook/progress-hook.types.js.map +1 -1
  79. package/src/lib/push-chain/push-chain.d.ts +71 -1
  80. package/src/lib/push-chain/push-chain.js +70 -1
  81. package/src/lib/push-chain/push-chain.js.map +1 -1
  82. package/src/lib/push-client/push-client.d.ts +10 -1
  83. package/src/lib/push-client/push-client.js +35 -6
  84. package/src/lib/push-client/push-client.js.map +1 -1
  85. package/src/lib/vm-client/evm-client.d.ts +3 -1
  86. package/src/lib/vm-client/evm-client.js +23 -15
  87. package/src/lib/vm-client/evm-client.js.map +1 -1
@@ -1,3 +1,30 @@
1
+ import type { CHAIN } from '../constants/enums';
2
+ /**
3
+ * Chain target for cross-chain routing (Routes 2, 3, 4)
4
+ * When `to` is a ChainTarget, the transaction executes on the specified external chain
5
+ */
6
+ export type ChainTarget = {
7
+ address: `0x${string}`;
8
+ chain: CHAIN;
9
+ };
10
+ /**
11
+ * Source chain for CEA-originated transactions (Routes 3, 4)
12
+ * Specifies which CEA domain submits the transaction
13
+ * NOTE: This does NOT represent where the user signed from
14
+ */
15
+ export type ChainSource = {
16
+ chain: CHAIN;
17
+ };
18
+ /**
19
+ * Union type for 'to' parameter - backwards compatible
20
+ * - string: Route 1 (UOA → Push)
21
+ * - ChainTarget: Routes 2, 3, 4 (cross-chain)
22
+ */
23
+ export type UniversalTo = `0x${string}` | ChainTarget;
24
+ /**
25
+ * Transaction route identifiers
26
+ */
27
+ export type TransactionRouteType = 'UOA_TO_PUSH' | 'UOA_TO_CEA' | 'CEA_TO_PUSH' | 'CEA_TO_CEA';
1
28
  export type ExecuteParams = {
2
29
  /**
3
30
  * The target contract or account on Push Chain.
@@ -62,6 +89,23 @@ export type ExecuteParams = {
62
89
  amount: bigint;
63
90
  token?: import('../constants').MoveableToken;
64
91
  };
92
+ /**
93
+ * Internal: Pre-fetched UEA status to avoid redundant RPC calls.
94
+ * Used by executeUoaToCea() to pass UEA state to execute().
95
+ * @internal
96
+ */
97
+ _ueaStatus?: {
98
+ isDeployed: boolean;
99
+ nonce: bigint;
100
+ balance: bigint;
101
+ };
102
+ /**
103
+ * Internal: Skip fee locking for outbound flows (UEA→CEA).
104
+ * Outbound txs execute entirely on Push Chain and don't need
105
+ * external-chain fee locking.
106
+ * @internal
107
+ */
108
+ _skipFeeLocking?: boolean;
65
109
  };
66
110
  /**
67
111
  * New Universal Transaction Receipt interface with prioritized field ordering
@@ -100,6 +144,18 @@ export interface UniversalTxResponse {
100
144
  data: string;
101
145
  value: bigint;
102
146
  };
147
+ /** Target chain where transaction was executed */
148
+ chain?: CHAIN;
149
+ /** CAIP-2 chain namespace, e.g., "eip155:11155111" */
150
+ chainNamespace?: string;
151
+ /** Position in chain sequence (0-indexed) */
152
+ hopIndex?: number;
153
+ /** Previous transaction hash in chain */
154
+ parentTxHash?: string;
155
+ /** Next transaction hash in chain */
156
+ childTxHash?: string;
157
+ /** Transaction route (UOA_TO_PUSH, UOA_TO_CEA, CEA_TO_PUSH, CEA_TO_CEA) */
158
+ route?: TransactionRouteType;
103
159
  }
104
160
  /**
105
161
  * New Universal Transaction Receipt interface for transaction receipts
@@ -122,6 +178,22 @@ export interface UniversalTxReceipt {
122
178
  from: string;
123
179
  to: string;
124
180
  };
181
+ /** Target chain where transaction was executed */
182
+ chain?: CHAIN;
183
+ /** CAIP-2 chain namespace, e.g., "eip155:11155111" */
184
+ chainNamespace?: string;
185
+ /** Transaction hash on external chain (outbound only) */
186
+ externalTxHash?: string;
187
+ /** External chain where tx executed */
188
+ externalChain?: CHAIN;
189
+ /** Explorer URL for external tx */
190
+ externalExplorerUrl?: string;
191
+ /** Recipient on external chain */
192
+ externalRecipient?: string;
193
+ /** Amount transferred to external chain */
194
+ externalAmount?: string;
195
+ /** Asset address on external chain */
196
+ externalAssetAddr?: string;
125
197
  }
126
198
  /**
127
199
  * Signature interface modeled after ethers.js v6 Signature interface
@@ -151,6 +223,15 @@ export interface UniversalTxRequest {
151
223
  };
152
224
  signatureData: `0x${string}`;
153
225
  }
226
+ /** V1 gateway request — uses a plain `revertRecipient` address instead of a struct. */
227
+ export interface UniversalTxRequestV1 {
228
+ recipient: `0x${string}`;
229
+ token: `0x${string}`;
230
+ amount: bigint;
231
+ payload: `0x${string}`;
232
+ revertRecipient: `0x${string}`;
233
+ signatureData: `0x${string}`;
234
+ }
154
235
  export interface UniversalTokenTxRequest {
155
236
  recipient: `0x${string}`;
156
237
  token: `0x${string}`;
@@ -166,9 +247,324 @@ export interface UniversalTokenTxRequest {
166
247
  amountOutMinETH: bigint;
167
248
  deadline: bigint;
168
249
  }
250
+ /** V1 gateway token request — uses a plain `revertRecipient` address instead of a struct. */
251
+ export interface UniversalTokenTxRequestV1 {
252
+ recipient: `0x${string}`;
253
+ token: `0x${string}`;
254
+ amount: bigint;
255
+ gasToken: `0x${string}`;
256
+ gasAmount: bigint;
257
+ payload: `0x${string}`;
258
+ revertRecipient: `0x${string}`;
259
+ signatureData: `0x${string}`;
260
+ amountOutMinETH: bigint;
261
+ deadline: bigint;
262
+ }
169
263
  /**
170
264
  * Options for tracking a transaction by hash
171
265
  */
266
+ /**
267
+ * Extended ExecuteParams for multi-chain transactions
268
+ * Supports all 4 routes:
269
+ * - Route 1: UOA → Push (to is string)
270
+ * - Route 2: UOA → CEA (to is ChainTarget, no from)
271
+ * - Route 3: CEA → Push (from.chain present, to.chain is Push)
272
+ * - Route 4: CEA → CEA (from.chain present, to.chain is external)
273
+ */
274
+ export type UniversalExecuteParams = Omit<ExecuteParams, 'to'> & {
275
+ /**
276
+ * Source chain for CEA-originated transactions (Routes 3, 4)
277
+ * When present, transaction originates from CEA on this chain
278
+ */
279
+ from?: ChainSource;
280
+ /**
281
+ * Destination - where execution happens
282
+ * - string: Push Chain target (Route 1)
283
+ * - ChainTarget: External chain target (Routes 2, 3, 4)
284
+ */
285
+ to: UniversalTo;
286
+ /**
287
+ * SVM-specific: CPI execution parameters for Solana targets (Route 2).
288
+ * When present, the outbound transaction will execute a Cross-Program Invocation
289
+ * on the specified Solana program with the given accounts and instruction data.
290
+ * Only applicable when `to.chain` is a Solana chain.
291
+ */
292
+ svmExecute?: SvmExecuteParams;
293
+ /**
294
+ * When true, sends MIGRATION_SELECTOR as raw CEA payload (no multicall wrapping).
295
+ * Used for CEA contract upgrades. Incompatible with value/funds/data/svmExecute.
296
+ * Only applicable for Route 2 (UOA_TO_CEA) on EVM chains.
297
+ */
298
+ migration?: boolean;
299
+ };
300
+ /**
301
+ * Account metadata for SVM CPI execution (Solana Gateway pattern).
302
+ * Pubkey is 0x-prefixed hex encoding of a 32-byte Solana public key.
303
+ */
304
+ export interface SvmGatewayAccountMeta {
305
+ /** Solana public key as 0x-prefixed hex (32 bytes = 0x + 64 hex chars) */
306
+ pubkey: `0x${string}`;
307
+ /** Whether this account is writable in the CPI */
308
+ isWritable: boolean;
309
+ }
310
+ /**
311
+ * Fields for encoding the SVM execute payload (binary format).
312
+ * Used internally by encodeSvmExecutePayload.
313
+ */
314
+ export interface SvmExecutePayloadFields {
315
+ /** Target Solana program to CPI into (32 bytes, 0x-prefixed hex) */
316
+ targetProgram: `0x${string}`;
317
+ /** Accounts required for the CPI call */
318
+ accounts: SvmGatewayAccountMeta[];
319
+ /** Raw instruction data for the target program */
320
+ ixData: Uint8Array;
321
+ /** Instruction ID: 2 = execute (default) */
322
+ instructionId?: number;
323
+ }
324
+ /**
325
+ * User-facing parameters for CPI execution on a Solana program via Route 2.
326
+ * Passed as `svmExecute` in UniversalExecuteParams when targeting SVM chains.
327
+ */
328
+ export interface SvmExecuteParams {
329
+ /** Target Solana program to CPI into (32 bytes, 0x-prefixed hex) */
330
+ targetProgram: `0x${string}`;
331
+ /** Accounts required for the CPI call */
332
+ accounts: SvmGatewayAccountMeta[];
333
+ /** Raw instruction data for the target program */
334
+ ixData: Uint8Array;
335
+ }
336
+ /**
337
+ * Request structure for sendUniversalTxOutbound on Push Chain
338
+ * Used for Routes 2, 3, 4 (outbound from Push)
339
+ *
340
+ * NOTE: The `target` field is a LEGACY parameter for contract compatibility.
341
+ * The deployed UniversalGatewayPC contract still expects this field, but it will
342
+ * be removed in future contract upgrades. Pass any non-zero address (e.g., CEA address).
343
+ * The actual destination is determined by the relay from the token's SOURCE_CHAIN_NAMESPACE.
344
+ */
345
+ export interface UniversalOutboundTxRequest {
346
+ /**
347
+ * LEGACY/DUMMY: Raw destination address bytes for contract compatibility.
348
+ * Pass any non-zero address - this value is NOT used by the relay to determine
349
+ * the actual transaction destination. Will be removed in future contract upgrades.
350
+ */
351
+ target: `0x${string}`;
352
+ /** PRC20 token address on Push Chain to burn */
353
+ token: `0x${string}`;
354
+ /** Amount to burn (0 for no-burn, use existing CEA balance) */
355
+ amount: bigint;
356
+ /** Gas limit for fee quote (0 = default BASE_GAS_LIMIT) */
357
+ gasLimit: bigint;
358
+ /** Raw ABI-encoded Multicall[] (no selector prefix) */
359
+ payload: `0x${string}`;
360
+ /** Address to receive funds on revert */
361
+ revertRecipient: `0x${string}`;
362
+ }
363
+ /**
364
+ * Internal metadata attached to each prepared transaction.
365
+ * Carries all information needed to nest this hop into a cascade.
366
+ * @internal
367
+ */
368
+ export interface HopDescriptor {
369
+ /** Original user params */
370
+ params: UniversalExecuteParams;
371
+ /** Detected route */
372
+ route: TransactionRouteType;
373
+ /** Target chain for outbound (Route 2) */
374
+ targetChain?: CHAIN;
375
+ /** Source chain for inbound (Route 3) */
376
+ sourceChain?: CHAIN;
377
+ /** CEA address on the relevant external chain */
378
+ ceaAddress?: `0x${string}`;
379
+ /** Operations to execute on external chain CEA */
380
+ ceaMulticalls?: MultiCall[];
381
+ /** Operations to execute on Push Chain */
382
+ pushMulticalls?: MultiCall[];
383
+ /** PRC-20 token address to burn for outbound */
384
+ prc20Token?: `0x${string}`;
385
+ /** Amount of PRC-20 to burn */
386
+ burnAmount?: bigint;
387
+ /** Gas token address on Push Chain */
388
+ gasToken?: `0x${string}`;
389
+ /** Gas fee amount in gas token */
390
+ gasFee?: bigint;
391
+ /** Gas limit for outbound relay */
392
+ gasLimit: bigint;
393
+ /** UEA address */
394
+ ueaAddress: `0x${string}`;
395
+ /** Address to receive funds on revert */
396
+ revertRecipient: `0x${string}`;
397
+ /** Whether this hop targets an SVM chain (Solana) */
398
+ isSvmTarget?: boolean;
399
+ /** SVM execute payload (binary-encoded, for Solana targets) */
400
+ svmPayload?: `0x${string}`;
401
+ /** Whether this hop is a CEA migration (raw MIGRATION_SELECTOR payload) */
402
+ isMigration?: boolean;
403
+ }
404
+ /**
405
+ * Segment types for cascade composition
406
+ * @internal
407
+ */
408
+ export type CascadeSegmentType = 'PUSH_EXECUTION' | 'OUTBOUND_TO_CEA' | 'INBOUND_FROM_CEA';
409
+ /**
410
+ * A segment groups one or more hops of the same type/direction.
411
+ * Consecutive same-chain hops are merged within a segment.
412
+ * @internal
413
+ */
414
+ export interface CascadeSegment {
415
+ /** Segment type determines composition behavior */
416
+ type: CascadeSegmentType;
417
+ /** Hops in this segment */
418
+ hops: HopDescriptor[];
419
+ /** Target chain (for OUTBOUND_TO_CEA) */
420
+ targetChain?: CHAIN;
421
+ /** Source chain (for INBOUND_FROM_CEA) */
422
+ sourceChain?: CHAIN;
423
+ /** Merged CEA multicalls from all hops in segment */
424
+ mergedCeaMulticalls?: MultiCall[];
425
+ /** Merged Push Chain multicalls from all hops in segment */
426
+ mergedPushMulticalls?: MultiCall[];
427
+ /** Sum of burn amounts from merged hops */
428
+ totalBurnAmount?: bigint;
429
+ /** PRC-20 token for this segment */
430
+ prc20Token?: `0x${string}`;
431
+ /** Gas token for this segment */
432
+ gasToken?: `0x${string}`;
433
+ /** Total gas fee for this segment */
434
+ gasFee?: bigint;
435
+ /** Gas limit for this segment */
436
+ gasLimit?: bigint;
437
+ }
438
+ /**
439
+ * Prepared transaction for inspection before sending
440
+ * Returned by prepareTransaction()
441
+ */
442
+ export interface PreparedUniversalTx {
443
+ /** Detected route for this transaction */
444
+ route: TransactionRouteType;
445
+ /** Encoded payload ready for submission */
446
+ payload: `0x${string}`;
447
+ /** Gateway request object (inbound or outbound) */
448
+ gatewayRequest: UniversalTxRequest | UniversalOutboundTxRequest;
449
+ /** Estimated gas for the transaction */
450
+ estimatedGas: bigint;
451
+ /** Nonce to use */
452
+ nonce: bigint;
453
+ /** Signature deadline */
454
+ deadline: bigint;
455
+ /** Internal hop descriptor for cascade nesting @internal */
456
+ _hop: HopDescriptor;
457
+ /** Chain additional transactions after this one (cascade) */
458
+ thenOn: (nextTx: PreparedUniversalTx) => CascadedTransactionBuilder;
459
+ /** Execute this prepared transaction */
460
+ send: () => Promise<UniversalTxResponse>;
461
+ }
462
+ /**
463
+ * @deprecated Use CascadedTransactionBuilder instead.
464
+ * Kept for backward compatibility.
465
+ */
466
+ export interface ChainedTransactionBuilder {
467
+ /** Add another transaction to the chain */
468
+ thenOn: (nextTx: UniversalExecuteParams) => ChainedTransactionBuilder;
469
+ /** Execute all chained transactions */
470
+ send: () => Promise<MultiChainTxResponse>;
471
+ }
472
+ /**
473
+ * @deprecated Use CascadedTxResponse instead.
474
+ * Kept for backward compatibility.
475
+ */
476
+ export interface MultiChainTxResponse {
477
+ /** All transaction responses in execution order */
478
+ transactions: UniversalTxResponse[];
479
+ /** Summary of each chain's execution */
480
+ chains: {
481
+ chain: CHAIN;
482
+ hash: string;
483
+ blockNumber: bigint;
484
+ status: 'pending' | 'confirmed' | 'failed';
485
+ }[];
486
+ }
487
+ /**
488
+ * Builder for composing cascaded (nested) multi-chain transactions.
489
+ * Each call to thenOn() adds another hop to the cascade.
490
+ * send() composes all hops bottom-to-top and executes a single Push Chain tx.
491
+ */
492
+ export interface CascadedTransactionBuilder {
493
+ /** Add another hop to the cascade */
494
+ thenOn: (nextTx: PreparedUniversalTx) => CascadedTransactionBuilder;
495
+ /** Compose all hops bottom-to-top and execute the single initial tx */
496
+ send: () => Promise<CascadedTxResponse>;
497
+ }
498
+ /**
499
+ * Response for cascaded multi-chain transactions.
500
+ * Contains the initial tx and tracking info for all hops.
501
+ */
502
+ export interface CascadedTxResponse {
503
+ /** The initial Push Chain transaction hash (user-signed) */
504
+ initialTxHash: string;
505
+ /** The initial transaction response */
506
+ initialTxResponse: UniversalTxResponse;
507
+ /** Ordered list of hops with their expected routing */
508
+ hops: CascadeHopInfo[];
509
+ /** Total number of hops in the cascade */
510
+ hopCount: number;
511
+ /** Wait for ALL hops to complete across all chains */
512
+ waitForAll: (opts?: CascadeTrackOptions) => Promise<CascadeCompletionResult>;
513
+ /** Convenience alias for waitForAll() */
514
+ wait: (opts?: CascadeTrackOptions) => Promise<CascadeCompletionResult>;
515
+ }
516
+ /**
517
+ * Information about a single hop in a cascade
518
+ */
519
+ export interface CascadeHopInfo {
520
+ /** Index in the cascade (0 = first hop) */
521
+ hopIndex: number;
522
+ /** Route for this hop */
523
+ route: TransactionRouteType;
524
+ /** Chain where execution occurs */
525
+ executionChain: CHAIN;
526
+ /** Expected universalSubTxId (computed from parent) */
527
+ expectedSubTxId?: string;
528
+ /** Status tracking */
529
+ status: 'pending' | 'submitted' | 'confirmed' | 'failed';
530
+ /** Resolved tx hash once available */
531
+ txHash?: string;
532
+ /** External chain tx details (for outbound hops) */
533
+ outboundDetails?: OutboundTxDetails;
534
+ }
535
+ /**
536
+ * Options for cascade tracking
537
+ */
538
+ export interface CascadeTrackOptions {
539
+ /** Polling interval (default: 5000ms) */
540
+ pollingIntervalMs?: number;
541
+ /** Total timeout (default: 600000ms = 10 min) */
542
+ timeout?: number;
543
+ /** Progress callback */
544
+ progressHook?: (event: CascadeProgressEvent) => void;
545
+ }
546
+ /**
547
+ * Progress event emitted during cascade tracking
548
+ */
549
+ export interface CascadeProgressEvent {
550
+ hopIndex: number;
551
+ route: TransactionRouteType;
552
+ chain: CHAIN;
553
+ status: 'waiting' | 'polling' | 'found' | 'confirmed' | 'failed' | 'timeout';
554
+ txHash?: string;
555
+ elapsed: number;
556
+ }
557
+ /**
558
+ * Final result of cascade completion tracking
559
+ */
560
+ export interface CascadeCompletionResult {
561
+ /** Whether all hops completed successfully */
562
+ success: boolean;
563
+ /** Final state of all hops */
564
+ hops: CascadeHopInfo[];
565
+ /** Index of first failed hop (if any) */
566
+ failedAt?: number;
567
+ }
172
568
  export interface TrackTransactionOptions {
173
569
  /**
174
570
  * Target chain to track transaction on. Defaults to Push Chain based on client network.
@@ -202,3 +598,94 @@ export interface TrackTransactionOptions {
202
598
  rpcUrls?: Partial<Record<import('../constants/enums').CHAIN, string[]>>;
203
599
  };
204
600
  }
601
+ /**
602
+ * External chain transaction details after relay completion
603
+ */
604
+ export interface OutboundTxDetails {
605
+ /** Transaction hash on the external chain */
606
+ externalTxHash: string;
607
+ /** Target chain enum */
608
+ destinationChain: import('../constants/enums').CHAIN;
609
+ /** Full explorer URL for the transaction */
610
+ explorerUrl: string;
611
+ /** Recipient address on the external chain */
612
+ recipient: string;
613
+ /** Amount transferred */
614
+ amount: string;
615
+ /** Asset address on external chain (address(0) for native) */
616
+ assetAddr: string;
617
+ }
618
+ /**
619
+ * Progress event for outbound sync operations
620
+ */
621
+ export interface OutboundSyncProgress {
622
+ status: 'waiting' | 'polling' | 'success' | 'failed' | 'timeout';
623
+ elapsed: number;
624
+ }
625
+ /**
626
+ * Options for waitForOutboundTx polling
627
+ */
628
+ export interface WaitForOutboundOptions {
629
+ /**
630
+ * Initial wait before first poll (default: 30000ms)
631
+ * Gives relay time to process before we start polling
632
+ */
633
+ initialWaitMs?: number;
634
+ /**
635
+ * Interval between polls (default: 5000ms)
636
+ */
637
+ pollingIntervalMs?: number;
638
+ /**
639
+ * Total timeout in milliseconds (default: 120000ms)
640
+ * Measured from start, includes initial wait
641
+ */
642
+ timeout?: number;
643
+ /**
644
+ * Progress callback for tracking events
645
+ */
646
+ progressHook?: (event: {
647
+ status: 'waiting' | 'polling' | 'found' | 'failed' | 'timeout';
648
+ elapsed: number;
649
+ }) => void;
650
+ /**
651
+ * @internal Pre-resolved universalSubTxId for cascade per-hop tracking.
652
+ * When provided, skips extraction from the Push Chain tx events.
653
+ */
654
+ _resolvedSubTxId?: string;
655
+ /**
656
+ * @internal Expected destination chain CAIP-2 namespace (e.g., 'eip155:97').
657
+ * When provided, only considers an outbound as found if its destinationChain
658
+ * matches this value. Used for multi-outbound cascades where a single utx_id
659
+ * has multiple outbound operations to different chains.
660
+ */
661
+ _expectedDestinationChain?: string;
662
+ }
663
+ /**
664
+ * UEA deployment and version status.
665
+ * Versions are stored as strings (e.g. "1.0.2") matching the on-chain format.
666
+ * Comparison uses parseUEAVersion() to convert to numeric for ordering.
667
+ */
668
+ export interface UEAStatus {
669
+ /** Whether status has been fetched from chain */
670
+ loaded: boolean;
671
+ /** Whether the UEA proxy is deployed on Push Chain */
672
+ deployed: boolean;
673
+ /** Current UEA implementation version string (e.g. "1.0.0", empty if not deployed) */
674
+ version: string;
675
+ /** Latest required version from UEAFactory (e.g. "1.0.2", empty if unknown) */
676
+ minRequiredVersion: string;
677
+ /** True when deployed && parseUEAVersion(version) < parseUEAVersion(minRequiredVersion) */
678
+ requiresUpgrade: boolean;
679
+ }
680
+ /**
681
+ * Account status returned by pushChainClient.getAccountStatus()
682
+ */
683
+ export interface AccountStatus {
684
+ mode: 'read-only' | 'signer';
685
+ uea: UEAStatus;
686
+ }
687
+ /**
688
+ * Parse a semver string into the numeric UEA version format.
689
+ * e.g. "1.0.2" → 1000002
690
+ */
691
+ export declare function parseUEAVersion(version: string): number;
@@ -1,3 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseUEAVersion = parseUEAVersion;
4
+ // ============================================================================
5
+ // UEA Version Utilities
6
+ // ============================================================================
7
+ /**
8
+ * Parse a semver string into the numeric UEA version format.
9
+ * e.g. "1.0.2" → 1000002
10
+ */
11
+ function parseUEAVersion(version) {
12
+ const parts = version.split('.');
13
+ if (parts.length !== 3)
14
+ return 0;
15
+ const major = parseInt(parts[0], 10) || 0;
16
+ const minor = parseInt(parts[1], 10) || 0;
17
+ const patch = parseInt(parts[2], 10) || 0;
18
+ return major * 1000000 + minor * 1000 + patch;
19
+ }
3
20
  //# sourceMappingURL=orchestrator.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator.types.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/orchestrator/orchestrator.types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"orchestrator.types.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/orchestrator/orchestrator.types.ts"],"names":[],"mappings":";;AAy1BA,0CAOC;AAfD,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAE/E;;;GAGG;AACH,SAAgB,eAAe,CAAC,OAAe;IAC7C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IAC1C,OAAO,KAAK,GAAG,OAAO,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC;AAChD,CAAC"}