@pushchain/core 6.0.25 → 6.0.27-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGW.md +194 -0
- package/CHANGELOG.md +74 -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 +409 -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 +15 -0
- package/src/lib/agentic/codec/abi-layout.js +121 -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 +75 -0
- package/src/lib/agentic/codec/native.js +328 -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 +242 -0
- package/src/lib/agentic/codec/universal-terms.d.ts +67 -0
- package/src/lib/agentic/codec/universal-terms.js +41 -0
- package/src/lib/agentic/codec/universal.d.ts +14 -0
- package/src/lib/agentic/codec/universal.js +157 -0
- package/src/lib/agentic/constants.d.ts +11 -0
- package/src/lib/agentic/constants.js +15 -0
- package/src/lib/agentic/context.d.ts +29 -0
- package/src/lib/agentic/context.js +56 -0
- package/src/lib/agentic/contracts/abi/v5/agent-validator.d.ts +105 -0
- package/src/lib/agentic/contracts/abi/v5/agent-validator.js +149 -0
- package/src/lib/agentic/contracts/abi/v5/agw-factory.d.ts +847 -0
- package/src/lib/agentic/contracts/abi/v5/agw-factory.js +1108 -0
- package/src/lib/agentic/contracts/abi/v5/agw.d.ts +1211 -0
- package/src/lib/agentic/contracts/abi/v5/agw.js +1588 -0
- package/src/lib/agentic/contracts/abi/v5/index.d.ts +6 -0
- package/src/lib/agentic/contracts/abi/v5/index.js +17 -0
- package/src/lib/agentic/contracts/abi/v5/smart-session.d.ts +1493 -0
- package/src/lib/agentic/contracts/abi/v5/smart-session.js +1965 -0
- package/src/lib/agentic/contracts/abi/v5/universal-rules-policy.d.ts +1640 -0
- package/src/lib/agentic/contracts/abi/v5/universal-rules-policy.js +2160 -0
- package/src/lib/agentic/contracts/donut-v5.d.ts +11 -0
- package/src/lib/agentic/contracts/donut-v5.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/v5.d.ts +5323 -0
- package/src/lib/agentic/contracts/v5.js +316 -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 +71 -0
- package/src/lib/agentic/errors.js +92 -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 +276 -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 +182 -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 +90 -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 +114 -0
- package/src/lib/agentic/management/create.d.ts +16 -0
- package/src/lib/agentic/management/create.js +271 -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 +21 -0
- package/src/lib/agentic/presets/catalog.js +10 -0
- package/src/lib/agentic/presets/index.d.ts +5 -0
- package/src/lib/agentic/presets/index.js +190 -0
- package/src/lib/agentic/presets/types.d.ts +44 -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 +342 -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 +286 -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 +95 -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/chain.js +1 -1
- package/src/lib/constants/enums.d.ts +6 -3
- package/src/lib/constants/enums.js +6 -3
- package/src/lib/constants/index.d.ts +65 -7
- package/src/lib/constants/index.js +18 -3
- package/src/lib/constants/read-state.d.ts +15 -2
- package/src/lib/constants/read-state.js +19 -3
- package/src/lib/index.d.ts +9 -3
- package/src/lib/index.js +11 -2
- 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 +84 -0
- package/src/lib/progress-hook/progress-hook.types.d.ts +14 -2
- package/src/lib/progress-hook/progress-hook.types.js +13 -0
- package/src/lib/push-chain/push-chain.d.ts +58 -16
- package/src/lib/push-chain/push-chain.js +68 -8
- package/src/lib/push-client/push-client.d.ts +7 -0
- package/src/lib/push-client/push-client.js +41 -15
- package/src/lib/read-state/destination.js +6 -1
- package/src/lib/read-state/envelopes/evm.js +2 -3
- package/src/lib/read-state/envelopes/svm.js +11 -1
- package/src/lib/read-state/read-executor.js +4 -0
- package/src/lib/read-state/read-params.d.ts +71 -26
- package/src/lib/read-state/read-params.js +60 -15
- package/src/lib/read-state/read-state.types.d.ts +44 -1
- package/src/lib/read-state/read-state.types.js +23 -1
- package/src/lib/read-state/read-tracker.d.ts +6 -1
- package/src/lib/read-state/read-tracker.js +83 -17
- package/src/lib/read-state/registry.js +2 -3
- package/src/lib/read-state/result-decoder.js +6 -0
- package/src/lib/read-state/spec-builder.js +2 -2
- package/src/lib/read-state/svm-account.d.ts +20 -0
- package/src/lib/read-state/svm-account.js +114 -0
- package/src/lib/read-state/svm-pda.d.ts +13 -0
- package/src/lib/read-state/svm-pda.js +147 -0
- 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,194 @@
|
|
|
1
|
+
# Agentic wallets on Push Chain
|
|
2
|
+
|
|
3
|
+
This branch implements the SDK-only October 12 feedback against the deployed Donut v5 contracts. Contract-dependent changes remain explicit below.
|
|
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 v5, native rules allow at most **eight** calls, eight equality pins and one maximum pin per call. Public native lifetime budgets, `maxCalls`, `amount`, single-call shorthand and `actions[]` are retired. Native counters still accumulate for reporting and atomic update assertions.
|
|
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. Unsupported dynamic/compound layouts fail explicitly; no guessed tuple-field indexes are produced.
|
|
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 policy supports one `WALLET` equality pin per EVM destination call. General destination equality/maximum pins need the new contract deployment and currently fail with `CAPABILITY_UNAVAILABLE` before signing.
|
|
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
|
+
## Deployment-dependent behavior
|
|
157
|
+
|
|
158
|
+
The October 12 contract feedback is not deployed. Until it is verified:
|
|
159
|
+
|
|
160
|
+
- Outbound sends on both doors require a separately owner-set gateway allowance; the SDK never silently creates or restores one. Insufficient allowance fails before signing.
|
|
161
|
+
- Creation uses the existing index-bound deploy/grant flow. If a signer cannot execute it atomically, `CREATE_PARTIAL` preserves committed receipts and recovery details. Do not blindly retry creation.
|
|
162
|
+
- General EVM destination pins and the new atomic factory `createWallet` are unavailable.
|
|
163
|
+
|
|
164
|
+
`rules.delete` is the public name; on-chain `revokeRules` names/events remain unchanged. Unsupported capabilities use `CAPABILITY_UNAVAILABLE`. On-chain errors retain revert details through `AgenticRevertError`/`PushChainExecutionError`.
|
|
165
|
+
|
|
166
|
+
## Preset discovery and templates (section 7)
|
|
167
|
+
|
|
168
|
+
`PushChain.utils.agentic` contains only `presets.list/get`. The enumerable categories are `AGENTIC.PRESETS.CATEGORY.DEXES`, `LENDING` and `PREDICTION`. All three currently have empty `chains` lists because the app/address catalog is not approved yet; hide them in a UI. No production DEX/lending addresses ship in this framework.
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
const { presets } = PushChain.utils.agentic.presets.list({ type: 'CATEGORY' });
|
|
172
|
+
const availablePresets = presets.filter(preset => preset.chains.length > 0);
|
|
173
|
+
const { rules: reviewTemplates } = PushChain.utils.agentic.presets.get(
|
|
174
|
+
PushChain.CONSTANTS.AGENTIC.PRESETS.CATEGORY.DEXES,
|
|
175
|
+
);
|
|
176
|
+
// Currently [], since there is no approved catalog. Never treat an empty result as an active preset.
|
|
177
|
+
|
|
178
|
+
function filledPreset(agent: Address) {
|
|
179
|
+
return PushChain.utils.agentic.presets.get(
|
|
180
|
+
PushChain.CONSTANTS.AGENTIC.PRESETS.CATEGORY.DEXES,
|
|
181
|
+
{ agent, validUntil: Math.floor(Date.now() / 1000) + 3600 },
|
|
182
|
+
).rules;
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
With catalog entries, `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. Missing `maxPerCall` or `maxTotal` defaults to zero (user decision, October 12), so missing caps do not grant token movement.
|
|
187
|
+
|
|
188
|
+
Reviewed EVM catalog spenders generate approvals pinned to that spender and bounded by the asset's per-call cap. Native assets need no approval. Conflicting spenders for the same token are rejected until the policy representation is reviewed; the framework never replaces them with an unrestricted approval. General EVM approval pins still require the pending contract upgrade, and normal `create/add` validation enforces that boundary. Presets do not sign, fetch app ABIs or modify wallets.
|
|
189
|
+
|
|
190
|
+
The remaining catalog work includes selecting verified apps/functions/chains, struct-field indexing and checking approval combinations against the delivered policy. App ABIs remain with the UI.
|
|
191
|
+
|
|
192
|
+
## Validation
|
|
193
|
+
|
|
194
|
+
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.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,77 @@
|
|
|
1
|
+
@pushchain/core@6.0.27-alpha.0 (2026-10-12)
|
|
2
|
+
|
|
3
|
+
- feat: align AGW rules and presets with October SDK feedback
|
|
4
|
+
- feat: add AGW v5 wallet and rules SDK
|
|
5
|
+
- test: mirror the restructured Universal Read docs playgrounds
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
@pushchain/core@6.0.26 (2026-09-23)
|
|
10
|
+
|
|
11
|
+
- docs: changelog for read-state docs parity
|
|
12
|
+
- feat: align read-state API with the Universal Read docs
|
|
13
|
+
- fix: race prune and archive for Push receipts and block results
|
|
14
|
+
- feat: add Solana account reads and update read registry
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
@pushchain/core (unreleased)
|
|
19
|
+
|
|
20
|
+
Changes on `feature/readstate-docs-parity` since 6.0.25, aligning Universal Read with the
|
|
21
|
+
push-chain-website docs (PR #1244).
|
|
22
|
+
|
|
23
|
+
### Breaking
|
|
24
|
+
|
|
25
|
+
- Solana token reads detect SPL Token vs Token-2022 from the mint's owner. The
|
|
26
|
+
`tokenProgram` option is removed and now throws.
|
|
27
|
+
- The Donut Universal Read Registry default is
|
|
28
|
+
`0x00000000000000000000000000000000000000b2`. Results stored on the previous
|
|
29
|
+
registry stay there; tracking by request ID still works.
|
|
30
|
+
- `READ-TX-199-01` (level SUCCESS) now fires only when `outcome` is `SUCCESS`. A
|
|
31
|
+
FULFILLED read that did not work (source error, callback failure, undecodable
|
|
32
|
+
result, unconfirmed delivery) ends on `READ-TX-199-02`, whose `status` is the
|
|
33
|
+
outcome name.
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
|
|
37
|
+
- Solana account reads with `idl`, the counterpart of `abi`. The account layout is
|
|
38
|
+
picked by its 8-byte discriminator; the optional `functionName` names the layout
|
|
39
|
+
(snake, camel or Pascal case) and types `value`. With the program id as the
|
|
40
|
+
subject, `functionName` plus positional `args` derive the PDA from the seeds the
|
|
41
|
+
IDL declares. `accountName` is not supported and throws with a hint.
|
|
42
|
+
- EVM contract-call reads accept any ABI function, including `nonpayable` and
|
|
43
|
+
`payable`. Validators run the call as an `eth_call` simulation at the pinned
|
|
44
|
+
block, so it returns data and never executes.
|
|
45
|
+
- `response.outcome` (`PushChain.CONSTANTS.READ.OUTCOME`): one answer to "did it
|
|
46
|
+
work" — `SUCCESS`, `SOURCE_ERROR`, `CALLBACK_FAILED`, `DECODE_FAILED`,
|
|
47
|
+
`EXPIRED`, `FAILED`, `ABORTED`, `PENDING`, or `UNKNOWN` (delivery unconfirmed).
|
|
48
|
+
- `response.requestIdUint`: the request ID as the `uint256` contracts key results by.
|
|
49
|
+
- Progress events: `READ-TX-104-03` Looking Up Request, `104-04` Request Found,
|
|
50
|
+
`104-05` Request Not Found (lookup timeout), `105-04` Approaching Expiry (once per
|
|
51
|
+
`wait()`, at 30 or fewer Push blocks left) and `102-04` Preflight Stale (a read
|
|
52
|
+
prepared more than 60 s before `executeReads`).
|
|
53
|
+
|
|
54
|
+
### Improved
|
|
55
|
+
|
|
56
|
+
- `trackRead` on a settled read returns in about 1 s instead of about 19 s on
|
|
57
|
+
Donut. Fulfil and settle receipts are fetched in parallel, and Push receipts
|
|
58
|
+
are requested from the prune RPC and the archive at the same time.
|
|
59
|
+
- `callback.gasLimit` is optional for custom targets and defaults to `500_000n`,
|
|
60
|
+
like the registry. Unused callback budget is refunded.
|
|
61
|
+
- Refund events `READ-TX-106-05/06` also fire for expired reads.
|
|
62
|
+
- `value` is typed `unknown` for ABIs not declared `as const`; a single-output
|
|
63
|
+
function decodes to the bare value, not an array.
|
|
64
|
+
|
|
65
|
+
### Fixed
|
|
66
|
+
|
|
67
|
+
- `explorerUrl` and Donut's viem `blockExplorers` pointed at
|
|
68
|
+
`explorer.donut.push.org`, which does not resolve. They now use
|
|
69
|
+
`https://donut.push.network`.
|
|
70
|
+
- Refunds of expired reads older than the prune window came back `undefined`.
|
|
71
|
+
Cosmos block results now fall back to the archive RPC.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
1
75
|
@pushchain/core@6.0.25 (2026-09-16)
|
|
2
76
|
|
|
3
77
|
- docs: document read-state and transaction fixes
|
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.0",
|
|
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
|