@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
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import type { ArgPinWire } from './codec/pins';
|
|
2
|
+
/** Public section-6 rules and internal adapters for the deployed v6 wire format.
|
|
3
|
+
* Source snapshot: October 12, 2026. Internal normalized types are not package exports.
|
|
4
|
+
*/
|
|
5
|
+
import type { Idl } from '@coral-xyz/anchor';
|
|
6
|
+
import type { SvmTermsWire } from './codec/svm-terms';
|
|
7
|
+
import type { MoveableToken } from '../constants/tokens';
|
|
8
|
+
import type { UniversalTxResponse } from '../orchestrator/orchestrator.types';
|
|
9
|
+
import type { ProgressEvent } from '../progress-hook/progress-hook.types';
|
|
10
|
+
export type AgenticAddress = `0x${string}`;
|
|
11
|
+
export type AgenticHex = `0x${string}`;
|
|
12
|
+
export type ForeignChainNamespace = `eip155:${string}` | `solana:${string}`;
|
|
13
|
+
export type AgenticProgressHook = (event: ProgressEvent) => void;
|
|
14
|
+
/** '0x617ba037' or 'supply(address,uint256,address,uint16)'. */
|
|
15
|
+
export type Selector = AgenticHex | `${string}(${string})`;
|
|
16
|
+
/** One Push function a native rule allows, with its own limits and counters. */
|
|
17
|
+
export interface NativeAction {
|
|
18
|
+
wirePins?: ArgPinWire[];
|
|
19
|
+
target: AgenticAddress;
|
|
20
|
+
selector: Selector | 'value-only';
|
|
21
|
+
/** Default 0: no native PC value allowance. */
|
|
22
|
+
maxValuePerCall?: bigint;
|
|
23
|
+
/** Default 0: no native PC value allowance. */
|
|
24
|
+
maxValueTotal?: bigint;
|
|
25
|
+
/** Default 0 (unlimited calls until expiry). */
|
|
26
|
+
maxCalls?: number;
|
|
27
|
+
pins?: ArgPin[];
|
|
28
|
+
/** `maxTotal` default uint256 max (unlimited total). */
|
|
29
|
+
amount?: AmountLimit;
|
|
30
|
+
/**
|
|
31
|
+
* Overrides the rule's `validUntil` for this action. Decoded rules set it
|
|
32
|
+
* only when stored actions expire at different times.
|
|
33
|
+
*/
|
|
34
|
+
validUntil?: number;
|
|
35
|
+
}
|
|
36
|
+
interface NativeRuleCommon {
|
|
37
|
+
/** Push address: an EOA, or the UEA of an external key. Never the owner. */
|
|
38
|
+
agent: AgenticAddress;
|
|
39
|
+
/** Omitted = the connected Push chain. */
|
|
40
|
+
chainNamespace?: never;
|
|
41
|
+
/** Unix seconds. */
|
|
42
|
+
validUntil: number;
|
|
43
|
+
}
|
|
44
|
+
/** A native rule allowing one function (shorthand for a one-entry `actions`). */
|
|
45
|
+
export interface NativeSingleRule extends NativeRuleCommon, Omit<NativeAction, 'validUntil'> {
|
|
46
|
+
actions?: never;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A native rule allowing 1..8 functions under ONE rule ID. Each action keeps
|
|
50
|
+
* its own limits and counters on-chain; (target, selector) pairs must be
|
|
51
|
+
* unique. One rule per agent on Push keeps send-time selection unambiguous.
|
|
52
|
+
* Internal normalized representation; public callers use Rule.allowedCalls.
|
|
53
|
+
*/
|
|
54
|
+
export interface NativeMultiRule extends NativeRuleCommon {
|
|
55
|
+
actions: NativeAction[];
|
|
56
|
+
target?: never;
|
|
57
|
+
selector?: never;
|
|
58
|
+
maxValuePerCall?: never;
|
|
59
|
+
maxValueTotal?: never;
|
|
60
|
+
maxCalls?: never;
|
|
61
|
+
pins?: never;
|
|
62
|
+
amount?: never;
|
|
63
|
+
}
|
|
64
|
+
export type NativeRule = NativeSingleRule | NativeMultiRule;
|
|
65
|
+
/**
|
|
66
|
+
* Where a pin or amount sits in the calldata. `arg` is the argument index in
|
|
67
|
+
* the selector signature (requires the signature form of `selector`).
|
|
68
|
+
* `offset` is the raw calldata byte offset, selector included — the form the
|
|
69
|
+
* contracts store; decoded rules (rules.get/list, decodeRules) always use it
|
|
70
|
+
* because stored terms carry no ABI. Advanced input form; ABI argument indexes are preferred for authoring.
|
|
71
|
+
*/
|
|
72
|
+
export type ArgPin = {
|
|
73
|
+
arg: number;
|
|
74
|
+
offset?: never;
|
|
75
|
+
expected: AgenticHex | AgenticAddress | bigint;
|
|
76
|
+
} | {
|
|
77
|
+
offset: number;
|
|
78
|
+
arg?: never;
|
|
79
|
+
expected: AgenticHex;
|
|
80
|
+
};
|
|
81
|
+
export type AmountLimit = ({
|
|
82
|
+
arg: number;
|
|
83
|
+
offset?: never;
|
|
84
|
+
} | {
|
|
85
|
+
offset: number;
|
|
86
|
+
arg?: never;
|
|
87
|
+
}) & {
|
|
88
|
+
maxPerCall: bigint;
|
|
89
|
+
maxTotal?: bigint;
|
|
90
|
+
};
|
|
91
|
+
export interface AssetCap {
|
|
92
|
+
/** The destination chain's token (MOVEABLE constant) or native marker. */
|
|
93
|
+
token: MoveableToken | AgenticAddress;
|
|
94
|
+
maxPerCall: bigint;
|
|
95
|
+
/** Omitted = zero. Explicit zero forbids movement. */
|
|
96
|
+
maxTotal?: bigint;
|
|
97
|
+
}
|
|
98
|
+
export interface AllowedCall {
|
|
99
|
+
pins?: ArgPinWire[];
|
|
100
|
+
target: AgenticAddress;
|
|
101
|
+
selector: Selector;
|
|
102
|
+
/** Argument index whose address must be the wallet's destination account. */
|
|
103
|
+
beneficiary?: number;
|
|
104
|
+
/** Exact stored calldata offset for lossless decoded rules; mutually exclusive with beneficiary. Approved advanced input form. */
|
|
105
|
+
beneficiaryOffset?: number;
|
|
106
|
+
/** Default 0. */
|
|
107
|
+
maxValue?: bigint;
|
|
108
|
+
}
|
|
109
|
+
export interface UniversalRule {
|
|
110
|
+
agent: AgenticAddress;
|
|
111
|
+
chainNamespace: `eip155:${string}`;
|
|
112
|
+
assets: AssetCap[];
|
|
113
|
+
/** PC (wei) per outbound for the destination leg. */
|
|
114
|
+
maxGasPerCall: bigint;
|
|
115
|
+
validUntil: number;
|
|
116
|
+
/** 1..32, all on chainNamespace. */
|
|
117
|
+
allowedCalls: AllowedCall[];
|
|
118
|
+
}
|
|
119
|
+
/** An address may be base58 or a 32-byte hex Solana public key. */
|
|
120
|
+
export type SvmAccountRef = {
|
|
121
|
+
kind: 'walletCEA';
|
|
122
|
+
} | {
|
|
123
|
+
kind: 'walletATA';
|
|
124
|
+
token: string;
|
|
125
|
+
} | {
|
|
126
|
+
kind: 'address';
|
|
127
|
+
address: string;
|
|
128
|
+
};
|
|
129
|
+
export type SvmFieldConstraint = {
|
|
130
|
+
name: string;
|
|
131
|
+
equals: AgenticHex | bigint | boolean;
|
|
132
|
+
} | {
|
|
133
|
+
name: string;
|
|
134
|
+
min: bigint;
|
|
135
|
+
} | {
|
|
136
|
+
name: string;
|
|
137
|
+
max: bigint;
|
|
138
|
+
} | {
|
|
139
|
+
numerator: string;
|
|
140
|
+
denominator: string;
|
|
141
|
+
minRatio: {
|
|
142
|
+
num: bigint;
|
|
143
|
+
den: bigint;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
export interface SvmInstructionRule {
|
|
147
|
+
/** Internal wire override: 0 means no exact account-count constraint. */
|
|
148
|
+
maxAccounts?: number;
|
|
149
|
+
program: string;
|
|
150
|
+
instruction: {
|
|
151
|
+
idl: Idl;
|
|
152
|
+
name: string;
|
|
153
|
+
};
|
|
154
|
+
/** Top-level account names from a supported Anchor IDL; optional/nested accounts are rejected. */
|
|
155
|
+
accounts: {
|
|
156
|
+
name: string;
|
|
157
|
+
expected: SvmAccountRef;
|
|
158
|
+
}[];
|
|
159
|
+
/** Fixed-width fields only; unsupported/variable layouts fail before signing. */
|
|
160
|
+
fields?: SvmFieldConstraint[];
|
|
161
|
+
}
|
|
162
|
+
export interface SolanaRule {
|
|
163
|
+
agent: AgenticAddress;
|
|
164
|
+
chainNamespace: `solana:${string}`;
|
|
165
|
+
validUntil: number;
|
|
166
|
+
assets: {
|
|
167
|
+
token: MoveableToken | string;
|
|
168
|
+
maxPerCall: bigint;
|
|
169
|
+
maxTotal?: bigint;
|
|
170
|
+
}[];
|
|
171
|
+
maxGasPerCall: bigint;
|
|
172
|
+
/** Additional output mints whose wallet ATAs must be protected. */
|
|
173
|
+
outputTokens?: string[];
|
|
174
|
+
allowedInstructions: SvmInstructionRule[];
|
|
175
|
+
}
|
|
176
|
+
/** Lossless stored Solana layout, accepted by update without an invented IDL. */
|
|
177
|
+
export interface DecodedSolanaRule extends Omit<SvmTermsWire, 'assets'> {
|
|
178
|
+
format: 'decoded';
|
|
179
|
+
agent: AgenticAddress;
|
|
180
|
+
chainNamespace: `solana:${string}`;
|
|
181
|
+
assets: {
|
|
182
|
+
token: string;
|
|
183
|
+
maxPerCall: bigint;
|
|
184
|
+
maxTotal: bigint;
|
|
185
|
+
}[];
|
|
186
|
+
}
|
|
187
|
+
export type InternalRule = NativeRule | UniversalRule | SolanaRule;
|
|
188
|
+
export interface InternalRulesRecord {
|
|
189
|
+
rulesId: AgenticHex;
|
|
190
|
+
enabled: boolean;
|
|
191
|
+
chainNamespace: string;
|
|
192
|
+
agent: AgenticAddress;
|
|
193
|
+
validUntil: number;
|
|
194
|
+
rule: InternalRule | DecodedSolanaRule;
|
|
195
|
+
}
|
|
196
|
+
/** Current SDK section 6 public rule shape; contract wire types above are internal. */
|
|
197
|
+
export type WalletMarker = 'agentic:wallet';
|
|
198
|
+
/** Top-level ABI argument, or a path through static tuple/fixed-array fields. */
|
|
199
|
+
export type ArgumentPath = number | readonly number[];
|
|
200
|
+
export type Pin = {
|
|
201
|
+
arg: ArgumentPath;
|
|
202
|
+
expected: AgenticHex | AgenticAddress | bigint | WalletMarker;
|
|
203
|
+
max?: never;
|
|
204
|
+
account?: never;
|
|
205
|
+
} | {
|
|
206
|
+
arg: ArgumentPath;
|
|
207
|
+
max: bigint;
|
|
208
|
+
expected?: never;
|
|
209
|
+
account?: never;
|
|
210
|
+
} | {
|
|
211
|
+
account: number;
|
|
212
|
+
expected: string | WalletMarker;
|
|
213
|
+
token?: MoveableToken | string;
|
|
214
|
+
arg?: never;
|
|
215
|
+
max?: never;
|
|
216
|
+
};
|
|
217
|
+
export interface RuleCall {
|
|
218
|
+
target: string;
|
|
219
|
+
selector: Selector | 'value-only';
|
|
220
|
+
pins?: Pin[];
|
|
221
|
+
maxValue?: bigint;
|
|
222
|
+
app?: string;
|
|
223
|
+
label?: string;
|
|
224
|
+
}
|
|
225
|
+
export interface RuleAsset {
|
|
226
|
+
token: MoveableToken | string;
|
|
227
|
+
maxPerCall: bigint;
|
|
228
|
+
maxTotal?: bigint;
|
|
229
|
+
}
|
|
230
|
+
export interface Rule {
|
|
231
|
+
agent: AgenticAddress;
|
|
232
|
+
chainNamespace?: ForeignChainNamespace;
|
|
233
|
+
validUntil: number;
|
|
234
|
+
assets?: RuleAsset[];
|
|
235
|
+
maxGasPerCall?: bigint;
|
|
236
|
+
allowedCalls: RuleCall[];
|
|
237
|
+
}
|
|
238
|
+
export type RuleInput = Rule | DecodedSolanaRule;
|
|
239
|
+
export type Spent = {
|
|
240
|
+
kind: 'native';
|
|
241
|
+
valueSpent: bigint;
|
|
242
|
+
amountSpent: bigint;
|
|
243
|
+
callsUsed: number;
|
|
244
|
+
} | {
|
|
245
|
+
kind: 'native';
|
|
246
|
+
actions: {
|
|
247
|
+
target: AgenticAddress;
|
|
248
|
+
selector: Selector | 'value-only';
|
|
249
|
+
valueSpent: bigint;
|
|
250
|
+
amountSpent: bigint;
|
|
251
|
+
callsUsed: number;
|
|
252
|
+
}[];
|
|
253
|
+
} | {
|
|
254
|
+
kind: 'universal';
|
|
255
|
+
assets: {
|
|
256
|
+
token: string;
|
|
257
|
+
spent: bigint;
|
|
258
|
+
}[];
|
|
259
|
+
};
|
|
260
|
+
export interface RulesRecord extends Omit<InternalRulesRecord, 'rule'> {
|
|
261
|
+
rule: RuleInput;
|
|
262
|
+
spent: Spent;
|
|
263
|
+
}
|
|
264
|
+
export interface InternalCreateOptions {
|
|
265
|
+
rules: InternalRule[];
|
|
266
|
+
progressHook?: AgenticProgressHook;
|
|
267
|
+
}
|
|
268
|
+
export interface CreateOptions {
|
|
269
|
+
rules: RuleInput[];
|
|
270
|
+
progressHook?: AgenticProgressHook;
|
|
271
|
+
}
|
|
272
|
+
export interface CreateResult {
|
|
273
|
+
wallet: AgenticAddress;
|
|
274
|
+
index: number;
|
|
275
|
+
rulesIds: AgenticHex[];
|
|
276
|
+
tx: UniversalTxResponse;
|
|
277
|
+
}
|
|
278
|
+
export interface WalletSummary {
|
|
279
|
+
address: AgenticAddress;
|
|
280
|
+
index: number;
|
|
281
|
+
label: string;
|
|
282
|
+
deployed: boolean;
|
|
283
|
+
rulesCount: number;
|
|
284
|
+
}
|
|
285
|
+
export interface WalletInfo {
|
|
286
|
+
address: AgenticAddress;
|
|
287
|
+
label: string;
|
|
288
|
+
index: number;
|
|
289
|
+
owner: AgenticAddress;
|
|
290
|
+
deployed: boolean;
|
|
291
|
+
rulesCount: number;
|
|
292
|
+
}
|
|
293
|
+
export type CheckpointKind = 'OWNER_ACTION' | 'RULES_GRANTED' | 'RULES_REVOKED';
|
|
294
|
+
export interface Checkpoint {
|
|
295
|
+
seq: number;
|
|
296
|
+
kind: CheckpointKind;
|
|
297
|
+
ref: AgenticHex;
|
|
298
|
+
blockNumber: bigint;
|
|
299
|
+
txHash: AgenticHex;
|
|
300
|
+
}
|
|
301
|
+
export interface AgenticWallet {
|
|
302
|
+
address: AgenticAddress;
|
|
303
|
+
info(): Promise<WalletInfo>;
|
|
304
|
+
owner(): Promise<{
|
|
305
|
+
owner: AgenticAddress;
|
|
306
|
+
}>;
|
|
307
|
+
/** Owner-only rename, at most 64 UTF-8 bytes. Empty resets the default label. */
|
|
308
|
+
setLabel(label: string, opts?: {
|
|
309
|
+
progressHook?: AgenticProgressHook;
|
|
310
|
+
}): Promise<UniversalTxResponse>;
|
|
311
|
+
checkpoints(opts?: {
|
|
312
|
+
sinceBlock?: bigint;
|
|
313
|
+
}): Promise<{
|
|
314
|
+
checkpoints: Checkpoint[];
|
|
315
|
+
}>;
|
|
316
|
+
rules: {
|
|
317
|
+
/** Enabled rules only; expired-but-enabled rules remain visible. Includes policy spend counters. */
|
|
318
|
+
list(): Promise<{
|
|
319
|
+
rules: RulesRecord[];
|
|
320
|
+
}>;
|
|
321
|
+
/** Unknown and revoked IDs both return RULE_NOT_FOUND; v1 has no historical records. */
|
|
322
|
+
get(rulesId: AgenticHex): Promise<RulesRecord>;
|
|
323
|
+
add(rules: RuleInput[], opts?: {
|
|
324
|
+
progressHook?: AgenticProgressHook;
|
|
325
|
+
}): Promise<{
|
|
326
|
+
rulesIds: AgenticHex[];
|
|
327
|
+
tx: UniversalTxResponse;
|
|
328
|
+
}>;
|
|
329
|
+
update(params: {
|
|
330
|
+
rules: {
|
|
331
|
+
rulesId: AgenticHex;
|
|
332
|
+
rule: RuleInput;
|
|
333
|
+
}[];
|
|
334
|
+
progressHook?: AgenticProgressHook;
|
|
335
|
+
}): Promise<{
|
|
336
|
+
rules: {
|
|
337
|
+
rulesId: AgenticHex;
|
|
338
|
+
replaced: AgenticHex;
|
|
339
|
+
}[];
|
|
340
|
+
tx: UniversalTxResponse;
|
|
341
|
+
}>;
|
|
342
|
+
delete(rulesIds: AgenticHex[], opts?: {
|
|
343
|
+
progressHook?: AgenticProgressHook;
|
|
344
|
+
}): Promise<UniversalTxResponse>;
|
|
345
|
+
delete(params: {
|
|
346
|
+
all: true;
|
|
347
|
+
progressHook?: AgenticProgressHook;
|
|
348
|
+
}): Promise<UniversalTxResponse>;
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
export interface AgenticNamespace {
|
|
352
|
+
derive(opts?: {
|
|
353
|
+
index?: number;
|
|
354
|
+
}): Promise<{
|
|
355
|
+
address: AgenticAddress;
|
|
356
|
+
index: number;
|
|
357
|
+
deployed: boolean;
|
|
358
|
+
}>;
|
|
359
|
+
create(label: string, options: CreateOptions): Promise<CreateResult>;
|
|
360
|
+
list(): Promise<{
|
|
361
|
+
wallets: WalletSummary[];
|
|
362
|
+
}>;
|
|
363
|
+
wallet(address: AgenticAddress): AgenticWallet;
|
|
364
|
+
}
|
|
365
|
+
/** Door the client uses in agenticWallet mode. */
|
|
366
|
+
export type AgenticDoor = 'owner' | 'agent';
|
|
367
|
+
/** AGW metadata attached to responses produced by an agentic client. */
|
|
368
|
+
export interface AgenticTxMetadata {
|
|
369
|
+
wallet: AgenticAddress;
|
|
370
|
+
door: AgenticDoor;
|
|
371
|
+
/** Rule selected for an agent-door send. */
|
|
372
|
+
rulesId?: AgenticHex;
|
|
373
|
+
/** Destination CAIP-2 chain for the selected rule / outbound. */
|
|
374
|
+
chainNamespace?: string;
|
|
375
|
+
/** The wallet's destination account (CEA) for an outbound. */
|
|
376
|
+
destinationAccount?: AgenticAddress;
|
|
377
|
+
/**
|
|
378
|
+
* Ordered calls encoded for the destination CEA. Outbound response
|
|
379
|
+
* to/data/value summarize the first call, including an SDK-generated token
|
|
380
|
+
* transfer. Replay uses the same representation; it cannot recover which
|
|
381
|
+
* calls were supplied explicitly versus generated from funds.
|
|
382
|
+
*/
|
|
383
|
+
destinationCalls?: readonly {
|
|
384
|
+
to: AgenticAddress;
|
|
385
|
+
data: AgenticHex;
|
|
386
|
+
value: bigint;
|
|
387
|
+
}[];
|
|
388
|
+
/** SVM instruction executed by the wallet's destination CEA. */
|
|
389
|
+
destinationInstruction?: {
|
|
390
|
+
program: AgenticHex;
|
|
391
|
+
data: AgenticHex;
|
|
392
|
+
accounts: readonly {
|
|
393
|
+
pubkey: AgenticHex;
|
|
394
|
+
isWritable: boolean;
|
|
395
|
+
}[];
|
|
396
|
+
};
|
|
397
|
+
/** Funds-only Solana transfer. token is the burned PRC20 on Push. */
|
|
398
|
+
destinationTransfer?: {
|
|
399
|
+
recipient: AgenticHex;
|
|
400
|
+
token: AgenticAddress;
|
|
401
|
+
amount: bigint;
|
|
402
|
+
};
|
|
403
|
+
/** Ordered actions in a native agent batch; to/data/value summarize its first action. */
|
|
404
|
+
nativeCalls?: readonly {
|
|
405
|
+
to: AgenticAddress;
|
|
406
|
+
data: AgenticHex;
|
|
407
|
+
value: bigint;
|
|
408
|
+
}[];
|
|
409
|
+
/** Account the signer's transaction actually called (wallet or outer sender account). */
|
|
410
|
+
rawTo: string;
|
|
411
|
+
/** Calldata the signer's transaction actually carried. */
|
|
412
|
+
rawData: string;
|
|
413
|
+
}
|
|
414
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal capability flags for an AGW contract generation. A method whose
|
|
3
|
+
* capability is absent fails before any signature. Each unresolved target
|
|
4
|
+
* feature identifies the contract or product capability that must be verified
|
|
5
|
+
* before it can be advertised.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum AgenticCapability {
|
|
8
|
+
/** Factory derive/list/deploy and wallet owner/info reads. */
|
|
9
|
+
WALLET_READS = "walletReads",
|
|
10
|
+
/** Active (enabled) rule enumeration and native-rule decoding. */
|
|
11
|
+
ACTIVE_RULE_READS = "activeRuleReads",
|
|
12
|
+
/** Owner door: execute(mode, executionCalldata). */
|
|
13
|
+
OWNER_EXECUTE = "ownerExecute",
|
|
14
|
+
/** Agent door: executeAsAgent(rulesId, mode, executionCalldata). */
|
|
15
|
+
AGENT_EXECUTE = "agentExecute",
|
|
16
|
+
/** Native (Push-chain) rule grants with NativeTerms encoding. */
|
|
17
|
+
NATIVE_RULES = "nativeRules",
|
|
18
|
+
/** Exact-equality native spend assertion used by rules.update. */
|
|
19
|
+
ASSERT_SPENT_NATIVE = "assertSpentNative",
|
|
20
|
+
/** checkpointCount + Checkpointed events. */
|
|
21
|
+
CHECKPOINTS = "checkpoints",
|
|
22
|
+
/** Agent-door EVM outbound composition against v6 per-token caps. */
|
|
23
|
+
UNIVERSAL_EVM_OUTBOUND = "universalEvmOutbound",
|
|
24
|
+
/** Target UniversalRule (assets[] / maxGasPerCall) encode/decode. A05/A07. */
|
|
25
|
+
UNIVERSAL_EVM_RULES = "universalEvmRules",
|
|
26
|
+
/** Per-token expected-spend assertion for universal replacement. A05. */
|
|
27
|
+
ASSERT_SPENT_UNIVERSAL_MULTI = "assertSpentUniversalMulti",
|
|
28
|
+
/** Numeric-pin Solana authoring, exact decoded reads and instruction execution. */
|
|
29
|
+
UNIVERSAL_SVM_RULES = "universalSvmRules",
|
|
30
|
+
/** Editable wallet label (setLabel / LabelSet). A07. */
|
|
31
|
+
SET_LABEL = "setLabel"
|
|
32
|
+
}
|
|
33
|
+
/** Why each target capability is unavailable when a generation lacks it. */
|
|
34
|
+
export declare const CAPABILITY_DEPENDENCY: Record<AgenticCapability, string>;
|
|
35
|
+
export declare function hasCapability(capabilities: ReadonlySet<AgenticCapability>, capability: AgenticCapability): boolean;
|
|
36
|
+
/** Throws CAPABILITY_UNAVAILABLE (before signing) when the flag is absent. */
|
|
37
|
+
export declare function requireCapability(capabilities: ReadonlySet<AgenticCapability> | undefined, capability: AgenticCapability): void;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CAPABILITY_DEPENDENCY = exports.AgenticCapability = void 0;
|
|
4
|
+
exports.hasCapability = hasCapability;
|
|
5
|
+
exports.requireCapability = requireCapability;
|
|
6
|
+
const errors_1 = require("./errors");
|
|
7
|
+
/**
|
|
8
|
+
* Internal capability flags for an AGW contract generation. A method whose
|
|
9
|
+
* capability is absent fails before any signature. Each unresolved target
|
|
10
|
+
* feature identifies the contract or product capability that must be verified
|
|
11
|
+
* before it can be advertised.
|
|
12
|
+
*/
|
|
13
|
+
var AgenticCapability;
|
|
14
|
+
(function (AgenticCapability) {
|
|
15
|
+
/** Factory derive/list/deploy and wallet owner/info reads. */
|
|
16
|
+
AgenticCapability["WALLET_READS"] = "walletReads";
|
|
17
|
+
/** Active (enabled) rule enumeration and native-rule decoding. */
|
|
18
|
+
AgenticCapability["ACTIVE_RULE_READS"] = "activeRuleReads";
|
|
19
|
+
/** Owner door: execute(mode, executionCalldata). */
|
|
20
|
+
AgenticCapability["OWNER_EXECUTE"] = "ownerExecute";
|
|
21
|
+
/** Agent door: executeAsAgent(rulesId, mode, executionCalldata). */
|
|
22
|
+
AgenticCapability["AGENT_EXECUTE"] = "agentExecute";
|
|
23
|
+
/** Native (Push-chain) rule grants with NativeTerms encoding. */
|
|
24
|
+
AgenticCapability["NATIVE_RULES"] = "nativeRules";
|
|
25
|
+
/** Exact-equality native spend assertion used by rules.update. */
|
|
26
|
+
AgenticCapability["ASSERT_SPENT_NATIVE"] = "assertSpentNative";
|
|
27
|
+
/** checkpointCount + Checkpointed events. */
|
|
28
|
+
AgenticCapability["CHECKPOINTS"] = "checkpoints";
|
|
29
|
+
/** Agent-door EVM outbound composition against v6 per-token caps. */
|
|
30
|
+
AgenticCapability["UNIVERSAL_EVM_OUTBOUND"] = "universalEvmOutbound";
|
|
31
|
+
/** Target UniversalRule (assets[] / maxGasPerCall) encode/decode. A05/A07. */
|
|
32
|
+
AgenticCapability["UNIVERSAL_EVM_RULES"] = "universalEvmRules";
|
|
33
|
+
/** Per-token expected-spend assertion for universal replacement. A05. */
|
|
34
|
+
AgenticCapability["ASSERT_SPENT_UNIVERSAL_MULTI"] = "assertSpentUniversalMulti";
|
|
35
|
+
/** Numeric-pin Solana authoring, exact decoded reads and instruction execution. */
|
|
36
|
+
AgenticCapability["UNIVERSAL_SVM_RULES"] = "universalSvmRules";
|
|
37
|
+
/** Editable wallet label (setLabel / LabelSet). A07. */
|
|
38
|
+
AgenticCapability["SET_LABEL"] = "setLabel";
|
|
39
|
+
})(AgenticCapability || (exports.AgenticCapability = AgenticCapability = {}));
|
|
40
|
+
/** Why each target capability is unavailable when a generation lacks it. */
|
|
41
|
+
exports.CAPABILITY_DEPENDENCY = {
|
|
42
|
+
[AgenticCapability.WALLET_READS]: 'no verified AGW deployment for this network (A07)',
|
|
43
|
+
[AgenticCapability.ACTIVE_RULE_READS]: 'no verified AGW deployment for this network (A07)',
|
|
44
|
+
[AgenticCapability.OWNER_EXECUTE]: 'no verified AGW deployment for this network (A07)',
|
|
45
|
+
[AgenticCapability.AGENT_EXECUTE]: 'no verified AGW deployment for this network (A07)',
|
|
46
|
+
[AgenticCapability.NATIVE_RULES]: 'no verified AGW deployment for this network (A07)',
|
|
47
|
+
[AgenticCapability.ASSERT_SPENT_NATIVE]: 'no verified AGW deployment for this network (A07)',
|
|
48
|
+
[AgenticCapability.CHECKPOINTS]: 'no verified AGW deployment for this network (A07)',
|
|
49
|
+
[AgenticCapability.UNIVERSAL_EVM_OUTBOUND]: 'the selected generation has no verified multi-asset outbound token resolution (A05/A07)',
|
|
50
|
+
[AgenticCapability.UNIVERSAL_EVM_RULES]: 'EVM universal rules are unavailable for the selected SDK configuration',
|
|
51
|
+
[AgenticCapability.ASSERT_SPENT_UNIVERSAL_MULTI]: 'universal expected-spend assertions are unavailable for this configuration',
|
|
52
|
+
[AgenticCapability.UNIVERSAL_SVM_RULES]: 'SVM rules are unavailable for this generation',
|
|
53
|
+
[AgenticCapability.SET_LABEL]: 'the selected generation has no editable label (A07; labels are deploy-time only)',
|
|
54
|
+
};
|
|
55
|
+
function hasCapability(capabilities, capability) {
|
|
56
|
+
return capabilities.has(capability);
|
|
57
|
+
}
|
|
58
|
+
/** Throws CAPABILITY_UNAVAILABLE (before signing) when the flag is absent. */
|
|
59
|
+
function requireCapability(capabilities, capability) {
|
|
60
|
+
if (!capabilities || !capabilities.has(capability)) {
|
|
61
|
+
throw (0, errors_1.capabilityUnavailable)(capability, exports.CAPABILITY_DEPENDENCY[capability]);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=capabilities.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pushChainNamespaceFor = pushChainNamespaceFor;
|
|
4
|
+
const chain_1 = require("../constants/chain");
|
|
5
|
+
const enums_1 = require("../constants/enums");
|
|
6
|
+
/** 'eip155:<id>' of the Push chain for a network — the native rule chain. */
|
|
7
|
+
function pushChainNamespaceFor(network) {
|
|
8
|
+
const chain = network === enums_1.PUSH_NETWORK.MAINNET
|
|
9
|
+
? enums_1.CHAIN.PUSH_MAINNET
|
|
10
|
+
: network === enums_1.PUSH_NETWORK.TESTNET_DONUT || network === enums_1.PUSH_NETWORK.TESTNET
|
|
11
|
+
? enums_1.CHAIN.PUSH_TESTNET_DONUT
|
|
12
|
+
: enums_1.CHAIN.PUSH_LOCALNET;
|
|
13
|
+
return `eip155:${chain_1.CHAIN_INFO[chain].chainId}`;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=chain.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type AbiParameter } from 'viem';
|
|
2
|
+
import type { AgenticHex } from '../agentic.types';
|
|
3
|
+
export declare function isDynamic(p: AbiParameter): boolean;
|
|
4
|
+
/** Bytes this parameter occupies in the head of an encoding. */
|
|
5
|
+
export declare function headSize(p: AbiParameter): number;
|
|
6
|
+
export declare function isSingleWordStatic(p: AbiParameter): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Absolute calldata byte offset (selector included) of argument `arg`.
|
|
9
|
+
* Rejects out-of-range indexes and any argument that is not one static word.
|
|
10
|
+
*/
|
|
11
|
+
export declare function argumentOffset(inputs: readonly AbiParameter[] | undefined, arg: number, what: string): number;
|
|
12
|
+
/** Encode a pin's expected value as the exact 32-byte calldata word. */
|
|
13
|
+
export declare function encodeArgWord(param: AbiParameter, expected: AgenticHex | bigint | string | boolean, what: string): AgenticHex;
|
|
14
|
+
/** Validate a raw calldata offset given directly (offset form). */
|
|
15
|
+
export declare function rawOffset(offset: number, what: string): number;
|
|
16
|
+
/** Absolute location of a scalar reached through static tuple/fixed-array indexes. */
|
|
17
|
+
export declare function argumentLocation(inputs: readonly AbiParameter[] | undefined, arg: number | readonly number[], what: string): {
|
|
18
|
+
offset: number;
|
|
19
|
+
param: AbiParameter;
|
|
20
|
+
};
|