@pushchain/core 6.0.26 → 6.0.27-alpha.1
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/AGW.md +226 -0
- package/CHANGELOG.md +18 -0
- package/README.md +2 -0
- package/package.json +7 -1
- package/src/lib/agentic/agentic.d.ts +23 -0
- package/src/lib/agentic/agentic.js +51 -0
- package/src/lib/agentic/agentic.types.d.ts +414 -0
- package/src/lib/agentic/agentic.types.js +3 -0
- package/src/lib/agentic/capabilities.d.ts +37 -0
- package/src/lib/agentic/capabilities.js +64 -0
- package/src/lib/agentic/chain.d.ts +3 -0
- package/src/lib/agentic/chain.js +15 -0
- package/src/lib/agentic/codec/abi-layout.d.ts +20 -0
- package/src/lib/agentic/codec/abi-layout.js +168 -0
- package/src/lib/agentic/codec/defaults.d.ts +51 -0
- package/src/lib/agentic/codec/defaults.js +53 -0
- package/src/lib/agentic/codec/ids.d.ts +35 -0
- package/src/lib/agentic/codec/ids.js +74 -0
- package/src/lib/agentic/codec/native.d.ts +73 -0
- package/src/lib/agentic/codec/native.js +341 -0
- package/src/lib/agentic/codec/pins.d.ts +20 -0
- package/src/lib/agentic/codec/pins.js +29 -0
- package/src/lib/agentic/codec/rules.d.ts +45 -0
- package/src/lib/agentic/codec/rules.js +110 -0
- package/src/lib/agentic/codec/selectors.d.ts +19 -0
- package/src/lib/agentic/codec/selectors.js +60 -0
- package/src/lib/agentic/codec/session.d.ts +54 -0
- package/src/lib/agentic/codec/session.js +65 -0
- package/src/lib/agentic/codec/svm-accounts.d.ts +35 -0
- package/src/lib/agentic/codec/svm-accounts.js +68 -0
- package/src/lib/agentic/codec/svm-idl.d.ts +11 -0
- package/src/lib/agentic/codec/svm-idl.js +226 -0
- package/src/lib/agentic/codec/svm-terms.d.ts +157 -0
- package/src/lib/agentic/codec/svm-terms.js +246 -0
- package/src/lib/agentic/codec/universal-terms.d.ts +82 -0
- package/src/lib/agentic/codec/universal-terms.js +43 -0
- package/src/lib/agentic/codec/universal.d.ts +14 -0
- package/src/lib/agentic/codec/universal.js +173 -0
- package/src/lib/agentic/constants.d.ts +12 -0
- package/src/lib/agentic/constants.js +16 -0
- package/src/lib/agentic/context.d.ts +29 -0
- package/src/lib/agentic/context.js +56 -0
- package/src/lib/agentic/contracts/abi/v6/agent-validator.d.ts +105 -0
- package/src/lib/agentic/contracts/abi/v6/agent-validator.js +149 -0
- package/src/lib/agentic/contracts/abi/v6/agw-factory.d.ts +1146 -0
- package/src/lib/agentic/contracts/abi/v6/agw-factory.js +1499 -0
- package/src/lib/agentic/contracts/abi/v6/agw.d.ts +1306 -0
- package/src/lib/agentic/contracts/abi/v6/agw.js +1713 -0
- package/src/lib/agentic/contracts/abi/v6/index.d.ts +6 -0
- package/src/lib/agentic/contracts/abi/v6/index.js +17 -0
- package/src/lib/agentic/contracts/abi/v6/smart-session.d.ts +1493 -0
- package/src/lib/agentic/contracts/abi/v6/smart-session.js +1965 -0
- package/src/lib/agentic/contracts/abi/v6/universal-rules-policy.d.ts +1661 -0
- package/src/lib/agentic/contracts/abi/v6/universal-rules-policy.js +2187 -0
- package/src/lib/agentic/contracts/donut-v6.d.ts +11 -0
- package/src/lib/agentic/contracts/donut-v6.js +15 -0
- package/src/lib/agentic/contracts/prc20-metadata.d.ts +26 -0
- package/src/lib/agentic/contracts/prc20-metadata.js +87 -0
- package/src/lib/agentic/contracts/reader.d.ts +35 -0
- package/src/lib/agentic/contracts/reader.js +16 -0
- package/src/lib/agentic/contracts/v6.d.ts +5739 -0
- package/src/lib/agentic/contracts/v6.js +343 -0
- package/src/lib/agentic/deployments.d.ts +61 -0
- package/src/lib/agentic/deployments.js +203 -0
- package/src/lib/agentic/errors.d.ts +65 -0
- package/src/lib/agentic/errors.js +84 -0
- package/src/lib/agentic/execution/guards.d.ts +9 -0
- package/src/lib/agentic/execution/guards.js +30 -0
- package/src/lib/agentic/execution/outbound.d.ts +55 -0
- package/src/lib/agentic/execution/outbound.js +187 -0
- package/src/lib/agentic/execution/send.d.ts +9 -0
- package/src/lib/agentic/execution/send.js +268 -0
- package/src/lib/agentic/execution/svm-instruction.d.ts +24 -0
- package/src/lib/agentic/execution/svm-instruction.js +40 -0
- package/src/lib/agentic/execution/svm-outbound.d.ts +18 -0
- package/src/lib/agentic/execution/svm-outbound.js +86 -0
- package/src/lib/agentic/execution/svm-payload.d.ts +18 -0
- package/src/lib/agentic/execution/svm-payload.js +136 -0
- package/src/lib/agentic/execution/svm-public.d.ts +5 -0
- package/src/lib/agentic/execution/svm-public.js +176 -0
- package/src/lib/agentic/execution/svm-quote.d.ts +11 -0
- package/src/lib/agentic/execution/svm-quote.js +24 -0
- package/src/lib/agentic/execution/svm-send.d.ts +44 -0
- package/src/lib/agentic/execution/svm-send.js +87 -0
- package/src/lib/agentic/index.d.ts +5 -0
- package/src/lib/agentic/index.js +10 -0
- package/src/lib/agentic/management/common.d.ts +29 -0
- package/src/lib/agentic/management/common.js +116 -0
- package/src/lib/agentic/management/create.d.ts +4 -0
- package/src/lib/agentic/management/create.js +138 -0
- package/src/lib/agentic/management/duplicates.d.ts +4 -0
- package/src/lib/agentic/management/duplicates.js +20 -0
- package/src/lib/agentic/management/label.d.ts +3 -0
- package/src/lib/agentic/management/label.js +17 -0
- package/src/lib/agentic/management/prepare.d.ts +7 -0
- package/src/lib/agentic/management/prepare.js +95 -0
- package/src/lib/agentic/management/rules-write.d.ts +42 -0
- package/src/lib/agentic/management/rules-write.js +279 -0
- package/src/lib/agentic/management/svm-context.d.ts +25 -0
- package/src/lib/agentic/management/svm-context.js +55 -0
- package/src/lib/agentic/management/svm-metadata.d.ts +10 -0
- package/src/lib/agentic/management/svm-metadata.js +56 -0
- package/src/lib/agentic/management/svm-public.d.ts +6 -0
- package/src/lib/agentic/management/svm-public.js +125 -0
- package/src/lib/agentic/management/svm.d.ts +27 -0
- package/src/lib/agentic/management/svm.js +150 -0
- package/src/lib/agentic/presets/catalog.d.ts +26 -0
- package/src/lib/agentic/presets/catalog.js +307 -0
- package/src/lib/agentic/presets/index.d.ts +5 -0
- package/src/lib/agentic/presets/index.js +265 -0
- package/src/lib/agentic/presets/types.d.ts +48 -0
- package/src/lib/agentic/presets/types.js +3 -0
- package/src/lib/agentic/public-rule.d.ts +9 -0
- package/src/lib/agentic/public-rule.js +326 -0
- package/src/lib/agentic/reads/checkpoints.d.ts +17 -0
- package/src/lib/agentic/reads/checkpoints.js +109 -0
- package/src/lib/agentic/reads/rules.d.ts +42 -0
- package/src/lib/agentic/reads/rules.js +302 -0
- package/src/lib/agentic/reads/snapshot.d.ts +28 -0
- package/src/lib/agentic/reads/snapshot.js +85 -0
- package/src/lib/agentic/reads/svm.d.ts +17 -0
- package/src/lib/agentic/reads/svm.js +52 -0
- package/src/lib/agentic/reads/wallets.d.ts +25 -0
- package/src/lib/agentic/reads/wallets.js +122 -0
- package/src/lib/agentic/response.d.ts +41 -0
- package/src/lib/agentic/response.js +358 -0
- package/src/lib/agentic/revert.d.ts +7 -0
- package/src/lib/agentic/revert.js +102 -0
- package/src/lib/agentic/runtime.d.ts +58 -0
- package/src/lib/agentic/runtime.js +104 -0
- package/src/lib/agentic/utils.d.ts +57 -0
- package/src/lib/agentic/utils.js +165 -0
- package/src/lib/agentic/wallet.d.ts +32 -0
- package/src/lib/agentic/wallet.js +130 -0
- package/src/lib/constants/enums.d.ts +6 -3
- package/src/lib/constants/enums.js +6 -3
- package/src/lib/constants/index.d.ts +61 -4
- package/src/lib/constants/index.js +17 -3
- package/src/lib/constants/read-state.d.ts +9 -0
- package/src/lib/constants/read-state.js +13 -1
- package/src/lib/index.d.ts +8 -2
- package/src/lib/index.js +9 -1
- package/src/lib/orchestrator/internals/errors.d.ts +7 -0
- package/src/lib/orchestrator/internals/errors.js +13 -1
- package/src/lib/orchestrator/internals/execute-standard.d.ts +3 -1
- package/src/lib/orchestrator/internals/execute-standard.js +3 -3
- package/src/lib/orchestrator/internals/outbound-sync.js +52 -7
- package/src/lib/orchestrator/internals/push-chain-tx.d.ts +1 -1
- package/src/lib/orchestrator/internals/push-chain-tx.js +13 -1
- package/src/lib/orchestrator/orchestrator.d.ts +3 -0
- package/src/lib/orchestrator/orchestrator.js +13 -1
- package/src/lib/orchestrator/orchestrator.types.d.ts +8 -0
- package/src/lib/orchestrator/route-detector.js +3 -2
- package/src/lib/orchestrator/svm-idl/resolve.d.ts +2 -0
- package/src/lib/orchestrator/svm-idl/resolve.js +11 -1
- package/src/lib/progress-hook/progress-hook.js +63 -0
- package/src/lib/progress-hook/progress-hook.types.d.ts +10 -1
- package/src/lib/progress-hook/progress-hook.types.js +10 -0
- package/src/lib/push-chain/push-chain.d.ts +57 -15
- package/src/lib/push-chain/push-chain.js +66 -7
- package/src/lib/read-state/destination.js +6 -1
- package/src/lib/read-state/read-params.d.ts +3 -3
- package/src/lib/read-state/read-params.js +3 -2
- package/src/lib/read-state/read-state.types.d.ts +3 -1
- package/src/lib/read-state/read-tracker.js +2 -2
- package/src/lib/read-state/spec-builder.js +1 -1
- package/src/lib/universal/prc20-address.d.ts +15 -0
- package/src/lib/universal/prc20-address.js +135 -0
- package/src/lib/utils.d.ts +6 -13
- package/src/lib/utils.js +5 -128
- package/src/lib/vm-client/evm-client.js +34 -20
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
import { CHAIN, LIBRARY, PUSH_NETWORK } from './enums';
|
|
2
2
|
import { TypedDataDomain, TypedData } from '../universal/signer/signer.types';
|
|
3
|
+
import { WEB2_READ_CHAIN } from './read-state';
|
|
3
4
|
import { UNIVERSAL_READ_STATUS, READ_STATUS, READ_ERROR_CODE, READ_OUTCOME } from '../read-state/read-state.types';
|
|
5
|
+
/**
|
|
6
|
+
* `PushChain.CONSTANTS.READ.CHAIN` — every read source: all of `CHAIN` (same
|
|
7
|
+
* string values) plus the enumerable Web2 source. A superset of CHAIN, so
|
|
8
|
+
* `read({ chain: CHAIN.X })` keeps compiling.
|
|
9
|
+
*/
|
|
10
|
+
export declare const READ_CHAIN: Readonly<{ [K in keyof typeof CHAIN]: (typeof CHAIN)[K]; }> & {
|
|
11
|
+
readonly WEB2: typeof WEB2_READ_CHAIN;
|
|
12
|
+
};
|
|
4
13
|
/** `PushChain.CONSTANTS.READ` — cross-chain read state. Values verified against the deployed UniversalCallback. */
|
|
5
14
|
export declare const READ_CONSTANTS: {
|
|
6
|
-
/**
|
|
7
|
-
readonly
|
|
15
|
+
/** Every read source, enumerable (spec page 5 §4). */
|
|
16
|
+
readonly CHAIN: Readonly<{
|
|
17
|
+
readonly PUSH_MAINNET: CHAIN.PUSH_MAINNET;
|
|
18
|
+
readonly PUSH_TESTNET: CHAIN.PUSH_TESTNET;
|
|
19
|
+
readonly PUSH_TESTNET_DONUT: CHAIN.PUSH_TESTNET;
|
|
20
|
+
readonly PUSH_LOCALNET: CHAIN.PUSH_LOCALNET;
|
|
21
|
+
readonly ETHEREUM_MAINNET: CHAIN.ETHEREUM_MAINNET;
|
|
22
|
+
readonly ETHEREUM_SEPOLIA: CHAIN.ETHEREUM_SEPOLIA;
|
|
23
|
+
readonly ARBITRUM_SEPOLIA: CHAIN.ARBITRUM_SEPOLIA;
|
|
24
|
+
readonly BASE_SEPOLIA: CHAIN.BASE_SEPOLIA;
|
|
25
|
+
readonly BNB_TESTNET: CHAIN.BNB_TESTNET;
|
|
26
|
+
readonly SOLANA_MAINNET: CHAIN.SOLANA_MAINNET;
|
|
27
|
+
readonly SOLANA_TESTNET: CHAIN.SOLANA_TESTNET;
|
|
28
|
+
readonly SOLANA_DEVNET: CHAIN.SOLANA_DEVNET;
|
|
29
|
+
readonly WEB2: "web2";
|
|
30
|
+
}> & {
|
|
31
|
+
readonly WEB2: typeof WEB2_READ_CHAIN;
|
|
32
|
+
};
|
|
33
|
+
/** @deprecated Use `READ.CHAIN.WEB2`. Same value (`'web2'`). */
|
|
34
|
+
readonly WEB2: "web2";
|
|
8
35
|
readonly NAMESPACE: {
|
|
9
36
|
readonly EVM: "eip155";
|
|
10
37
|
readonly SVM: "solana";
|
|
@@ -39,8 +66,26 @@ export declare const CONSTANTS: {
|
|
|
39
66
|
TOKEN: import("./tokens").PayableTokenConstantsMap;
|
|
40
67
|
};
|
|
41
68
|
READ: {
|
|
42
|
-
/**
|
|
43
|
-
readonly
|
|
69
|
+
/** Every read source, enumerable (spec page 5 §4). */
|
|
70
|
+
readonly CHAIN: Readonly<{
|
|
71
|
+
readonly PUSH_MAINNET: CHAIN.PUSH_MAINNET;
|
|
72
|
+
readonly PUSH_TESTNET: CHAIN.PUSH_TESTNET;
|
|
73
|
+
readonly PUSH_TESTNET_DONUT: CHAIN.PUSH_TESTNET;
|
|
74
|
+
readonly PUSH_LOCALNET: CHAIN.PUSH_LOCALNET;
|
|
75
|
+
readonly ETHEREUM_MAINNET: CHAIN.ETHEREUM_MAINNET;
|
|
76
|
+
readonly ETHEREUM_SEPOLIA: CHAIN.ETHEREUM_SEPOLIA;
|
|
77
|
+
readonly ARBITRUM_SEPOLIA: CHAIN.ARBITRUM_SEPOLIA;
|
|
78
|
+
readonly BASE_SEPOLIA: CHAIN.BASE_SEPOLIA;
|
|
79
|
+
readonly BNB_TESTNET: CHAIN.BNB_TESTNET;
|
|
80
|
+
readonly SOLANA_MAINNET: CHAIN.SOLANA_MAINNET;
|
|
81
|
+
readonly SOLANA_TESTNET: CHAIN.SOLANA_TESTNET;
|
|
82
|
+
readonly SOLANA_DEVNET: CHAIN.SOLANA_DEVNET;
|
|
83
|
+
readonly WEB2: "web2";
|
|
84
|
+
}> & {
|
|
85
|
+
readonly WEB2: typeof WEB2_READ_CHAIN;
|
|
86
|
+
};
|
|
87
|
+
/** @deprecated Use `READ.CHAIN.WEB2`. Same value (`'web2'`). */
|
|
88
|
+
readonly WEB2: "web2";
|
|
44
89
|
readonly NAMESPACE: {
|
|
45
90
|
readonly EVM: "eip155";
|
|
46
91
|
readonly SVM: "solana";
|
|
@@ -63,6 +108,18 @@ export declare const CONSTANTS: {
|
|
|
63
108
|
readonly ERROR_CODE: typeof READ_ERROR_CODE;
|
|
64
109
|
readonly OUTCOME: typeof READ_OUTCOME;
|
|
65
110
|
};
|
|
111
|
+
/** Checked v5 agentic wallet deployments by Push network (Donut only). */
|
|
112
|
+
AGENTIC: Readonly<{
|
|
113
|
+
WALLET: "agentic:wallet";
|
|
114
|
+
PRESETS: Readonly<{
|
|
115
|
+
CATEGORY: Readonly<{
|
|
116
|
+
DEXES: "DEXES";
|
|
117
|
+
LENDING: "LENDING";
|
|
118
|
+
STAKING: "STAKING";
|
|
119
|
+
PREDICTION: "PREDICTION";
|
|
120
|
+
}>;
|
|
121
|
+
}>;
|
|
122
|
+
}>;
|
|
66
123
|
};
|
|
67
124
|
export type { TypedDataDomain, TypedData };
|
|
68
125
|
export { CHAIN_EXPLORERS, CEA_FACTORY_ADDRESSES, UNIVERSAL_GATEWAY_ADDRESSES, VAULT_ADDRESSES, getExplorerTxUrl, getExplorerAddressUrl, } from './chain';
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UNIVERSAL_CALLBACK_ADDRESSES = exports.UNIVERSAL_CORE_ADDRESSES = exports.DEFAULT_CEA_TO_PUSH_GAS_LIMIT = exports.DEFAULT_OUTBOUND_GAS_LIMIT = exports.ZERO_ADDRESS = exports.TX_TYPE = exports.MIGRATION_SELECTOR = exports.UEA_MULTICALL_SELECTOR = exports.MULTICALL_SELECTOR = exports.getExplorerAddressUrl = exports.getExplorerTxUrl = exports.VAULT_ADDRESSES = exports.UNIVERSAL_GATEWAY_ADDRESSES = exports.CEA_FACTORY_ADDRESSES = exports.CHAIN_EXPLORERS = exports.CONSTANTS = exports.READ_CONSTANTS = void 0;
|
|
3
|
+
exports.UNIVERSAL_CALLBACK_ADDRESSES = exports.UNIVERSAL_CORE_ADDRESSES = exports.DEFAULT_CEA_TO_PUSH_GAS_LIMIT = exports.DEFAULT_OUTBOUND_GAS_LIMIT = exports.ZERO_ADDRESS = exports.TX_TYPE = exports.MIGRATION_SELECTOR = exports.UEA_MULTICALL_SELECTOR = exports.MULTICALL_SELECTOR = exports.getExplorerAddressUrl = exports.getExplorerTxUrl = exports.VAULT_ADDRESSES = exports.UNIVERSAL_GATEWAY_ADDRESSES = exports.CEA_FACTORY_ADDRESSES = exports.CHAIN_EXPLORERS = exports.CONSTANTS = exports.READ_CONSTANTS = exports.READ_CHAIN = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const enums_1 = require("./enums");
|
|
6
6
|
const tokens_1 = require("./tokens");
|
|
7
7
|
const chain_1 = require("./chain");
|
|
8
8
|
const read_state_1 = require("./read-state");
|
|
9
9
|
const read_state_types_1 = require("../read-state/read-state.types");
|
|
10
|
+
const constants_1 = require("../agentic/constants");
|
|
11
|
+
/**
|
|
12
|
+
* `PushChain.CONSTANTS.READ.CHAIN` — every read source: all of `CHAIN` (same
|
|
13
|
+
* string values) plus the enumerable Web2 source. A superset of CHAIN, so
|
|
14
|
+
* `read({ chain: CHAIN.X })` keeps compiling.
|
|
15
|
+
*/
|
|
16
|
+
exports.READ_CHAIN = Object.freeze({
|
|
17
|
+
...enums_1.CHAIN,
|
|
18
|
+
WEB2: read_state_1.WEB2_READ_CHAIN,
|
|
19
|
+
});
|
|
10
20
|
/** `PushChain.CONSTANTS.READ` — cross-chain read state. Values verified against the deployed UniversalCallback. */
|
|
11
21
|
exports.READ_CONSTANTS = {
|
|
12
|
-
/**
|
|
13
|
-
|
|
22
|
+
/** Every read source, enumerable (spec page 5 §4). */
|
|
23
|
+
CHAIN: exports.READ_CHAIN,
|
|
24
|
+
/** @deprecated Use `READ.CHAIN.WEB2`. Same value (`'web2'`). */
|
|
25
|
+
WEB2: read_state_1.WEB2_READ_CHAIN,
|
|
14
26
|
NAMESPACE: read_state_1.READ_NAMESPACE,
|
|
15
27
|
MAX_CALLBACK_GAS_LIMIT: read_state_1.MAX_CALLBACK_GAS_LIMIT,
|
|
16
28
|
MIN_CONFIRMATIONS_FLOOR: read_state_1.MIN_CONFIRMATIONS_FLOOR,
|
|
@@ -35,6 +47,8 @@ exports.CONSTANTS = {
|
|
|
35
47
|
MOVEABLE: { TOKEN: tokens_1.MOVEABLE_TOKEN_CONSTANTS },
|
|
36
48
|
PAYABLE: { TOKEN: tokens_1.PAYABLE_TOKEN_CONSTANTS },
|
|
37
49
|
READ: exports.READ_CONSTANTS,
|
|
50
|
+
/** Checked v5 agentic wallet deployments by Push network (Donut only). */
|
|
51
|
+
AGENTIC: constants_1.AGENTIC,
|
|
38
52
|
};
|
|
39
53
|
// Multi-chain configuration exports
|
|
40
54
|
var chain_2 = require("./chain");
|
|
@@ -32,6 +32,15 @@ export declare const WEB2_MAX_TIMEOUT_MS = 15000;
|
|
|
32
32
|
* Web2 is not a blockchain and is not a `CHAIN` enum member. Reads target it via
|
|
33
33
|
* an explicit destination; the node routes on namespace `web2`, id `https`.
|
|
34
34
|
*/
|
|
35
|
+
/** Public Web2 read source (`READ.CHAIN.WEB2`). */
|
|
36
|
+
export declare const WEB2_READ_CHAIN: "web2";
|
|
37
|
+
/**
|
|
38
|
+
* Legacy public spelling, and the unchanged CAIP-2 wire identity validators
|
|
39
|
+
* route on. Still accepted as read input.
|
|
40
|
+
*/
|
|
41
|
+
export declare const LEGACY_WEB2_READ_CHAIN: "web2:https";
|
|
42
|
+
/** True for either public Web2 spelling. */
|
|
43
|
+
export declare function isWeb2ReadChain(chain: unknown): chain is typeof WEB2_READ_CHAIN | typeof LEGACY_WEB2_READ_CHAIN;
|
|
35
44
|
export declare const WEB2_DESTINATION: {
|
|
36
45
|
readonly chainNamespace: "web2";
|
|
37
46
|
readonly chainId: "https";
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* `read-state/__tests__/abi-selectors.spec.ts`.
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.READ_TRACK_LOOKUP_TIMEOUT_MS = exports.READ_EXPIRY_WARNING_BLOCKS = exports.READ_PREFLIGHT_STALE_MS = exports.READ_TRACK_MAX_TIMEOUT_MS = exports.READ_TRACK_MIN_POLL_INTERVAL_MS = exports.READ_TRACK_POLL_INTERVAL_MS = exports.PUSH_BLOCK_TIME_MS = exports.READ_NAMESPACE = exports.WEB2_DESTINATION = exports.WEB2_MAX_TIMEOUT_MS = exports.WEB2_DEFAULT_TIMEOUT_MS = exports.WEB2_MAX_EXTRACT_ENTRIES = exports.CALLBACK_BUDGET_BUFFER = exports.DEFAULT_EXPIRY_BLOCKS = exports.MIN_CONFIRMATIONS_FLOOR = exports.UNIVERSAL_READ_REGISTRY_ADDRESS = exports.REGISTRY_CALLBACK_GAS = exports.MAX_CALLBACK_GAS_LIMIT = void 0;
|
|
10
|
+
exports.READ_TRACK_LOOKUP_TIMEOUT_MS = exports.READ_EXPIRY_WARNING_BLOCKS = exports.READ_PREFLIGHT_STALE_MS = exports.READ_TRACK_MAX_TIMEOUT_MS = exports.READ_TRACK_MIN_POLL_INTERVAL_MS = exports.READ_TRACK_POLL_INTERVAL_MS = exports.PUSH_BLOCK_TIME_MS = exports.READ_NAMESPACE = exports.WEB2_DESTINATION = exports.LEGACY_WEB2_READ_CHAIN = exports.WEB2_READ_CHAIN = exports.WEB2_MAX_TIMEOUT_MS = exports.WEB2_DEFAULT_TIMEOUT_MS = exports.WEB2_MAX_EXTRACT_ENTRIES = exports.CALLBACK_BUDGET_BUFFER = exports.DEFAULT_EXPIRY_BLOCKS = exports.MIN_CONFIRMATIONS_FLOOR = exports.UNIVERSAL_READ_REGISTRY_ADDRESS = exports.REGISTRY_CALLBACK_GAS = exports.MAX_CALLBACK_GAS_LIMIT = void 0;
|
|
11
|
+
exports.isWeb2ReadChain = isWeb2ReadChain;
|
|
11
12
|
/** Hard upper bound on the gas an app callback may declare — `ReadTypes.sol:50`. */
|
|
12
13
|
exports.MAX_CALLBACK_GAS_LIMIT = 1000000n;
|
|
13
14
|
/** Default callback gas (registry and custom targets); large results may need an explicit override up to the maximum. */
|
|
@@ -35,6 +36,17 @@ exports.WEB2_MAX_TIMEOUT_MS = 15_000;
|
|
|
35
36
|
* Web2 is not a blockchain and is not a `CHAIN` enum member. Reads target it via
|
|
36
37
|
* an explicit destination; the node routes on namespace `web2`, id `https`.
|
|
37
38
|
*/
|
|
39
|
+
/** Public Web2 read source (`READ.CHAIN.WEB2`). */
|
|
40
|
+
exports.WEB2_READ_CHAIN = 'web2';
|
|
41
|
+
/**
|
|
42
|
+
* Legacy public spelling, and the unchanged CAIP-2 wire identity validators
|
|
43
|
+
* route on. Still accepted as read input.
|
|
44
|
+
*/
|
|
45
|
+
exports.LEGACY_WEB2_READ_CHAIN = 'web2:https';
|
|
46
|
+
/** True for either public Web2 spelling. */
|
|
47
|
+
function isWeb2ReadChain(chain) {
|
|
48
|
+
return chain === exports.WEB2_READ_CHAIN || chain === exports.LEGACY_WEB2_READ_CHAIN;
|
|
49
|
+
}
|
|
38
50
|
exports.WEB2_DESTINATION = {
|
|
39
51
|
chainNamespace: 'web2',
|
|
40
52
|
chainId: 'https',
|
package/src/lib/index.d.ts
CHANGED
|
@@ -7,17 +7,23 @@ export { isPC20Reference } from './orchestrator/orchestrator.types';
|
|
|
7
7
|
export { PC20Error, InvalidPC20AddressError, PC20TokenChainMismatchError, PC20WrapperNotRegisteredError, PC20RegistryMismatchError, PC20FactoryMismatchError, InvalidPC20MetadataError, PC20ExpectedButPRC20Error, PC20AmbiguousAddressError, UnsupportedPC20DestinationError, InsufficientPC20BalanceError, PC20UnknownChainNamespaceError, PC20WrapperPredictionUnavailableError, PC20ExportRevertedError, PC20UnsafeEmptyPayloadError, } from './orchestrator/internals/pc20/errors';
|
|
8
8
|
export type { ChainTarget, ChainSource, UniversalTo, TransactionRouteType, UniversalExecuteParams, UniversalOutboundTxRequest, PreparedUniversalTx, CascadedTxResponse, CascadeHopInfo, CascadeTrackOptions, CascadeProgressEvent, CascadeCompletionResult, MultiChainTxResponse, OutboundTxDetails, WaitForOutboundOptions, SvmGatewayAccountMeta, SvmExecutePayloadFields, AccountStatus, UEAStatus, RescueFundsParams, } from './orchestrator/orchestrator.types';
|
|
9
9
|
export { parseUEAVersion } from './orchestrator/orchestrator.types';
|
|
10
|
-
export { TransactionRoute, detectRoute, isChainTarget } from './orchestrator/route-detector';
|
|
10
|
+
export { TransactionRoute, detectRoute, isChainTarget, } from './orchestrator/route-detector';
|
|
11
11
|
export { DEFAULT_MAX_PC_FOR_GAS_BUFFER_BPS, MAX_PC_FOR_GAS_BUFFER_BPS_LIMIT, quoteMaxPCForGasCap, quoteMaxPCForGasCapFromNativeValue, } from './orchestrator/max-pc-for-gas';
|
|
12
12
|
export type { MaxPCForGasCapInput, MaxPCForGasCapFromNativeValueInput, MaxPCForGasCapQuote, } from './orchestrator/max-pc-for-gas';
|
|
13
13
|
export { getCEAAddress, getPushAccountForCEA, isCEA, chainSupportsCEA, chainSupportsOutbound, getCEAFactoryAddress, getAllCEAAddresses, } from './orchestrator/cea-utils';
|
|
14
14
|
export { encodeSvmExecutePayload, isSvmChain, isValidSolanaHexAddress, buildMigrationPayload, buildErc20WithdrawalMulticall, } from './orchestrator/payload-builders';
|
|
15
15
|
export type { ReadChain, ReadDestination, ResolvedDestination, ReadQuery, EvmReadQuery, SvmReadQuery, Web2ReadQuery, Web2Extract, Web2ValueType, EncodedReadQuery, ReadResultShape, DecodedReadResult, ReadPreflight, ReadSpec, ReadSpecTuple, BuildReadSpecParams, PreparedRead, ReadCallback, SimulateReadResult, ParsedReadRequest, FulfilOutcome, ReceiptLike, ReadRef, ReadLifecycleOptions, ReadFees, UniversalReadResponse, ReadResponseTuple, BatchReadResponse, } from './read-state/read-state.types';
|
|
16
|
-
export type { ReadOptions, ReadPrepareOptions, ReadQueryOptions, ReadCallbackOptions, ReadValue, ValidateReadCall, ReadWeb2Options, ReadTrackOptions, ReadExecuteOptions } from './read-state/read-params';
|
|
16
|
+
export type { ReadOptions, ReadPrepareOptions, ReadQueryOptions, ReadCallbackOptions, ReadValue, ValidateReadCall, ReadWeb2Options, ReadTrackOptions, ReadExecuteOptions, } from './read-state/read-params';
|
|
17
17
|
export { UNIVERSAL_READ_STATUS, READ_STATUS, READ_ERROR_CODE, READ_OUTCOME, CONTRACT_REQUEST_STATUS, TERMINAL_READ_STATUSES, } from './read-state/read-state.types';
|
|
18
18
|
export { ReadStateError, InvalidReadQueryError, InvalidReadSpecError, ReadHeightUnavailableError, UnsupportedReadDestinationError, ReadDecodeError, ReadTimeoutError, ReadNotFoundError, ReadRegistryUnavailableError, } from './read-state/errors';
|
|
19
19
|
export type { ReadSpecViolation } from './read-state/errors';
|
|
20
20
|
export { resolveDestination, encodeReadQuery, decodeReadResult, parseReadRequestsFromReceipt, parseFulfilOutcome, buildReadSpecFromPreflight, validateReadSpec, toCallData, sizeCallbackBudget, inferResultShape, toRequestIdHex, toReadQuery, } from './read-state';
|
|
21
21
|
export { UNIVERSAL_CALLBACK_EVM } from './constants/abi/universalCallback.evm';
|
|
22
22
|
export { UNIVERSAL_READ_REGISTRY_EVM } from './constants/abi/universalReadRegistry.evm';
|
|
23
|
+
export { PushChainExecutionError, PushChainBatchExecutionError, } from './orchestrator/internals/errors';
|
|
24
|
+
export type { DecodedErrorPayload } from './orchestrator/internals/errors';
|
|
25
|
+
export type { PushChainInitializeOptions } from './push-chain/push-chain';
|
|
26
|
+
export { AGENTIC_ERROR_CODE, AgenticError, AgenticRevertError, } from './agentic';
|
|
27
|
+
export type { AgenticAddress, AgenticDoor, AgenticErrorCode, AgenticHex, AgenticNamespace, AgenticProgressHook, AgenticTxMetadata, AgenticWallet, AllowedCall, AssetCap, Checkpoint, CheckpointKind, CreateOptions, CreateResult, ForeignChainNamespace, DecodedSolanaRule, Rule, RuleInput, Pin, Spent, WalletMarker, ArgumentPath, RulesRecord, Selector, WalletInfo, WalletSummary, } from './agentic';
|
|
23
28
|
export { PushChain };
|
|
29
|
+
export type { Preset, PresetCategory, PresetAsset, PresetOptions, ReadyPresetOptions, PresetRuleTemplate, AgenticPresets, } from './agentic';
|
package/src/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ReadTimeoutError = exports.ReadDecodeError = exports.UnsupportedReadDestinationError = exports.ReadHeightUnavailableError = exports.InvalidReadSpecError = exports.InvalidReadQueryError = exports.ReadStateError = exports.TERMINAL_READ_STATUSES = exports.CONTRACT_REQUEST_STATUS = exports.READ_OUTCOME = exports.READ_ERROR_CODE = exports.READ_STATUS = exports.UNIVERSAL_READ_STATUS = exports.buildErc20WithdrawalMulticall = exports.buildMigrationPayload = exports.isValidSolanaHexAddress = exports.isSvmChain = exports.encodeSvmExecutePayload = exports.getAllCEAAddresses = exports.getCEAFactoryAddress = exports.chainSupportsOutbound = exports.chainSupportsCEA = exports.isCEA = exports.getPushAccountForCEA = exports.getCEAAddress = exports.quoteMaxPCForGasCapFromNativeValue = exports.quoteMaxPCForGasCap = exports.MAX_PC_FOR_GAS_BUFFER_BPS_LIMIT = exports.DEFAULT_MAX_PC_FOR_GAS_BUFFER_BPS = exports.isChainTarget = exports.detectRoute = exports.TransactionRoute = exports.parseUEAVersion = exports.PC20UnsafeEmptyPayloadError = exports.PC20ExportRevertedError = exports.PC20WrapperPredictionUnavailableError = exports.PC20UnknownChainNamespaceError = exports.InsufficientPC20BalanceError = exports.UnsupportedPC20DestinationError = exports.PC20AmbiguousAddressError = exports.PC20ExpectedButPRC20Error = exports.InvalidPC20MetadataError = exports.PC20FactoryMismatchError = exports.PC20RegistryMismatchError = exports.PC20WrapperNotRegisteredError = exports.PC20TokenChainMismatchError = exports.InvalidPC20AddressError = exports.PC20Error = exports.isPC20Reference = exports.CHAIN = void 0;
|
|
4
|
-
exports.PushChain = exports.UNIVERSAL_READ_REGISTRY_EVM = exports.UNIVERSAL_CALLBACK_EVM = exports.toReadQuery = exports.toRequestIdHex = exports.inferResultShape = exports.sizeCallbackBudget = exports.toCallData = exports.validateReadSpec = exports.buildReadSpecFromPreflight = exports.parseFulfilOutcome = exports.parseReadRequestsFromReceipt = exports.decodeReadResult = exports.encodeReadQuery = exports.resolveDestination = exports.ReadRegistryUnavailableError = exports.ReadNotFoundError = void 0;
|
|
4
|
+
exports.PushChain = exports.AgenticRevertError = exports.AgenticError = exports.AGENTIC_ERROR_CODE = exports.PushChainBatchExecutionError = exports.PushChainExecutionError = exports.UNIVERSAL_READ_REGISTRY_EVM = exports.UNIVERSAL_CALLBACK_EVM = exports.toReadQuery = exports.toRequestIdHex = exports.inferResultShape = exports.sizeCallbackBudget = exports.toCallData = exports.validateReadSpec = exports.buildReadSpecFromPreflight = exports.parseFulfilOutcome = exports.parseReadRequestsFromReceipt = exports.decodeReadResult = exports.encodeReadQuery = exports.resolveDestination = exports.ReadRegistryUnavailableError = exports.ReadNotFoundError = void 0;
|
|
5
5
|
const push_chain_1 = require("./push-chain/push-chain");
|
|
6
6
|
Object.defineProperty(exports, "PushChain", { enumerable: true, get: function () { return push_chain_1.PushChain; } });
|
|
7
7
|
var enums_1 = require("./constants/enums");
|
|
@@ -88,4 +88,12 @@ var universalCallback_evm_1 = require("./constants/abi/universalCallback.evm");
|
|
|
88
88
|
Object.defineProperty(exports, "UNIVERSAL_CALLBACK_EVM", { enumerable: true, get: function () { return universalCallback_evm_1.UNIVERSAL_CALLBACK_EVM; } });
|
|
89
89
|
var universalReadRegistry_evm_1 = require("./constants/abi/universalReadRegistry.evm");
|
|
90
90
|
Object.defineProperty(exports, "UNIVERSAL_READ_REGISTRY_EVM", { enumerable: true, get: function () { return universalReadRegistry_evm_1.UNIVERSAL_READ_REGISTRY_EVM; } });
|
|
91
|
+
// Structured execution errors (base class of AgenticRevertError)
|
|
92
|
+
var errors_3 = require("./orchestrator/internals/errors");
|
|
93
|
+
Object.defineProperty(exports, "PushChainExecutionError", { enumerable: true, get: function () { return errors_3.PushChainExecutionError; } });
|
|
94
|
+
Object.defineProperty(exports, "PushChainBatchExecutionError", { enumerable: true, get: function () { return errors_3.PushChainBatchExecutionError; } });
|
|
95
|
+
var agentic_1 = require("./agentic");
|
|
96
|
+
Object.defineProperty(exports, "AGENTIC_ERROR_CODE", { enumerable: true, get: function () { return agentic_1.AGENTIC_ERROR_CODE; } });
|
|
97
|
+
Object.defineProperty(exports, "AgenticError", { enumerable: true, get: function () { return agentic_1.AgenticError; } });
|
|
98
|
+
Object.defineProperty(exports, "AgenticRevertError", { enumerable: true, get: function () { return agentic_1.AgenticRevertError; } });
|
|
91
99
|
//# sourceMappingURL=index.js.map
|
|
@@ -39,11 +39,18 @@ export declare class PushChainExecutionError extends Error {
|
|
|
39
39
|
readonly code: "PUSH_CHAIN_EXECUTION_FAILED";
|
|
40
40
|
readonly gatewayTxHash?: string;
|
|
41
41
|
readonly decodedError?: DecodedErrorPayload;
|
|
42
|
+
/** Underlying transport/RPC error, kept so raw revert data is not lost. */
|
|
43
|
+
readonly cause?: unknown;
|
|
42
44
|
constructor(message: string, opts?: {
|
|
43
45
|
gatewayTxHash?: string;
|
|
44
46
|
decodedError?: DecodedErrorPayload;
|
|
47
|
+
cause?: unknown;
|
|
45
48
|
});
|
|
46
49
|
}
|
|
50
|
+
/** @internal A caller required an atomic native batch; sequential fallback is forbidden. */
|
|
51
|
+
export declare class AtomicBatchUnavailableError extends PushChainExecutionError {
|
|
52
|
+
constructor(message: string, cause?: unknown);
|
|
53
|
+
}
|
|
47
54
|
/** Recovery metadata for a non-atomic Push batch. A pending hash is broadcast but unconfirmed. */
|
|
48
55
|
export declare class PushChainBatchExecutionError extends PushChainExecutionError {
|
|
49
56
|
readonly transactionHashes: `0x${string}`[];
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* callers.
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.InsufficientUEABalanceError = exports.PushChainBatchExecutionError = exports.PushChainExecutionError = void 0;
|
|
13
|
+
exports.InsufficientUEABalanceError = exports.PushChainBatchExecutionError = exports.AtomicBatchUnavailableError = exports.PushChainExecutionError = void 0;
|
|
14
14
|
const formatters_1 = require("../../formatters");
|
|
15
15
|
/**
|
|
16
16
|
* Typed error for Route 1 Push Chain tx failures. Thrown by
|
|
@@ -31,14 +31,26 @@ class PushChainExecutionError extends Error {
|
|
|
31
31
|
code = 'PUSH_CHAIN_EXECUTION_FAILED';
|
|
32
32
|
gatewayTxHash;
|
|
33
33
|
decodedError;
|
|
34
|
+
/** Underlying transport/RPC error, kept so raw revert data is not lost. */
|
|
35
|
+
cause;
|
|
34
36
|
constructor(message, opts = {}) {
|
|
35
37
|
super((0, formatters_1.normalizePublicErrorMessage)(message));
|
|
36
38
|
this.name = 'PushChainExecutionError';
|
|
37
39
|
this.gatewayTxHash = opts.gatewayTxHash;
|
|
38
40
|
this.decodedError = opts.decodedError;
|
|
41
|
+
if (opts.cause !== undefined)
|
|
42
|
+
this.cause = opts.cause;
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
exports.PushChainExecutionError = PushChainExecutionError;
|
|
46
|
+
/** @internal A caller required an atomic native batch; sequential fallback is forbidden. */
|
|
47
|
+
class AtomicBatchUnavailableError extends PushChainExecutionError {
|
|
48
|
+
constructor(message, cause) {
|
|
49
|
+
super(message, { cause });
|
|
50
|
+
this.name = 'AtomicBatchUnavailableError';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.AtomicBatchUnavailableError = AtomicBatchUnavailableError;
|
|
42
54
|
/** Recovery metadata for a non-atomic Push batch. A pending hash is broadcast but unconfirmed. */
|
|
43
55
|
class PushChainBatchExecutionError extends PushChainExecutionError {
|
|
44
56
|
transactionHashes;
|
|
@@ -3,4 +3,6 @@ import type { ExecuteParams, UniversalTxResponse } from '../orchestrator.types';
|
|
|
3
3
|
import type { OrchestratorContext } from './context';
|
|
4
4
|
import { type ResponseBuilderCallbacks } from './response-builder';
|
|
5
5
|
export declare function resolveRequiredFunds(requiredGasFee: bigint, executeValue: bigint, requiredFundsOverride?: bigint): bigint;
|
|
6
|
-
export declare function executeStandardPayload(ctx: OrchestratorContext, execute: ExecuteParams, eventBuffer: ProgressEvent[], getResponseCallbacks: () => ResponseBuilderCallbacks
|
|
6
|
+
export declare function executeStandardPayload(ctx: OrchestratorContext, execute: ExecuteParams, eventBuffer: ProgressEvent[], getResponseCallbacks: () => ResponseBuilderCallbacks, policy?: {
|
|
7
|
+
requireAtomicBatch: boolean;
|
|
8
|
+
}): Promise<UniversalTxResponse>;
|
|
@@ -83,7 +83,7 @@ function resolveRequiredFunds(requiredGasFee, executeValue, requiredFundsOverrid
|
|
|
83
83
|
? requiredFundsOverride
|
|
84
84
|
: baseRequiredFunds;
|
|
85
85
|
}
|
|
86
|
-
async function executeStandardPayload(ctx, execute, eventBuffer, getResponseCallbacks) {
|
|
86
|
+
async function executeStandardPayload(ctx, execute, eventBuffer, getResponseCallbacks, policy) {
|
|
87
87
|
const transformFn = (tx, buf = []) => (0, response_builder_1.transformToUniversalTxResponse)(ctx, tx, buf, getResponseCallbacks());
|
|
88
88
|
// Set default value for value if undefined
|
|
89
89
|
if (execute.value === undefined) {
|
|
@@ -104,7 +104,7 @@ async function executeStandardPayload(ctx, execute, eventBuffer, getResponseCall
|
|
|
104
104
|
(0, context_1.fireProgressHook)(ctx, progress_hook_types_1.PROGRESS_HOOK.SEND_TX_107);
|
|
105
105
|
let tx;
|
|
106
106
|
try {
|
|
107
|
-
tx = await (0, push_chain_tx_1.sendPushTx)(ctx, execute, eventBuffer, transformFn);
|
|
107
|
+
tx = await (0, push_chain_tx_1.sendPushTx)(ctx, execute, eventBuffer, transformFn, policy?.requireAtomicBatch);
|
|
108
108
|
}
|
|
109
109
|
catch (err) {
|
|
110
110
|
// Push Chain broadcast failed. Wallet rejection surfaces as 104-04;
|
|
@@ -116,7 +116,7 @@ async function executeStandardPayload(ctx, execute, eventBuffer, getResponseCall
|
|
|
116
116
|
// outer orchestrator catch doesn't emit a second 199-02 on top.
|
|
117
117
|
ctx._routeTerminalEmitted = true;
|
|
118
118
|
if (!isUserDecline && !(err instanceof push_chain_tx_1.PushChainExecutionError)) {
|
|
119
|
-
throw new push_chain_tx_1.PushChainExecutionError(errMsg);
|
|
119
|
+
throw new push_chain_tx_1.PushChainExecutionError(errMsg, { cause: err });
|
|
120
120
|
}
|
|
121
121
|
throw err;
|
|
122
122
|
}
|
|
@@ -9,8 +9,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.OutboundFailedError = exports.OutboundTimeoutError = exports.INBOUND_INITIAL_WAIT_MS = exports.INBOUND_MAX_TIMEOUT_MS = exports.OUTBOUND_MAX_TIMEOUT_MS = exports.OUTBOUND_POLL_INTERVAL_MS = exports.OUTBOUND_INITIAL_WAIT_MS = void 0;
|
|
10
10
|
exports.waitForOutboundTx = waitForOutboundTx;
|
|
11
11
|
exports.waitForAllOutboundTxsV2 = waitForAllOutboundTxsV2;
|
|
12
|
+
const tslib_1 = require("tslib");
|
|
12
13
|
const tracking_1 = require("./pc20/tracking");
|
|
13
14
|
const viem_1 = require("viem");
|
|
15
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
16
|
+
const bs58_1 = tslib_1.__importDefault(require("bs58"));
|
|
14
17
|
const chain_1 = require("../../constants/chain");
|
|
15
18
|
const enums_1 = require("../../constants/enums");
|
|
16
19
|
const types_1 = require("../../generated/uexecutor/v1/types");
|
|
@@ -90,11 +93,11 @@ exports.OutboundFailedError = OutboundFailedError;
|
|
|
90
93
|
* (preserves the silent-success bug fix); if no receipt yet or RPC failure,
|
|
91
94
|
* we keep polling.
|
|
92
95
|
*
|
|
93
|
-
* EVM
|
|
96
|
+
* EVM receipts and confirmed/finalized Solana signatures are supported.
|
|
94
97
|
*/
|
|
95
|
-
async function
|
|
98
|
+
async function verifyExternalReceipt(ctx, destinationChain, externalTxHash) {
|
|
96
99
|
const chainInfo = chain_1.CHAIN_INFO[destinationChain];
|
|
97
|
-
if (!chainInfo || chainInfo.vm !== enums_1.VM.EVM) {
|
|
100
|
+
if (!chainInfo || (chainInfo.vm !== enums_1.VM.EVM && chainInfo.vm !== enums_1.VM.SVM)) {
|
|
98
101
|
return 'unsupported';
|
|
99
102
|
}
|
|
100
103
|
// Guard against unit-test contexts that don't pass a real rpcUrls map —
|
|
@@ -106,6 +109,45 @@ async function verifyExternalEvmReceipt(ctx, destinationChain, externalTxHash) {
|
|
|
106
109
|
: chainInfo.defaultRPC;
|
|
107
110
|
if (!rpcUrls?.length)
|
|
108
111
|
return 'unsupported';
|
|
112
|
+
if (chainInfo.vm === enums_1.VM.SVM) {
|
|
113
|
+
let signature;
|
|
114
|
+
try {
|
|
115
|
+
const bytes = externalTxHash.startsWith('0x')
|
|
116
|
+
? /^0x[0-9a-fA-F]{128}$/.test(externalTxHash)
|
|
117
|
+
? Buffer.from(externalTxHash.slice(2), 'hex')
|
|
118
|
+
: new Uint8Array()
|
|
119
|
+
: bs58_1.default.decode(externalTxHash);
|
|
120
|
+
if (bytes.length !== 64)
|
|
121
|
+
return 'pending';
|
|
122
|
+
signature = bs58_1.default.encode(bytes);
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return 'pending';
|
|
126
|
+
}
|
|
127
|
+
for (const url of rpcUrls) {
|
|
128
|
+
try {
|
|
129
|
+
const connection = new web3_js_1.Connection(url, 'confirmed');
|
|
130
|
+
if (`solana:${(await connection.getGenesisHash()).slice(0, 32)}` !==
|
|
131
|
+
destinationChain)
|
|
132
|
+
continue;
|
|
133
|
+
const result = await connection.getSignatureStatuses([signature], {
|
|
134
|
+
searchTransactionHistory: true,
|
|
135
|
+
});
|
|
136
|
+
const status = result.value[0];
|
|
137
|
+
// A processed vote can still disappear. Never report success/failure
|
|
138
|
+
// before the signature is confirmed or finalized on the right cluster.
|
|
139
|
+
if (!status ||
|
|
140
|
+
(status.confirmationStatus !== 'confirmed' &&
|
|
141
|
+
status.confirmationStatus !== 'finalized'))
|
|
142
|
+
return 'pending';
|
|
143
|
+
return status.err ? 'reverted' : 'success';
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
(0, context_1.printLog)(ctx, `[verifyExternalReceipt] SVM RPC unavailable: ${error instanceof Error ? error.name : 'unknown'}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return 'pending';
|
|
150
|
+
}
|
|
109
151
|
try {
|
|
110
152
|
const client = (0, viem_1.createPublicClient)({
|
|
111
153
|
transport: (0, viem_1.fallback)(rpcUrls.map((url) => (0, viem_1.http)(url))),
|
|
@@ -128,7 +170,7 @@ async function verifyExternalEvmReceipt(ctx, destinationChain, externalTxHash) {
|
|
|
128
170
|
if (/not found|TransactionReceiptNotFound|could not be found/i.test(msg)) {
|
|
129
171
|
return 'pending';
|
|
130
172
|
}
|
|
131
|
-
(0, context_1.printLog)(ctx, `[
|
|
173
|
+
(0, context_1.printLog)(ctx, `[verifyExternalReceipt] RPC error for ${destinationChain} tx ${externalTxHash}: ${msg}`);
|
|
132
174
|
return 'pending';
|
|
133
175
|
}
|
|
134
176
|
}
|
|
@@ -268,7 +310,7 @@ async function waitForOutboundTx(ctx, pushChainTxHash, options = {}) {
|
|
|
268
310
|
const isCosmosObserved = ob.outboundStatus === types_2.OutboundStatus.OBSERVED;
|
|
269
311
|
if (!isCosmosObserved) {
|
|
270
312
|
// Tiebreaker: ask the destination-chain RPC directly.
|
|
271
|
-
const verdict = await
|
|
313
|
+
const verdict = await verifyExternalReceipt(ctx, chain, ob.observedTx.txHash);
|
|
272
314
|
if (verdict === 'reverted') {
|
|
273
315
|
(0, context_1.printLog)(ctx, `[waitForOutboundTx] Source-chain RPC reports REVERTED for ${ob.destinationChain} tx ${ob.observedTx.txHash} (cosmos still ${types_1.UniversalTxStatus[statusNum] ?? statusNum})`);
|
|
274
316
|
progressHook?.({
|
|
@@ -313,7 +355,10 @@ async function waitForOutboundTx(ctx, pushChainTxHash, options = {}) {
|
|
|
313
355
|
// created, and a repeat export deploys no wrapper so nothing is
|
|
314
356
|
// ever observed to backfill it. Resolve from UniversalCore instead,
|
|
315
357
|
// keyed by the Push-native source token.
|
|
316
|
-
const pc20Wrapper = await (0, tracking_1.resolvePC20WrapperForReceipt)(ctx, ob, {
|
|
358
|
+
const pc20Wrapper = await (0, tracking_1.resolvePC20WrapperForReceipt)(ctx, ob, {
|
|
359
|
+
network: ctx.pushNetwork,
|
|
360
|
+
rpcUrls: ctx.rpcUrls,
|
|
361
|
+
});
|
|
317
362
|
const details = {
|
|
318
363
|
externalTxHash: ob.observedTx.txHash,
|
|
319
364
|
destinationChain: chain,
|
|
@@ -477,7 +522,7 @@ async function waitForAllOutboundTxsV2(ctx, pushChainTxHash, outboundHops, optio
|
|
|
477
522
|
continue;
|
|
478
523
|
const isCosmosObserved = ob.outboundStatus === types_2.OutboundStatus.OBSERVED;
|
|
479
524
|
if (!isCosmosObserved) {
|
|
480
|
-
const verdict = await
|
|
525
|
+
const verdict = await verifyExternalReceipt(ctx, chain, externalTxHash);
|
|
481
526
|
if (verdict === 'reverted') {
|
|
482
527
|
for (const targetHop of pendingTargetHops) {
|
|
483
528
|
targetHop.status = 'failed';
|
|
@@ -20,7 +20,7 @@ type TransformToResponseFn = (tx: TxResponse, eventBuffer: ProgressEvent[]) => P
|
|
|
20
20
|
* For multicall arrays: executes each call as a separate transaction with
|
|
21
21
|
* local nonce management and per-tx receipt confirmation.
|
|
22
22
|
*/
|
|
23
|
-
export declare function sendPushTx(ctx: OrchestratorContext, execute: ExecuteParams, eventBuffer: ProgressEvent[], transformFn: TransformToResponseFn): Promise<UniversalTxResponse>;
|
|
23
|
+
export declare function sendPushTx(ctx: OrchestratorContext, execute: ExecuteParams, eventBuffer: ProgressEvent[], transformFn: TransformToResponseFn, requireAtomicBatch?: boolean): Promise<UniversalTxResponse>;
|
|
24
24
|
export type ResignUniversalPayloadFn = () => Promise<{
|
|
25
25
|
universalPayload: UniversalPayload;
|
|
26
26
|
verificationData: `0x${string}`;
|
|
@@ -66,7 +66,7 @@ async function getIndexedPushTransaction(ctx, txHash, label) {
|
|
|
66
66
|
* For multicall arrays: executes each call as a separate transaction with
|
|
67
67
|
* local nonce management and per-tx receipt confirmation.
|
|
68
68
|
*/
|
|
69
|
-
async function sendPushTx(ctx, execute, eventBuffer, transformFn) {
|
|
69
|
+
async function sendPushTx(ctx, execute, eventBuffer, transformFn, requireAtomicBatch = false) {
|
|
70
70
|
if (Array.isArray(execute.data)) {
|
|
71
71
|
const calls = execute.data;
|
|
72
72
|
// Reject a zero `to` BEFORE route selection so behaviour is identical
|
|
@@ -82,6 +82,15 @@ async function sendPushTx(ctx, execute, eventBuffer, transformFn) {
|
|
|
82
82
|
// (b) a wallet that can sign a 7702 authorization. When either is missing we
|
|
83
83
|
// fall back to the legacy non-atomic per-call loop below.
|
|
84
84
|
const executor = (0, chain_1.getBatchExecutorAddress)(ctx.universalSigner.account.chain);
|
|
85
|
+
if (requireAtomicBatch) {
|
|
86
|
+
if (!executor || !ctx.universalSigner.signAuthorization) {
|
|
87
|
+
throw new errors_1.AtomicBatchUnavailableError('This operation requires a sender-preserving atomic batch; the signer/network does not support EIP-7702.');
|
|
88
|
+
}
|
|
89
|
+
const code = await ctx.pushClient.publicClient.getCode({ address: executor });
|
|
90
|
+
if (!code || code === '0x') {
|
|
91
|
+
throw new errors_1.AtomicBatchUnavailableError(`Atomic batch executor ${executor} is not deployed on the connected network.`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
85
94
|
if (executor && ctx.universalSigner.signAuthorization) {
|
|
86
95
|
try {
|
|
87
96
|
(0, context_1.printLog)(ctx, `sendPushTx — executing ${calls.length} call(s) atomically via EIP-7702 (executor: ${executor})`);
|
|
@@ -100,6 +109,9 @@ async function sendPushTx(ctx, execute, eventBuffer, transformFn) {
|
|
|
100
109
|
// (e.g. a real revert) must surface.
|
|
101
110
|
if (!(err instanceof evm_client_1.EIP7702NotSupportedError))
|
|
102
111
|
throw err;
|
|
112
|
+
if (requireAtomicBatch) {
|
|
113
|
+
throw new errors_1.AtomicBatchUnavailableError('The signer could not authorize EIP-7702; no sequential transactions were sent.', err);
|
|
114
|
+
}
|
|
103
115
|
(0, context_1.printLog)(ctx, `sendPushTx — wallet cannot sign EIP-7702 authorization; falling back to sequential execution`);
|
|
104
116
|
// eslint-disable-next-line no-console
|
|
105
117
|
console.warn('[push-chain] Wallet cannot produce an EIP-7702 authorization — batch ' +
|
|
@@ -97,6 +97,9 @@ export declare class Orchestrator {
|
|
|
97
97
|
* Route 1 (Push Chain) dispatches to extracted sub-flow modules.
|
|
98
98
|
*/
|
|
99
99
|
execute(params: ExecuteParams | UniversalExecuteParams, options?: TransactionExecutionOptions): Promise<UniversalTxResponse>;
|
|
100
|
+
/** @internal Sender-preserving batch. Never uses the native sequential fallback. */
|
|
101
|
+
executeAtomicBatch(params: ExecuteParams, options?: TransactionExecutionOptions): Promise<UniversalTxResponse>;
|
|
102
|
+
private executeWithPolicy;
|
|
100
103
|
/**
|
|
101
104
|
* Prepare a universal transaction without executing it.
|
|
102
105
|
* Returns a PreparedUniversalTx that can be chained with thenOn() or sent with send().
|
|
@@ -157,6 +157,16 @@ class Orchestrator {
|
|
|
157
157
|
* Route 1 (Push Chain) dispatches to extracted sub-flow modules.
|
|
158
158
|
*/
|
|
159
159
|
async execute(params, options) {
|
|
160
|
+
return this.executeWithPolicy(params, options, false);
|
|
161
|
+
}
|
|
162
|
+
/** @internal Sender-preserving batch. Never uses the native sequential fallback. */
|
|
163
|
+
async executeAtomicBatch(params, options) {
|
|
164
|
+
if (typeof params.to !== 'string' || !Array.isArray(params.data) || params.data.length < 2 || params.funds) {
|
|
165
|
+
throw new Error('executeAtomicBatch requires multiple Push calls and no signer funds');
|
|
166
|
+
}
|
|
167
|
+
return this.executeWithPolicy(params, options, true);
|
|
168
|
+
}
|
|
169
|
+
async executeWithPolicy(params, options, requireAtomicBatch) {
|
|
160
170
|
const inlineProgressHook = params.progressHook;
|
|
161
171
|
if (options || inlineProgressHook) {
|
|
162
172
|
params = {
|
|
@@ -312,7 +322,9 @@ class Orchestrator {
|
|
|
312
322
|
? await (0, internals_1.executeFundsOnly)(this.ctx, legacy, eventBuffer, rcb)
|
|
313
323
|
: await (0, internals_1.executeFundsWithPayload)(this.ctx, legacy, eventBuffer, rcb));
|
|
314
324
|
}
|
|
315
|
-
return attachPerCallHookForWait(await (
|
|
325
|
+
return attachPerCallHookForWait(await (requireAtomicBatch
|
|
326
|
+
? (0, internals_1.executeStandardPayload)(this.ctx, execute, eventBuffer, rcb, { requireAtomicBatch: true })
|
|
327
|
+
: (0, internals_1.executeStandardPayload)(this.ctx, execute, eventBuffer, rcb)));
|
|
316
328
|
}
|
|
317
329
|
catch (err) {
|
|
318
330
|
const errMessage = (0, formatters_1.normalizePublicErrorMessage)(err);
|
|
@@ -374,6 +374,14 @@ export interface UniversalTxResponse {
|
|
|
374
374
|
childTxHash?: string;
|
|
375
375
|
/** Transaction route (UOA_TO_PUSH, UOA_TO_CEA, CEA_TO_PUSH, CEA_TO_CEA) */
|
|
376
376
|
route?: TransactionRouteType;
|
|
377
|
+
/**
|
|
378
|
+
* Agentic wallet (AGW) context, present when the transaction executed
|
|
379
|
+
* through an AGW. `from` is then the wallet and `origin` stays the signer;
|
|
380
|
+
* `agentic.rawTo` / `rawData` hold the wrapped call the signer sent.
|
|
381
|
+
* Outbound to/data/value summarize the first encoded destination call;
|
|
382
|
+
* `agentic.destinationCalls` retains the complete ordered call list.
|
|
383
|
+
*/
|
|
384
|
+
agentic?: import('../agentic/agentic.types').AgenticTxMetadata;
|
|
377
385
|
/**
|
|
378
386
|
* @internal True when this response was produced by `trackTransaction` and
|
|
379
387
|
* its progress events have already been replayed via the registered hook.
|
|
@@ -19,6 +19,7 @@ exports.detectRoute = detectRoute;
|
|
|
19
19
|
exports.validateRouteParams = validateRouteParams;
|
|
20
20
|
exports.getRouteInfo = getRouteInfo;
|
|
21
21
|
const enums_1 = require("../constants/enums");
|
|
22
|
+
const read_state_1 = require("../constants/read-state");
|
|
22
23
|
const tokens_1 = require("../constants/tokens");
|
|
23
24
|
const orchestrator_types_1 = require("./orchestrator.types");
|
|
24
25
|
const payload_builders_1 = require("./payload-builders");
|
|
@@ -215,8 +216,8 @@ function detectRoute(params) {
|
|
|
215
216
|
*/
|
|
216
217
|
function validateRouteParams(params, context) {
|
|
217
218
|
const toChain = isChainTarget(params.to) ? String(params.to.chain) : undefined;
|
|
218
|
-
if (String(params.from?.chain ?? '')
|
|
219
|
-
throw new RouteValidationError('CHAIN.WEB2 is a read-only destination and cannot be used with transaction APIs');
|
|
219
|
+
if ((0, read_state_1.isWeb2ReadChain)(String(params.from?.chain ?? '')) || (0, read_state_1.isWeb2ReadChain)(toChain)) {
|
|
220
|
+
throw new RouteValidationError('READ.CHAIN.WEB2 is a read-only destination and cannot be used with transaction APIs');
|
|
220
221
|
}
|
|
221
222
|
const route = detectRoute(params);
|
|
222
223
|
// Validate from.chain is supported external chain (Routes 3, 4)
|
|
@@ -12,3 +12,5 @@ export interface ResolvedSvmCall {
|
|
|
12
12
|
ixData: Uint8Array;
|
|
13
13
|
}
|
|
14
14
|
export declare function resolveSvmCall(input: ResolveInput): ResolvedSvmCall;
|
|
15
|
+
/** Internal AGW seam: use its registry-derived authority, not the signer's CEA. */
|
|
16
|
+
export declare function resolveSvmCallForCea(input: ResolveInput, ceaAuthority: `0x${string}`): ResolvedSvmCall;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveSvmCall = resolveSvmCall;
|
|
4
|
+
exports.resolveSvmCallForCea = resolveSvmCallForCea;
|
|
4
5
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
6
|
const buffer_1 = require("buffer");
|
|
6
7
|
const account_1 = require("../../universal/account/account");
|
|
@@ -13,6 +14,15 @@ const CEA_AUTHORITY_NAMES = new Set([
|
|
|
13
14
|
'ceaSigner',
|
|
14
15
|
]);
|
|
15
16
|
function resolveSvmCall(input) {
|
|
17
|
+
return resolveCall(input);
|
|
18
|
+
}
|
|
19
|
+
/** Internal AGW seam: use its registry-derived authority, not the signer's CEA. */
|
|
20
|
+
function resolveSvmCallForCea(input, ceaAuthority) {
|
|
21
|
+
if (!/^0x[0-9a-fA-F]{64}$/.test(ceaAuthority))
|
|
22
|
+
throw new Error('SVM CEA authority must be 32 bytes');
|
|
23
|
+
return resolveCall(input, ceaAuthority);
|
|
24
|
+
}
|
|
25
|
+
function resolveCall(input, authority) {
|
|
16
26
|
const idl = (0, registry_1.getIdl)(input.programAddress);
|
|
17
27
|
if (!idl) {
|
|
18
28
|
throw new Error(`resolveSvmCall: no IDL found for ${input.programAddress}. ` +
|
|
@@ -30,7 +40,7 @@ function resolveSvmCall(input) {
|
|
|
30
40
|
throw new Error(`resolveSvmCall: no instruction in IDL '${idl.metadata?.name ?? idl.address}' matches discriminator [${Array.from(disc).join(',')}]`);
|
|
31
41
|
}
|
|
32
42
|
const programPk = new web3_js_1.PublicKey(buffer_1.Buffer.from(input.programAddress.slice(2), 'hex'));
|
|
33
|
-
const
|
|
43
|
+
const ceaPdaHex = authority ?? (0, account_1.deriveSvmCeaPda)(input.senderUea, input.targetChain, true).address;
|
|
34
44
|
const accounts = [];
|
|
35
45
|
for (const item of ix.accounts) {
|
|
36
46
|
if ('accounts' in item) {
|