@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
package/AGW.md
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# Agentic wallets on Push Chain
|
|
2
|
+
|
|
3
|
+
This branch implements the SDK-only October 12 feedback against the deployed Donut v6 contracts. The runtime targets v6 only; existing v5 wallets are not silently adapted.
|
|
4
|
+
|
|
5
|
+
## Connect
|
|
6
|
+
|
|
7
|
+
Use an application-managed key; examples do not load secrets or execute automatically.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import {
|
|
11
|
+
PushChain,
|
|
12
|
+
AgenticError,
|
|
13
|
+
type Rule,
|
|
14
|
+
} from '@pushchain/core';
|
|
15
|
+
import {
|
|
16
|
+
createWalletClient,
|
|
17
|
+
http,
|
|
18
|
+
parseEther,
|
|
19
|
+
encodeFunctionData,
|
|
20
|
+
erc20Abi,
|
|
21
|
+
type Address,
|
|
22
|
+
type Hex,
|
|
23
|
+
} from 'viem';
|
|
24
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
25
|
+
|
|
26
|
+
type WalletTransaction = Awaited<ReturnType<PushChain['universal']['sendTransaction']>>;
|
|
27
|
+
|
|
28
|
+
const NETWORK = PushChain.CONSTANTS.PUSH_NETWORK.TESTNET_DONUT;
|
|
29
|
+
const PUSH = PushChain.CONSTANTS.CHAIN.PUSH_TESTNET_DONUT;
|
|
30
|
+
const SEPOLIA = PushChain.CONSTANTS.CHAIN.ETHEREUM_SEPOLIA;
|
|
31
|
+
const ETH = PushChain.CONSTANTS.MOVEABLE.TOKEN.ETHEREUM_SEPOLIA.ETH;
|
|
32
|
+
|
|
33
|
+
async function connectPush(key: Hex, wallet?: Address): Promise<PushChain> {
|
|
34
|
+
const walletClient = createWalletClient({
|
|
35
|
+
account: privateKeyToAccount(key),
|
|
36
|
+
transport: http('https://evm.donut.rpc.push.org/'),
|
|
37
|
+
});
|
|
38
|
+
const signer = await PushChain.utils.signer.toUniversalFromKeypair(
|
|
39
|
+
walletClient,
|
|
40
|
+
{ chain: PUSH, library: PushChain.CONSTANTS.LIBRARY.ETHEREUM_VIEM },
|
|
41
|
+
);
|
|
42
|
+
return PushChain.initialize(signer, {
|
|
43
|
+
network: NETWORK,
|
|
44
|
+
...(wallet ? { agenticWallet: wallet } : {}),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Create and manage rules
|
|
50
|
+
|
|
51
|
+
Every chain uses `Rule.allowedCalls`. Omit `chainNamespace` for Push. The agent is always its Push address: a native EOA or an external signer's UEA. The owner cannot be its own agent.
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
async function createNative(owner: PushChain, agent: Address, token: Address, recipient: Address) {
|
|
55
|
+
const rule: Rule = {
|
|
56
|
+
agent,
|
|
57
|
+
validUntil: Math.floor(Date.now() / 1000) + 3600,
|
|
58
|
+
allowedCalls: [{
|
|
59
|
+
target: token,
|
|
60
|
+
selector: 'transfer(address,uint256)',
|
|
61
|
+
pins: [{ arg: 0, expected: recipient }, { arg: 1, max: 10n }],
|
|
62
|
+
}],
|
|
63
|
+
};
|
|
64
|
+
return owner.agentic.create('operations', { rules: [rule] });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function manage(owner: PushChain, address: Address, id: Hex) {
|
|
68
|
+
const wallet = owner.agentic.wallet(address);
|
|
69
|
+
const record = await wallet.rules.get(id);
|
|
70
|
+
// Reads preserve the constraints needed by update.
|
|
71
|
+
const changed = await wallet.rules.update({
|
|
72
|
+
rules: [{ rulesId: id, rule: { ...record.rule, validUntil: record.validUntil + 3600 } }],
|
|
73
|
+
});
|
|
74
|
+
await wallet.setLabel('renamed'); // direct cosmetic write; no checkpoint
|
|
75
|
+
await wallet.rules.delete([changed.rules[0].rulesId]);
|
|
76
|
+
// Delete all requires an explicit target:
|
|
77
|
+
// await wallet.rules.delete({ all: true });
|
|
78
|
+
return wallet.info();
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`derive({ index? })` returns the predicted address, index and deployment state. `list()` enumerates the connected owner's wallets. A wallet handle provides `info`, `owner`, `checkpoints`, `setLabel`, and `rules.list/get/add/update/delete`. Deleted rules are not returned in v1. Rule IDs may change during update.
|
|
83
|
+
|
|
84
|
+
`create` and `rules.add` reject a duplicate agent/chain pair with `DUPLICATE_RULE`. Put several permitted calls in the same rule. Existing overlapping grants can still cause `AMBIGUOUS_RULE` when sending; the owner must resolve the overlap. The contract validates every actual agent call.
|
|
85
|
+
|
|
86
|
+
On deployed v6, native rules allow at most **eight** calls, eight equality/maximum pins per call. Public native lifetime budgets, `maxCalls`, `amount`, single-call shorthand and `actions[]` are retired. Native value and call counters accumulate for reporting and atomic updates. A v6 MAX pin only bounds an individual call and does not increment amountSpent; that counter belongs to the separate internal amount meter.
|
|
87
|
+
|
|
88
|
+
## Pins and zero defaults
|
|
89
|
+
|
|
90
|
+
An equality pin fixes an argument; a maximum pin bounds it. For EVM signatures, `arg` is a zero-based static argument position. With a raw four-byte selector, it is a 32-byte ABI head-word position. Reads return a raw selector and these word positions. For full signatures, a path such as `arg: [0, 3]` selects a field within a static tuple or fixed array. Dynamic layouts fail explicitly. Reads retain exact word positions rather than guessing missing ABI metadata.
|
|
91
|
+
|
|
92
|
+
`PushChain.CONSTANTS.AGENTIC.WALLET` resolves to the AGW on Push, its CEA on an EVM destination, or its CEA/selected token ATA on Solana. Deployment addresses and encoding helpers are internal.
|
|
93
|
+
|
|
94
|
+
Omitted `maxValue`, `assets[].maxTotal`, and `maxGasPerCall` default to **zero**, which permits no corresponding movement. Specify positive caps for sends that need value, tokens or destination gas. Native value is limited per call; there is no public native lifetime-total cap.
|
|
95
|
+
|
|
96
|
+
## EVM destinations
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
function evmRule(agent: Address, target: Address): Rule {
|
|
100
|
+
return {
|
|
101
|
+
agent,
|
|
102
|
+
chainNamespace: SEPOLIA,
|
|
103
|
+
validUntil: Math.floor(Date.now() / 1000) + 3600,
|
|
104
|
+
assets: [{ token: ETH, maxPerCall: 1_000n, maxTotal: 10_000n }],
|
|
105
|
+
maxGasPerCall: parseEther('20'),
|
|
106
|
+
allowedCalls: [{
|
|
107
|
+
target,
|
|
108
|
+
selector: 'deposit(address,uint256)',
|
|
109
|
+
pins: [{ arg: 0, expected: PushChain.CONSTANTS.AGENTIC.WALLET }],
|
|
110
|
+
}],
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The deployed v6 policy supports up to eight EQ/MAX pins per EVM destination call and 32 across the rule. Multiple entries for the same target/function are alternatives; every constraint in one entry must pass. The SDK rejects a bare alternative beside a pinned one because it would bypass the pins.
|
|
116
|
+
|
|
117
|
+
When the caller omits destination `gasLimit`, a fresh EVM CEA gets a 2,000,000 gas default to cover first-use deployment. An existing CEA uses the normal quote default. An explicit caller value is preserved. The rule's gas/value caps still apply.
|
|
118
|
+
|
|
119
|
+
## Solana destinations
|
|
120
|
+
|
|
121
|
+
Rules use fixed-width signatures and numeric positions, without an IDL:
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
function solanaRule(agent: Address, program: string): Rule {
|
|
125
|
+
return {
|
|
126
|
+
agent,
|
|
127
|
+
chainNamespace: PushChain.CONSTANTS.CHAIN.SOLANA_DEVNET,
|
|
128
|
+
validUntil: Math.floor(Date.now() / 1000) + 3600,
|
|
129
|
+
maxGasPerCall: parseEther('20'),
|
|
130
|
+
allowedCalls: [{
|
|
131
|
+
target: program,
|
|
132
|
+
selector: 'receive_sol(u64)',
|
|
133
|
+
pins: [
|
|
134
|
+
{ account: 2, expected: PushChain.CONSTANTS.AGENTIC.WALLET },
|
|
135
|
+
{ arg: 0, max: 1_000n },
|
|
136
|
+
],
|
|
137
|
+
}],
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Use the program's actual account positions. `{ account, expected: WALLET, token: mint }` pins the wallet's ATA, using the verified mint/token-program context. Fixed integer, bool, pubkey and fixed-array layouts are supported; dynamic or undefined layouts fail before signing. Raw eight-byte discriminators support account pins; argument pins also need argument types. A nonzero per-call EVM `maxValue` has no Solana encoding.
|
|
143
|
+
|
|
144
|
+
Solana reads return `format: 'decoded'` with exact stored discriminators, offsets and constraints. This raw form is accepted by `rules.update`, preserving restrictions without inventing an IDL. Reusing it for another wallet/gateway is rejected. Send-data encoding still uses the existing `utils.helpers.encodeTxData` IDL helper; rule authoring and transaction encoding are separate operations.
|
|
145
|
+
|
|
146
|
+
## Spend, checkpoints and execution
|
|
147
|
+
|
|
148
|
+
`rules.get/list` return `spent`. Universal spend contains one entry per asset in stored order. A single native call has scalar value/amount/call counters. Several native calls return `spent.actions`, with each entry identified by target and selector; unrelated token amounts are not summed.
|
|
149
|
+
|
|
150
|
+
Native historical terms with lifetime limits or differing per-action expiries that the new public shape cannot preserve return an explicit capability error rather than silently dropping restrictions.
|
|
151
|
+
|
|
152
|
+
Connect with `PushChain.initialize(signer, { agenticWallet: address })` to send from the wallet. Signer identity determines the owner or agent door. Native agent arrays are atomic and every call passes policy checks. `from` cannot be overridden. Responses identify the wallet as `from` and signer as `origin`, including wait/replay results.
|
|
153
|
+
|
|
154
|
+
Updates assert existing spend, delete the old rule and grant its replacement atomically. Native updates assert each action separately: a rule with N native actions records N+4 checkpoints on current v5. Agent execution records no owner checkpoint. Direct `setLabel` records none.
|
|
155
|
+
|
|
156
|
+
## V6 deployment and creation
|
|
157
|
+
|
|
158
|
+
The runtime uses factory `0xFBBEB6a365178fAaA81A9789a5f64b300c37e5bc` and URP `0xBA32e7A1500cb34311a31127bcD40CA52C8CFd36`, from source `ffd567d`. URP still reports 3.1.0; verified deployment wiring and the v6 ABI identify the supported generation.
|
|
159
|
+
|
|
160
|
+
`create` uses one index-bound `createWalletWithSig` call from the owner's Push identity, with the contract's owner-caller empty-signature path. The wallet and up to eight initial rules are committed atomically. A concurrent slot change returns INDEX_RACE; a receipt-read failure retains the submitted hash for recovery. CREATE_PARTIAL is removed. No sequential creation fallback exists.
|
|
161
|
+
|
|
162
|
+
For outbound sends on either door, the wallet approves the gateway inside the transaction after policy authorization, executes the outbound, and clears remaining allowance. No separate approval or SDK allowance check is needed; GATEWAY_ALLOWANCE_INSUFFICIENT is removed. Approval/cleanup uses the contract's best-effort token calls. To stop an agent, delete its rules; clearing the gateway allowance does not disable an otherwise valid rule.
|
|
163
|
+
|
|
164
|
+
The wire encoder uses uint32 maximum for unlimited native calls and 255 for unspecified Solana account count. Neither uses the retired zero sentinel. The envelope remains version 1. Existing v5 wallets and addresses do not become v6 wallets.
|
|
165
|
+
|
|
166
|
+
`rules.delete` is the public name; on-chain `revokeRules` names/events remain unchanged. Revert errors retain decoded details and cause. Core transaction response fields used by other SDK routes are not globally removed.
|
|
167
|
+
|
|
168
|
+
## Preset discovery and templates (section 7)
|
|
169
|
+
|
|
170
|
+
`PushChain.utils.agentic` contains `presets.list/get`. The categories are `AGENTIC.PRESETS.CATEGORY.DEXES`, `LENDING`, `STAKING` and `PREDICTION`. The catalog includes mainnet and testnet templates. Discovery is network-independent: pass `chainNamespace` to select the intended chain. A mainnet template does not imply that the connected Push network supports execution to it:
|
|
171
|
+
|
|
172
|
+
- DEXES: Uniswap V3 on Ethereum, Base and Arbitrum (mainnet and their Sepolia testnets); PancakeSwap V3 on BNB mainnet and BSC testnet.
|
|
173
|
+
- LENDING: Aave on Ethereum, Base, Arbitrum and BNB mainnets, plus Sepolia/Base Sepolia/Arbitrum Sepolia; Moonwell on Base mainnet/testnet and Venus on BNB mainnet/testnet.
|
|
174
|
+
- STAKING: EigenLayer deposits on Ethereum mainnet and Sepolia (EigenLayer withdrawals excluded); Lido stake, wrap/unwrap and withdrawal requests/claims on Ethereum mainnet. Lido ETH staking defaults to `maxValue: 0`; explicitly set a value cap before use.
|
|
175
|
+
- PREDICTION: no entries yet. Hide categories with empty `chains` lists.
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
const { presets } = PushChain.utils.agentic.presets.list({ type: 'CATEGORY' });
|
|
179
|
+
const availablePresets = presets.filter(preset => preset.chains.length > 0);
|
|
180
|
+
const { rules: reviewTemplates } = PushChain.utils.agentic.presets.get(
|
|
181
|
+
PushChain.CONSTANTS.AGENTIC.PRESETS.CATEGORY.DEXES,
|
|
182
|
+
);
|
|
183
|
+
// Choose tokens in the review UI, then call get again as below.
|
|
184
|
+
|
|
185
|
+
function filledPreset(agent: Address, tokenIn: Address, tokenOut: Address) {
|
|
186
|
+
return PushChain.utils.agentic.presets.get(
|
|
187
|
+
PushChain.CONSTANTS.AGENTIC.PRESETS.CATEGORY.DEXES,
|
|
188
|
+
{
|
|
189
|
+
chainNamespace: 'eip155:11155111',
|
|
190
|
+
agent,
|
|
191
|
+
validUntil: Math.floor(Date.now() / 1000) + 3600,
|
|
192
|
+
maxGasPerCall: BigInt(10) ** BigInt(18),
|
|
193
|
+
assets: [
|
|
194
|
+
{ token: tokenIn, maxPerCall: BigInt(100), maxTotal: BigInt(1000) },
|
|
195
|
+
{ token: tokenOut, maxPerCall: BigInt(100), maxTotal: BigInt(1000) },
|
|
196
|
+
],
|
|
197
|
+
},
|
|
198
|
+
).rules;
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
The example caps are illustrative raw units; choose caps for the actual token decimals and gas requirements. `get` groups calls into one rule per chain. With agent and expiry supplied, its return type is `Rule[]`; otherwise it is `PresetRuleTemplate[]`, requiring those fields before `create`. Assets must name their chain unless a single chain filter is supplied. Omitted asset caps and `maxGasPerCall` default to zero.
|
|
203
|
+
|
|
204
|
+
DEX discovery works without options, with an empty asset list, or with assets for only some chains. A chain with fewer than two tokens returns full-signature review calls with wallet-recipient pins and an explicit zero input-amount maximum. A single supplied token is also pinned as the input. These calls cannot spend swap input tokens, even if asset budgets are filled later. Call `get` again after selecting both tokens to replace the review calls with the complete token-pinned rules; merely assigning `rule.assets` is insufficient.
|
|
205
|
+
|
|
206
|
+
With two ERC20 tokens, `get` expands ordered pairs into exact-input and exact-output calls with token, wallet-recipient and input-amount pins. Native markers and expansions exceeding the policy's 32-pin limit are rejected. Two tokens fit the shipped router template; three do not. Static tuple fields use paths such as `[0, 3]`.
|
|
207
|
+
|
|
208
|
+
Reviewed EVM spenders generate approvals pinned to that spender and bounded by the asset's per-call cap. Money-market approvals are restricted to the market's underlying token. Distinct spenders become separate pinned alternatives under v6. These destination approvals are ordinary ERC20 allowances; the wallet's automatic Push-side gateway approval is separate.
|
|
209
|
+
|
|
210
|
+
Templates describe permissions, not available liquidity or guaranteed execution. Verify destination token balances, supported reserves and source PRC20 routes before use: protocol testnet mock tokens may differ from MOVEABLE tokens. Presets do not sign, fetch app ABIs or modify wallets. Dynamic-path swaps, Solana protocol templates and unconfirmed deployments are excluded. Mainnet addresses were checked read-only; no mainnet transactions were executed. Other mainnet protocols in the proposal remain excluded until their deployment and permission constraints are verified. Local policy tests do not execute the destination protocols.
|
|
211
|
+
|
|
212
|
+
## Validation
|
|
213
|
+
|
|
214
|
+
Run `node packages/core/scripts/check-agw-docs.js` to typecheck these examples. Unit tests use the normal core Jest configuration. `jest.agw-local.config.ts` uses pinned real AGW contracts and a stub gateway. Live E2Es are opt-in under `__e2e__/agw`; preflight verifies the deployment and funding limits. Local tests do not prove destination delivery, and historical live results do not count as validation of a changed public API.
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
### Live preset acceptance
|
|
218
|
+
|
|
219
|
+
The opt-in `agw-presets` E2E group exercises real Donut-to-Sepolia protocol calls. From `packages/core`, run `npm run e2e:preflight -- --group agw-presets --dry-run`, then `npm run e2e:ci -- --group agw-presets`. It uses the existing E2E credentials in memory. Each scenario funds a fresh wallet with at most 65 PC plus a fresh agent's configured gas allocation; the Uniswap case also uses 0.000002 pETH. No mainnet transaction is part of this group.
|
|
220
|
+
|
|
221
|
+
Uniswap uses destination WETH/Circle USDC; Aave uses its faucet LINK. Their generated preset calls and pins are retained, but bridge `assets` are set to `[]` because these destination tokens are not a supported SDK PRC20 pair. The owner funds the CEA separately. These tests establish swaps and lending against actual protocols, not the ability to bridge arbitrary assets. Missing liquidity, exhausted reserve caps or an unavailable faucet fail as prerequisites rather than silently skipping. Results are specific to Sepolia and do not certify the other catalog chains.
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
The additional opt-in group `agw-presets-expanded` covers EigenLayer deposits on Sepolia; Uniswap swaps on Base/Arbitrum Sepolia; PancakeSwap plus Venus on BNB testnet; and Aave plus Moonwell on Base Sepolia. Use the same preflight/run commands with `--group agw-presets-expanded`. Each scenario funds a fresh wallet with at most 100 PC and checks any required destination-native PRC20 before transfer. Native-wrap cases use 10^12 raw native-token units. These are deposit/swap/redemption checks, not borrow/repay or every-market coverage.
|
|
225
|
+
|
|
226
|
+
AGW token resolution uses the destination chain for ordinary token objects: an explicit Base or Arbitrum ETH token must not select Sepolia's PRC20 merely because its symbol/address is identical. An explicit Push PRC20 reference must name the same source chain as the destination; a mismatch fails before signing.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
@pushchain/core@6.0.27-alpha.1 (2026-10-15)
|
|
2
|
+
|
|
3
|
+
- fix: resolve AGW tokens by destination and expand live coverage
|
|
4
|
+
- feat: add mainnet AGW presets and live protocol coverage
|
|
5
|
+
- fix: return safe AGW preset review templates
|
|
6
|
+
- feat: add verified testnet AGW preset templates
|
|
7
|
+
- feat: migrate AGW SDK to deployed v6 contracts
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
@pushchain/core@6.0.27-alpha.0 (2026-10-12)
|
|
12
|
+
|
|
13
|
+
- feat: align AGW rules and presets with October SDK feedback
|
|
14
|
+
- feat: add AGW v5 wallet and rules SDK
|
|
15
|
+
- test: mirror the restructured Universal Read docs playgrounds
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
1
19
|
@pushchain/core@6.0.26 (2026-09-23)
|
|
2
20
|
|
|
3
21
|
- docs: changelog for read-state docs parity
|
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@ Push Chain is a true universal L1 that is 100% EVM compatible. It allows develop
|
|
|
8
8
|
|
|
9
9
|
## Documentation
|
|
10
10
|
|
|
11
|
+
For AGW v5 in this branch, see the [agentic wallet integration guide](AGW.md) for creation, rules, funding, execution and recovery.
|
|
12
|
+
|
|
11
13
|
For full documentation, API references, and guides, visit:
|
|
12
14
|
👉 [Push Chain Developer Docs](https://push.org/docs)
|
|
13
15
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushchain/core",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.27-alpha.1",
|
|
4
4
|
"homepage": "https://push.org",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pushchain",
|
|
@@ -51,6 +51,11 @@
|
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build:proto": "scripts/protoc-generate.sh",
|
|
54
|
+
"docs:check:agw": "node scripts/check-agw-docs.js",
|
|
55
|
+
"agw:verify": "node scripts/agw-verify.js",
|
|
56
|
+
"agw:check:package": "node scripts/check-agw-package.js",
|
|
57
|
+
"agw:check:api": "node scripts/check-agw-api.js",
|
|
58
|
+
"agw:check:runtimes": "node scripts/check-agw-runtimes.js",
|
|
54
59
|
"e2e:list": "ts-node --transpile-only __e2e__/ci/run.ts --list",
|
|
55
60
|
"e2e:verify": "ts-node --transpile-only __e2e__/ci/run.ts --verify",
|
|
56
61
|
"e2e:preflight": "ts-node --transpile-only __e2e__/ci/preflight.ts",
|
|
@@ -67,6 +72,7 @@
|
|
|
67
72
|
"src/**/*.d.ts",
|
|
68
73
|
"src/**/*.json",
|
|
69
74
|
"README.md",
|
|
75
|
+
"AGW.md",
|
|
70
76
|
"CHANGELOG.md"
|
|
71
77
|
],
|
|
72
78
|
"devDependencies": {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AgenticRuntime } from './runtime';
|
|
2
|
+
import type { AgenticAddress, AgenticNamespace, AgenticWallet, CreateOptions, CreateResult, WalletSummary } from './agentic.types';
|
|
3
|
+
/**
|
|
4
|
+
* client.agentic — owner-side AGW management (spec section 1). Ownership is
|
|
5
|
+
* always the connected signer's Push identity (EOA, or the UEA for its origin
|
|
6
|
+
* chain), never the AGW an agentic client exposes as universal.account.
|
|
7
|
+
*/
|
|
8
|
+
export declare class AgenticNamespaceImpl implements AgenticNamespace {
|
|
9
|
+
private readonly runtime;
|
|
10
|
+
constructor(runtime: AgenticRuntime);
|
|
11
|
+
derive(opts?: {
|
|
12
|
+
index?: number;
|
|
13
|
+
}): Promise<{
|
|
14
|
+
address: AgenticAddress;
|
|
15
|
+
index: number;
|
|
16
|
+
deployed: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
create(label: string, options: CreateOptions): Promise<CreateResult>;
|
|
19
|
+
list(): Promise<{
|
|
20
|
+
wallets: WalletSummary[];
|
|
21
|
+
}>;
|
|
22
|
+
wallet(address: AgenticAddress): AgenticWallet;
|
|
23
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgenticNamespaceImpl = void 0;
|
|
4
|
+
const public_rule_1 = require("./public-rule");
|
|
5
|
+
const capabilities_1 = require("./capabilities");
|
|
6
|
+
const deployments_1 = require("./deployments");
|
|
7
|
+
const create_1 = require("./management/create");
|
|
8
|
+
const common_1 = require("./management/common");
|
|
9
|
+
const wallets_1 = require("./reads/wallets");
|
|
10
|
+
const wallet_1 = require("./wallet");
|
|
11
|
+
const progress_hook_types_1 = require("../progress-hook/progress-hook.types");
|
|
12
|
+
/**
|
|
13
|
+
* client.agentic — owner-side AGW management (spec section 1). Ownership is
|
|
14
|
+
* always the connected signer's Push identity (EOA, or the UEA for its origin
|
|
15
|
+
* chain), never the AGW an agentic client exposes as universal.account.
|
|
16
|
+
*/
|
|
17
|
+
class AgenticNamespaceImpl {
|
|
18
|
+
runtime;
|
|
19
|
+
constructor(runtime) {
|
|
20
|
+
this.runtime = runtime;
|
|
21
|
+
}
|
|
22
|
+
async derive(opts) {
|
|
23
|
+
const gen = (0, deployments_1.currentGeneration)(this.runtime.network);
|
|
24
|
+
(0, capabilities_1.requireCapability)(gen.capabilities, capabilities_1.AgenticCapability.WALLET_READS);
|
|
25
|
+
const owner = this.runtime.signerPushAccount();
|
|
26
|
+
const r = await (0, wallets_1.deriveForOwner)(this.runtime.reader, gen, owner, opts?.index);
|
|
27
|
+
(0, common_1.emitAgentic)(this.runtime, undefined, progress_hook_types_1.PROGRESS_HOOK.AGENTIC_TX_101, r.address, r.index, r.deployed);
|
|
28
|
+
return {
|
|
29
|
+
address: r.address,
|
|
30
|
+
index: r.index,
|
|
31
|
+
deployed: r.deployed,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
async create(label, options) {
|
|
35
|
+
return (0, create_1.createWallet)(this.runtime, label, {
|
|
36
|
+
...options,
|
|
37
|
+
rules: (0, public_rule_1.publicRules)(options?.rules),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async list() {
|
|
41
|
+
const gen = (0, deployments_1.currentGeneration)(this.runtime.network);
|
|
42
|
+
(0, capabilities_1.requireCapability)(gen.capabilities, capabilities_1.AgenticCapability.WALLET_READS);
|
|
43
|
+
const wallets = await (0, wallets_1.listForOwner)(this.runtime.reader, gen, this.runtime.signerPushAccount());
|
|
44
|
+
return { wallets };
|
|
45
|
+
}
|
|
46
|
+
wallet(address) {
|
|
47
|
+
return new wallet_1.AgenticWalletHandle(this.runtime, address);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.AgenticNamespaceImpl = AgenticNamespaceImpl;
|
|
51
|
+
//# sourceMappingURL=agentic.js.map
|