@pushchain/core 5.1.4-alpha.3 → 5.1.4-alpha.5
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/package.json +2 -1
- package/src/lib/index.d.ts +1 -1
- package/src/lib/orchestrator/internals/cascade.d.ts +4 -2
- package/src/lib/orchestrator/internals/cascade.js +0 -3
- package/src/lib/orchestrator/internals/route-handlers.js +1 -1
- package/src/lib/orchestrator/orchestrator.d.ts +5 -3
- package/src/lib/orchestrator/orchestrator.js +1 -1
- package/src/lib/orchestrator/orchestrator.types.d.ts +0 -15
- package/src/lib/progress-hook/progress-hook.js +1 -1
- package/src/lib/push-chain/push-chain.d.ts +5 -6
- package/src/lib/push-chain/push-chain.js +3 -3
- package/src/lib/universal/account/account.js +4 -4
- package/src/lib/universal/signer/signer.js +1 -1
- package/src/lib/universal/universal.types.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushchain/core",
|
|
3
|
-
"version": "5.1.4-alpha.
|
|
3
|
+
"version": "5.1.4-alpha.5",
|
|
4
4
|
"homepage": "https://push.org",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pushchain",
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"CHANGELOG.md"
|
|
67
67
|
],
|
|
68
68
|
"devDependencies": {
|
|
69
|
+
"@types/bs58": "^4.0.0",
|
|
69
70
|
"secp256k1": "^5.0.1",
|
|
70
71
|
"ts-proto": "^2.0.3"
|
|
71
72
|
}
|
package/src/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PushChain } from './push-chain/push-chain';
|
|
2
2
|
export type { ConversionQuote } from './constants/tokens';
|
|
3
3
|
export type { UniversalSigner, UniversalAccount, UniversalSignerSkeleton, DerivedExecutorAccount, ResolvedAccount, ResolvedControllerAccounts, AccountType, AccountRole, } from './universal/universal.types';
|
|
4
|
-
export type { ChainTarget, ChainSource, UniversalTo, TransactionRouteType, UniversalExecuteParams, UniversalOutboundTxRequest, PreparedUniversalTx,
|
|
4
|
+
export type { ChainTarget, ChainSource, UniversalTo, TransactionRouteType, UniversalExecuteParams, UniversalOutboundTxRequest, PreparedUniversalTx, CascadedTxResponse, CascadeHopInfo, CascadeTrackOptions, CascadeProgressEvent, CascadeCompletionResult, MultiChainTxResponse, OutboundTxDetails, WaitForOutboundOptions, SvmGatewayAccountMeta, SvmExecutePayloadFields, SvmExecuteParams, AccountStatus, UEAStatus, RescueFundsParams, } from './orchestrator/orchestrator.types';
|
|
5
5
|
export { parseUEAVersion } from './orchestrator/orchestrator.types';
|
|
6
6
|
export { TransactionRoute, detectRoute, isChainTarget } from './orchestrator/route-detector';
|
|
7
7
|
export { getCEAAddress, getPushAccountForCEA, isCEA, chainSupportsCEA, chainSupportsOutbound, getCEAFactoryAddress, getAllCEAAddresses, } from './orchestrator/cea-utils';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* getSegmentType, composeCascade, createCascadedBuilder, createChainedBuilder.
|
|
6
6
|
*/
|
|
7
7
|
import { TransactionRoute } from '../route-detector';
|
|
8
|
-
import type { HopDescriptor, CascadeSegment, CascadeSegmentType, PreparedUniversalTx,
|
|
8
|
+
import type { HopDescriptor, CascadeSegment, CascadeSegmentType, PreparedUniversalTx, CascadedTxResponse, CascadeHopInfo, UniversalTxResponse, UniversalExecuteParams, MultiCall, WaitForOutboundOptions, OutboundTxDetails } from '../orchestrator.types';
|
|
9
9
|
import type { OrchestratorContext } from './context';
|
|
10
10
|
export interface CascadeCallbacks {
|
|
11
11
|
executeFn: (params: any) => Promise<UniversalTxResponse>;
|
|
@@ -20,4 +20,6 @@ export declare function buildHopDescriptor(ctx: OrchestratorContext, params: Uni
|
|
|
20
20
|
export declare function classifyIntoSegments(hops: HopDescriptor[]): CascadeSegment[];
|
|
21
21
|
export declare function getSegmentType(route: string): CascadeSegmentType;
|
|
22
22
|
export declare function composeCascade(ctx: OrchestratorContext, segments: CascadeSegment[], ueaAddress: `0x${string}`, ueaBalance?: bigint, ueaNonce?: bigint): MultiCall[];
|
|
23
|
-
export declare function createCascadedBuilder(ctx: OrchestratorContext, preparedTxs: PreparedUniversalTx[], callbacks: CascadeCallbacks):
|
|
23
|
+
export declare function createCascadedBuilder(ctx: OrchestratorContext, preparedTxs: PreparedUniversalTx[], callbacks: CascadeCallbacks): {
|
|
24
|
+
send: () => Promise<CascadedTxResponse>;
|
|
25
|
+
};
|
|
@@ -62,8 +62,6 @@ function prepareTransaction(ctx, params, callbacks) {
|
|
|
62
62
|
nonce,
|
|
63
63
|
deadline,
|
|
64
64
|
_hop: hop,
|
|
65
|
-
thenOn: (nextTx) => createCascadedBuilder(ctx, [prepared, nextTx], callbacks),
|
|
66
|
-
send: () => callbacks.executeFn(params),
|
|
67
65
|
};
|
|
68
66
|
return prepared;
|
|
69
67
|
});
|
|
@@ -653,7 +651,6 @@ function composeCascade(ctx, segments, ueaAddress, ueaBalance, ueaNonce) {
|
|
|
653
651
|
// ============================================================================
|
|
654
652
|
function createCascadedBuilder(ctx, preparedTxs, callbacks) {
|
|
655
653
|
return {
|
|
656
|
-
thenOn: (nextTx) => createCascadedBuilder(ctx, [...preparedTxs, nextTx], callbacks),
|
|
657
654
|
send: () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
658
655
|
const ueaAddress = (0, uea_manager_1.computeUEAOffchain)(ctx);
|
|
659
656
|
// Extract HopDescriptors
|
|
@@ -939,7 +939,7 @@ function executeCeaToCea(ctx, params, executeFn) {
|
|
|
939
939
|
// CEA -> CEA requires chaining Route 3 (CEA -> Push) and Route 2 (Push -> CEA)
|
|
940
940
|
// This is a complex flow that requires coordination
|
|
941
941
|
throw new Error('CEA -> CEA transactions are not yet fully implemented. ' +
|
|
942
|
-
'Use prepareTransaction()
|
|
942
|
+
'Use prepareTransaction() and executeTransactions() to chain Route 3 -> Route 2 manually.');
|
|
943
943
|
});
|
|
944
944
|
}
|
|
945
945
|
// ---------------------------------------------------------------------------
|
|
@@ -4,7 +4,7 @@ import type { AccountStatus, UniversalTxResponse } from './orchestrator.types';
|
|
|
4
4
|
import { ProgressEvent } from '../progress-hook/progress-hook.types';
|
|
5
5
|
import { PushClient } from '../push-client/push-client';
|
|
6
6
|
import type { UniversalAccount, UniversalSigner } from '../universal/universal.types';
|
|
7
|
-
import { ExecuteParams, UniversalExecuteParams, PreparedUniversalTx,
|
|
7
|
+
import { ExecuteParams, UniversalExecuteParams, PreparedUniversalTx, CascadedTxResponse, RescueFundsParams } from './orchestrator.types';
|
|
8
8
|
export declare class Orchestrator {
|
|
9
9
|
private readonly universalSigner;
|
|
10
10
|
private pushNetwork;
|
|
@@ -79,9 +79,11 @@ export declare class Orchestrator {
|
|
|
79
79
|
* The cascade composes all hops bottom-to-top into a single Push Chain tx.
|
|
80
80
|
*
|
|
81
81
|
* @param preparedTxs - Array of prepared transactions
|
|
82
|
-
* @returns
|
|
82
|
+
* @returns Object with send() method
|
|
83
83
|
*/
|
|
84
|
-
createCascadedBuilder(preparedTxs: PreparedUniversalTx[]):
|
|
84
|
+
createCascadedBuilder(preparedTxs: PreparedUniversalTx[]): {
|
|
85
|
+
send: () => Promise<CascadedTxResponse>;
|
|
86
|
+
};
|
|
85
87
|
/**
|
|
86
88
|
* Queries gas fee for an outbound transaction from the UniversalCore contract.
|
|
87
89
|
*/
|
|
@@ -211,7 +211,7 @@ class Orchestrator {
|
|
|
211
211
|
* The cascade composes all hops bottom-to-top into a single Push Chain tx.
|
|
212
212
|
*
|
|
213
213
|
* @param preparedTxs - Array of prepared transactions
|
|
214
|
-
* @returns
|
|
214
|
+
* @returns Object with send() method
|
|
215
215
|
*/
|
|
216
216
|
createCascadedBuilder(preparedTxs) {
|
|
217
217
|
return (0, internals_1.createCascadedBuilder)(this.ctx, preparedTxs, this._getCascadeCallbacks());
|
|
@@ -465,10 +465,6 @@ export interface PreparedUniversalTx {
|
|
|
465
465
|
deadline: bigint;
|
|
466
466
|
/** Internal hop descriptor for cascade nesting @internal */
|
|
467
467
|
_hop: HopDescriptor;
|
|
468
|
-
/** Chain additional transactions after this one (cascade) */
|
|
469
|
-
thenOn: (nextTx: PreparedUniversalTx) => CascadedTransactionBuilder;
|
|
470
|
-
/** Execute this prepared transaction */
|
|
471
|
-
send: () => Promise<UniversalTxResponse>;
|
|
472
468
|
}
|
|
473
469
|
/**
|
|
474
470
|
* @deprecated Use CascadedTxResponse instead.
|
|
@@ -485,17 +481,6 @@ export interface MultiChainTxResponse {
|
|
|
485
481
|
status: 'pending' | 'confirmed' | 'failed';
|
|
486
482
|
}[];
|
|
487
483
|
}
|
|
488
|
-
/**
|
|
489
|
-
* Builder for composing cascaded (nested) multi-chain transactions.
|
|
490
|
-
* Each call to thenOn() adds another hop to the cascade.
|
|
491
|
-
* send() composes all hops bottom-to-top and executes a single Push Chain tx.
|
|
492
|
-
*/
|
|
493
|
-
export interface CascadedTransactionBuilder {
|
|
494
|
-
/** Add another hop to the cascade */
|
|
495
|
-
thenOn: (nextTx: PreparedUniversalTx) => CascadedTransactionBuilder;
|
|
496
|
-
/** Compose all hops bottom-to-top and execute the single initial tx */
|
|
497
|
-
send: () => Promise<CascadedTxResponse>;
|
|
498
|
-
}
|
|
499
484
|
/**
|
|
500
485
|
* Response for cascaded multi-chain transactions.
|
|
501
486
|
* Contains the initial tx and tracking info for all hops.
|
|
@@ -35,7 +35,7 @@ const RAW_HOOKS = {
|
|
|
35
35
|
[progress_hook_types_1.PROGRESS_HOOK.SEND_TX_03_01]: () => ({
|
|
36
36
|
id: progress_hook_types_1.PROGRESS_HOOK.SEND_TX_03_01,
|
|
37
37
|
title: 'Resolving UEA',
|
|
38
|
-
message: 'Resolving
|
|
38
|
+
message: 'Resolving Executor Account (UEA) – computing address, checking deployment status and balance',
|
|
39
39
|
response: null,
|
|
40
40
|
level: 'INFO',
|
|
41
41
|
}),
|
|
@@ -6,7 +6,7 @@ import { TypedData, TypedDataDomain } from 'viem';
|
|
|
6
6
|
import { ProgressEvent } from '../progress-hook/progress-hook.types';
|
|
7
7
|
import type { AccountStatus } from '../orchestrator/orchestrator.types';
|
|
8
8
|
import { MoveableToken, PayableToken, ConversionQuote, MoveableTokenAccessor, PayableTokenAccessor } from '../constants/tokens';
|
|
9
|
-
import type { PreparedUniversalTx,
|
|
9
|
+
import type { PreparedUniversalTx, CascadedTxResponse } from '../orchestrator/orchestrator.types';
|
|
10
10
|
/**
|
|
11
11
|
* @class PushChain
|
|
12
12
|
*
|
|
@@ -71,15 +71,14 @@ export declare class PushChain {
|
|
|
71
71
|
sendTransaction: Orchestrator['execute'];
|
|
72
72
|
/**
|
|
73
73
|
* Prepare a universal transaction without executing it.
|
|
74
|
-
* Returns a PreparedUniversalTx that can be
|
|
74
|
+
* Returns a PreparedUniversalTx that can be passed to executeTransactions.
|
|
75
75
|
*/
|
|
76
76
|
prepareTransaction: Orchestrator['prepareTransaction'];
|
|
77
77
|
/**
|
|
78
|
-
* Execute
|
|
79
|
-
* Accepts PreparedUniversalTx (from prepareTransaction)
|
|
80
|
-
* a CascadedTransactionBuilder that supports .thenOn() for chaining.
|
|
78
|
+
* Execute one or more prepared transactions as a cascade across chains.
|
|
79
|
+
* Accepts an array of PreparedUniversalTx (from prepareTransaction).
|
|
81
80
|
*/
|
|
82
|
-
executeTransactions: (
|
|
81
|
+
executeTransactions: (txs: PreparedUniversalTx[]) => Promise<CascadedTxResponse>;
|
|
83
82
|
/**
|
|
84
83
|
* Tracks a transaction by hash on Push Chain
|
|
85
84
|
*/
|
|
@@ -87,12 +87,12 @@ class PushChain {
|
|
|
87
87
|
}
|
|
88
88
|
return orchestrator.prepareTransaction.bind(orchestrator)(params);
|
|
89
89
|
},
|
|
90
|
-
executeTransactions: (
|
|
90
|
+
executeTransactions: (txs) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
91
91
|
if (this.isReadMode) {
|
|
92
92
|
throw new Error('Read only mode cannot call executeTransactions function');
|
|
93
93
|
}
|
|
94
|
-
return orchestrator.createCascadedBuilder(
|
|
95
|
-
},
|
|
94
|
+
return orchestrator.createCascadedBuilder(txs).send();
|
|
95
|
+
}),
|
|
96
96
|
trackTransaction: (txHash, options) => {
|
|
97
97
|
return orchestrator.trackTransaction.bind(orchestrator)(txHash, options);
|
|
98
98
|
},
|
|
@@ -491,11 +491,11 @@ function deriveExecutorAccount(account, options) {
|
|
|
491
491
|
// If target chain is external, derive CEA from the computed UEA
|
|
492
492
|
if (targetChain && !isPushChain(targetChain)) {
|
|
493
493
|
const { cea, isDeployed } = yield (0, cea_utils_1.getCEAAddress)(ueaAddress, targetChain);
|
|
494
|
-
return { address: cea, deployed: skipNetworkCheck ?
|
|
494
|
+
return { address: cea, deployed: skipNetworkCheck ? null : isDeployed };
|
|
495
495
|
}
|
|
496
496
|
// Return UEA with deployment check
|
|
497
497
|
if (skipNetworkCheck) {
|
|
498
|
-
return { address: ueaAddress, deployed:
|
|
498
|
+
return { address: ueaAddress, deployed: null };
|
|
499
499
|
}
|
|
500
500
|
const pushChainKey = pushNetworkToChainKey(pushNetwork);
|
|
501
501
|
const pushClient = new push_client_1.PushClient({
|
|
@@ -513,11 +513,11 @@ function deriveExecutorAccount(account, options) {
|
|
|
513
513
|
// If target chain is external, derive CEA
|
|
514
514
|
if (targetChain && !isPushChain(targetChain)) {
|
|
515
515
|
const { cea, isDeployed } = yield (0, cea_utils_1.getCEAAddress)(address, targetChain);
|
|
516
|
-
return { address: cea, deployed: skipNetworkCheck ?
|
|
516
|
+
return { address: cea, deployed: skipNetworkCheck ? null : isDeployed };
|
|
517
517
|
}
|
|
518
518
|
// Push address, no external target — return with deployment check
|
|
519
519
|
if (skipNetworkCheck) {
|
|
520
|
-
return { address: address, deployed:
|
|
520
|
+
return { address: address, deployed: null };
|
|
521
521
|
}
|
|
522
522
|
const pushNetwork = targetChain && isPushChain(targetChain)
|
|
523
523
|
? getPushNetworkFromChain(targetChain)
|
|
@@ -23,7 +23,7 @@ const bs58_1 = require("../../internal/bs58");
|
|
|
23
23
|
* viem uses `gas` while ethers expects `gasLimit`.
|
|
24
24
|
*/
|
|
25
25
|
function toEthersTxRequest(viemTx) {
|
|
26
|
-
const _a = viemTx, { gas } = _a, rest = tslib_1.__rest(_a, ["gas"]);
|
|
26
|
+
const _a = viemTx, { gas, type } = _a, rest = tslib_1.__rest(_a, ["gas", "type"]);
|
|
27
27
|
return Object.assign(Object.assign({}, rest), { gasLimit: gas });
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
@@ -137,8 +137,8 @@ export type AccountRole = 'controller';
|
|
|
137
137
|
export interface DerivedExecutorAccount {
|
|
138
138
|
/** The computed executor address on Push Chain (or CEA on external chain) */
|
|
139
139
|
address: `0x${string}`;
|
|
140
|
-
/** Whether the executor account is deployed on-chain */
|
|
141
|
-
deployed: boolean;
|
|
140
|
+
/** Whether the executor account is deployed on-chain. null when skipNetworkCheck is true. */
|
|
141
|
+
deployed: boolean | null;
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
* A single resolved account entry in the resolveControllerAccount response.
|