@pushchain/core 6.0.27-alpha.3 → 6.0.27-alpha.4
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 +27 -6
- package/CHANGELOG.md +7 -0
- package/MARKETPLACE.md +206 -0
- package/package.json +2 -1
- package/src/lib/agentic/codec/rules.js +74 -69
- package/src/lib/agentic/codec/universal.js +15 -3
- package/src/lib/agentic/constants.d.ts +36 -1
- package/src/lib/agentic/constants.js +14 -1
- package/src/lib/agentic/contracts/reader.d.ts +21 -0
- package/src/lib/agentic/contracts/reader.js +3 -0
- package/src/lib/agentic/error-messages.d.ts +3 -0
- package/src/lib/agentic/error-messages.js +125 -0
- package/src/lib/agentic/errors.d.ts +12 -3
- package/src/lib/agentic/errors.js +76 -0
- package/src/lib/agentic/management/common.js +6 -0
- package/src/lib/agentic/management/destination.d.ts +5 -0
- package/src/lib/agentic/management/destination.js +32 -0
- package/src/lib/agentic/management/prepare.js +80 -55
- package/src/lib/agentic/management/svm-public.js +13 -4
- package/src/lib/agentic/presets/index.js +7 -8
- package/src/lib/agentic/presets/routes.d.ts +1 -1
- package/src/lib/agentic/presets/routes.js +6 -7
- package/src/lib/agentic/presets/types.d.ts +1 -6
- package/src/lib/agentic/public-rule.js +13 -2
- package/src/lib/constants/index.d.ts +35 -0
- package/src/lib/index.d.ts +4 -0
- package/src/lib/index.js +6 -2
- package/src/lib/job/job.d.ts +35 -0
- package/src/lib/job/job.js +382 -0
- package/src/lib/job/types.d.ts +94 -0
- package/src/lib/job/types.js +3 -0
- package/src/lib/job/watch.d.ts +3 -0
- package/src/lib/job/watch.js +169 -0
- package/src/lib/job-spec/codec.d.ts +18 -0
- package/src/lib/job-spec/codec.js +348 -0
- package/src/lib/job-spec/constants.d.ts +32 -0
- package/src/lib/job-spec/constants.js +36 -0
- package/src/lib/job-spec/helpers.d.ts +19 -0
- package/src/lib/job-spec/helpers.js +138 -0
- package/src/lib/job-spec/index.d.ts +14 -0
- package/src/lib/job-spec/index.js +17 -0
- package/src/lib/job-spec/preview.d.ts +8 -0
- package/src/lib/job-spec/preview.js +298 -0
- package/src/lib/job-spec/read.d.ts +20 -0
- package/src/lib/job-spec/read.js +224 -0
- package/src/lib/job-spec/schema.d.ts +290 -0
- package/src/lib/job-spec/schema.js +70 -0
- package/src/lib/job-spec/types.d.ts +139 -0
- package/src/lib/job-spec/types.js +3 -0
- package/src/lib/market/contracts/AgenticCommerce.d.ts +1026 -0
- package/src/lib/market/contracts/AgenticCommerce.js +1317 -0
- package/src/lib/market/contracts/RulesBindingHook.d.ts +235 -0
- package/src/lib/market/contracts/RulesBindingHook.js +314 -0
- package/src/lib/market/contracts/UniversalMarketplace.d.ts +1770 -0
- package/src/lib/market/contracts/UniversalMarketplace.js +2295 -0
- package/src/lib/market/contracts/UniversalMarketplaceErrors.d.ts +309 -0
- package/src/lib/market/contracts/UniversalMarketplaceErrors.js +416 -0
- package/src/lib/market/contracts/UniversalMarketplaceRules.d.ts +241 -0
- package/src/lib/market/contracts/UniversalMarketplaceRules.js +323 -0
- package/src/lib/market/data.d.ts +8 -0
- package/src/lib/market/data.js +60 -0
- package/src/lib/market/deployment.d.ts +14 -0
- package/src/lib/market/deployment.js +23 -0
- package/src/lib/market/deposit.d.ts +24 -0
- package/src/lib/market/deposit.js +271 -0
- package/src/lib/market/errors.d.ts +13 -0
- package/src/lib/market/errors.js +81 -0
- package/src/lib/market/history.d.ts +6 -0
- package/src/lib/market/history.js +83 -0
- package/src/lib/market/index.d.ts +4 -0
- package/src/lib/market/index.js +12 -0
- package/src/lib/market/kernel-wire.d.ts +15 -0
- package/src/lib/market/kernel-wire.js +41 -0
- package/src/lib/market/market.d.ts +55 -0
- package/src/lib/market/market.js +635 -0
- package/src/lib/market/rules.d.ts +106 -0
- package/src/lib/market/rules.js +293 -0
- package/src/lib/market/runtime.d.ts +35 -0
- package/src/lib/market/runtime.js +130 -0
- package/src/lib/market/types.d.ts +180 -0
- package/src/lib/market/types.js +3 -0
- package/src/lib/orchestrator/internals/errors.d.ts +9 -2
- package/src/lib/orchestrator/internals/errors.js +9 -2
- package/src/lib/orchestrator/internals/push-chain-tx.js +17 -3
- package/src/lib/push-chain/push-chain.d.ts +44 -1
- package/src/lib/push-chain/push-chain.js +23 -3
- package/src/lib/read-state/read-params.d.ts +9 -0
- package/src/lib/read-state/read-params.js +5 -1
- package/src/lib/utils.d.ts +15 -0
- package/src/lib/utils.js +4 -0
package/AGW.md
CHANGED
|
@@ -10,6 +10,7 @@ Use an application-managed key; examples do not load secrets or execute automati
|
|
|
10
10
|
import {
|
|
11
11
|
PushChain,
|
|
12
12
|
AgenticError,
|
|
13
|
+
AgenticRevertError,
|
|
13
14
|
type Rule,
|
|
14
15
|
} from '@pushchain/core';
|
|
15
16
|
import {
|
|
@@ -116,6 +117,27 @@ The deployed v6 policy supports up to eight EQ/MAX pins per EVM destination call
|
|
|
116
117
|
|
|
117
118
|
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
|
|
|
120
|
+
## Displaying errors in the UI
|
|
121
|
+
|
|
122
|
+
Use `userMessage` for `AgenticError` and `AgenticRevertError`. Keep `code`, `message`, `hint`, `details`, `decodedError` and `cause` for diagnostics or application-specific translations. Unknown exceptions should get a neutral fallback instead of raw RPC/ABI text.
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
function walletErrorText(error: unknown): string {
|
|
126
|
+
if (error instanceof AgenticError || error instanceof AgenticRevertError) {
|
|
127
|
+
return error.userMessage;
|
|
128
|
+
}
|
|
129
|
+
return 'The request could not be completed. Check wallet activity before trying again.';
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Creation and rule-preparation errors include a zero-based `details.ruleIndex` when a rule can be identified, with `assetIndex`, `callIndex` and `field` where available. The UI message uses a one-based rule number. Use these details to show the error on the relevant rule instead of only in a footer. Read/receipt failures preserve their causes and transaction hashes; do not automatically retry a submitted transaction whose outcome is unknown.
|
|
134
|
+
|
|
135
|
+
`TOKEN_ROUTE_UNAVAILABLE` means an asset cannot be resolved for transfers from Push. Choose a token with a supported route on this network, or wait for a verified PRC20 route for that exact token address. Changing a symbol does not create a route. Display `error.userMessage` and check preset readiness before creation.
|
|
136
|
+
|
|
137
|
+
A DEX condition-limit failure reports `details.reason = 'RULE_CONSTRAINT_LIMIT'`, `actual`, `limit` and `callCount`. Conditions here are generated input checks (for example token, recipient and amount checks), rather than the number of visible function names. A stock two-token, single-router preset contains six allowed-call entries and twenty conditions. Appending the same call list again makes forty conditions. The SDK rejects this; it does not deduplicate, remove conditions or split authority automatically. Preserve per-chain rules and regenerate after edits rather than appending generated calls.
|
|
138
|
+
|
|
139
|
+
For the review screen, show the actual network (including testnet name), selected token addresses and limits. Label maxGasPerCall as a maximum PC gas budget, not a guaranteed fee or execution gas-unit count. maxTotal meters cumulative Push outbounds; it is not a lifetime destination-spend limit.
|
|
140
|
+
|
|
119
141
|
## Solana destinations
|
|
120
142
|
|
|
121
143
|
Rules use fixed-width signatures and numeric positions, without an IDL:
|
|
@@ -185,7 +207,7 @@ const { rules: reviewTemplates } = PushChain.utils.agentic.presets.get(
|
|
|
185
207
|
// Supply the agent to get complete Rule[] configuration.
|
|
186
208
|
const configuredPreset = PushChain.utils.agentic.presets.get(
|
|
187
209
|
PushChain.CONSTANTS.AGENTIC.PRESETS.CATEGORY.LENDING,
|
|
188
|
-
{ chainNamespace: 'eip155:11155111', agent: '0x0000000000000000000000000000000000001234'
|
|
210
|
+
{ chainNamespace: 'eip155:11155111', agent: '0x0000000000000000000000000000000000001234' },
|
|
189
211
|
);
|
|
190
212
|
// Destination assets must already be funded; no Push token exports are granted.
|
|
191
213
|
// Show configuredPreset.readiness.chains[0].selectedAssets in the review UI.
|
|
@@ -197,7 +219,6 @@ function filledPreset(agent: Address, tokenIn: Address, tokenOut: Address) {
|
|
|
197
219
|
PushChain.CONSTANTS.AGENTIC.PRESETS.CATEGORY.DEXES,
|
|
198
220
|
{
|
|
199
221
|
chainNamespace: 'eip155:11155111',
|
|
200
|
-
funding: 'destination',
|
|
201
222
|
agent,
|
|
202
223
|
validUntil: Math.floor(Date.now() / 1000) + 3600,
|
|
203
224
|
maxGasPerCall: BigInt(10) ** BigInt(18),
|
|
@@ -235,13 +256,13 @@ These are small, protocol-specific subsets chosen to fit the 32-call/32-pin ceil
|
|
|
235
256
|
| Arbitrum Sepolia | WETH / Circle USDC | Aave USDC |
|
|
236
257
|
| BSC testnet | WBNB / Venus USDT | Venus USDT, USDC |
|
|
237
258
|
|
|
238
|
-
Staking defaults are ETH/stETH/wstETH on Ethereum and the reviewed EigenLayer strategy's WETH on Sepolia. Testnet tokens with similar names can have different addresses; the returned addresses are authoritative.
|
|
259
|
+
Staking defaults are ETH/stETH/wstETH on Ethereum and the reviewed EigenLayer strategy's WETH on Sepolia. Testnet tokens with similar names can have different addresses; the returned addresses are authoritative. Defaults do not guarantee active reserves, liquidity or a Push PRC20 route. An unmodified preset cannot be granted when its assets lack matching PRC20 routes. The SDK preserves the selected tokens and caps and reports unavailable routes; it never removes assets to bypass this check. No runtime metadata/price fetch is added to get.
|
|
239
260
|
|
|
240
261
|
### Funding and release-network checks
|
|
241
262
|
|
|
242
|
-
|
|
263
|
+
Missing PRC20 registry entries produce `BRIDGE_ASSET_UNAVAILABLE`, and readiness is false while the returned rule retains all requested assets. No address or cap is silently replaced. `network` defaults to `TESTNET_DONUT` (`TESTNET` is accepted as an alias). Networks without a verified AGW deployment report `AGW_NETWORK_UNAVAILABLE`.
|
|
243
264
|
|
|
244
|
-
|
|
265
|
+
The public preset API has no `funding` option. Remove it from existing integrations; supplying it now produces `INVALID_RULE` rather than silently changing permissions. Internal prefunded CEA test fixtures explicitly clear bridge assets to isolate protocol constraints. Those fixtures do not demonstrate that an unsupported preset route is executable.
|
|
245
266
|
|
|
246
267
|
Existing mappings distinguish token identity by chain and address, including address casing for EVM. WETH/stETH Sepolia mappings and string/address-word source metadata are supported; mainnet or other-chain WETH is never aliased to them. Protocol mock LINK, Moonwell/Venus mocks and Circle testnet USDC can differ from the supported source tokens; they remain unavailable for bridge funding until real matching routes exist.
|
|
247
268
|
|
|
@@ -266,7 +287,7 @@ Explicit `validUntil` and `maxGasPerCall` override policy values; zero gas is pr
|
|
|
266
287
|
|
|
267
288
|
### Configure, inspect and regenerate
|
|
268
289
|
|
|
269
|
-
`readiness.ready` requires complete configuration plus offline SDK deployment
|
|
290
|
+
`readiness.ready` requires complete configuration plus offline SDK deployment, destination and bridge-registry support. Per-chain `configurationReady` reports input completeness separately. These checks do not verify live balances, reserve flags, liquidity or deployed bytecode. Grant preparation verifies wiring and token metadata on-chain before signing. Per-chain `selectedAssets` mirrors the selected rule assets; `bridgeAssets` reports registry presence, not verified live deployment. Mainnet templates remain discoverable but report `DESTINATION_UNAVAILABLE` on Donut. Check readiness before passing `rules` to create/update.
|
|
270
291
|
|
|
271
292
|
Tokens and permission defaults come directly from the SDK: omitted `assets` populates the curated subset and its caps in every returned `rule.assets`. Omitted gas and expiry use the policy below. The caller supplies the agent and can filter chains; no per-network token selection is required. Show the generated permissions for owner review and allow explicit overrides. Regenerate via get after an edit so operation pins/approvals match the new caps. Show explicitly zero-cap calls as disabled and present excluded calls clearly. A zero bridge limit can be intentional when assets are already at the destination; it is reported separately from operation readiness.
|
|
272
293
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
@pushchain/core@6.0.27-alpha.4 (2026-10-20)
|
|
2
|
+
|
|
3
|
+
- fix: remove preset funding mode and preserve asset limits
|
|
4
|
+
- feat: sync v4 SDK changes without plan files
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
1
8
|
@pushchain/core@6.0.27-alpha.3 (2026-10-18)
|
|
2
9
|
|
|
3
10
|
- feat: ship bounded preset defaults with funding checks
|
package/MARKETPLACE.md
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# Agentic marketplace and jobs
|
|
2
|
+
|
|
3
|
+
This SDK checkpoint targets UniversalMarketplace v2 on Push Donut, its pUSDC kernel and AGW v6. It implements card management, JobSpec authoring and paid previews, preview/open, historical deposits and the kernel lifecycle. The evaluator is currently an EOA: there is no automatic verification, baseline or rating claim.
|
|
4
|
+
|
|
5
|
+
`PushChain.initialize` now exposes `client.market` and `client.job`. Helpers are `PushChain.utils.market` and `PushChain.utils.job`; vocabulary is under `PushChain.CONSTANTS.AGENTIC`. There is no separate `client.evaluation` namespace. Read-only clients can discover cards and jobs.
|
|
6
|
+
|
|
7
|
+
## Author a card
|
|
8
|
+
|
|
9
|
+
Use verified application/token addresses and raw token units. The following helper returns permissions and a criteria template; it does not sign or send anything.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { PushChain, MarketError, type AgentCardInput, type AgentCardRules, type JobPlan, type JobWatchCursor, type MarketDepositResult, type PreviewJobSpecOptions } from '@pushchain/core';
|
|
13
|
+
import { parseAbi, type Address } from 'viem';
|
|
14
|
+
|
|
15
|
+
function authorCard(app: Address, token: Address, receiptToken: Address) {
|
|
16
|
+
const { WALLET, PRINCIPAL, JOB } = PushChain.CONSTANTS.AGENTIC;
|
|
17
|
+
const read = PushChain.utils.job.prepareRead({
|
|
18
|
+
chain: PushChain.CONSTANTS.CHAIN.BNB_TESTNET,
|
|
19
|
+
target: receiptToken,
|
|
20
|
+
abi: parseAbi(['function balanceOf(address) view returns (uint256)']),
|
|
21
|
+
functionName: 'balanceOf',
|
|
22
|
+
args: [WALLET],
|
|
23
|
+
});
|
|
24
|
+
const jobSpecTemplate = PushChain.utils.job.buildJobSpecTemplate({
|
|
25
|
+
reads: [read],
|
|
26
|
+
checks: [{ read: 0, evaluation: JOB.EVALUATION.COMPARE, operation: JOB.OPERATION.GREATER_OR_EQUAL, target: { principalBps: 9990n } }],
|
|
27
|
+
logic: JOB.LOGIC.ALL,
|
|
28
|
+
allowedMutability: JOB.ALLOWED_MUTABILITY.NONE,
|
|
29
|
+
});
|
|
30
|
+
const rules: AgentCardRules = {
|
|
31
|
+
assets: [{ token, maxPerCall: PRINCIPAL, maxTotal: PRINCIPAL }],
|
|
32
|
+
principalAsset: 0,
|
|
33
|
+
maxGasPerCall: 10n ** 18n,
|
|
34
|
+
allowedCalls: [
|
|
35
|
+
{ target: token, selector: 'approve(address,uint256)', pins: [{ arg: 0, expected: app }, { arg: 1, max: PRINCIPAL }] },
|
|
36
|
+
{ target: app, selector: 'supply(address,uint256,address,uint16)', pins: [{ arg: 0, expected: token }, { arg: 1, max: PRINCIPAL }, { arg: 2, expected: WALLET }] },
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
PushChain.utils.market.validateAgentCardRules(rules);
|
|
40
|
+
return { rules, jobSpecTemplate };
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`client.universal.read.prepare(options)` is the same pure authoring helper. `client.universal.read(prepared, options?)` sends a resolved prepared call and returns raw consensus bytes. WALLET/PARAM holes must first be resolved; the sender rejects them before a paid request. Existing async `universal.prepareRead(subject, options)` remains the paid-request preparation API. They produce different representations. A literal zero is never guessed to be a placeholder. Dynamic-layout placeholders are refused. Descriptions retain ABI function names in memory when available and apply explicit token decimals while retaining raw targets; chain-decoded specs fall back to selectors and addresses.
|
|
45
|
+
|
|
46
|
+
Cards name one execution chain and one provider. Destination tokens resolve to verified Push PRC20 routes on that chain. An explicit `{ prc20: address }` is available for already-known Push tokens and is returned by lossless rule decoding. No route or same-symbol alias is invented. Structural validation alone does not establish deployment or liquidity readiness.
|
|
47
|
+
|
|
48
|
+
Approvals are **allowed calls with spender/amount pins** in v2. There is no separate `approvals[]` field or automatic owner-approval deposit step. Principal caps meter outbound tokens from Push; they are not a destination-lifetime trading budget. Spec comparisons use raw units; the receipt token must have the units expected by the criterion.
|
|
49
|
+
|
|
50
|
+
## Register, preview and open
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
async function registerOffer(
|
|
54
|
+
provider: PushChain,
|
|
55
|
+
listing: AgentCardInput,
|
|
56
|
+
app: Address,
|
|
57
|
+
token: Address,
|
|
58
|
+
receiptToken: Address,
|
|
59
|
+
) {
|
|
60
|
+
const authored = authorCard(app, token, receiptToken);
|
|
61
|
+
return provider.market.agent.register(listing, authored);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async function openReviewedJob(owner: PushChain, cardId: bigint) {
|
|
65
|
+
const now = Math.floor(Date.now() / 1000);
|
|
66
|
+
const plan = await owner.market.preview(cardId, {
|
|
67
|
+
principal: 100_000_000n,
|
|
68
|
+
executeBy: now + 3600,
|
|
69
|
+
expiredAt: now + 86400,
|
|
70
|
+
});
|
|
71
|
+
// Render every mayDo/mayMove/judgedBy entry and the logic before signing.
|
|
72
|
+
return owner.market.openJob(plan, {
|
|
73
|
+
progressHook: event => console.log(event.id, event.message),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Opening deploys/reuses the AGW, grants the card's exact resolved permissions and creates an Open job. It moves no principal or fee. The plan is revalidated before signing; changed card versions, nonces, occupancy or plan content require a new preview. OwnerIntent authorization uses the factory EIP-712 domain. Client submission can require a second wallet interaction; no relay is supplied in this checkpoint.
|
|
79
|
+
|
|
80
|
+
Opening supports EVM typed-data signers. An external owner's UEA must already be deployed on Push (`OWNER_NOT_DEPLOYED` otherwise). The SDK checks the factory domain before prompting, then simulates the complete signed request through the real owner verifier before broadcasting. UEA and ERC-1271 acceptance follows the deployed contract; an EIP-7702 delegate without a compatible verifier fails simulation. Signing capability checks run before prompting; a verifier can reject the resulting signature after prompting. Provider writes use the connected signer's ordinary Push identity, including when the instance also has an AGW execution context.
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
async function recoverOpening(client: PushChain, reviewedPlan: JobPlan, txHash: string) {
|
|
84
|
+
const tx = await client.universal.trackTransaction(txHash);
|
|
85
|
+
return client.market.openJob(reviewedPlan, { resume: tx });
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
If receipt lookup or post-state verification fails, keep the original plan and reported transaction hash. Resume verifies the mined input, event, permission ID, wallet ownership, kernel record and marketplace mappings without another signature or submission. A read-only client can recover an existing opening. Normal writes copy reviewed inputs before awaiting RPCs or wallet prompts. Provider registration/update also simulate the exact card write before submission. A reference ERC-1271 contract-owner adapter and compatible/incompatible EIP-7702 verifiers are exercised against real contracts in the local acceptance suite; custom wallets supply their own `UniversalSigner` transport.
|
|
90
|
+
|
|
91
|
+
Native transport errors also retain `txHash` and, when confirmation is uncertain, `pendingTransactionHash` after broadcast. Atomic native sends never fall back to sequential calls after a hash exists. Track that hash before another attempt; a confirmed revert retains its hash without claiming that it is still pending.
|
|
92
|
+
|
|
93
|
+
**Current destination readiness:** BSC Testnet has passing live open/cancel coverage. Sepolia, Base Sepolia and Arbitrum Sepolia have different CEA factories in the marketplace configuration and current SDK routing table; preview returns `CEA_MISMATCH`. The SDK does not substitute the marketplace's account for an independently derived account. Align the deployment/routing configuration before opening on those chains.
|
|
94
|
+
|
|
95
|
+
Card IDs, versions, ratings and job IDs are bigint. `jobType` reads are the canonical bytes32 hash, not a guessed original name. `cards` walks IDs with bounded concurrency; summaries remain readable even if an unverified provider stored a malformed template. Full `card` decoding/preview rejects unsupported content. `agent.card`, `agent.update` and `agent.setActive` manage the provider's one card. Preserve raw `rulesBytes`/`jobSpecTemplateBytes` for archival rather than serializing away unknown wire metadata.
|
|
96
|
+
|
|
97
|
+
## Fund and track the kernel lifecycle
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
async function depositForJob(owner: PushChain, jobId: bigint): Promise<MarketDepositResult> {
|
|
101
|
+
return owner.market.deposit(jobId, {
|
|
102
|
+
// Target wallet PC balance, not a gas quote for the whole job.
|
|
103
|
+
pcAmount: 10n ** 18n,
|
|
104
|
+
funding: 'push',
|
|
105
|
+
progressHook: event => console.log(event.id, event.message),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
`deposit` recovers the original principal and card version from the opening event and historical card state. It never sizes an old job from today's updated card. It tops up wallet balances to the principal, original reference fee and PC target; a shared principal/fee token is combined before subtracting the balance. `providerFee` explicitly overrides the fee reserve and `pcAmount` overrides the PC target. The default PC target is one per-call card gas cap, not a promise that all job execution is covered. This operation leaves the kernel escrow Open and makes no destination approval calls: those are pinned permissions granted to the agent in v2.
|
|
111
|
+
|
|
112
|
+
The default source is the connected signer's Push identity, even on an instance configured to execute through an AGW. `funding: 'origin'` explicitly uses normal inbound `funds` transfers for registered assets from the connected origin chain; required tokens without such a route fail before any leg is sent. PC still comes from the signer's Push holdings. The underlying gateway's normal route, liquidity, balance and fee checks apply.
|
|
113
|
+
|
|
114
|
+
Steps are separate transactions. `DEPOSIT_INCOMPLETE` retains `details.txs`, any `details.pending` broadcast hash and chain, and the original cause. The same client remembers submitted steps; pass `resume: previousSteps` when continuing with another client. After restarting, rehydrate recorded hashes with `universal.trackTransaction(hash, { chain })` before passing their transaction responses. Pending receipts must settle before another transfer, and a confirmed transfer whose target balance has since fallen requires manual review. Concurrent deposits on the same client are rejected. Coordinate other clients and avoid running the agent during deposits. Deposits require an Open, unexpired job and an enabled permission with no recorded asset spend. When archive state is unavailable or updates share the opening block, the SDK recovers the version from registration/update events and canonical transaction input, checking emitted content hashes, fee and immutable card identity. If neither source can authenticate it, `HISTORY_UNAVAILABLE` stops the operation.
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
async function priceAndFund(provider: PushChain, owner: PushChain, jobId: bigint) {
|
|
118
|
+
// First deposit the payment token, principal and PC appropriate to the job.
|
|
119
|
+
await (await provider.job.setBudget(jobId, 5_000_000n)).wait();
|
|
120
|
+
// Explicitly pass the price the client reviewed; never silently accept a re-quote.
|
|
121
|
+
return owner.job.fund(jobId, { expectedBudget: 5_000_000n });
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function trackJob(client: PushChain, provider: PushChain, jobId: bigint) {
|
|
125
|
+
const stop = client.job.watch(jobId, event => console.log(event.kind));
|
|
126
|
+
const job = await client.job.status(jobId);
|
|
127
|
+
await (await provider.job.submit(jobId, { deliverable: 'ipfs://deliverable' })).wait();
|
|
128
|
+
stop();
|
|
129
|
+
return job;
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The kernel currently accepts pUSDC (`USDC.eth`, 6 decimals) only; explicit mismatching payment tokens are rejected. A card's providerFee is a reference price. For an unchanged marketplace card version, omitted expectedBudget uses that reference; plain jobs or changed card versions need an explicit reviewed amount. A zero-price job is valid.
|
|
134
|
+
|
|
135
|
+
For AGW clients, fund verifies ownership, rule/provider identity and expiry, then batches any necessary ERC20 allowance change and escrow funding through the owner door. This allowance is distinct from the AGW's automatic gateway allowance. Plain-client allowance/fund batching requires a supported atomic signer transport; the SDK does not silently fall back to sequential acceptance.
|
|
136
|
+
|
|
137
|
+
`status` reads the kernel and hook, retains binary description bytes, decodes supported v2 JobSpecs, and recovers deliverable from submission logs. `evaluation.available` is false for this manual/unverified evaluator profile; frozen/baseline/verdict data is not fabricated. Plain text descriptions may have no decoded JobSpec. `list` can filter client/provider/status; `watch` polls bounded event ranges, reports read errors, supports a starting block and returns a stop function. It is not an indexer or a reorg-finality service.
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
function resumeJobEvents(client: PushChain, jobId: bigint, cursor?: JobWatchCursor) {
|
|
141
|
+
return client.job.watch(jobId, event => {
|
|
142
|
+
// Persist cursor only after your application handles the event.
|
|
143
|
+
if (event.kind !== 'Error') console.log(event.kind, event.cursor);
|
|
144
|
+
}, cursor ? { cursor } : { pollIntervalMs: 3000 });
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Each delivered event has an exact block/log cursor. Resuming excludes already delivered logs within the same block; duplicate RPC logs are delivered once. RPC failures retry the same range, consumer callback errors do not rewind delivery, and unsubscribe suppresses pending callbacks. A changed canonical cursor emits `WATCH_REORG` and stops; reload status and choose a reviewed restart block.
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
async function stopOpenJob(owner: PushChain, jobId: bigint) {
|
|
152
|
+
// For marketplace AGWs, one owner batch rejects the Open job and revokes its recorded grant.
|
|
153
|
+
return owner.job.cancel(jobId);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function marketplaceErrorText(error: unknown): string {
|
|
157
|
+
return error instanceof MarketError ? error.userMessage : 'Check transaction activity before retrying.';
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Cancellation is client-side Open-job rejection. It does not withdraw deposited wallet balances; those remain under the owner's existing transfer authority. A plain job has no marketplace grant to infer. Other terminal paths do not imply AGW permission revocation. `claimRefund` respects expiry/grace and remains available while the kernel is paused; a third party may trigger it, with funds returned to the recorded client.
|
|
162
|
+
|
|
163
|
+
Plain jobs can use `job.create` with provider/evaluator/hook/expiry/paymentToken plus either binary jobSpec or text description. The kernel's Solidity string slot can carry binary JobSpec bytes; the SDK preserves them and retains the original createJob selector.
|
|
164
|
+
|
|
165
|
+
## Paid criteria preview
|
|
166
|
+
|
|
167
|
+
```ts
|
|
168
|
+
async function previewCriteria(client: PushChain, template: ReturnType<typeof authorCard>['jobSpecTemplate'], wallet: Address) {
|
|
169
|
+
const options: PreviewJobSpecOptions = {
|
|
170
|
+
client, wallet, principal: 100_000_000n,
|
|
171
|
+
maxTotalFee: 10n ** 16n,
|
|
172
|
+
advanced: { timeout: 120_000 },
|
|
173
|
+
};
|
|
174
|
+
return PushChain.utils.job.previewJobSpec(template, options);
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
This prepares every raw read, checks the total callback/protocol fee cap, then executes through the existing universal-read registry (or an explicit `callback`). Native transaction gas is separate from `maxTotalFee`. A real SDK client derives destination CEAs for template wallet holes using its configured routes; `accounts` supplies explicit destination addresses when needed. An AGW's Push address is never substituted for its destination account.
|
|
179
|
+
|
|
180
|
+
The result includes raw values, decoded fields, request responses and fees. `pass` and each check are `true`, `false`, or `null` (unknown). NUMBER and PERCENTAGE require an explicit per-read `baseline`; missing baselines, zero percentage denominators and unavailable reads stay unknown. A preview is an observation, not an automatic evaluator verdict or proof that a job is complete. Raw EVM calls are also available as `universal.read(target, { chain, callData })` and return consensus bytes.
|
|
181
|
+
|
|
182
|
+
`PREVIEW_INCOMPLETE` retains all known request IDs and transaction hashes. Track uncertain submissions before retrying. Pass `resume: requestIds` (one per read, in order) to finish without new requests or payment. Resume checks each on-chain destination, call, pin and confirmation requirement before evaluating; unrelated reads are refused. `fees.newlyPaid` is zero on recovery, while `fees.paid` retains the original request deposits. A zero `maxTotalFee` is valid for recovery.
|
|
183
|
+
|
|
184
|
+
## Explicit placeholders
|
|
185
|
+
|
|
186
|
+
- `job.verify`, baseline/prefund/retry integration: no compatible automatic evaluator is configured. A different linked evaluator source has a different wire and enum values.
|
|
187
|
+
- Replacement JobSpecs, non-NONE marketplace criteria, recurring jobs and relay are unavailable.
|
|
188
|
+
|
|
189
|
+
Unsupported paths throw before signing/sending. They do not return successful dummy results. Keep message, code, details and cause for diagnostics.
|
|
190
|
+
|
|
191
|
+
## E2E validation
|
|
192
|
+
|
|
193
|
+
From the repository root:
|
|
194
|
+
|
|
195
|
+
```sh
|
|
196
|
+
# Real deployed stack on an isolated Anvil fork; no private keys or public-chain writes.
|
|
197
|
+
node node_modules/jest/bin/jest.js --config packages/core/jest.marketplace-local.config.ts --runInBand
|
|
198
|
+
# Read-only live Donut acceptance.
|
|
199
|
+
node node_modules/ts-node/dist/bin.js --compiler-options '{"module":"commonjs"}' packages/core/__e2e__/ci/run.ts --group marketplace
|
|
200
|
+
# Explicit funded smoke, using packages/core/.env: fresh provider/card/owner/wallet, then cancel/revoke/deactivate.
|
|
201
|
+
node node_modules/ts-node/dist/bin.js --compiler-options '{"module":"commonjs"}' packages/core/__e2e__/ci/run.ts --group marketplace-live
|
|
202
|
+
# Owned-token acceptance: actual deposits, native/AGW escrow and payouts, BSC-origin principal bridging.
|
|
203
|
+
node node_modules/ts-node/dist/bin.js --compiler-options '{"module":"commonjs"}' packages/core/__e2e__/ci/run.ts --group marketplace-funding
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Marketplace groups stay out of the runner's default `all`. The basic live group spends bounded PC for gas/test wallets and read callbacks. The separate funding group uses owned test assets: 0.01 pUSDC per paid job, 0.01 USDT of bridged principal and up to 0.01 pBNB for source-gas setup. It cancels/revokes market jobs, completes plain jobs with a fresh controlled manual evaluator, returns principal/reserve/payout tokens and deactivates its card. The deployed marketplace evaluator remains unchanged. Pause/refund and signature variants use the local fork. The fork's UEA signature test uses a native submitter because Anvil has no Cosmos transport; live cases exercise actual external-owner transport. No automated verdict is implied by those results. Signature fixtures compile from repo-owned source at harness startup; Foundry and cached solc 0.8.26 are prerequisites.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushchain/core",
|
|
3
|
-
"version": "6.0.27-alpha.
|
|
3
|
+
"version": "6.0.27-alpha.4",
|
|
4
4
|
"homepage": "https://push.org",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pushchain",
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"src/**/*.json",
|
|
74
74
|
"README.md",
|
|
75
75
|
"AGW.md",
|
|
76
|
+
"MARKETPLACE.md",
|
|
76
77
|
"CHANGELOG.md"
|
|
77
78
|
],
|
|
78
79
|
"devDependencies": {
|
|
@@ -33,78 +33,83 @@ function prepareRules(rules, ctx) {
|
|
|
33
33
|
throw new errors_1.AgenticError(errors_1.AGENTIC_ERROR_CODE.INVALID_RULE, 'rules must be an array');
|
|
34
34
|
}
|
|
35
35
|
return rules.map((rule, i) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
rule
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
chainNamespace,
|
|
64
|
-
svmTerms: terms,
|
|
65
|
-
session: (0, session_1.buildSession)({
|
|
66
|
-
validator: ctx.validator,
|
|
67
|
-
rulesPolicy: ctx.rulesPolicy,
|
|
36
|
+
try {
|
|
37
|
+
if (!rule || typeof rule !== 'object') {
|
|
38
|
+
throw new errors_1.AgenticError(errors_1.AGENTIC_ERROR_CODE.INVALID_RULE, `rules[${i}] is not an object`);
|
|
39
|
+
}
|
|
40
|
+
if (!(0, viem_1.isAddress)(rule.agent, { strict: false }) ||
|
|
41
|
+
/^0x0{40}$/i.test(rule.agent)) {
|
|
42
|
+
throw new errors_1.AgenticError(errors_1.AGENTIC_ERROR_CODE.INVALID_RULE, `rules[${i}].agent must be a non-zero Push address`);
|
|
43
|
+
}
|
|
44
|
+
const agent = (0, viem_1.getAddress)(rule.agent);
|
|
45
|
+
if (ctx.owner && agent === (0, viem_1.getAddress)(ctx.owner)) {
|
|
46
|
+
throw new errors_1.AgenticError(errors_1.AGENTIC_ERROR_CODE.AGENT_IS_OWNER, `rules[${i}].agent is the wallet owner; the owner uses the owner door`);
|
|
47
|
+
}
|
|
48
|
+
const chainNamespace = ruleChain(rule, ctx.pushChainNamespace);
|
|
49
|
+
if (isUniversalRule(rule) &&
|
|
50
|
+
rule.chainNamespace === ctx.pushChainNamespace) {
|
|
51
|
+
throw new errors_1.AgenticError(errors_1.AGENTIC_ERROR_CODE.INVALID_RULE, `rules[${i}] names the connected Push chain; omit chainNamespace for a native rule`);
|
|
52
|
+
}
|
|
53
|
+
if ('ref' in rule) {
|
|
54
|
+
throw new errors_1.AgenticError(errors_1.AGENTIC_ERROR_CODE.INVALID_RULE, 'InternalRule ref is not supported; remove it from the input');
|
|
55
|
+
}
|
|
56
|
+
if (isSolanaRule(rule)) {
|
|
57
|
+
(0, capabilities_1.requireCapability)(ctx.capabilities, capabilities_1.AgenticCapability.UNIVERSAL_SVM_RULES);
|
|
58
|
+
const terms = ctx.svm?.get(rule);
|
|
59
|
+
if (!terms || !ctx.gateway)
|
|
60
|
+
throw new errors_1.AgenticError(errors_1.AGENTIC_ERROR_CODE.INVALID_RULE, 'SVM rules require resolved wallet context and validated instruction layouts');
|
|
61
|
+
return {
|
|
62
|
+
rule,
|
|
68
63
|
agent,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
64
|
+
chainNamespace,
|
|
65
|
+
svmTerms: terms,
|
|
66
|
+
session: (0, session_1.buildSession)({
|
|
67
|
+
validator: ctx.validator,
|
|
68
|
+
rulesPolicy: ctx.rulesPolicy,
|
|
69
|
+
agent,
|
|
70
|
+
actions: [
|
|
71
|
+
{
|
|
72
|
+
target: ctx.gateway,
|
|
73
|
+
selector: v6_1.SEND_OUTBOUND_SELECTOR,
|
|
74
|
+
initData: (0, session_1.encodeEnvelope)(chainNamespace, (0, svm_terms_1.encodeSvmTerms)(terms, ctx.nowSeconds)),
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
}),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (isUniversalRule(rule)) {
|
|
81
|
+
return (0, universal_1.encodeUniversalRule)(rule, ctx);
|
|
82
|
+
}
|
|
83
|
+
(0, capabilities_1.requireCapability)(ctx.capabilities, capabilities_1.AgenticCapability.NATIVE_RULES);
|
|
84
|
+
const actions = (0, native_1.nativeRuleToActionTerms)(rule, ctx).map((a) => a.terms);
|
|
85
|
+
const forbidden = [
|
|
86
|
+
'0x0000000000000000000000000000000000000000',
|
|
87
|
+
'0x0000000000000000000000000000000000000001',
|
|
88
|
+
...(ctx.forbiddenTargets ?? []),
|
|
89
|
+
].map((a) => a.toLowerCase());
|
|
90
|
+
actions.forEach((terms, j) => {
|
|
91
|
+
if (forbidden.includes(terms.target.toLowerCase())) {
|
|
92
|
+
const where = actions.length > 1 ? `rules[${i}].actions[${j}]` : `rules[${i}]`;
|
|
93
|
+
throw new errors_1.AgenticError(errors_1.AGENTIC_ERROR_CODE.INVALID_RULE, `${where}.target ${terms.target} is a wallet-infrastructure address the contracts refuse as a native target`);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
// One rule, one rule ID: every action is a separate (target, selector)
|
|
97
|
+
// entry of the same session, each with its own stored terms.
|
|
98
|
+
const session = (0, session_1.buildSession)({
|
|
99
|
+
validator: ctx.validator,
|
|
100
|
+
agent,
|
|
101
|
+
rulesPolicy: ctx.rulesPolicy,
|
|
102
|
+
actions: actions.map((terms) => ({
|
|
103
|
+
target: terms.target,
|
|
104
|
+
selector: terms.selector,
|
|
105
|
+
initData: (0, session_1.encodeEnvelope)(chainNamespace, (0, native_1.encodeNativeTerms)(terms)),
|
|
106
|
+
})),
|
|
107
|
+
});
|
|
108
|
+
return { rule, agent, chainNamespace, session, nativeTerms: actions };
|
|
78
109
|
}
|
|
79
|
-
|
|
80
|
-
|
|
110
|
+
catch (error) {
|
|
111
|
+
throw (0, errors_1.ruleErrorContext)(error, i, rule?.chainNamespace);
|
|
81
112
|
}
|
|
82
|
-
(0, capabilities_1.requireCapability)(ctx.capabilities, capabilities_1.AgenticCapability.NATIVE_RULES);
|
|
83
|
-
const actions = (0, native_1.nativeRuleToActionTerms)(rule, ctx).map((a) => a.terms);
|
|
84
|
-
const forbidden = [
|
|
85
|
-
'0x0000000000000000000000000000000000000000',
|
|
86
|
-
'0x0000000000000000000000000000000000000001',
|
|
87
|
-
...(ctx.forbiddenTargets ?? []),
|
|
88
|
-
].map((a) => a.toLowerCase());
|
|
89
|
-
actions.forEach((terms, j) => {
|
|
90
|
-
if (forbidden.includes(terms.target.toLowerCase())) {
|
|
91
|
-
const where = actions.length > 1 ? `rules[${i}].actions[${j}]` : `rules[${i}]`;
|
|
92
|
-
throw new errors_1.AgenticError(errors_1.AGENTIC_ERROR_CODE.INVALID_RULE, `${where}.target ${terms.target} is a wallet-infrastructure address the contracts refuse as a native target`);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
// One rule, one rule ID: every action is a separate (target, selector)
|
|
96
|
-
// entry of the same session, each with its own stored terms.
|
|
97
|
-
const session = (0, session_1.buildSession)({
|
|
98
|
-
validator: ctx.validator,
|
|
99
|
-
agent,
|
|
100
|
-
rulesPolicy: ctx.rulesPolicy,
|
|
101
|
-
actions: actions.map((terms) => ({
|
|
102
|
-
target: terms.target,
|
|
103
|
-
selector: terms.selector,
|
|
104
|
-
initData: (0, session_1.encodeEnvelope)(chainNamespace, (0, native_1.encodeNativeTerms)(terms)),
|
|
105
|
-
})),
|
|
106
|
-
});
|
|
107
|
-
return { rule, agent, chainNamespace, session, nativeTerms: actions };
|
|
108
113
|
});
|
|
109
114
|
}
|
|
110
115
|
//# sourceMappingURL=rules.js.map
|
|
@@ -61,11 +61,16 @@ function validateUniversalRuleShape(rule, nowSeconds) {
|
|
|
61
61
|
(0, pins_1.validatePins)(call.pins ?? []);
|
|
62
62
|
}
|
|
63
63
|
catch (error) {
|
|
64
|
-
throw
|
|
64
|
+
throw new errors_1.AgenticError(errors_1.AGENTIC_ERROR_CODE.INVALID_RULE, error.message, {
|
|
65
|
+
cause: error,
|
|
66
|
+
details: {
|
|
67
|
+
callIndex: i,
|
|
68
|
+
field: `allowedCalls[${i}].pins`,
|
|
69
|
+
chainNamespace: rule.chainNamespace,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
65
72
|
}
|
|
66
73
|
pinCount += call.pins?.length ?? 0;
|
|
67
|
-
if (pinCount > 32)
|
|
68
|
-
throw invalid('at most 32 pins across all allowed calls');
|
|
69
74
|
const key = `${call.target.toLowerCase()}:${parsed.selector}`;
|
|
70
75
|
const restricted = !!call.pins?.length ||
|
|
71
76
|
call.beneficiary !== undefined ||
|
|
@@ -74,11 +79,18 @@ function validateUniversalRuleShape(rule, nowSeconds) {
|
|
|
74
79
|
throw invalid('an unpinned alternative would bypass restrictions for this target/selector');
|
|
75
80
|
seen.set(key, restricted);
|
|
76
81
|
});
|
|
82
|
+
if (pinCount > 32)
|
|
83
|
+
throw (0, errors_1.ruleConstraintLimit)(pinCount, rule.allowedCalls.length, rule.chainNamespace);
|
|
77
84
|
const tokens = new Set();
|
|
78
85
|
rule.assets.forEach((a, i) => {
|
|
79
86
|
const address = typeof a.token === 'string' ? a.token : a.token?.address;
|
|
80
87
|
if (typeof address !== 'string')
|
|
81
88
|
throw invalid(`assets[${i}].token is missing an address`);
|
|
89
|
+
if (!(0, viem_1.isAddress)(address, { strict: false }))
|
|
90
|
+
throw new errors_1.AgenticError(errors_1.AGENTIC_ERROR_CODE.INVALID_RULE, 'The selected token has an invalid address.', {
|
|
91
|
+
userMessage: 'The selected token has an invalid address. Select the token again.',
|
|
92
|
+
details: { assetIndex: i, field: `assets[${i}].token` },
|
|
93
|
+
});
|
|
82
94
|
const key = address.toLowerCase();
|
|
83
95
|
if (tokens.has(key))
|
|
84
96
|
throw invalid(`assets[${i}] duplicates an earlier token`);
|
|
@@ -1,6 +1,41 @@
|
|
|
1
|
-
/** Public
|
|
1
|
+
/** Public vocabulary. JOB.ADDRESS is the explicit per-chain job integration surface. */
|
|
2
2
|
export declare const AGENTIC: Readonly<{
|
|
3
3
|
WALLET: "agentic:wallet";
|
|
4
|
+
PRINCIPAL: "agentic:principal";
|
|
5
|
+
JOB: Readonly<{
|
|
6
|
+
ADDRESS: Readonly<{
|
|
7
|
+
'eip155:42101': Readonly<{
|
|
8
|
+
KERNEL: "0x977cf1AC973E9eC4332791d531507575006157Ed";
|
|
9
|
+
HOOK: "0xDe7A94e510b6C571DE7880d441349689F73A32b3";
|
|
10
|
+
EVALUATOR: "0x1afC81396f1bb36F91f74506284952b81e4bd47c";
|
|
11
|
+
}>;
|
|
12
|
+
}>;
|
|
13
|
+
EVALUATION: Readonly<{
|
|
14
|
+
readonly BOOLEAN: "BOOLEAN";
|
|
15
|
+
readonly COMPARE: "COMPARE";
|
|
16
|
+
readonly NUMBER: "NUMBER";
|
|
17
|
+
readonly PERCENTAGE: "PERCENTAGE";
|
|
18
|
+
}>;
|
|
19
|
+
OPERATION: Readonly<{
|
|
20
|
+
readonly EQUAL: "EQUAL";
|
|
21
|
+
readonly NOT_EQUAL: "NOT_EQUAL";
|
|
22
|
+
readonly GREATER_THAN: "GREATER_THAN";
|
|
23
|
+
readonly GREATER_OR_EQUAL: "GREATER_OR_EQUAL";
|
|
24
|
+
readonly LESS_THAN: "LESS_THAN";
|
|
25
|
+
readonly LESS_OR_EQUAL: "LESS_OR_EQUAL";
|
|
26
|
+
}>;
|
|
27
|
+
LOGIC: Readonly<{
|
|
28
|
+
readonly ALL: "ALL";
|
|
29
|
+
readonly ANY: "ANY";
|
|
30
|
+
readonly AT_LEAST: "AT_LEAST";
|
|
31
|
+
}>;
|
|
32
|
+
ALLOWED_MUTABILITY: Readonly<{
|
|
33
|
+
readonly NONE: "NONE";
|
|
34
|
+
readonly CLIENT: "CLIENT";
|
|
35
|
+
readonly PROVIDER: "PROVIDER";
|
|
36
|
+
readonly BOTH: "BOTH";
|
|
37
|
+
}>;
|
|
38
|
+
}>;
|
|
4
39
|
PRESETS: Readonly<{
|
|
5
40
|
CATEGORY: Readonly<{
|
|
6
41
|
DEXES: "DEXES";
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AGENTIC = void 0;
|
|
4
|
-
|
|
4
|
+
const constants_1 = require("../job-spec/constants");
|
|
5
|
+
const deployment_1 = require("../market/deployment");
|
|
6
|
+
/** Public vocabulary. JOB.ADDRESS is the explicit per-chain job integration surface. */
|
|
5
7
|
exports.AGENTIC = Object.freeze({
|
|
6
8
|
WALLET: 'agentic:wallet',
|
|
9
|
+
PRINCIPAL: constants_1.PRINCIPAL,
|
|
10
|
+
JOB: Object.freeze({
|
|
11
|
+
...constants_1.JOB_VOCABULARY,
|
|
12
|
+
ADDRESS: Object.freeze({
|
|
13
|
+
'eip155:42101': Object.freeze({
|
|
14
|
+
KERNEL: deployment_1.DONUT_MARKETPLACE.kernel,
|
|
15
|
+
HOOK: deployment_1.DONUT_MARKETPLACE.hook,
|
|
16
|
+
EVALUATOR: deployment_1.DONUT_MARKETPLACE.evaluator,
|
|
17
|
+
}),
|
|
18
|
+
}),
|
|
19
|
+
}),
|
|
7
20
|
PRESETS: Object.freeze({
|
|
8
21
|
CATEGORY: Object.freeze({
|
|
9
22
|
DEXES: 'DEXES',
|
|
@@ -13,6 +13,12 @@ export interface ChainReader {
|
|
|
13
13
|
blockNumber?: bigint;
|
|
14
14
|
}): Promise<unknown>;
|
|
15
15
|
getBlockNumber(): Promise<bigint>;
|
|
16
|
+
getBlock?(args: {
|
|
17
|
+
blockNumber: bigint;
|
|
18
|
+
}): Promise<{
|
|
19
|
+
timestamp: bigint;
|
|
20
|
+
hash?: Hex | null;
|
|
21
|
+
}>;
|
|
16
22
|
getCode(args: {
|
|
17
23
|
address: Address;
|
|
18
24
|
blockNumber?: bigint;
|
|
@@ -31,5 +37,20 @@ export interface ChainReader {
|
|
|
31
37
|
getTransactionReceipt(args: {
|
|
32
38
|
hash: Hex;
|
|
33
39
|
}): Promise<TransactionReceipt>;
|
|
40
|
+
getTransaction?(args: {
|
|
41
|
+
hash: Hex;
|
|
42
|
+
}): Promise<{
|
|
43
|
+
input: Hex;
|
|
44
|
+
blockNumber: bigint | null;
|
|
45
|
+
}>;
|
|
46
|
+
/** Raw eth_call, used to verify complete signed marketplace requests before broadcast. */
|
|
47
|
+
call?(args: {
|
|
48
|
+
to: Address;
|
|
49
|
+
data: Hex;
|
|
50
|
+
account?: Address;
|
|
51
|
+
blockNumber?: bigint;
|
|
52
|
+
}): Promise<{
|
|
53
|
+
data?: Hex;
|
|
54
|
+
}>;
|
|
34
55
|
}
|
|
35
56
|
export declare function chainReaderFromPublicClient(client: PublicClient): ChainReader;
|